Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[INFO] Summer update for OpenCV 4.x has been released :) #6284

Open
dsbyprateekg opened this issue Jul 20, 2020 · 3 comments
Open

[INFO] Summer update for OpenCV 4.x has been released :) #6284

dsbyprateekg opened this issue Jul 20, 2020 · 3 comments

Comments

@dsbyprateekg
Copy link

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)`

@not-matthias
Copy link

It might be worth mentioning that this does also include YOLOv4 Tiny.

@kermado
Copy link

kermado commented Jul 26, 2020

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?

@YashasSamaga
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants