Commit bb2c3df0 authored by sikhin.vc's avatar sikhin.vc

Update yolov7_multiprocessing_videos.py

parent 4a0fe7b8
...@@ -2,10 +2,8 @@ ...@@ -2,10 +2,8 @@
import time import time
import multiprocessing import multiprocessing
from multiprocessing import Process from multiprocessing import Process
#from torch.multiprocessing import Pool, Process, set_start_method
from yolov7_trt import YoLov7TRT from yolov7_trt import YoLov7TRT
import cv2 import cv2
#print(torch.cuda.is_available())
engine_file_path = "build/yolov7.engine" engine_file_path = "build/yolov7.engine"
yolo_v7_wrapper = YoLov7TRT(engine_file_path) yolo_v7_wrapper = YoLov7TRT(engine_file_path)
...@@ -17,20 +15,16 @@ def detectObject(video,name): ...@@ -17,20 +15,16 @@ def detectObject(video,name):
if img is None: if img is None:
break break
else: else:
print("image shape")
print(img.shape)
result_boxes, result_scores, result_classid = yolo_v7_wrapper.infer(img) result_boxes, result_scores, result_classid = yolo_v7_wrapper.infer(img)
print(str(result_classid), str(name)) print(str(result_classid), str(name))
cTime = time.time() cTime = time.time()
print("fps", str(1/(cTime - pTime))) print("fps", str(1/(cTime - pTime)))
#cv2.imshow(name, cv2.resize(img, (600, 300))) #cv2.imshow(name, cv2.resize(img, (600, 300)))
#cv2.waitKey(1) #cv2.waitKey(1)
cap.release() cap.release()
try: try:
#set_start_method('spawn', force=True)
multiprocessing.set_start_method('spawn') multiprocessing.set_start_method('spawn')
except RuntimeError: except RuntimeError:
pass pass
......
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