hollance / YOLO-CoreML-MPSNNGraph

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

throws error - 'float' has no len() #23

Closed RRathna closed 6 years ago

RRathna commented 6 years ago

Error Message: Traceback (most recent call last): File "yad2k.py", line 271, in _main(parser.parse_args()) File "yad2k.py", line 263, in _main print('Warning: {} unused weights'.format(len(remaining_weights))) TypeError: object of type 'float' has no len()

Possible correction/suggestion: In line 263 replace,

print('Warning: {} unused weights'.format(len(remaining_weights)))

with print('Warning: {} unused weights'.format(remaining_weights))

hollance commented 6 years ago

This sounds like a version issue. What version of Python, Keras, etc are you using?

RRathna commented 6 years ago

python 3.6.4 keras 1.2.2 tensorflow 0.12.1 h5py 2.7.1

hollance commented 6 years ago

Just to be clear, I'm not the author of YAD2K and I only hacked it to get it to work with Keras 1.x. ;-)

It worked with my setup (which I think included TensorFlow 1.x and Python 2) and I think it's either the Python version or TensorFlow version that gives this error for you.

However, now that coremltools supports Keras 2, it might be worth updating this code to use the latest YAD2K.

RRathna commented 6 years ago

Hey! It is a version issue, should use python2.7 instead of 3. Thanks!

haemi commented 6 years ago

@RRathna I get the same error with my own model, but according to this repo we should use python 3 - where exactly did you switch to python2 to solve this problem?