-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathdemo.py
More file actions
38 lines (32 loc) · 875 Bytes
/
demo.py
File metadata and controls
38 lines (32 loc) · 875 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# -*- coding: utf-8 -*-
#!/usr/bin/python3
"""
Created on 2021/5/24 13:46
@Author: Wang Cong
@Email : iwangcong@outlook.com
@Version : 0.1
@File : demo_trt.py
"""
import yolo_deepsort
import cv2
import time
if __name__ == '__main__':
yolo_engine = './yolov5/yolov5s.engine'
sort_engine = './deepsort/deepsort.engine'
capture = cv2.VideoCapture(0)
yolo_deepsort_test = yolo_deepsort.Yolov5DeepSort(yolo_engine, sort_engine)
fps = 0.0
while True:
ret, img = capture.read()
if img is None:
print('No image input!')
break
t1 = time.time()
frame = yolo_deepsort_test.detect_track_frame(img)
t2 = time.time() - t1
print(t2*1000)
cv2.imshow('frame', frame)
if cv2.waitKey(10) & 0xFF == ord('q'):
break
capture.release()
cv2.destroyAllWindows()