scorevision: push artifact
Browse filesFiles changed (6)
- README.md+20-25
- __pycache__/miner.cpython-312.pyc
- class_names.txt-79
- miner.py+78-82
- model_type.json+1-1
- weights.onnx+2-2
123456789101112132 unmodified lines1617181920212223242526272829303132333435363738394041424344454647---tags:- element_type:detect- model:yolov11-small- object:vehiclemanako:description: >YOLO11s vehicle detector fine-tuned on COCO vehicles + BDD100K + VisDrone.FP16 ONNX, 1280x1280 input. Trained R6: 59,870 images, 50 epochs.source: meaculpitt/Detect-Vehicleprompt_hints: nullinput_payload:- name: frame2 unmodified linesoutput_payload:- name: detectionstype: detectionsdescription: Bounding boxes for detected vehiclesevaluation_score: 0.7701last_benchmark:type: visdrone_valran_at: 2026-03-25T17:34:00+00:00result_path: null---# Detect-Vehicle β SN44YOLO11s fine-tuned for vehicle detection (car, bus, truck, motorcycle).| Metric | Value ||--------|-------|| mAP@50 | 77.01% || Model | YOLO11s (FP16 ONNX) || Input size | 1280x1280 || Model size | 19.2 MB || Training data | COCO vehicles + BDD100K + VisDrone (59,870 images) || Baseline to beat | 40.72% |## Classes| Output ID | Class ||-----------|-------|| 0 | car || 1 | bus || 2 | truck || 3 | motorcycle |12345678910111213142 unmodified lines1718192021222324252627282930313233343536373839404142---tags:- element_type:detect- model:yolov11-nano- object:personmanako:description: >YOLOv11-nano fine-tuned for ground-level CCTV person detection on SN44.Trained on CrowdHuman (15k, dense crowds) + BDD100K street pedestrians.Conf threshold raised to 0.35 to minimise false positives.source: meaculpitt/Detect-Personprompt_hints: nullinput_payload:- name: frame2 unmodified linesoutput_payload:- name: detectionstype: detectionsdescription: Bounding boxes for detected personsevaluation_score: 0.5563last_benchmark:type: coco_val2017ran_at: '2026-03-25T02:58:57+00:00'result_path: null---# Detect-Person β SN44YOLOv11-nano fine-tuned for ground-level CCTV person detection.| Metric | Value ||--------|-------|| mAP@50 (COCO val2017) | 55.63% || Precision (conf=0.35) | 56.86% || Recall | 50.67% || Baseline to beat | 37.55% || Model size | 5.6 MB || Input size | 1280Γ1280 |**Training data**: CrowdHuman (15k) + BDD100K (3.2k pedestrians)**Validation**: COCO val2017 persons (2,693 images)
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980personbicyclecarmotorcycleairplanebustraintruckboattraffic lightfire hydrantstop signparking meterbenchbirdcatdoghorsesheepcowelephantbearzebragiraffebackpackumbrellahandbagtiesuitcasefrisbeeskissnowboardsports ballkitebaseball batbaseball gloveskateboardsurfboardtennis racketbottlewine glasscupforkknifespoonbowlbananaapplesandwichorangebroccolicarrothot dogpizzadonutcakechaircouchpotted plantbeddining tabletoilettvlaptopmouseremotekeyboardcell phonemicrowaveoventoastersinkrefrigeratorbookclockvasescissorsteddy bearhair driertoothbrush1person
1234567891011126 unmodified lines19202122232425262728293031323317 unmodified lines515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271285 unmodified lines13413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718834 unmodified lines223224225226227228229230231"""Score Vision SN44 β VehicleDetect miner. v3 (2026-03-26).TTA (3 augmentations) + WBF fusion. Letterbox preprocessing.Model: YOLO11s ONNX, 4 classes trained as:0 = car, 1 = bus, 2 = truck, 3 = motorcycleOfficial submission order (remapped in MODEL_TO_OUT):0 = bus, 1 = car, 2 = truck, 3 = motorcycle"""from pathlib import Path6 unmodified linesfrom pydantic import BaseModelfrom ensemble_boxes import weighted_boxes_fusion# ββ Model class index β submission class index βββββββββββββββββββββββββββββββMODEL_TO_OUT: dict[int, int] = {0: 1, 1: 0, 2: 2, 3: 3}OUT_TO_MODEL: dict[int, int] = {v: k for k, v in MODEL_TO_OUT.items()}OUT_NAMES = ["bus", "car", "truck", "motorcycle"]IMG_SIZE = 1280CONF_THRESH = 0.55IOU_THRESH = 0.45WBF_IOU_THR = 0.55WBF_SKIP_THR = 0.0001TTA_SCALE = 1.217 unmodified linesclass Miner:def __init__(self, path_hf_repo: Path) -> None:self.path_hf_repo = path_hf_repoself.session = ort.InferenceSession(str(path_hf_repo / "weights.onnx"),providers=["CUDAExecutionProvider", "CPUExecutionProvider"],)self.input_name = self.session.get_inputs()[0].nameself.conf_threshold = CONF_THRESHself.iou_threshold = IOU_THRESHdef __repr__(self) -> str:return f"VehicleDetect Miner TTA+WBF session={type(self.session).__name__}"def _letterbox(self, img: ndarray) -> tuple[np.ndarray, float, int, int]:h, w = img.shape[:2]r = min(IMG_SIZE / h, IMG_SIZE / w)new_w, new_h = int(round(w * r)), int(round(h * r))img_r = cv2.resize(img, (new_w, new_h), interpolation=cv2.INTER_LINEAR)dw, dh = IMG_SIZE - new_w, IMG_SIZE - new_hpad_l, pad_t = dw // 2, dh // 2img_p = cv2.copyMakeBorder(img_r, pad_t, dh - pad_t, pad_l, dw - pad_l,cv2.BORDER_CONSTANT, value=(114, 114, 114),)return img_p, r, pad_l, pad_tdef _preprocess(self, image_bgr: ndarray) -> tuple[np.ndarray, float, int, int]:img_p, ratio, pad_l, pad_t = self._letterbox(image_bgr)img_rgb = cv2.cvtColor(img_p, cv2.COLOR_BGR2RGB)inp = img_rgb.astype(np.float32) / 255.0inp = np.ascontiguousarray(inp.transpose(2, 0, 1)[np.newaxis])return inp, ratio, pad_l, pad_tdef _decode_raw(self, raw: np.ndarray, ratio: float, pad_l: int, pad_t: int,orig_w: int, orig_h: int) -> tuple[np.ndarray, np.ndarray, np.ndarray]:"""Decode ONNX output to (boxes_xyxy, confs, cls_ids) in original image coords."""pred = raw[0]if pred.shape[0] < pred.shape[1]:pred = pred.Tbboxes_cx = pred[:, :4]cls_scores = pred[:, 4:]cls_ids = np.argmax(cls_scores, axis=1)confs = np.max(cls_scores, axis=1)mask = confs >= self.conf_thresholdif not mask.any():return np.empty((0, 4)), np.empty(0), np.empty(0, dtype=int)bboxes_cx = bboxes_cx[mask]confs = confs[mask]cls_ids = cls_ids[mask]cx, cy, bw, bh = bboxes_cx[:, 0], bboxes_cx[:, 1], bboxes_cx[:, 2], bboxes_cx[:, 3]lx1 = cx - bw / 2ly1 = cy - bh / 2lx2 = cx + bw / 2ly2 = cy + bh / 2x1 = np.clip((lx1 - pad_l) / ratio, 0, orig_w)y1 = np.clip((ly1 - pad_t) / ratio, 0, orig_h)x2 = np.clip((lx2 - pad_l) / ratio, 0, orig_w)y2 = np.clip((ly2 - pad_t) / ratio, 0, orig_h)boxes = np.stack([x1, y1, x2, y2], axis=1)return boxes, confs, cls_idsdef _run_single_pass(self, image_bgr: ndarray) -> tuple[np.ndarray, np.ndarray, np.ndarray]:"""Run one inference pass, return (boxes_xyxy, confs, cls_ids) in original coords."""orig_h, orig_w = image_bgr.shape[:2]inp, ratio, pad_l, pad_t = self._preprocess(image_bgr)raw = self.session.run(None, {self.input_name: inp})[0]return self._decode_raw(raw, ratio, pad_l, pad_t, orig_w, orig_h)def _infer_single(self, image_bgr: ndarray) -> list[BoundingBox]:orig_h, orig_w = image_bgr.shape[:2]5 unmodified lines# ββ TTA pass 1: original ββboxes, confs, cls_ids = self._run_single_pass(image_bgr)if len(boxes):# Remap to output class IDs for WBFout_cls = np.array([MODEL_TO_OUT[int(c)] for c in cls_ids])# Normalize to [0,1]norm_boxes = boxes.copy()norm_boxes[:, [0, 2]] /= orig_wnorm_boxes[:, [1, 3]] /= orig_hnorm_boxes = np.clip(norm_boxes, 0, 1)all_boxes_list.append(norm_boxes)all_scores_list.append(confs)all_labels_list.append(out_cls)# ββ TTA pass 2: horizontal flip ββflipped = cv2.flip(image_bgr, 1)boxes_f, confs_f, cls_ids_f = self._run_single_pass(flipped)if len(boxes_f):# Flip x coords backboxes_f[:, 0], boxes_f[:, 2] = orig_w - boxes_f[:, 2], orig_w - boxes_f[:, 0]out_cls_f = np.array([MODEL_TO_OUT[int(c)] for c in cls_ids_f])norm_boxes_f = boxes_f.copy()norm_boxes_f[:, [0, 2]] /= orig_wnorm_boxes_f[:, [1, 3]] /= orig_hnorm_boxes_f = np.clip(norm_boxes_f, 0, 1)all_boxes_list.append(norm_boxes_f)all_scores_list.append(confs_f)all_labels_list.append(out_cls_f)# ββ TTA pass 3: scale 1.2x (center crop to original size) ββscaled_h, scaled_w = int(orig_h * TTA_SCALE), int(orig_w * TTA_SCALE)scaled = cv2.resize(image_bgr, (scaled_w, scaled_h), interpolation=cv2.INTER_LINEAR)# Center crop back to original sizey_off = (scaled_h - orig_h) // 2x_off = (scaled_w - orig_w) // 2cropped = scaled[y_off:y_off + orig_h, x_off:x_off + orig_w]boxes_s, confs_s, cls_ids_s = self._run_single_pass(cropped)if len(boxes_s):# Map cropped coords back to original: offset + scaleboxes_s[:, 0] = (boxes_s[:, 0] + x_off) / TTA_SCALEboxes_s[:, 1] = (boxes_s[:, 1] + y_off) / TTA_SCALEboxes_s[:, 2] = (boxes_s[:, 2] + x_off) / TTA_SCALEboxes_s[:, 3] = (boxes_s[:, 3] + y_off) / TTA_SCALEboxes_s = np.clip(boxes_s, 0, [[orig_w, orig_h, orig_w, orig_h]])out_cls_s = np.array([MODEL_TO_OUT[int(c)] for c in cls_ids_s])norm_boxes_s = boxes_s.copy()norm_boxes_s[:, [0, 2]] /= orig_wnorm_boxes_s[:, [1, 3]] /= orig_hnorm_boxes_s = np.clip(norm_boxes_s, 0, 1)all_boxes_list.append(norm_boxes_s)all_scores_list.append(confs_s)all_labels_list.append(out_cls_s)if not all_boxes_list:return []34 unmodified linesfor idx, image in enumerate(batch_images):boxes = self._infer_single(image)keypoints = [(0, 0) for _ in range(max(0, int(n_keypoints)))]results.append(TVFrameResult(frame_id=offset + idx,boxes=boxes,keypoints=keypoints,))return results12345676 unmodified lines14151617181917 unmodified lines3738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291305 unmodified lines13613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118234 unmodified lines217218219220221222223224225226227"""Score Vision SN44 β DetectPerson miner. v2 (2026-03-26).TTA (3 augmentations) + WBF fusion. Stretch resize preprocessing.Single class: person (cls_id=0)."""from pathlib import Path6 unmodified linesfrom pydantic import BaseModelfrom ensemble_boxes import weighted_boxes_fusionWBF_IOU_THR = 0.55WBF_SKIP_THR = 0.0001TTA_SCALE = 1.217 unmodified linesclass Miner:def __init__(self, path_hf_repo: Path) -> None:self.path_hf_repo = path_hf_repoself.class_names = ['person']self.session = ort.InferenceSession(str(path_hf_repo / "weights.onnx"),providers=["CUDAExecutionProvider", "CPUExecutionProvider"],)self.input_name = self.session.get_inputs()[0].nameinput_shape = self.session.get_inputs()[0].shapeself.input_h = int(input_shape[2])self.input_w = int(input_shape[3])self.conf_threshold = 0.50self.iou_threshold = 0.45def __repr__(self) -> str:return f"DetectPerson Miner TTA+WBF session={type(self.session).__name__}"def _preprocess(self, image_bgr: ndarray) -> tuple[np.ndarray, tuple[int, int]]:h, w = image_bgr.shape[:2]rgb = cv2.cvtColor(image_bgr, cv2.COLOR_BGR2RGB)resized = cv2.resize(rgb, (self.input_w, self.input_h))x = resized.astype(np.float32) / 255.0x = np.transpose(x, (2, 0, 1))[None, ...]return x, (h, w)def _decode_raw(self, raw: np.ndarray, orig_h: int, orig_w: int) -> tuple[np.ndarray, np.ndarray, np.ndarray]:"""Decode ONNX output to (boxes_xyxy, confs, cls_ids) in original image coords."""pred = raw[0]if pred.ndim != 2:return np.empty((0, 4)), np.empty(0), np.empty(0, dtype=int)if pred.shape[0] < pred.shape[1]:pred = pred.transpose(1, 0)if pred.shape[1] < 5:return np.empty((0, 4)), np.empty(0), np.empty(0, dtype=int)boxes = pred[:, :4]cls_scores = pred[:, 4:]if cls_scores.shape[1] == 0:return np.empty((0, 4)), np.empty(0), np.empty(0, dtype=int)cls_ids = np.argmax(cls_scores, axis=1)confs = np.max(cls_scores, axis=1)keep = confs >= self.conf_thresholdboxes = boxes[keep]confs = confs[keep]cls_ids = cls_ids[keep]if boxes.shape[0] == 0:return np.empty((0, 4)), np.empty(0), np.empty(0, dtype=int)sx = orig_w / float(self.input_w)sy = orig_h / float(self.input_h)cx, cy, bw, bh = boxes[:, 0], boxes[:, 1], boxes[:, 2], boxes[:, 3]x1 = np.clip((cx - bw / 2) * sx, 0, orig_w)y1 = np.clip((cy - bh / 2) * sy, 0, orig_h)x2 = np.clip((cx + bw / 2) * sx, 0, orig_w)y2 = np.clip((cy + bh / 2) * sy, 0, orig_h)out_boxes = np.stack([x1, y1, x2, y2], axis=1)return out_boxes, confs, cls_idsdef _run_single_pass(self, image_bgr: ndarray) -> tuple[np.ndarray, np.ndarray, np.ndarray]:orig_h, orig_w = image_bgr.shape[:2]inp, _ = self._preprocess(image_bgr)raw = self.session.run(None, {self.input_name: inp})[0]return self._decode_raw(raw, orig_h, orig_w)def _nms_dets(self, boxes: np.ndarray, confs: np.ndarray) -> tuple[np.ndarray, np.ndarray]:"""Simple NMS on boxes+confs."""if len(boxes) == 0:return boxes, confsx1, y1, x2, y2 = boxes[:, 0], boxes[:, 1], boxes[:, 2], boxes[:, 3]areas = (x2 - x1) * (y2 - y1)order = confs.argsort()[::-1]keep = []while len(order):i = order[0]keep.append(int(i))xx1 = np.maximum(x1[i], x1[order[1:]])yy1 = np.maximum(y1[i], y1[order[1:]])xx2 = np.minimum(x2[i], x2[order[1:]])yy2 = np.minimum(y2[i], y2[order[1:]])inter = np.maximum(0, xx2 - xx1) * np.maximum(0, yy2 - yy1)iou = inter / (areas[i] + areas[order[1:]] - inter + 1e-7)order = order[1:][iou <= self.iou_threshold]return boxes[keep], confs[keep]def _infer_single(self, image_bgr: ndarray) -> list[BoundingBox]:orig_h, orig_w = image_bgr.shape[:2]5 unmodified lines# ββ TTA pass 1: original ββboxes, confs, cls_ids = self._run_single_pass(image_bgr)if len(boxes):norm_boxes = boxes.copy()norm_boxes[:, [0, 2]] /= orig_wnorm_boxes[:, [1, 3]] /= orig_hnorm_boxes = np.clip(norm_boxes, 0, 1)all_boxes_list.append(norm_boxes)all_scores_list.append(confs)all_labels_list.append(cls_ids.astype(float))# ββ TTA pass 2: horizontal flip ββflipped = cv2.flip(image_bgr, 1)boxes_f, confs_f, cls_ids_f = self._run_single_pass(flipped)if len(boxes_f):boxes_f[:, 0], boxes_f[:, 2] = orig_w - boxes_f[:, 2], orig_w - boxes_f[:, 0]norm_boxes_f = boxes_f.copy()norm_boxes_f[:, [0, 2]] /= orig_wnorm_boxes_f[:, [1, 3]] /= orig_hnorm_boxes_f = np.clip(norm_boxes_f, 0, 1)all_boxes_list.append(norm_boxes_f)all_scores_list.append(confs_f)all_labels_list.append(cls_ids_f.astype(float))# ββ TTA pass 3: scale 1.2x center crop ββscaled_h, scaled_w = int(orig_h * TTA_SCALE), int(orig_w * TTA_SCALE)scaled = cv2.resize(image_bgr, (scaled_w, scaled_h), interpolation=cv2.INTER_LINEAR)y_off = (scaled_h - orig_h) // 2x_off = (scaled_w - orig_w) // 2cropped = scaled[y_off:y_off + orig_h, x_off:x_off + orig_w]boxes_s, confs_s, cls_ids_s = self._run_single_pass(cropped)if len(boxes_s):boxes_s[:, 0] = (boxes_s[:, 0] + x_off) / TTA_SCALEboxes_s[:, 1] = (boxes_s[:, 1] + y_off) / TTA_SCALEboxes_s[:, 2] = (boxes_s[:, 2] + x_off) / TTA_SCALEboxes_s[:, 3] = (boxes_s[:, 3] + y_off) / TTA_SCALEboxes_s = np.clip(boxes_s, 0, [[orig_w, orig_h, orig_w, orig_h]])norm_boxes_s = boxes_s.copy()norm_boxes_s[:, [0, 2]] /= orig_wnorm_boxes_s[:, [1, 3]] /= orig_hnorm_boxes_s = np.clip(norm_boxes_s, 0, 1)all_boxes_list.append(norm_boxes_s)all_scores_list.append(confs_s)all_labels_list.append(cls_ids_s.astype(float))if not all_boxes_list:return []34 unmodified linesfor idx, image in enumerate(batch_images):boxes = self._infer_single(image)keypoints = [(0, 0) for _ in range(max(0, int(n_keypoints)))]results.append(TVFrameResult(frame_id=offset + idx,boxes=boxes,keypoints=keypoints,))return results
1{"task_type": "object-detection", "model_type": "yolov11-small", "deploy": "2026-03-26T07:43Z"}1{"task_type": "object-detection", "model_type": "yolov11-nano", "deploy": "2026-03-26T07:46Z"}
123version https://git-lfs.github.com/spec/v1oid sha256:e3916408ec21f8c94358c18914f922814770b78557e52fe17ff7a9ee74339a5asize 19272252123version https://git-lfs.github.com/spec/v1oid sha256:f32ed65b9024a69693f675d494c7fc813a964766c54b241464a463377342da60size 5607862
README.md+20-25
__pycache__/miner.cpython-312.pyc
class_names.txt-79
miner.py+78-82
model_type.json+1-1
weights.onnx+2-2