david8862 / keras-YOLOv3-model-set

end-to-end YOLOv4/v3/v2 object detection pipeline, implemented on tf.keras with different technologies
MIT License
640 stars 222 forks source link

python tools/convert.py --yolo4_reorder error: buffer is too small for requested array #75

Open bsugerman opened 4 years ago

bsugerman commented 4 years ago

Following your directions to download and convert yolov4 weights, the following happens:

$ curl https://github.com/AlexeyAB/darknet/releases/download/darknet_yolo_v3_optimal/yolov4.weights > weights/yolov4.weights

$ python tools/convert.py --yolo4_reorder cfg/yolov4.cfg weights/yolov4.weights weights/yolov4.h5

2020-06-24 11:03:18.818036: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_101.dll
tools/convert.py:86: RuntimeWarning: overflow encountered in long_scalars
  if (major*10+minor)>=2 and major<1000 and minor<1000:
Loading weights.
Weights Header:  1836345404 1648115308 1048142959 [544567129]
Parsing Darknet config.
Creating Keras model.
Parsing section net_0
Parsing section convolutional_0
conv2d bn mish (3, 3, 3, 32)
Traceback (most recent call last):
  File "tools/convert.py", line 311, in <module>
    _main(parser.parse_args())
  File "tools/convert.py", line 153, in _main
    buffer=weights_file.read(weights_size * 4))
TypeError: buffer is too small for requested array
david8862 commented 4 years ago

@bsugerman can you double confirm your downloading is finished correctly? seems your weights file is corrupted. The md5sum for verified file is 00a4878d05f4d832ab38861b32061283:

# ls -l weights/yolov4.weights
-rwxrwxrwx 1 root root 257717640 Apr 24 16:10 weights/yolov4.weights
# md5sum weights/yolov4.weights
00a4878d05f4d832ab38861b32061283  weights/yolov4.weights
bsugerman commented 4 years ago

Turns out that the file directory https://github.com/AlexeyAB/darknet/releases/download/darknet_yolo_v3_optimal no longer exists!

On Jun 24, 2020, at 11:43 AM, david8862 notifications@github.com wrote:

@bsugerman https://github.com/bsugerman can you double confirm your downloading is finished correctly? seems your weights file is corrupted. The md5sum for verified file is 00a4878d05f4d832ab38861b32061283:

ls -l weights/yolov4.weights

-rwxrwxrwx 1 root root 257717640 Apr 24 16:10 weights/yolov4.weights

md5sum weights/yolov4.weights

00a4878d05f4d832ab38861b32061283 weights/yolov4.weights — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/david8862/keras-YOLOv3-model-set/issues/75#issuecomment-648900581, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFOHNQA4I3GTXEFB32YIF7DRYINJNANCNFSM4OGYHXSA.

david8862 commented 4 years ago

I tried with wget again, the file link itself still works

# wget -O yolov4.weights https://github.com/AlexeyAB/darknet/releases/download/darknet_yolo_v3_optimal/yolov4.weights
--2020-06-24 23:37:02--  https://github.com/AlexeyAB/darknet/releases/download/darknet_yolo_v3_optimal/yolov4.weights
Resolving github.com (github.com)... 13.250.177.223
Connecting to github.com (github.com)|13.250.177.223|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://github-production-release-asset-2e65be.s3.amazonaws.com/75388965/ba4b6380-889c-11ea-9751-f994f5961796?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20200624%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20200624T153706Z&X-Amz-Expires=300&X-Amz-Signature=1315fa52a99803b3146b7071f38a075c062af35b1dfe69581e9b4e7e11756177&X-Amz-SignedHeaders=host&actor_id=0&repo_id=75388965&response-content-disposition=attachment%3B%20filename%3Dyolov4.weights&response-content-type=application%2Foctet-stream [following]
--2020-06-24 23:37:08--  https://github-production-release-asset-2e65be.s3.amazonaws.com/75388965/ba4b6380-889c-11ea-9751-f994f5961796?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20200624%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20200624T153706Z&X-Amz-Expires=300&X-Amz-Signature=1315fa52a99803b3146b7071f38a075c062af35b1dfe69581e9b4e7e11756177&X-Amz-SignedHeaders=host&actor_id=0&repo_id=75388965&response-content-disposition=attachment%3B%20filename%3Dyolov4.weights&response-content-type=application%2Foctet-stream
Resolving github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)... 52.216.132.195
Connecting to github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)|52.216.132.195|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 257717640 (246M) [application/octet-stream]
Saving to: ‘yolov4.weights’

yolov4.weights                        100%[========================================================================>] 245.78M   960KB/s    in 4m 6s

2020-06-24 23:41:15 (1.00 MB/s) - ‘yolov4.weights’ saved [257717640/257717640]
bsugerman commented 4 years ago

On Windows, wget isn’t often available so I used curl. I guess the lesson here is that you have to use wget. Thanks.

On Jun 24, 2020, at 11:58 AM, david8862 notifications@github.com wrote:

I tried with wget again, the file link itself still works

wget -O yolov4.weights https://github.com/AlexeyAB/darknet/releases/download/darknet_yolo_v3_optimal/yolov4.weights

--2020-06-24 23:37:02-- https://github.com/AlexeyAB/darknet/releases/download/darknet_yolo_v3_optimal/yolov4.weights Resolving github.com (github.com)... 13.250.177.223 Connecting to github.com (github.com)|13.250.177.223|:443... connected. HTTP request sent, awaiting response... 302 Found Location: https://github-production-release-asset-2e65be.s3.amazonaws.com/75388965/ba4b6380-889c-11ea-9751-f994f5961796?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20200624%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20200624T153706Z&X-Amz-Expires=300&X-Amz-Signature=1315fa52a99803b3146b7071f38a075c062af35b1dfe69581e9b4e7e11756177&X-Amz-SignedHeaders=host&actor_id=0&repo_id=75388965&response-content-disposition=attachment%3B%20filename%3Dyolov4.weights&response-content-type=application%2Foctet-stream [following] --2020-06-24 23:37:08-- https://github-production-release-asset-2e65be.s3.amazonaws.com/75388965/ba4b6380-889c-11ea-9751-f994f5961796?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20200624%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20200624T153706Z&X-Amz-Expires=300&X-Amz-Signature=1315fa52a99803b3146b7071f38a075c062af35b1dfe69581e9b4e7e11756177&X-Amz-SignedHeaders=host&actor_id=0&repo_id=75388965&response-content-disposition=attachment%3B%20filename%3Dyolov4.weights&response-content-type=application%2Foctet-stream Resolving github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)... 52.216.132.195 Connecting to github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)|52.216.132.195|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 257717640 (246M) [application/octet-stream] Saving to: ‘yolov4.weights’

yolov4.weights 100%[========================================================================>] 245.78M 960KB/s in 4m 6s

2020-06-24 23:41:15 (1.00 MB/s) - ‘yolov4.weights’ saved [257717640/257717640] — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/david8862/keras-YOLOv3-model-set/issues/75#issuecomment-648909084, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFOHNQC4B3L7WQO7U76FASLRYIPA3ANCNFSM4OGYHXSA.

YetkinMesutKaraman commented 4 years ago

Is it possible to convert tiny yolov4? buffer error occurs

david8862 commented 4 years ago

@YetkinMesutKaraman I've updated the darknet convert tool to support official Tiny YOLOv4 model now. You can have a try