hunglc007 / tensorflow-yolov4-tflite

YOLOv4, YOLOv4-tiny, YOLOv3, YOLOv3-tiny Implemented in Tensorflow 2.0, Android. Convert YOLO v4 .weights tensorflow, tensorrt and tflite
https://github.com/hunglc007/tensorflow-yolov4-tflite
MIT License
2.24k stars 1.24k forks source link

Not able to run benchmark.py with pretrained model #310

Open dh0d opened 3 years ago

dh0d commented 3 years ago

I'm trying to run benchmark with pretrained model YOLOv4-Mish-416 from this page: https://github.com/AlexeyAB/darknet/wiki/YOLOv4-model-zoo

After run: python benchmarks.py --size 416 --model yolov4 --weights ./data/yolov4-mish-416.weights

I got error:

Traceback (most recent call last):
  File "benchmarks.py", line 132, in <module>
    app.run(main)
  File "/home/hc/repo/python_yolo/lib/python3.6/site-packages/absl/app.py", line 303, in run
    _run_main(main, args)
  File "/home/hc/repo/python_yolo/lib/python3.6/site-packages/absl/app.py", line 251, in _run_main
    sys.exit(main(argv))
  File "benchmarks.py", line 65, in main
    bbox_tensor = decode(fm, NUM_CLASS, i)
TypeError: decode() missing 3 required positional arguments: 'STRIDES', 'ANCHORS', and 'i'
linmeon commented 3 years ago

same error

dalhorde commented 3 years ago

Same error as well. In the code there is only few parameters for the decode function. If you look at the function decode(), it calls another function : decode_tf(). You can see at the line 27 and 29 of benchmark.py that the variables STRIDES and ANCHORS are defined. Therefor, they are not used in the function. If you add them at line 65, there is always a missing argument, i. Because the constructor of the YOLOv4 class return this : return [conv_sbbox, conv_mbbox, conv_lbbox] and there is an enumerate(feature_map) in the loop, we need to find out how to include output_size. For now, my new line 65 is : bbox_tensor = decode(fm, NUM_CLASS, STRIDES, ANCHORS, i)

MediniAmani commented 2 years ago

any solutions for this Error ?

Emmanuel-Messulam commented 2 years ago

I fixed it using:

decode(fm, cfg.TRAIN.INPUT_SIZE // 16, NUM_CLASS, STRIDES, ANCHORS, i)

instead of

decode(fm, NUM_CLASS, i)
MediniAmani commented 2 years ago

Thank you.

On Thu, Jan 20, 2022 at 6:11 PM Emmanuel-Messulam @.***> wrote:

I fixed it using: decode(fm, cfg.TRAIN.INPUT_SIZE // 16, NUM_CLASS, STRIDES, ANCHORS, i) instead of decode(fm, NUM_CLASS, i)

— Reply to this email directly, view it on GitHub https://github.com/hunglc007/tensorflow-yolov4-tflite/issues/310#issuecomment-1017728567, or unsubscribe https://github.com/notifications/unsubscribe-auth/AM4ZYUTE2FGG4FYJOPYQVJLUXA633ANCNFSM4XTJNBSQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>