GithubHelp home page GithubHelp logo

lincolnhard / mtcnn-head-detection Goto Github PK

View Code? Open in Web Editor NEW

This project forked from luoyetx/joint-face-detection-and-alignment

47.0 4.0 10.0 42.94 MB

Head detection with modified cascaded CNN

License: BSD 3-Clause "New" or "Revised" License

Shell 0.31% C++ 32.67% Python 66.51% Cuda 0.51%
mtcnn object-detection opencv head-detection caffe cascaded-cnn

mtcnn-head-detection's Introduction

MTCNN head detection

Set up

Set up environment and copy C++ layer code to Caffe's source code tree.

$ export PYTHONPATH=/path/to/mtcnn-head-detection:$PYTHONPATH
$ export CAFFE_HOME=/path/to/caffe
$ pip install easydict
$ pip install lmdb
$ sh layers/copy.sh

Compile Caffe following its document.

Prepare data

Download dataset SCUT-HEAD. Unzip and put them in data directory.

Train

pnet

python jfda/prepare.py --net p --wider --worker 8
python jfda/train.py --net p --gpu 0 --size 128 --lr 0.05 --lrw 0.1 --lrp 5 --wd 0.0001 --epoch 25

rnet

Choose appropriate pnet caffemodel to generate prior for rnet, and edit cfg.PROPOSAL_NETS in config.py

python jfda/prepare.py --net r --gpu 0 --detect --wider --worker 4
python jfda/train.py --net r --gpu 0 --size 128 --lr 0.05 --lrw 0.1 --lrp 5 --wd 0.0001 --epoch 25

onet

Choose appropriate rnet caffemodel to generate prior for onet, and edit cfg.PROPOSAL_NETS in config.py

python jfda/prepare.py --net o --gpu 0 --detect --wider --worker 4
python jfda/train.py --net o --gpu $GPU --size 64 --lr 0.05 --lrw 0.1 --lrp 7 --wd 0.0001 --epoch 35

Test

python simpledemo.py

Note

  1. Landmark alignment in original mtcnn is removed in this repo. Here only do object classification and bounding box regression.

  2. Each convolutional layer kernel number in onet has reduced for faster network inference.

Result

pnet

pnet1

rnet

rnet1

onet

onet1

References

mtcnn-head-detection's People

Contributors

lincolnhard avatar luoyetx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

mtcnn-head-detection's Issues

Unable to find cheat and brainwash dataset

haneesh@haneesh:~/Desktop/mtcnn-head-detection-master$ python3 jfda/prepare.py --net p --wider --worker 8
[2020-01-05 20:31:13,719][INFO] loading WIDER
parsing /home/haneesh/Desktop/mtcnn-head-detection-master/data/SCUT_HEAD_Part_B/JPEGImages/ ...
parsing /home/haneesh/Desktop/mtcnn-head-detection-master/data/SCUT_HEAD_Part_A/JPEGImages/ ...
parsing /media/lincolnhard/11e5b063-4031-49ed-bf24-312fc250e90c/lincoln/cheat/JPEGImages/ ...
Traceback (most recent call last):
File "jfda/prepare.py", line 544, in
gen_wider()
File "jfda/prepare.py", line 270, in gen_wider
train_data, val_data = load_scutbrainwashcheat()
File "/home/haneesh/Desktop/mtcnn-head-detection-master/jfda/utils.py", line 15, in load_scutbrainwashcheat
for name in os.listdir(trainimdir):
FileNotFoundError: [Errno 2] No such file or directory: '/media/lincolnhard/11e5b063-4031-49ed-bf24-312fc250e90c/lincoln/cheat/JPEGImages/'

IndexError: Index out of range

Hi, I have generated my own data,there has some issues like below when I trained,
I0906 03:52:38.055449 145076 layer_factory.hpp:77] Creating layer data
I0906 03:52:38.056452 145076 net.cpp:86] Creating Layer data
I0906 03:52:38.056471 145076 net.cpp:382] data -> data
I0906 03:52:38.056488 145076 net.cpp:382] data -> bbox_target
I0906 03:52:38.056497 145076 net.cpp:382] data -> label
Traceback (most recent call last):
File "jfda/train.py", line 123, in
solver = Solver(solver_prototxt, args)
File "jfda/train.py", line 60, in init
self.solver = caffe.SGDSolver(tmp_solver_prototxt)
File "/home/ll/Project/Object_Detection/mtcnn-head-detection/layers/data_layer.py", line 55, in setup
self.reshape(bottom, top)
File "/home/ll/Project/Object_Detection/mtcnn-head-detection/layers/data_layer.py", line 61, in reshape
top[3].reshape(self.n)
IndexError: Index out of range

I would like to cite your work

Hello!
Your implementation has greatly aided in my research!
I changed some things up in the code ( and will happily provide all changes upon request) and the model is currently being re-trained for purposes not related to facial recognition.
I would like to firstly thank you and show my appreciation.
I'm not sure how to cite your work other than putting a link to your github in my paper.
Other than that is there any special way you would like to be cited?
Thanks again!

在训练时遇到caffe.SGDSolver这个错误

I0704 15:17:48.250639 31549 net.cpp:382] data -> bbox_target
I0704 15:17:48.250646 31549 net.cpp:382] data -> label
Traceback (most recent call last):
File "jfda/train.py", line 125, in
solver = Solver(solver_prototxt, args)
File "jfda/train.py", line 62, in init
self.solver = caffe.SGDSolver(tmp_solver_prototxt)
File "/home/isp/workspace/opencvLab/mtcnn-head-detection/layers/data_layer.py", line 55, in setup
self.reshape(bottom, top)
File "/home/isp/workspace/opencvLab/mtcnn-head-detection/layers/data_layer.py", line 61, in reshape
top[3].reshape(self.n)
IndexError: Index out of range

inference time

想问下up主,caffe下跑单一图片的时间有测算过么?
谢谢~

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.