Open bemoregt opened 7 years ago
Hi, @bemoregt , first you should use a face detector to find bounding boxes, then you can use python to make data as the format. However, since different dataset store the landmark labels in different format, it's hard to give a general example. If you have a label file for each face, and each label file has 5 lines: x1 y1 x2 y2 x3 y3 x4 y4 x5 y5 Then you can use following codes to make your text file.
file_names = ["1.pts", "2.pts"] # Suppose the corresponding images are 1.jpg and 2.jpg
def read_data(file_name):
with open(file_name, 'r') as fid:
lines = fid.readlines()
return lines.join(' ')
res = []
for file_name in file_names:
res.append(file_name[:-3] + "jpg " + read_data(file_name))
with open("format.txt", 'w') as fid:
fid.writelines(res)
Hope that helps.
Hi mariolew@
Thank you mail answering,
OK, I've got it. It's very helpful ~
Can I use your deep-source for pupil center detection of eye image? (face=> eye area, lanmark=> pupil center point)
So, I'm just need only one point result...
Is that Possible ?
Thanks.
2017-03-21 16:04 GMT+09:00 SUPER-MARIO notifications@github.com:
Hi, @bemoregt https://github.com/bemoregt , first you should use a face detector http://mmlab.ie.cuhk.edu.hk/archive/CNN/data/code_face.zip to find bounding boxes, then you can use python to make data as the format. However, since different dataset store the landmark labels in different format, it's hard to give a general example. If you have a label file for each face, and each label file has 5 lines: x1 y1 x2 y2 x3 y3 x4 y4 x5 y5 Then you can use following codes to make your text file. file_names = ["1.pts", "2.pts"] # Suppose the corresponding images are 1.jpg and 2.jpg def read_data(file_name): with open(file_name, 'r') as fid: lines = fid.readlines() return lines.join(' ') res = [] for file_name in file_names: res.append(file_name[:-3] + "jpg " + read_data(file_name)) with open("format.txt", 'w') as fid: fid.writelines(res)
Hope that helps.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mariolew/TF-FaceLandmarkDetection/issues/1#issuecomment-287993561, or mute the thread https://github.com/notifications/unsubscribe-auth/ASgkZHDcP2LTISOvV9X3WRT7RnT0nRQUks5rn3Z6gaJpZM4MjZSL .
@bemoregt , of course you can. Thanks for your attention.
Hi, mariolew@
/home/vcamp1/Pictures/eyes/1.jpeg 2 177 2 177 67 101 10 10 /home/vcamp1/Pictures/eyes/2.jpeg 2 177 2 177 49 102 10 10 /home/vcamp1/Pictures/eyes/3.jpeg 2 177 2 177 116 53 10 10 /home/vcamp1/Pictures/eyes/4.jpeg 2 177 2 177 70 57 10 10 /home/vcamp1/Pictures/eyes/5.jpeg 2 177 2 177 88 81 10 10
but it doesn't work --; What's wrong whit this?
I made from readme.md of github: Prepare data: You should have a text file, each line of the text file should have the format: image_path bbx_left bbx_right bbx_top bbx_bottom landmark1_x landmark1_y ... landmarki_x landmarki_y
2017-03-21 21:54 GMT+09:00 SUPER-MARIO notifications@github.com:
@bemoregt https://github.com/bemoregt , of course you can. Thanks for your attention.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mariolew/TF-FaceLandmarkDetection/issues/1#issuecomment-288069357, or mute the thread https://github.com/notifications/unsubscribe-auth/ASgkZGD4KdP1VXpqMyqicolVlUat4BwZks5rn8iVgaJpZM4MjZSL .
@bemoregt ,Hi, you should modify the code so that it can be used to detect 2 points. For example, you should modify the input pipeline to
record_defaults = [[""]] + [[1.0]] * 4
and modify #L62,#L136,#L147,#L159,#L164,#L170 in model_train.py, and modify #L50,#L161 in model_eval.py.
BTW, the codes are written with Tensorflow 0.10.0, so interface might be different with the new versions, you should change corresponding interfaces if you use newer versions.
Thanks a lot,
I'll try this and reply later .
Happy hump day ~
2017-03-22 15:15 GMT+09:00 SUPER-MARIO notifications@github.com:
@bemoregt https://github.com/bemoregt ,Hi, you should modify the code so that it can be used to detect 2 points. For example, you should modify the input pipeline https://github.com/mariolew/TF-FaceLandmarkDetection/blob/master/libs/tfpipeline.py#L12 to
record_defaults = [[""]] + [[1.0]] * 4
and modify #L62,#L136,#L147,#L159,#L164,#L170 in model_train.py, and modify #L50,#L161 in model_eval.py.
BTW, the codes are written with Tensorflow 0.10.0, so interface might be different with the new versions, you should change corresponding interfaces if you use newer versions.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mariolew/TF-FaceLandmarkDetection/issues/1#issuecomment-288308399, or mute the thread https://github.com/notifications/unsubscribe-auth/ASgkZFT589Iv8M15j-Vf5nmnfu_ak_p7ks5roLxlgaJpZM4MjZSL .
OK, I have moditied that you teaching ..
I think that above error is another problem. I've enter just one-point landmark data(Lx, Ly) in txt file.. It may be an error form this reason ..
and Is augmentation procedure is must needed procedure ?
Thanks at any rate .. (-;
2017-03-22 15:15 GMT+09:00 SUPER-MARIO notifications@github.com:
@bemoregt https://github.com/bemoregt ,Hi, you should modify the code so that it can be used to detect 2 points. For example, you should modify the input pipeline https://github.com/mariolew/TF-FaceLandmarkDetection/blob/master/libs/tfpipeline.py#L12 to
record_defaults = [[""]] + [[1.0]] * 4
and modify #L62,#L136,#L147,#L159,#L164,#L170 in model_train.py, and modify #L50,#L161 in model_eval.py.
BTW, the codes are written with Tensorflow 0.10.0, so interface might be different with the new versions, you should change corresponding interfaces if you use newer versions.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mariolew/TF-FaceLandmarkDetection/issues/1#issuecomment-288308399, or mute the thread https://github.com/notifications/unsubscribe-auth/ASgkZFT589Iv8M15j-Vf5nmnfu_ak_p7ks5roLxlgaJpZM4MjZSL .
@bemoregt In your text file /home/vcamp1/Pictures/eyes/1.jpeg 2 177 2 177 67 101 10 10, you have two points. 67 101 10 10, so the reshape can indeed happen, i.e. reshape to shape(2, 2), the error message shows that your text file might have only one axis provided, which is not even enough for one point, I mean one point need two values x, y. Can you show me your text file?
@bemoregt Well, since deep learning requires a lot of data, data augmentation is needed. I've been using my code for various number of landmark detection, so I don't think it's an error.
My txt file is here ...
and, How many image is need to train ? .. over about million images?
thanks.
2017-03-22 17:07 GMT+09:00 SUPER-MARIO notifications@github.com:
@bemoregt https://github.com/bemoregt Well, since deep learning requires a lot of data, data augmentation is needed. I've been using my code for various number of landmark detection, so I don't think it's an error.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mariolew/TF-FaceLandmarkDetection/issues/1#issuecomment-288325686, or mute the thread https://github.com/notifications/unsubscribe-auth/ASgkZEZXGaJ-k5SkfO7RD-3XEtCat2ebks5roNa4gaJpZM4MjZSL .
/home/vcamp1/Pictures/eyes/1.jpeg 2 177 2 177 67 101 /home/vcamp1/Pictures/eyes/2.jpeg 2 177 2 177 49 102 /home/vcamp1/Pictures/eyes/3.jpeg 2 177 2 177 116 53 /home/vcamp1/Pictures/eyes/4.jpeg 2 177 2 177 70 57 /home/vcamp1/Pictures/eyes/5.jpeg 2 177 2 177 88 81
@bemoregt Did you modify augment.py? I used the text file like yours and I met no error locally... Hmm, generally 50k ~100k images are enough.
Yes I did. My augment.py file is added in mail.
but I have a problem yet ..
2017-03-22 17:40 GMT+09:00 SUPER-MARIO notifications@github.com:
@bemoregt https://github.com/bemoregt Did you modified augment.py? I used the text file like yours and I met no error locally... Hmm, generally 50k ~100k images are enough.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mariolew/TF-FaceLandmarkDetection/issues/1#issuecomment-288332422, or mute the thread https://github.com/notifications/unsubscribe-auth/ASgkZPg64L4AR2kTadKc7w-7XG7UJoEUks5roN5lgaJpZM4MjZSL .
@bemoregt Let me see how you modify augment.py
I just changed :
bbx = map(int, components[1:4]) // here 5->4
landmarks = map(float, components[5:])
landmarks = np.asarray(landmarks).reshape([1,2]) //and here [-1,
2] -> [1, 2]
That's all .
Thnaks.
2017-03-22 18:10 GMT+09:00 SUPER-MARIO notifications@github.com:
Let me see how you modify augment.py
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mariolew/TF-FaceLandmarkDetection/issues/1#issuecomment-288338955, or mute the thread https://github.com/notifications/unsubscribe-auth/ASgkZGEsaoU8F5OeZDfDqBxH-e9DrZ20ks5roOVsgaJpZM4MjZSL .
@bemoregt You don't need to change bbx = map(int, components[1:4]) // here 5->4, bbx should be defined by 4 numbers, components[1:5] does not include components[5].
Thanks.
2017-03-22 18:20 GMT+09:00 SUPER-MARIO notifications@github.com:
@bemoregt https://github.com/bemoregt You don't need to change bbx = map(int, components[1:4]) // here 5->4, bbx should be defined by 4 numbers, components[1:5] does not include components[5].
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mariolew/TF-FaceLandmarkDetection/issues/1#issuecomment-288341252, or mute the thread https://github.com/notifications/unsubscribe-auth/ASgkZH4cwRf6msPwDO1HdKnQgZWrFcFqks5roOfXgaJpZM4MjZSL .
/home/vcamp1/Pictures/eyes/1.jpeg 2 177 2 177 67 101 /home/vcamp1/Pictures/eyes/2.jpeg 2 177 2 177 49 102 /home/vcamp1/Pictures/eyes/3.jpeg 2 177 2 177 116 53 /home/vcamp1/Pictures/eyes/4.jpeg 2 177 2 177 70 57 /home/vcamp1/Pictures/eyes/5.jpeg 2 177 2 177 88 81
@bemoregt Hi, can you print components and see what is components?
Hi, @mariolew.
I dot know the meaning of "component" ...
What's that?
2017-03-22 21:27 GMT+09:00 SUPER-MARIO notifications@github.com:
@bemoregt https://github.com/bemoregt Hi, can you print components and see what is components?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mariolew/TF-FaceLandmarkDetection/issues/1#issuecomment-288383454, or mute the thread https://github.com/notifications/unsubscribe-auth/ASgkZD3bY7RT2u8X16ZC1DJPo4usNSTqks5roRPEgaJpZM4MjZSL .
@bemoregt You might need to learn a bit more Python. For now just add one line of code
print(components)
after
components = line.strip().split(' ')
vcamp1@vcamp:~/TF-FaceLandmarkDetection$ python3 augment.py File "augment.py", line 14 print components ^ TabError: Missing parentheses in call to 'print'
thanks ...
2017-03-23 12:19 GMT+09:00 SUPER-MARIO notifications@github.com:
@bemoregt https://github.com/bemoregt You might need to learn a bit more Python. For now just add one line of code
print components
after
components = line.strip().split(' ')
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mariolew/TF-FaceLandmarkDetection/issues/1#issuecomment-288606260, or mute the thread https://github.com/notifications/unsubscribe-auth/ASgkZJS8_g_lUC04CDVy4_BipY26U2H-ks5roeTJgaJpZM4MjZSL .
@bemoregt
print(components)
Sorry for the mistake
Can you provide the sample txt data for training with image
And steps to train my own data.
Hi, mariolew@
Is there any sample of training text data file?
I don't know the making method of my own text file.
Thanks at any rate ...