Instructions to use openEuler/sam2.1_hiera_tiny_prompt_ascend with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sam2
How to use openEuler/sam2.1_hiera_tiny_prompt_ascend with sam2:
# Use SAM2 with images import torch from sam2.sam2_image_predictor import SAM2ImagePredictor predictor = SAM2ImagePredictor.from_pretrained(openEuler/sam2.1_hiera_tiny_prompt_ascend) 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(openEuler/sam2.1_hiera_tiny_prompt_ascend) 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 β box-prompt segmentation (Ascend 310P)
Compiled box-prompt SAM 2.1 Hiera Tiny deployment for IB-Robot's
SegmentDetections perception service (/perception/*/segment_detections).
Deployments
| deployment | backend | artifacts | notes |
|---|---|---|---|
ascend_310p |
Ascend ACL (Ascend310P1) | encoder OM + decoder OM (batch=4 box prompts) | board-side box-prompt masks |
Files
inference_manifest.jsonβ deployment routing (schema v3)artifacts/ascend_310p/sam2_encoder.omβ vision encoder (longest-side 1024)artifacts/ascend_310p/sam2_decoder_bs4.omβ mask decoder, 4 box prompts per batchassets/sam2.1_hiera_tiny.ptβ original PyTorch checkpoint the OMs were converted from (same weights as openEuler/sam2.1_hiera_tiny)assets/adapter.jsonβ adapter identity (sam2-mask-logits-iou-v1)
Usage
Select deployment ascend_310p through the unified inference runtime
(ibrobot_msgs/srv/SegmentDetections, adapter
perception_service.model_service_plugins:SegmentDetectionsPlugin).
For host-side Torch execution (automatic-mask mode), use
openEuler/sam2.1_hiera_tiny
instead, which ships torch_cpu/torch_cuda deployments.
Selective download:
./scripts/download_models.py --models sam2.1_hiera_tiny_prompt_ascend --target 310p
- Downloads last month
- 13