Save original frame

This commit is contained in:
Nicolas Mowen 2025-10-07 09:19:58 -06:00
parent 03cbe650f8
commit 5b8ec7b8b7

View File

@ -142,7 +142,7 @@ class CustomStateClassificationProcessor(RealTimeProcessorApi):
if frame.shape != (224, 224): if frame.shape != (224, 224):
try: try:
frame = cv2.resize(frame, (224, 224)) resized_frame = cv2.resize(frame, (224, 224))
except Exception: except Exception:
logger.warning("Failed to resize image for state classification") logger.warning("Failed to resize image for state classification")
return return
@ -158,7 +158,7 @@ class CustomStateClassificationProcessor(RealTimeProcessorApi):
) )
return return
input = np.expand_dims(frame, axis=0) input = np.expand_dims(resized_frame, axis=0)
self.interpreter.set_tensor(self.tensor_input_details[0]["index"], input) self.interpreter.set_tensor(self.tensor_input_details[0]["index"], input)
self.interpreter.invoke() self.interpreter.invoke()
res: np.ndarray = self.interpreter.get_tensor( res: np.ndarray = self.interpreter.get_tensor(
@ -286,7 +286,7 @@ class CustomObjectClassificationProcessor(RealTimeProcessorApi):
if crop.shape != (224, 224): if crop.shape != (224, 224):
try: try:
crop = cv2.resize(crop, (224, 224)) resized_crop = cv2.resize(crop, (224, 224))
except Exception: except Exception:
logger.warning("Failed to resize image for state classification") logger.warning("Failed to resize image for state classification")
return return
@ -302,7 +302,7 @@ class CustomObjectClassificationProcessor(RealTimeProcessorApi):
) )
return return
input = np.expand_dims(crop, axis=0) input = np.expand_dims(resized_crop, axis=0)
self.interpreter.set_tensor(self.tensor_input_details[0]["index"], input) self.interpreter.set_tensor(self.tensor_input_details[0]["index"], input)
self.interpreter.invoke() self.interpreter.invoke()
res: np.ndarray = self.interpreter.get_tensor( res: np.ndarray = self.interpreter.get_tensor(