hollance / YOLO-CoreML-MPSNNGraph

Tiny YOLO for iOS implemented using CoreML but also using the new MPS graph API.
MIT License
935 stars 252 forks source link

TypeError: __init__() got an unexpected keyword argument 'dtype' #59

Open wiamadaya opened 5 years ago

wiamadaya commented 5 years ago

i trained a 1 class tiny yolo model on a custom dataset (https://github.com/experiencor/kangaroo) using this repo https://github.com/experiencor/keras-yolo2 and received the following error when performing coreml conversion

TypeError: __init__() got an unexpected keyword argument 'dtype'

hollance commented 5 years ago

What line number and in which file does that error occur?

wiamadaya commented 5 years ago

@hollance

(coreml) (base) Wiamas-MacBook-Air:Convert user$ python coreml.py WARNING: Logging before flag parsing goes to stderr. W0826 20:13:05.465229 4428912064 __init__.py:118] TensorFlow version 1.14.0 detected. Last version known to be fully compatible is 1.12.0 . Traceback (most recent call last): File "coreml.py", line 7, in <module> coreml_model = coremltools.converters.keras.convert('yad2k/model_data/tiny_yolo_kangaroo.h5', image_input_names='image', image_scale=1/255.) File "/Users/user/coreml/lib/python2.7/site-packages/coremltools/converters/keras/_keras_converter.py", line 760, in convert custom_conversion_functions=custom_conversion_functions) File "/Users/user/coreml/lib/python2.7/site-packages/coremltools/converters/keras/_keras_converter.py", line 537, in convertToSpec custom_objects=custom_objects) File "/Users/user/coreml/lib/python2.7/site-packages/coremltools/converters/keras/_keras_converter.py", line 168, in _convert model = _keras.models.load_model(model, custom_objects = custom_objects) File "/Users/user/coreml/lib/python2.7/site-packages/keras/models.py", line 142, in load_model model = model_from_config(model_config, custom_objects=custom_objects) File "/Users/user/coreml/lib/python2.7/site-packages/keras/models.py", line 193, in model_from_config return layer_from_config(config, custom_objects=custom_objects) File "/Users/user/coreml/lib/python2.7/site-packages/keras/utils/layer_utils.py", line 40, in layer_from_config custom_objects=custom_objects) File "/Users/user/coreml/lib/python2.7/site-packages/keras/engine/topology.py", line 2582, in from_config process_layer(layer_data) File "/Users/user/coreml/lib/python2.7/site-packages/keras/engine/topology.py", line 2560, in process_layer custom_objects=custom_objects) File "/Users/user/coreml/lib/python2.7/site-packages/keras/utils/layer_utils.py", line 42, in layer_from_config return layer_class.from_config(config['config']) File "/Users/user/coreml/lib/python2.7/site-packages/keras/engine/topology.py", line 1025, in from_config return cls(**config) TypeError: __init__() got an unexpected keyword argument 'dtype'

i converted the sample tiny-yolo-voc.h5 to coreml without issue, so the problem should be on my custom model, or should i use this repo to train my custom model instead https://github.com/thtrieu/darkflow

hollance commented 5 years ago

This sounds like you're using an incompatible version of Keras. Unfortunately, Keras changes a lot between one version and the next. Since this is a relatively old repo, I'd suggest updating the yad2k package that is inside it.