mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-12-06 05:24:11 +03:00
check for valid model type
This commit is contained in:
parent
6e288839be
commit
6ee36d6ffc
@ -145,11 +145,7 @@ class EdgeTpuTfl(DetectionApi):
|
|||||||
self.boxes_tensor_index = boxes_details["index"]
|
self.boxes_tensor_index = boxes_details["index"]
|
||||||
self.boxes_scale, self.boxes_zero_point = boxes_details["quantization"]
|
self.boxes_scale, self.boxes_zero_point = boxes_details["quantization"]
|
||||||
|
|
||||||
else:
|
elif self.model_type == ModelTypeEnum.ssd:
|
||||||
if self.model_type not in [ModelTypeEnum.ssd, None]:
|
|
||||||
logger.warning(
|
|
||||||
f"Unsupported model_type '{self.model_type}' for EdgeTPU detector, falling back to SSD"
|
|
||||||
)
|
|
||||||
logger.debug("Using SSD preprocessing/postprocessing")
|
logger.debug("Using SSD preprocessing/postprocessing")
|
||||||
|
|
||||||
# SSD model indices (4 outputs: boxes, class_ids, scores, count)
|
# SSD model indices (4 outputs: boxes, class_ids, scores, count)
|
||||||
@ -162,6 +158,11 @@ class EdgeTpuTfl(DetectionApi):
|
|||||||
self.output_class_ids_index = None
|
self.output_class_ids_index = None
|
||||||
self.output_class_scores_index = None
|
self.output_class_scores_index = None
|
||||||
|
|
||||||
|
else:
|
||||||
|
raise Exception(
|
||||||
|
f"{self.model_type} is currently not supported for edgetpu. See the docs for more info on supported models."
|
||||||
|
)
|
||||||
|
|
||||||
def _generate_anchors_and_strides(self):
|
def _generate_anchors_and_strides(self):
|
||||||
# for decoding the bounding box DFL information into xy coordinates
|
# for decoding the bounding box DFL information into xy coordinates
|
||||||
all_anchors = []
|
all_anchors = []
|
||||||
@ -334,8 +335,7 @@ class EdgeTpuTfl(DetectionApi):
|
|||||||
detections[:num_detections, 5] = final_boxes[:, 2] / self.model_width
|
detections[:num_detections, 5] = final_boxes[:, 2] / self.model_width
|
||||||
return detections
|
return detections
|
||||||
|
|
||||||
else:
|
elif self.model_type == ModelTypeEnum.ssd:
|
||||||
# Default SSD model
|
|
||||||
self.determine_indexes_for_non_yolo_models()
|
self.determine_indexes_for_non_yolo_models()
|
||||||
boxes = self.interpreter.tensor(self.tensor_output_details[0]["index"])()[0]
|
boxes = self.interpreter.tensor(self.tensor_output_details[0]["index"])()[0]
|
||||||
class_ids = self.interpreter.tensor(
|
class_ids = self.interpreter.tensor(
|
||||||
@ -366,3 +366,8 @@ class EdgeTpuTfl(DetectionApi):
|
|||||||
]
|
]
|
||||||
|
|
||||||
return detections
|
return detections
|
||||||
|
|
||||||
|
else:
|
||||||
|
raise Exception(
|
||||||
|
f"{self.model_type} is currently not supported for edgetpu. See the docs for more info on supported models."
|
||||||
|
)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user