GithubHelp home page GithubHelp logo

jangocheng / facedetection-1 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jasonleaster/facedetection

0.0 2.0 0.0 15.56 MB

:star2: Human Face Detection based on AdaBoost

License: MIT License

Python 63.48% Makefile 0.24% TeX 36.28%

facedetection-1's Introduction

EFace -- A project of face detection in Python

This project name as E-Face which is a implementation of face detection algorithm.

My nick name is EOF. For convenient, I name it as E-Face.

It's stimulating to do this project. Enjoy with it.

The architecture of this project.

The following list show the files in this awesome project.

  • adaboost.py Implementation of Adaptive Boosting algorithm

  • cascade.py Cascade Decision Tree

  • config.py All parameters of configuration in this project are stored in this file.

  • image.py The initialization of images. class Image and class ImageSet are in this file.

  • haarFeature.py Stuff with Haar-Features.

  • weakClassifier.py The detail about Weak classifier.

  • training.py Script for training the model.

directories:

  • model/ cache files for adaboost model.

  • featuers/ values for different feaures with different samples.

  • doc/ documents with this project.

Usage:

For training a adaboost model:

     python ./trainingAdaBoost.py

To detect faces in a image, you have to define the TEST_IMG which is the path where store your image:

    python ./EFace.py

Presentation of current result:

I'm still working on making this project more powerful. So, here is the presentation of current result.

images

images

images

Programming Style:

I used basic OOP(Object Oriented Programming) tricks to build my program. Something like... I put all about AdaBoost into a class(AdaBoost) which you can find in file adaboost.py. Everytime you want to do something with adaboost, just create a object instance of that class.

Adavantages of this style: Higher level of abstraction and easy to be used. With this style, green hand will easy to build good archtecture with our project.

Disadvantages of this style: Without optimalization, it will cost a lot of memory. This will be obvious when the scale of project goes more and more large.

During this period when I working on the project, I meet a lots of problem. But I also want to say "thanks" to these problem. It help me a lot to enhance my ability in programming.

  • Exception Handle The training process cost too much time. Sometimes, we have a better idea to change the code into a better version. But the trainning process is going on. If we press ctrl + c to interrupt, the data that we have get from the AdaBoost process will lost.

    I use a handler for KeyboardInterrupt and then save the data of model so that the valuable data won't be lose.

  • High Performance Programming in Python

    There have lots of tricks to make native Python code run more faster. The computation of image processing is very huge. This means that it's a typical problem about CPU-bound.

  • Concurrent Control To improve the performance of this system in the training process, I try to use parallel mechanism with the two CPU in my workstation.

... ...


Optimization diary

2016-04-09 Restart to built this project and finished optimize the image.py

2016-04-13 refactor the training.py and make it more light. create a new module mapReduce.py. In haarFeature.py, @idxVector is initialized by numpy.zeros, it's faster than numpy.array([0 for i in range(length)])

2016-04-15 going to optimal weakClassifier.py and adaboost.py. Try to vectorize weakclassifier.py

2016-04-16 change scanImage.py and use different size of final classifier image but not resize the inputed image.

facedetection-1's People

Contributors

jasonleaster avatar

Watchers

 avatar  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.