GithubHelp home page GithubHelp logo

ichejun / simpsonrecognition Goto Github PK

View Code? Open in Web Editor NEW

This project forked from alexattia/simpsonrecognition

0.0 1.0 0.0 140.54 MB

Detect and recognize The Simpsons characters using Keras

Home Page: https://medium.com/alex-attia-blog/the-simpsons-character-recognition-using-keras-d8e1796eae36

Jupyter Notebook 96.66% Python 3.34%

simpsonrecognition's Introduction

SimpsonRecognition

Training a Convolutional Neural Network to recognize The Simpson TV Show characters using Keras (TensorFlow backend).
To have more detailed explanations, see the blog article on Medium. If you like it, don't hesitate to recommend it (as for the dataset on Kaggle)

First part : Collecting data

The first part is collecting and labeling Simpson pictures.
Most of the pictures are from Simpson video, analyzed frame by frame.

Run python3 label_data.py into a folder with Simpson episodes (.avi format) to analyze them and label frames.
You crop each frame (left part, right part, full-frame, nothing) and then label it.

You can find the dataset on Kaggle

Second part : Training with Keras

The second part is training the model. My goal is to have 20 classes. I aim to have 1000 pictures per class, unfortunately some characters are not often on screen so I have fewer pictures for those characters. As you can see on the Jupyter notebook, I benchmark two models : 4 and 6 convolutional layers neural networks. Because of the small number of pictures (approx. 1k pictures per class), I use data augmentation.
Currently, I have 96% of accuracy (F1-Score) for 18 classes.

Third part : Faster R-CNN

The third part is upgrade the model to detect and recognize characters. I have to annotate data to get bounding boxes for characters for each picture in order to train a new model : Faster R-CNN (which is based on a Region Proposal Network). As usual, the annotation text file with the bounding boxes coordinates will be released soon.
The implementation on this network on Keras is from here by Yann Henon. I slightly edited the code : remove parts which are useless for my purpose).

Files description

  1. label_data.py : tools functions for notebooks + script to name characters from frames from .avi videos
  2. label_pointer.py : point with mouse clicks to save bounding box coordinates on annotations text file (from already labeled pictures)
  3. train.py : training simple convnet
  4. train_frcnn.py -p annotation.txt : training Faster R-CNN with data from the annotation text file
  5. test_frcnn.py -p path/test_data/ : testing Faster R-CNN

Lisa picture

simpsonrecognition's People

Contributors

alexattia avatar

Watchers

M_bones avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.