open-mmlab / mmpose

OpenMMLab Pose Estimation Toolbox and Benchmark.
https://mmpose.readthedocs.io/en/latest/
Apache License 2.0
5.71k stars 1.23k forks source link

modify a backbone of mmpose and use pretrained model #2337

Closed alaa-shubbak closed 1 year ago

alaa-shubbak commented 1 year ago

What is the feature?

I would like to ask about the possibility to change the initialization of a backbone in mmpose model. for example in model based on HRNet as bellow : HRNet for mmpose

can i modify the backbone and load a pretrain model of .pth from another training stage ? is there certain points shall i take care of ?

can i do the same in the model based on ResNet-50 backbone ,like this one : resnet_50 for mmpose

Any other context?

i need to try to train the backbone first on huge amount of dataset ,without any annotation or with just basic annotation. then do the pose estimation part on less amount of data.

so i was thinking to modify the backbone initialization by the results of .pth of well trained model.

looking forward to hear from your side.

thanks

Ben-Louis commented 1 year ago

Certainly, you can change the value of checkpoint to reference any other checkpoint file you'd like.

alaa-shubbak commented 1 year ago

Thanks for your reply.

I try it, but unfortunately i got this error :

TypeError: TopDown: ResNet: __init__() got an unexpected keyword argument 'init_cfg'

here is my update in the Resnet_50_animalpose config:

image

please note that i used the old version of mmpose. as it worked before with me in my application.

Ben-Louis commented 1 year ago

Hi @alaa-shubbak, the old version (v0.x) of mmpose is not compatible with the current config you are using. You could use the configs from the old version and modify the pretrained value in config, such as https://github.com/open-mmlab/mmpose/blob/3b8173463c4ecdcd3d82d566254bb2ae2eb0cc07/configs/animal/2d_kpt_sview_rgb_img/topdown_heatmap/ap10k/hrnet_w48_ap10k_256x256.py#L40-L41.

alaa-shubbak commented 1 year ago

Thank you very much. the training is running now.