Commit a40e3e83 authored by jack's avatar jack

Merge branch 'master' of gitlab.ubocare.com:jiajunjie/face_detect

parents edfb6f8c ba0b15f2
......@@ -86,4 +86,5 @@ class DarknetYolo:
k=k+1
return lists
else:
print("Cann't detect objects,please check image!")
#print("Cann't detect objects,please check image!")
return []
......@@ -2,6 +2,9 @@ import cv2 as cv
import os.path
import darknet as interface
import argparse
import sys
import time
import datetime
configPath='hat-obj-test.cfg'
......@@ -54,22 +57,31 @@ while cv.waitKey(1) < 0:
cap.release()
break
detections_lists = []
t1 = time.time()
detections_lists = yolo.getdetresults(frame)
print(len(detections_lists ))
for i in range( len(detections_lists) ):
# get x,y,w,h
x1 = detections_lists[i][0]
y1 = detections_lists[i][1]
x2 = detections_lists[i][2]
y2 = detections_lists[i][3]
label = detections_lists[i][4]
confidence = detections_lists[i][5]
color = detections_lists[i][6]
t = time.time()
print(int(round((t-t1) * 1000)))
if detections_lists:
print(len(detections_lists ))
for i in range( len(detections_lists) ):
# get x,y,w,h
x1 = detections_lists[i][0]
y1 = detections_lists[i][1]
x2 = detections_lists[i][2]
y2 = detections_lists[i][3]
label = detections_lists[i][4]
confidence = detections_lists[i][5]
color = detections_lists[i][6]
cv.rectangle(frame, (x1, y1), (x2, y2), color, 1, lineType=cv.LINE_AA)
text = "{}: {:.4f}".format(label, confidence )
cv.putText(frame, text, (x1, y1 - 5), cv.FONT_HERSHEY_SIMPLEX,
0.5, color, 1, lineType=cv.LINE_AA)
else:
print(0)
cv.rectangle(frame, (x1, y1), (x2, y2), color, 1, lineType=cv.LINE_AA)
text = "{}: {:.4f}".format(label, confidence )
cv.putText(frame, text, (x1, y1 - 5), cv.FONT_HERSHEY_SIMPLEX,
0.5, color, 1, lineType=cv.LINE_AA)
cv.imshow("Tag", frame)
cv.imshow("Tag", frame)
#print(detections_lists)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment