* Catch bird classification resize error

* Improve openvino width detection

* Use auto by default

* Set type
This commit is contained in:
Nicolas Mowen
2025-09-16 16:06:51 -06:00
committed by GitHub
parent 975c8485f9
commit 26178444f3
3 changed files with 37 additions and 10 deletions
+5 -1
View File
@@ -128,7 +128,11 @@ class BirdRealTimeProcessor(RealTimeProcessorApi):
]
if input.shape != (224, 224):
input = cv2.resize(input, (224, 224))
try:
input = cv2.resize(input, (224, 224))
except Exception:
logger.warning("Failed to resize image for bird classification")
return
input = np.expand_dims(input, axis=0)
self.interpreter.set_tensor(self.tensor_input_details[0]["index"], input)
@@ -133,8 +133,12 @@ class CustomStateClassificationProcessor(RealTimeProcessorApi):
x:x2,
]
if frame.shape != (224, 224):
frame = cv2.resize(frame, (224, 224))
if input.shape != (224, 224):
try:
input = cv2.resize(input, (224, 224))
except Exception:
logger.warning("Failed to resize image for state classification")
return
input = np.expand_dims(frame, axis=0)
self.interpreter.set_tensor(self.tensor_input_details[0]["index"], input)
@@ -254,8 +258,12 @@ class CustomObjectClassificationProcessor(RealTimeProcessorApi):
x:x2,
]
if crop.shape != (224, 224):
crop = cv2.resize(crop, (224, 224))
if input.shape != (224, 224):
try:
input = cv2.resize(input, (224, 224))
except Exception:
logger.warning("Failed to resize image for object classification")
return
input = np.expand_dims(crop, axis=0)
self.interpreter.set_tensor(self.tensor_input_details[0]["index"], input)