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/clip.py from camstack/camstack-trainer: direct link, hf CLI and curl.
- Browser
- Download file 1.07 kB
-
https://huggingface.co/camstack/camstack-trainer/resolve/main/camstack_train/_vendor/pipeline_python/postprocessors/clip.py
- Command line
-
hf download hf://camstack/camstack-trainer/camstack_train/_vendor/pipeline_python/postprocessors/clip.py
-
curl -L -o clip.py https://huggingface.co/camstack/camstack-trainer/resolve/main/camstack_train/_vendor/pipeline_python/postprocessors/clip.py
1.07 kB
| """CLIP image embedding postprocessor. | |
| Input: raw embedding tensor from a CLIP vision encoder (e.g. MobileCLIP S0/S1/S2) | |
| Output: {"kind": "embedding", "embedding": [...], "embeddingNorm": [...]} | |
| MobileCLIP uses resize 256×256 + rescale /255 only (no ImageNet mean/std). | |
| The existing inference_pool resize_image path already produces this layout — | |
| preprocessMode:'resize' + inputNormalization:'none' is the correct config. | |
| """ | |
| import numpy as np | |
| def postprocess_clip( | |
| predictions: dict, | |
| config: dict, | |
| orig_w: int, | |
| orig_h: int, | |
| scale: float, | |
| pad: tuple[int, int], | |
| ) -> dict: | |
| """L2-normalize the CLIP embedding vector.""" | |
| # Get the first output tensor (vision encoder emits a single embedding) | |
| raw = np.array(list(predictions.values())[0]).flatten().astype(np.float32) | |
| norm = np.linalg.norm(raw) | |
| if norm == 0: | |
| normalized = np.zeros_like(raw) | |
| else: | |
| normalized = raw / norm | |
| return { | |
| "kind": "embedding", | |
| "embedding": raw.tolist(), | |
| "embeddingNorm": normalized.tolist(), | |
| } | |