Keras-retinanet: TypeError: __init__() missing 1 required positional argument: 'freeze' when trying to use convert.py (MobileNet backbone)

Created on 5 Jun 2018  路  3Comments  路  Source: fizyr/keras-retinanet

Traceback (most recent call last):
  File "keras-retinanet/keras_retinanet/bin/convert_model.py", line 58, in <module>
    main()
  File "keras-retinanet/keras_retinanet/bin/convert_model.py", line 51, in main
    model = models.load_model(args.model_in, convert=True, backbone_name=args.backbone, nms=args.nms)
  File "keras-retinanet/keras_retinanet/bin/../../keras_retinanet/models/__init__.py", line 77, in load_model
    model = keras.models.load_model(filepath, custom_objects=backbone(backbone_name).custom_objects)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/keras/models.py", line 270, in load_model
    model = model_from_config(model_config, custom_objects=custom_objects)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/keras/models.py", line 347, in model_from_config
    return layer_module.deserialize(config, custom_objects=custom_objects)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/keras/layers/__init__.py", line 55, in deserialize
    printable_module_name='layer')
  File "/home/ubuntu/.local/lib/python3.6/site-packages/keras/utils/generic_utils.py", line 144, in deserialize_keras_object
    list(custom_objects.items())))
  File "/home/ubuntu/.local/lib/python3.6/site-packages/keras/engine/topology.py", line 2525, in from_config
    process_layer(layer_data)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/keras/engine/topology.py", line 2511, in process_layer
    custom_objects=custom_objects)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/keras/layers/__init__.py", line 55, in deserialize
    printable_module_name='layer')
  File "/home/ubuntu/.local/lib/python3.6/site-packages/keras/utils/generic_utils.py", line 146, in deserialize_keras_object
    return cls.from_config(config['config'])
  File "/home/ubuntu/.local/lib/python3.6/site-packages/keras/engine/topology.py", line 1271, in from_config
    return cls(**config)
TypeError: __init__() missing 1 required positional argument: 'freeze'

When I try to convert a MobileNet model (128_0.25 with random starting weights - --no-weights option) this type error happens.

76

397

These two issues are very similar, but they concern evaluate.py script, and they get me nowhere close to the solution in this case.

Most helpful comment

@lugi7 I got the same error.. I had missed the argument --backbone=mobilenet128_0.25 while invoking convert_model.py . Now it works!

All 3 comments

Hmm I haven't used mobilenet, but I could look into this.

On a different note, I have heard multiple people say mobilenet doesn't perform great for object detection.

@lugi7 I got the same error.. I had missed the argument --backbone=mobilenet128_0.25 while invoking convert_model.py . Now it works!

@Akshai it seems that was indeed the issue. I'm closing this then.

Was this page helpful?
0 / 5 - 0 ratings