Instructions to use camstack/camstack-trainer with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- ultralytics
How to use camstack/camstack-trainer with ultralytics:
from huggingface_hub import hf_hub_download from ultralytics import YOLO # pick the weights file from this repo's "Files and versions" tab weights = hf_hub_download("camstack/camstack-trainer", "<weights>.pt") model = YOLO(weights) source = 'http://images.cocodataset.org/val2017/000000039769.jpg' model.predict(source=source, save=True) - Notebooks
- Google Colab
- Kaggle
camstack-train 0.1.0: YOLOv9 root detector fine-tune (job.json in, result.json + bundle.tar out)
ebeed67 verified Download camstack_train/_vendor/camstack_eval/classes.py from camstack/camstack-trainer: direct link, hf CLI and curl.
- Browser
- Download file 1.5 kB
-
https://huggingface.co/camstack/camstack-trainer/resolve/main/camstack_train/_vendor/camstack_eval/classes.py
- Command line
-
hf download hf://camstack/camstack-trainer/camstack_train/_vendor/camstack_eval/classes.py
-
curl -L -o classes.py https://huggingface.co/camstack/camstack-trainer/resolve/main/camstack_train/_vendor/camstack_eval/classes.py
1.5 kB
| """COCO → CamStack macro classes, as the pipeline maps them | |
| (`packages/types/src/catalogs/coco-classmap.ts` `COCO_TO_MACRO`). The floors | |
| and the comparison are per macro class, because that is what the pipeline | |
| gates on. `package` (COCO luggage proxies) is mapped but not evaluated by | |
| default: it was too rare to calibrate (D739 keeps it at 0.50).""" | |
| from __future__ import annotations | |
| from typing import Optional | |
| from .metrics import Detection | |
| COCO_TO_MACRO: dict[str, str] = { | |
| "person": "person", | |
| **{k: "vehicle" for k in ("bicycle", "car", "motorcycle", "airplane", "bus", "train", "truck", "boat")}, | |
| **{ | |
| k: "animal" | |
| for k in ("bird", "cat", "dog", "horse", "sheep", "cow", "elephant", "bear", "zebra", "giraffe") | |
| }, | |
| **{k: "package" for k in ("suitcase", "backpack", "handbag")}, | |
| } | |
| #: Macro classes a root detector is evaluated on. | |
| DETECTOR_CLASSES: tuple[str, ...] = ("person", "vehicle", "animal") | |
| def macro_of(label: str) -> Optional[str]: | |
| """A label's macro class; a label that already IS a macro maps to itself.""" | |
| if label in DETECTOR_CLASSES or label == "package": | |
| return label | |
| return COCO_TO_MACRO.get(label) | |
| def to_macro(detections: list[Detection]) -> list[Detection]: | |
| """Map detections to macro classes; a class the pipeline drops is dropped.""" | |
| out = [] | |
| for d in detections: | |
| macro = macro_of(d.cls) | |
| if macro is not None: | |
| out.append(Detection(macro, d.score, d.bbox)) | |
| return out | |