tensorflow-yolov4-tflite icon indicating copy to clipboard operation
tensorflow-yolov4-tflite copied to clipboard

Not able to run benchmark.py with pretrained model

Open dh0d opened this issue 4 years ago • 5 comments

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'

dh0d avatar Feb 14 '21 14:02 dh0d

same error

linmeon avatar Feb 22 '21 09:02 linmeon

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)

dalhorde avatar Apr 08 '21 07:04 dalhorde

any solutions for this Error ?

MediniAmani avatar Jan 10 '22 13:01 MediniAmani

I fixed it using:

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

instead of

decode(fm, NUM_CLASS, i)

Emmanuel-Messulam avatar Jan 20 '22 17:01 Emmanuel-Messulam

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: @.***>

MediniAmani avatar Jan 21 '22 10:01 MediniAmani