thermal-face
thermal-face copied to clipboard
Try retraining an existing TPU face detector model
The current approach is to train a detector model from scratch on a dataset that combines visible-light and thermal images, then compile it for Edge TPU.
An alternative approach would be to retrain an existing and already TPU-optimized detector model such as MobileNet SSD v2 (Faces), probably using only the thermal images.
This could be particularly interesting as a workaround for issue #2.
Hello
I have a colab version and im trying to retrain MobileNet SSD v2 (Faces) model with datashet created only with thermal images from tutfs and flir, i have the tf-records ..... everything is working.
Im able to retrain ssd_mobilenet_v2_quantized_300x300_coco_2019_01_03
but when trying with precise face model im not able to lower loss < 1
I think one of the reason is that im not freezing lower layers as in the coco version
freeze_variables:
[ 'FeatureExtractor/MobilenetV2/Conv/',
'FeatureExtractor/MobilenetV2/expanded_conv/',
'FeatureExtractor/MobilenetV2/expanded_conv_1/',
'FeatureExtractor/MobilenetV2/expanded_conv_2/',
'FeatureExtractor/MobilenetV2/expanded_conv_3/',
'FeatureExtractor/MobilenetV2/expanded_conv_4/',
'FeatureExtractor/MobilenetV2/expanded_conv_5/',
'FeatureExtractor/MobilenetV2/expanded_conv_6/',
'FeatureExtractor/MobilenetV2/expanded_conv_7/']
I can share colab doc and tfrecords or want to try yourself if you are interested. I think that my problem is that my pipeline.config for faces version is not totally correct.
Can you give me some clues on how to know for example which layers should i freeze in the face model? Or any tutorial where i can see it
Thanks
That's awesome! Would love to have a look at the Colab.
I'd have to look more into this before I can really answer your question. My guess would be that you actually do want to retrain (i.e. not freeze) the lower layers, because the feature extraction from thermal images may be different compared to visible light ones. Just to clarify, in your attempt so far you are retraining the whole model?
Sure, i will upload in a github repo!!. I can also share my data
Yes im retraining the whole model, but i don't know why im not able to get a loos < 1
Note that im new to this so im learning, previously i made tfrecords with images and annotations in native aspect ratio but now i converted the images to 320x320 and annotation in that ratio to have the same as the input layer.
Im doing this step ok?
I can not train long because i hit colab limits and currently i don't have a GPU to try on local so my options are very limited
Good news! I have one with 5000 steps and get 0.8 loss, will try with 10k steps to see if improve, always retraining all the layers
That's probably the right thing to do. I noticed that at inference time at least I was getting better results by maintaining the aspect ratio though.
Now im sure that using square ratio images on ssd models is the way to go, i have a nice precision model running.
Finally i did not use coral usb accelerator as it performed not good on my pi3b, sure on pi4 will be better but thats what i have, so im using it on openvino.
If you want to try i can send you the training data or the model if you can convert it to tensorflow.
Nice! I'd love to try out the model if you send it to me.
how can i contact to share the model with you? in my profile you can see my gmail address, send me a mail with some contact info and i will send you the model to test if interested
You could share a link to the Colab and for the model file you should be able to drag & drop or copy & paste it here.