scorevision: push artifact
Browse files
miner.py
CHANGED
|
@@ -1,9 +1,4 @@
|
|
| 1 |
"""
|
| 2 |
-
TurboVision miner: YOLO11n detection weights shipped as yolo11n.pt in this repo root.
|
| 3 |
-
|
| 4 |
-
Place `yolo11n.pt` next to this file before `sv push` (e.g. download via Ultralytics locally).
|
| 5 |
-
Detection-only: bounding boxes from YOLO11n; keypoints are padded to n_keypoints with (0, 0).
|
| 6 |
-
|
| 7 |
Emitted cls_id values are subnet indices for manifests whose objects list is:
|
| 8 |
[bus, car, truck, motorcycle] (e.g. manak0/Detect-detect-vehicle)
|
| 9 |
YOLO COCO-80 class ids are remapped; other COCO classes are skipped.
|
|
@@ -18,7 +13,7 @@ from ultralytics import YOLO
|
|
| 18 |
|
| 19 |
logger = getLogger(__name__)
|
| 20 |
|
| 21 |
-
WEIGHTS_NAME = "
|
| 22 |
|
| 23 |
# Must match manifest `objects` order for the vehicle element.
|
| 24 |
SUBNET_VEHICLE_LABELS: tuple[str, ...] = ("bus", "car", "truck", "motorcycle")
|
|
@@ -54,10 +49,6 @@ class TVFrameResult(BaseModel):
|
|
| 54 |
|
| 55 |
|
| 56 |
class Miner:
|
| 57 |
-
"""
|
| 58 |
-
Loads YOLO11n from the Hugging Face repo snapshot. Must define `Miner` with
|
| 59 |
-
`predict_batch` as required by the TurboVision chute template.
|
| 60 |
-
"""
|
| 61 |
|
| 62 |
def __init__(self, path_hf_repo: Path) -> None:
|
| 63 |
weights = path_hf_repo / WEIGHTS_NAME
|
|
@@ -66,7 +57,6 @@ class Miner:
|
|
| 66 |
f"Missing {WEIGHTS_NAME} in repo root. Add weights before push."
|
| 67 |
)
|
| 68 |
self.model = YOLO(str(weights))
|
| 69 |
-
logger.info("YOLO11n weights loaded from %s", weights.name)
|
| 70 |
|
| 71 |
def __repr__(self) -> str:
|
| 72 |
return f"Model: YOLO ({type(self.model).__name__})"
|
|
|
|
| 1 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
Emitted cls_id values are subnet indices for manifests whose objects list is:
|
| 3 |
[bus, car, truck, motorcycle] (e.g. manak0/Detect-detect-vehicle)
|
| 4 |
YOLO COCO-80 class ids are remapped; other COCO classes are skipped.
|
|
|
|
| 13 |
|
| 14 |
logger = getLogger(__name__)
|
| 15 |
|
| 16 |
+
WEIGHTS_NAME = "best.pt"
|
| 17 |
|
| 18 |
# Must match manifest `objects` order for the vehicle element.
|
| 19 |
SUBNET_VEHICLE_LABELS: tuple[str, ...] = ("bus", "car", "truck", "motorcycle")
|
|
|
|
| 49 |
|
| 50 |
|
| 51 |
class Miner:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
def __init__(self, path_hf_repo: Path) -> None:
|
| 54 |
weights = path_hf_repo / WEIGHTS_NAME
|
|
|
|
| 57 |
f"Missing {WEIGHTS_NAME} in repo root. Add weights before push."
|
| 58 |
)
|
| 59 |
self.model = YOLO(str(weights))
|
|
|
|
| 60 |
|
| 61 |
def __repr__(self) -> str:
|
| 62 |
return f"Model: YOLO ({type(self.model).__name__})"
|