1adrianb / face-alignment

:fire: 2D and 3D Face alignment library build using pytorch
https://www.adrianbulat.com
BSD 3-Clause "New" or "Revised" License
7.05k stars 1.34k forks source link

adds `create_target_heatmap` and tests #134

Closed siarez closed 5 years ago

siarez commented 5 years ago

create_target_heatmap() is useful for people who want to fine-tune or train the model from scratch. Figuring it out was not trivial, so I thought it will save people time. It addresses #128

1adrianb commented 5 years ago

Thanks a lot, sorry for delay!

flyduck commented 4 years ago

@siarez I read your code for create the target heatmap, but I have some question for this: your bbox is not 256256, you get the heat map is 6464, how to make the heat map get point in the bbox? Its say your bbox will resize to 256*256 to train, I cant understand that. could you help to explain that? Thanks!

siarez commented 4 years ago

@flyduck FAN outputs 64x64 heatmaps, even tough the input image is 256x256. That's why the target heatmaps are 64x64.

flyduck commented 4 years ago

@siarez thank you for your answer. I have another question, did you do some data enhance for the train data? such as rotation, scale, transform?

siarez commented 4 years ago

@flyduck I didn't, but it sounds like a good idea. You can look at the original lua code for FAN to see if they did it originally.

flyduck commented 4 years ago

@siarez thank you very much! I use your code to generate the 646468 heat map, and then I use the "get_preds_fromhm" function to get the cordinate from the gt heat map, but the point is some like not really correct, have you do some experiment like this?

siarez commented 4 years ago

@flyduck what do you mean by not really correct?

flyduck commented 4 years ago

@siarez Its means that when I use the gt heat map by the function "get_preds_fromhm" to get landmark in the ori image, the landmark is not the same as the GT.

siarez commented 4 years ago

@flyduck Hmm, you will loose some accuracy due to quantization. Because your landmarks coordinates are scaled down from their original scale to fit the 64x64 grid. To make sure nothing fishy is going on, check the mean of the error residuals. It should be close to zero.