Instructions to use strangelab/sam2.1-hiera-tiny-cvat-image-only with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use strangelab/sam2.1-hiera-tiny-cvat-image-only with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("mask-generation", model="strangelab/sam2.1-hiera-tiny-cvat-image-only")# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMaskGeneration processor = AutoProcessor.from_pretrained("strangelab/sam2.1-hiera-tiny-cvat-image-only") model = AutoModelForMaskGeneration.from_pretrained("strangelab/sam2.1-hiera-tiny-cvat-image-only", device_map="auto") - sam2
How to use strangelab/sam2.1-hiera-tiny-cvat-image-only with sam2:
# Use SAM2 with images import torch from sam2.sam2_image_predictor import SAM2ImagePredictor predictor = SAM2ImagePredictor.from_pretrained("strangelab/sam2.1-hiera-tiny-cvat-image-only") with torch.inference_mode(), torch.autocast("cuda", dtype=torch.bfloat16): predictor.set_image(<your_image>) masks, _, _ = predictor.predict(<input_prompts>)# Use SAM2 with videos import torch from sam2.sam2_video_predictor import SAM2VideoPredictor predictor = SAM2VideoPredictor.from_pretrained("strangelab/sam2.1-hiera-tiny-cvat-image-only") with torch.inference_mode(), torch.autocast("cuda", dtype=torch.bfloat16): state = predictor.init_state(<your_video>) # add new prompts and instantly get the output on the same frame frame_idx, object_ids, masks = predictor.add_new_points(state, <your_prompts>) # propagate the prompts to get masklets throughout the video for frame_idx, object_ids, masks in predictor.propagate_in_video(state): ... - Notebooks
- Google Colab
- Kaggle
SAM 2.1 Hiera Tiny for CVAT still images
This checkpoint retains the FP32 weights used by CVAT's still-image SAM 2.1 Tiny interactor. It removes the upstream video memory modules. The weight download drops from 155.9 MB to 125.8 MB, a 19.3% reduction.
The pinned CVAT CPU interactor returned pixel-identical binary masks for all 197 saved click steps across 48 COCO validation photos. This test used fixed click sequences and tested still-image masks.
Use in CVAT
Follow the CVAT SAM2 interactor setup. In both the registration and the agent startup commands, use:
-p model_id=str:strangelab/sam2.1-hiera-tiny-cvat-image-only -p device=str:cpu
In CVAT annotation jobs, use positive and negative points to refine the mask. Use the upstream checkpoint for the SAM2 video tracker. This release uses Transformers Sam2Model and Sam2Processor.
The original weights are from Meta's SAM 2.1 Hiera Tiny. No weights were fine-tuned. The original and this derivative use Apache-2.0.
- Downloads last month
- 24
Model tree for strangelab/sam2.1-hiera-tiny-cvat-image-only
Base model
facebook/sam2.1-hiera-tiny