mks0601 / A-Convolutional-Neural-Network-Cascade-for-Face-Detection

TensorFlow implementation of "A Convolutional Neural Network Cascade for Face Detection", CVPR 2015
http://www.cv-foundation.org/openaccess/content_cvpr_2015/papers/Li_A_Convolutional_Neural_2015_CVPR_paper.pdf
109 stars 62 forks source link

Hard_neg_mining #12

Closed asdfghwunai closed 6 years ago

asdfghwunai commented 7 years ago

HI, Thanks for your great work.I have a problem.When running hard_negative mining,how do you choose the three net‘s thresholds? After I complete the hard_negative mining for 24 net using your 12net'sthreshold(3e-3),I'm very shocked that the db size I got is about 5 millions.I think there is something wrong.So on what basis do you adjust the threshold when you run the hard_neg_mining? Thank you.

mks0601 commented 7 years ago

In table1, there is # of windows and recall. You`d better choose the thr based on that table

asdfghwunai commented 7 years ago

Thank you for your answer.But before you run the hard_neg_mining,the three thresholds have been determined.The paper said "We then apply a 2-stage cascade consists of the 12-net and 12-calibration-net on a subset of the AFLW images to choose a threshold T1 at 99% recall rate."Is that how you choose the threshold?

asdfghwunai commented 7 years ago

For T2,the paper said "After that, we follow the same process for the 4-stage cascade consists of the 12-net, 12-calibration-net, 24-net and 24-calibrationnet. We set the threshold T2 to keep 97% recall rate."

mks0601 commented 7 years ago

you can follow those swntences or table1 I followed table1

asdfghwunai commented 7 years ago

Thank you.When computing the recall,do you use the tools provided by the official website of fddb or something else?

mks0601 commented 7 years ago

I implemented the code by myself based on PASVAL VOC detection evaluation code. Its been long time since I implemented the code, so i do not have the code :(

asdfghwunai commented 7 years ago

Hello,I have completed the training but the result is very terrible.I test my model on FDDB, the False Positive number is about 10,000.I draw the rectangle on every image and find that many false positives come from the human skin such as arm,hand.My negative images are 6000 scenery pictures without any people.Is it a big influence?Does the problem come from training method or just the data set?You said your negative images come from coco.Have you choose negative images without any people?Thank you for all your kind help.

mks0601 commented 7 years ago

This is cascade model, so you have to choose the threshold carefully. Try to select the based on table1

Best, Gyeongsik Moon

Gyeongsik Moon Ph.D. Candidate Department of ECE, SNU, Seoul, Korea http://cv.snu.ac.kr http://cv.snu.ac.kr/

      1. 오후 7:13, asdfghwunai notifications@github.com 작성:

Hello,I have completed the training but the result is very terrible.I test my model on FDDB, the False Positive number is about 10,000.I draw the rectangle on every image and find that many false positives come from the human skin such as arm,hand.My negative images are 6000 scenery pictures without any people.Is it a big influence?Does the problem come from training method or just the data set?You said your negative images come from coco.Have you choose negative images without any people?Thank you for all your kind help.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mks0601/A-Convolutional-Neural-Network-Cascade-for-Face-Detection/issues/12#issuecomment-338942921, or mute the thread https://github.com/notifications/unsubscribe-auth/AM-Lu6eXxO5Ar1Fch8-XkjCyGUwFHjvjks5svbhlgaJpZM4P-rgJ.

asdfghwunai commented 7 years ago

I admit I choose the same thresholds as yours and want to complete the training and get the result as soon as possible . I will retrain the model and choose the thresholds based on Table1. Is there a problem with the negative images data set I used?

mks0601 commented 7 years ago

That db would be enough

나의 iPhone에서 보냄

      1. 오후 12:26, asdfghwunai notifications@github.com 작성:

I admit I choose the same thresholds as yours and want to complete the training and get the result as soon as possible . I will retrain the model and choose the thresholds based on Table1. Is there a problem with the negative images data set I used?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

asdfghwunai commented 7 years ago

Thank you.I will try.But if the negative images don‘t include people's body,how does the model exclude the skin?(not face) In the case of my model , the biggest problem is that the skin and face can't be correctly distinguished.I see your test pictures on the code page, your training model is effective to distinguish hands and face.Why?

mks0601 commented 7 years ago

I havent considered that issue. I just implemented the paper and it gave nice performance. Maybe the reason why my implementation gives slightly lower performance than the paper can be that.

나의 iPhone에서 보냄

      1. 오후 1:13, asdfghwunai notifications@github.com 작성:

Thank you.I will try.But if the negative images don‘t include people's body,how do the model exclude the skin?(not face) In my model case, the biggest problem is that the skin and face can't be correctly distinguished.I see your test pictures on the code page, your training model is effective to distinguish hands and face.Why?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

asdfghwunai commented 7 years ago

Thank you for your sincere help. I choose the negative images from SUN data set.The data set is used for scene classification.Most of them are pictures of landscapes, interiors and streets. My next step is choose images from COCO like you do.What criteria do you choose for negative sample pictures?Thank you.

mks0601 commented 7 years ago

Hey I cannot help you every step by step.. Just try any DB and train the model. Selecting between SUN or COCO seems not important issur

나의 iPhone에서 보냄

      1. 오전 3:06, asdfghwunai notifications@github.com 작성:

Thank you for your sincere help. I choose the negative images from SUN data set.The data set is used for scene classification.Most of them are pictures of landscapes, interiors and streets. My next step is choose images from COCO like you do.What criteria do you choose for negative sample pictures?Thank you.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

asdfghwunai commented 7 years ago

Sorry to bother you all the time.I'm eager to know why my effect doesn't reach yours.So I asked you a lot of questions.Thank you for your help.

mks0601 commented 7 years ago

As I remember, I chose COCO segmentation test set (about 7000 frames) and it might not include human. Just images of landscape.

-- Gyeongsik Moon Ph.D. Candidate Department of ECE, SNU, Seoul, Korea http://cv.snu.ac.kr http://cv.snu.ac.kr/

      1. 오전 11:00, asdfghwunai notifications@github.com 작성:

Sorry to bother you all the time.I'm eager to know why my effect doesn't reach yours.So I asked you a lot of questions.Thank you for your help.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mks0601/A-Convolutional-Neural-Network-Cascade-for-Face-Detection/issues/12#issuecomment-339190102, or mute the thread https://github.com/notifications/unsubscribe-auth/AM-Lu-hvYGz-4XOQY6IuRtcOq7ZL6PeYks5svpYvgaJpZM4P-rgJ.

asdfghwunai commented 7 years ago

https://github.com/mks0601/A-Convolutional-Neural-Network-Cascade-for-Face-Detection/blob/f3e5e820d27c6bce3ca9c82a633bfb5ce5d7aa25/test.py#L129-L141

I think your code has a minor errorscale_cur += 1.It should be scale_cur=box[6]. If the scale of result_box is not continuous,for example 0,0,0,1,1,3,3 ,then when scale_cur is added to the 2,scale_box is equal to the first image under scale 3. When scale_cur is added to the 3,scale_box is equal to the second image under scale 3.The first image under scale 3 is gone.

mks0601 commented 7 years ago

I think you are right I'll modify my code

ShuoYe2020 commented 6 years ago

Hi @asdfghwunai ,Thanks for your kind, I'm currently studying the CNN network, but there is a problem with the order in which the program runs, My order of execution is: data_parse; train_12net; train_calib.py 12; hard_neg_mining.py 24......am i wrong? could you please tell me your order? Looking forward to your reply

asdfghwunai commented 6 years ago

@Redemfre Yes,you are right. I used the SUN dataset as a negative sample set. I got very bad results and you can try other negative dataset. The thing I remind you is that you don't know what criteria to use to choose the threshold? I didn't have a good idea at the time.

ShuoYe2020 commented 6 years ago

@asdfghwunai ,I use COCO as negative dataset, hope to get a good result, I was alone in the lab in this direction and no one could talk about it, it make me crazy, Do you have a good idea about threshold now? If I'm right, what is the next network to be trained on? train_12net; calib12; hard_neg_mining.py 24; train_24net; calib24; hard_neg_mining.py 48 train_48net; calib48 This is my full training sequence, and it seems have some problem, Do you have any Suggestions?

asdfghwunai commented 6 years ago

@Redemfre Sequence is right. The threshold only affects the number of negative samples you get for hard negative mining. You can set this number arbitrarily. When testing, you can also change them. But what I encountered was that even though I set the threshold very low to get a lot of hard negative samples, I still couldn't get a good training result. I attribute it to the lack of diversity on the negative sample set. My ROC reaches at most 70%. You can study the author's code with a learning attitude and train the network independently. The result is not necessarily good, but you have learned knowledge. Just be patient. Then you can look at MTCNN's tensorflow implementation on github. This code can meet your expectations.

ShuoYe2020 commented 6 years ago

@asdfghwunai ,Thanks for your advice, I'm going to run the neural network through, ,I will use COCO as negative dataset, maybe this will verify your guess that the unsatisfactory performance should attribute to the lack of diversity on the negative sample set

ShuoYe2020 commented 6 years ago

Hi @asdfghwunai ,Sorry to bother you, when i run the "python hard-neg-mining.py 48", The program gave me an error 'Segmentation fault (core dumped)', But before that, when i run "python hard-neg-mining.py 24", there is no similar problems, I checked the "hard-neg-mining.py" file, but found nothing unusual, maybe I'm not good at it now, Have you ever had a similar problem?

asdfghwunai commented 6 years ago

@Redemfre Check the relevant code for image processing. Check carefully whether the picture is out of bounds.