make cython app exit correctly

This commit is contained in:
Alex Bezdieniezhnykh
2025-02-11 20:40:49 +02:00
parent 9973a16ada
commit 43cae0d03c
9 changed files with 87 additions and 65 deletions
+1 -3
View File
@@ -137,7 +137,7 @@ cdef class Inference:
self._previous_annotation = None
v_input = cv2.VideoCapture(<str>video_name)
while v_input.isOpened():
while v_input.isOpened() and not self.stop_signal:
ret, frame = v_input.read()
if not ret or frame is None:
break
@@ -186,11 +186,9 @@ cdef class Inference:
print(annotation.to_str(self.class_names))
self.on_annotation(cmd, annotation)
cdef stop(self):
self.stop_signal = True
cdef bint is_valid_annotation(self, Annotation annotation):
# No detections, invalid
if not annotation.detections: