sicara / tf2-yolov4

A TensorFlow 2.0 implementation of YOLOv4: Optimal Speed and Accuracy of Object Detection

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error in colab notebook, cannot reshape array of size 687 into shape (32,3,3,3)

robmarkcole opened this issue · comments

In colab notebook YoloV4_Dectection_Example.ipynb, at the cell:

!convert-darknet-weights yolov4.weights -o yolov4.h5
!ls -la ./yolov4.h5

I hit error:

Traceback (most recent call last):
  File "/usr/local/bin/convert-darknet-weights", line 8, in <module>
    sys.exit(convert_darknet_weights())
  File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/tf2_yolov4/tools/convert_darknet_weights.py", line 103, in convert_darknet_weights
    .reshape((filters, input_filters, kernel_size[0], kernel_size[1]))
ValueError: cannot reshape array of size 687 into shape (32,3,3,3)

ls: cannot access './yolov4.h5': No such file or directory

I confirmed yolov4.weights was downloaded successfully. Clearly 'reshape array of size 687 into shape (32,3,3,3)' is not going to succeed

commented

Hi @robmarkcole, thanks for opening this issue.
I was not able to reproduce the error, the colab works perfectly fine with me.

Are you sure the yolov4.weights file was downloaded entirely? Its size should be 257717640:

Screenshot 2020-06-13 at 09 42 27

If yes, could you give me more detail so that I can reproduce the bug?

Hi @AntoineToubhans
reran the notebook just now and completed fine this time. I guess it was a corrupted download.
Thanks and keep up the great work.
Cheers

Hello, the problem is with the wget command, I download it always incomplete (just 3 KB) so maybe better to download it directly from google or with
wget -P --no-check-certificate --no-proxy <url>