michalfaber / tensorflow_Realtime_Multi-Person_Pose_Estimation

Multi-Person Pose Estimation project for Tensorflow 2.0 with a small and fast model based on MobilenetV3
Other
215 stars 65 forks source link

Batch normalization moving mean and variance are not being updated #13

Closed muditbac closed 4 years ago

muditbac commented 4 years ago

Hi, I think the moving mean and variance variables of all the batch norm layers are not being updated. This is mainly because training=True variable is not being passed while generating the training output. The moving mean and moving variance variables are not updated by optimizers but the layers themselves during training time.

https://github.com/michalfaber/tensorflow_Realtime_Multi-Person_Pose_Estimation/blob/8ffbeb55d6ece3fb00d49efa9edf89fd8e5c7dd2/train_custom_loop_mobilenet.py#L76

https://github.com/michalfaber/tensorflow_Realtime_Multi-Person_Pose_Estimation/blob/8ffbeb55d6ece3fb00d49efa9edf89fd8e5c7dd2/train_custom_loop.py#L129

References: https://github.com/tensorflow/tensorflow/issues/28028#issuecomment-490337903

michalfaber commented 4 years ago

Thank you. I missed this detail. Now I understand what was the main factor contributing to the instability of training. I will try to rework the code if time permits - the dataset requires fixing as well.

muditbac commented 4 years ago

Should I make the changes and raise the PR? I need the pre-trained model for MobileNet. What fixing does the dataset require?

michalfaber commented 4 years ago

I would suggest not to raise PR for the time being because I plan to re-work quite a lot of stuff like model architecture and dataset generation. I see a few problems with the COCO dataset: an imbalance in the distribution of human pose scales in images - more images with poses occupying the entire image area, picking only the main person in the image, instances where the annotated pose is just like a black shadow.