yolo最新选择
This commit is contained in:
+12
-3
@@ -126,10 +126,19 @@ def _get_detector(model_path: str):
|
||||
return _detector_by_path[model_path]
|
||||
try:
|
||||
from maix import nn
|
||||
except ImportError:
|
||||
except Exception:
|
||||
return None
|
||||
_detector_by_path[model_path] = nn.YOLOv5(model=model_path, dual_buff=False)
|
||||
return _detector_by_path[model_path]
|
||||
# YOLO is an optional capability. A broken/incompatible model must not
|
||||
# abort boot (especially before the OTA rollback check).
|
||||
try:
|
||||
detector = nn.YOLOv5(model=model_path, dual_buff=False)
|
||||
except Exception:
|
||||
# Cache the failure to avoid retrying a broken native load every frame.
|
||||
# reset_yolo_detector_cache() clears this after a model replacement.
|
||||
_detector_by_path[model_path] = None
|
||||
return None
|
||||
_detector_by_path[model_path] = detector
|
||||
return detector
|
||||
|
||||
|
||||
def preload_yolo_detector(logger=None):
|
||||
|
||||
Reference in New Issue
Block a user