yolo最新选择

This commit is contained in:
yrx
2026-08-28 14:57:56 +08:00
parent 70aa072164
commit 231937afba
27 changed files with 418 additions and 29 deletions
+12 -3
View File
@@ -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):