Error while using finetuning pretrained detection model in GluonCV

gluon-cv

#1

Hi, I was trying to finetune a pretrained ‘ssd_512_mobilenet1.0_voc’ by copying the code provided on 08. Finetune a pretrained detection model GluonCV tutorial. All steps executed normally until the last block of code of predicting using the finetuned model. Please help me out! as I have been training this for quite a while to find out that it is throwing errors at final step.

net = gcv.model_zoo.get_model(‘ssd_512_mobilenet1.0_custom’, classes=classes,
pretrained_base=False)
net.load_parameters(’./params/ssd_512_mobilenet1.0_pikachu_191_.params’)
Traceback (most recent call last):

File “”, line 3, in
net.load_parameters(’./params/ssd_512_mobilenet1.0_pikachu_191_.params’)

File “C:\Users\Anoubhav\Anaconda3\envs\myenv\lib\site-packages\mxnet\gluon\block.py”, line 394, in load_parameters
name, filename, _brief_print_list(loaded.keys()))

AssertionError: Parameter ‘features.mobilenet0_conv0_weight’ is missing in file ‘./params/ssd_512_mobilenet1.0_pikachu_191_.params’, which contains parameters: ‘features.resnetv10_conv0_weight’, ‘features.resnetv10_batchnorm0_gamma’, ‘features.resnetv10_batchnorm0_beta’, …, ‘anchor_generators.2.anchors’, ‘anchor_generators.3.anchors’, ‘anchor_generators.4.anchors’, ‘anchor_generators.5.anchors’. Set allow_missing=True to ignore missing parameters.


#2

Hi,

Looks like the net object has a mobilenet backend and is expecting a mobilenet parameters from your params file but your saved parameters was saved by a model with a resnet backend and has resnet params.

Could you post the script you ran to perform the training? It seems like perhaps you may have loaded a different model or missed some arguments.