From 70c9fb1dbd648c550e0c65f7e30ba6982f8db9e8 Mon Sep 17 00:00:00 2001 From: matteo porta Date: Wed, 27 Jul 2022 15:43:03 +0200 Subject: [PATCH] wip --- src/components/vision.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/vision.py b/src/components/vision.py index 9d01c1b..b227c74 100644 --- a/src/components/vision.py +++ b/src/components/vision.py @@ -336,6 +336,8 @@ class Vision(Component): self.loading_model_signal.emit({"status": "done"}) def check_features(self, frame, lock=True): + if frame is None: + return [] if self.interpreter is not None and frame.shape != self.interpreter.get_input_details()[0]["shape"][1:3]: tensor = np.expand_dims(cv2.resize(frame, self.interpreter.get_input_details()[0]["shape"][1:3], interpolation=cv2.INTER_LINEAR), axis=0) else: @@ -691,7 +693,7 @@ class Vision(Component): def vision_consumer_work(self, consumable=None): # VISION_CONSUMER TASK - if consumable is None: + if consumable is None or consumable["frame"] is None: return detections = self.check_features(consumable["frame"]) results = self.process_detections(detections)