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/pipeline_python/postprocessors/yamnet.py from camstack/camstack-trainer: direct link, hf CLI and curl.
- Browser
- Download file 1.22 kB
-
https://huggingface.co/camstack/camstack-trainer/resolve/main/camstack_train/_vendor/pipeline_python/postprocessors/yamnet.py
- Command line
-
hf download hf://camstack/camstack-trainer/camstack_train/_vendor/pipeline_python/postprocessors/yamnet.py
-
curl -L -o yamnet.py https://huggingface.co/camstack/camstack-trainer/resolve/main/camstack_train/_vendor/pipeline_python/postprocessors/yamnet.py
1.22 kB
| """YAMNet audio classification postprocessor. | |
| Input: [numFrames, 521] score matrix | |
| Output: {"kind": "classifications", "classifications": [{"class", "score"}]} | |
| """ | |
| import numpy as np | |
| def postprocess_yamnet( | |
| predictions: dict, | |
| config: dict, | |
| orig_w: int, | |
| orig_h: int, | |
| scale: float, | |
| pad: tuple[int, int], | |
| ) -> dict: | |
| """Average scores across frames, return top classes above threshold.""" | |
| labels = config.get("labels", []) | |
| min_score = config.get("confidence", 0.1) | |
| # Get output_0 (scores) — shape [numFrames, 521] | |
| raw = np.array(list(predictions.values())[0]).astype(np.float32) | |
| if raw.ndim == 1: | |
| raw = raw.reshape(1, -1) | |
| num_frames, num_classes = raw.shape | |
| # Average across frames | |
| avg_scores = np.mean(raw, axis=0) | |
| # Collect classes above threshold, sorted by score | |
| results = [] | |
| for c in range(num_classes): | |
| score = float(avg_scores[c]) | |
| if score >= min_score: | |
| label = labels[c] if c < len(labels) else str(c) | |
| results.append({"class": label, "score": round(score, 4)}) | |
| results.sort(key=lambda x: x["score"], reverse=True) | |
| return {"kind": "classifications", "classifications": results} | |