hollance / YOLO-CoreML-MPSNNGraph

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

Too many weights? #26

Closed haemi closed 5 years ago

haemi commented 6 years ago

when converting my weights file to h5, I get the following:

Read 15867885 of 50676062.0 from Darknet weights.
Traceback (most recent call last):
  File "yad2k.py", line 271, in <module>
    _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()

When using the downloaded weights-file it works as all the weights are read:

Saved Keras model to model_data/tiny-yolo-voc.h5
Read 15867885 of 15867885.0 from Darknet weights.
Saved model plot to model_data/tiny-yolo-voc.png

What am I doing wrong?

hollance commented 6 years ago

Are you using Python 2?

haemi commented 6 years ago

no, python 3, like the command in the readme says:

python3 yad2k.py -p ../tiny-yolo-voc.cfg ../tiny-yolo-voc.weights model_data/tiny-yolo-voc.h5
hollance commented 6 years ago

I suggest using the latest version of YAD2K (it's on GitHub somewhere). I only included it in this repo because coremltools needed Keras 1.x at the time.

haemi commented 6 years ago

with that, I get

Traceback (most recent call last):
  File "./yad2k.py", line 270, in <module>
    _main(parser.parse_args())
  File "./yad2k.py", line 156, in _main
    buffer=weights_file.read(weights_size * 4))
TypeError: buffer is too small for requested array

:(

hollance commented 6 years ago

Ah, the fun of converting between different deep learning packages that are constantly changing... ;-)

Unfortunately, I don't have time right now to investigate this -- and the script works for the weights that come with this repo, just not for custom models, apparently.