Skip to content

An image classification project from data collection, machine learning to deployment.

Notifications You must be signed in to change notification settings

msi1427/Anime-vs-Animation-vs-CGI

Repository files navigation

Anime vs Animation vs CGI

An image classification project to classify among anime, animation and cgi characters from data collection, machine learning to deployment. Defining the labels.
anime: anime characters from an original anime
animation: animation characters from an animation movie or series
cgi: CGI characters from a real movie [no animation]

Dataset construction and processing

Data Gathering: Downloaded from Google Images by Google Image Search using keywords
DataLoader: Used fastai DataBlock API to set up the DataLoader.
Data Augmentation: fastai provides default data augmentation which operates in GPU.
Data Cleaning: This part took the highest time. Since I collected data from Google Images, there were many noises. Also, there were images that contained anime and animation or anime and CGI, which is not my goal right now for this project. I cleaned and updated data using fastai ImageClassifierCleaner.

Training and inference

Training: Fine-tuned a resnet50 model for 5 epochs and got upto 80% accuracy.
Confusion Matrix: Looking into the confusion matrix I understood that the model can identify the anime and animation clearly but the 'CGI' images were confusing between anime and animation which actually is very logical if we think about it.

Setting up for Inference: After more fixing, I set up the model for inference. The results on random images were satisfactory.

Result on anime

Result on animation

Result on CGI

Web Development

Built a basic web frontend and backend with Flask, HTML, CSS and others, integrated the trained model and prepared everything for deployment.

Build from sources

  1. Clone the Git Repo
$ git clone https://github.com/msi1427/https://github.com/msi1427/Anime-vs-Animation-vs-CGI.git
$ cd Anime-vs-Animation-vs-CGI
  1. Initialize and activate a virtualenv
$ virtualenv --no-site-packages env
$ source env/bin/activate

# For Windows
$ source .\env\Scripts\activate.bat
  1. Install the dependencies
$ pip install -r requirements.txt
  1. Run the development server
$ python app.py
  1. Navigate to http://localhost:5000

Features

  • Given an image, it can classify among Anime, Animation and CGI characters

Walkthrough

Video Walkthrough

YouTube Link: https://youtu.be/aK4_xdcn2Yg

Descriptive Walkthrough

Landing Page

After building from sources, navigate to http://localhost:5000

There we land here

Results Page

When we add an image and mark it to classify. We get to this page.

Clicking on Classify Image will take back to the landing page.

Deployment

Deployed the Web app to Heroku.
Important thing I noticed here is that numpy, pandas and scipy library versions doesn't match with the Heroku version so I changed those to previous versions and it worked. However, I could not deploy my model to Heroku because the whole thing was nearly 1 GB and Heroku does not approve more than 500MB for free.

Resources

fastai course: https://course.fast.ai/
Flask Tutorial: https://www.youtube.com/watch?v=Z1RJmh_OqeA

About

An image classification project from data collection, machine learning to deployment.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages