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

How to train on my own data set? #13

Closed yuye1992 closed 6 years ago

yuye1992 commented 6 years ago

Thank you for sharing you code! But I have meet two problems. 1、I had download the AFLW dataset,but i didn't find the file named"annot", please tell me where is it,or how to create? 2、How to train this model on my own data set?

mks0601 commented 6 years ago

Hi,

You can create the file 'annot' by running the code in dataGen folder.

yuye1992 commented 6 years ago

Thank you

yuye1992 commented 6 years ago

Sorry,I met another problem, where are the 'npy' files for 24-net and 48-net in training step? Should I download or use some code to cerate them?

mks0601 commented 6 years ago

run hard_neg_mining.py

ShubhamMandwe commented 6 years ago

Even using data_parse i am unable to write, although, it can be seen that something is written in annot file, but while i go through it. it doesn't show anything. Can you please help? @mks0601 See the screen shot untitled

mks0601 commented 6 years ago

I cannot understand your question. Can you tell me again?

ShubhamMandwe commented 6 years ago

@mks0601, I meant, while i go for training the 12-net, there's nothing to read from annot file as the file is empty, in result there's not even a single array that gets saved in raw_data of data.py and hence an error pops out later when np.vstack tries to concatenate arrays. It shows "there should be atleast one array to concatenate".

when i see the annot file, it is empty. There are two possibilities: 1) The data_parse.py writes the annotations in annot by running it. or 2) Did i mis-interpret the code? Do i need to prepare annotations separately. What is the solution in either case? If you can help.

ShubhamMandwe commented 6 years ago

@mks0601 to clarify the doubt see another screenshot while running train_12net.py untitled

mks0601 commented 6 years ago

The annot file is generated by running data_parse.py. Did you read the aflw.sqlite file correctly? You`d better check that when you run data_parse.py

ShubhamMandwe commented 6 years ago

Yes, i read it fine. as you can see it from my previous snippet. Although the annot file gets's generated as you mentioned but it contains nothing in it.

Any modification in this code of data_parse.py

import sqlite3

db_dir = "D:/My_proj_1/aflw/data/aflw.sqlite" save_dir = "D:/My_proj_1/aflw/data/annot"

con = sqlite3.connect(db_dir) cursor = con.cursor()

cursor.execute("select FaceImages.filepath, FaceRect.x, FaceRect.y, FaceRect.w, FaceRect.h from FaceImages join Faces on FaceImages.file_id = Faces.file_id join FaceRect on FaceRect.face_id = Faces.face_id")

result = cursor.fetchall()

filename, x, y, w, h

fp = open(save_dir,"w") for elem in result: print(fp, elem) print(result)

i cannot find where am i going wrong?

mks0601 commented 6 years ago

It seems you are using python3 instead of version 2, right? Anyway, what do you mean by print(fp,elem)? Does that code actually save the elem in file pointer fp? Did you check that?

I checked that, but that only print on the screen about 'information about fp' and 'elem'. You have to save elem to the file pointed by file pointer fp.

https://www.digitalocean.com/community/tutorials/how-to-handle-plain-text-files-in-python-3 This post would be helpful.

ShubhamMandwe commented 6 years ago

@mks0601 yes, i am using python 3. Thank you for your help, i got your point, i wan't writing into the annot file.