Muhammad-Yunus / Jetson-Nano-OpenCV-CUDA-Test

3 stars 1 forks source link

opencv-dnn-cuda-test.py with pretrained YOLOv4-tiny samples #1

Open DWSuryo opened 3 years ago

DWSuryo commented 3 years ago

in your example, you used pretrained yolov3-tiny model for testing those sample images. i used pretrained yolov4-tiny models here (search yolov4-tiny in page) to see how it works. Specifications: Jetson Nano (with 4GB swap), Jetpack 4.5.1, OpenCV 4.5.2, numpy 1.19

OpenCV version : 4.5.2 

[INFO] load coco names :
number of classes : 80 

[INFO] load tiny yolo model :
unconnected layer : ['yolo_16', 'yolo_23'] 

[INFO] inference for all image in `images/` :

processing 000000500100.jpg ...
inference time: 0.35 s
postprocess 000000500100.jpg ...

Traceback (most recent call last):
  File "opencv-dnn-cuda.py", line 72, in <module>
    frame = util.postprocess(outs, frame, classes)
  File "/home/dito/Jetson-Nano-OpenCV-CUDA-Test/utils.py", line 44, in postprocess
    c_x = int(detection[0] * frame_w)
ValueError: cannot convert float NaN to integer

Then I switched v4 and v3 including cfg files and vice-versa, looks like the problem might be in v4 weights. Have you experienced this yet? If I'm curious, is the v3 model pretrained by yours or using samples? Thank you

Muhammad-Yunus commented 3 years ago

On this sample, I'm using original YOLOv3-tiny from https://pjreddie.com/darknet/yolo/

Currently, I dont have any experience using YOLOv4-tiny. But on the error you are facing out, problem seems on utils.py script. That script is only the post-processing part after network finish generating output layer.

I guest, this because output layer from YOLOv3 and YOLOv4 is different.

Muhammad-Yunus commented 3 years ago

utils.py on this test script only tested on YOLOv3 layer output , just check YOLOv4 layer output and than compare with YOLOv3