app
parent
7087e87559
commit
b4d2cb204e
10
app.py
10
app.py
|
@ -72,8 +72,12 @@ def worker(id,source,region=None,stream=False):
|
|||
if not cap.isOpened():
|
||||
print("Error opening video stream..")
|
||||
cap = cv2.VideoCapture(source)
|
||||
time.sleep(1)
|
||||
if not cap.isOpened():
|
||||
print("Error opening video stream...")
|
||||
time.sleep(3)
|
||||
if not cap.isOpened():
|
||||
print("Error opening video stream....")
|
||||
break
|
||||
continue
|
||||
result = model.track(frame,show=False,stream=False,persist=True,device=int(id)%4)
|
||||
|
@ -81,7 +85,11 @@ def worker(id,source,region=None,stream=False):
|
|||
detections = sv.Detections.from_yolov8(result)
|
||||
if result.boxes.id is not None:
|
||||
detections.tracker_id = result.boxes.id.cpu().numpy().astype(int)
|
||||
detections = detections[(detections.tracker_id != None)]
|
||||
else:
|
||||
detections.tracker_id = np.array([])
|
||||
detections.conf = np.array([])
|
||||
detections.xyxy=np.empty((0, 4), dtype=np.float32)
|
||||
# detections = detections[(detections.tracker_id != None)]
|
||||
|
||||
count += 1
|
||||
names = {}
|
||||
|
|
Loading…
Reference in New Issue