Open dsbyprateekg opened 4 years ago
It might be worth mentioning that this does also include YOLOv4 Tiny.
Thanks, I got this working. The inference time returned by Net::getPerfProfile()
and converted to seconds is extremely fast (around 200 fps). However, when I measure the time for Net::forward()
, it is about 5 times slower (40 fps). This is for yolov4 on a GTX 1080TI with 512x512 input size. What is accounting for the difference?
@kermado getPerfProfile()
is not supported by the CUDA backend. It reports the time it took to dump operations onto the GPU, not the time it took to complete the operations.
However, when I measure the time for Net::forward(), it is about 5 times slower (40 fps). This is for yolov4 on a GTX 1080TI with 512x512 input size.
This doesn't seem correct. I get 48 FPS for 608 x 608 image. You can find a more detailed performance summary here.
Hi All,
OpenCV 4.4.0 is released with the support of State-of-art Yolo v4 Detector. Please see the release details here- https://github.com/opencv/opencv/wiki/ChangeLog#version440
Sample Python code:- `import cv2 as cv
net = cv.dnn_DetectionModel('yolov4.cfg', 'yolov4.weights') net.setInputSize(608, 608) net.setInputScale(1.0 / 255) net.setInputSwapRB(True)
frame = cv.imread('example.jpg')
with open('coco.names', 'rt') as f: names = f.read().rstrip('\n').split('\n')
classes, confidences, boxes = net.detect(frame, confThreshold=0.1, nmsThreshold=0.4) for classId, confidence, box in zip(classes.flatten(), confidences.flatten(), boxes): label = '%.2f' % confidence label = '%s: %s' % (names[classId], label) labelSize, baseLine = cv.getTextSize(label, cv.FONT_HERSHEY_SIMPLEX, 0.5, 1) left, top, width, height = box top = max(top, labelSize[1]) cv.rectangle(frame, box, color=(0, 255, 0), thickness=3) cv.rectangle(frame, (left, top - labelSize[1]), (left + labelSize[0], top + baseLine), (255, 255, 255), cv.FILLED) cv.putText(frame, label, (left, top), cv.FONT_HERSHEY_SIMPLEX, 0.5, (0, 0, 0))
cv.imshow('out', frame)`