Instructions to use uyiosa/sam2.1-hiera-large-onnx-jetson-orin with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sam2
How to use uyiosa/sam2.1-hiera-large-onnx-jetson-orin with sam2:
# Use SAM2 with images import torch from sam2.sam2_image_predictor import SAM2ImagePredictor predictor = SAM2ImagePredictor.from_pretrained(uyiosa/sam2.1-hiera-large-onnx-jetson-orin) 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(uyiosa/sam2.1-hiera-large-onnx-jetson-orin) 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
# Use SAM2 with videos
import torch
from sam2.sam2_video_predictor import SAM2VideoPredictor
predictor = SAM2VideoPredictor.from_pretrained(uyiosa/sam2.1-hiera-large-onnx-jetson-orin)
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):
...SAM 2.1 Hiera-Large β ONNX (encoder + decoder)
Meta Segment Anything Model 2.1 (Hiera-Large, ~224 M params) exported as two ONNX subgraphs: image encoder (1024x1024 RGB β multi-scale embeddings) and prompt+mask decoder (re-queriable per click/box). Verified end-to-end on Jetson Orin Nano FP16 TRT: encoder 371 ms/run, decoder 8.2 ms/run.
This is a private mirror prepared for the robot_perception_scoring project (github.com/JSBAICenter/Nvidia_Edge_work_arounds, branch orin_yolo). It bundles the original source weights together with an ONNX export and a TensorRT FP16 engine built on a Jetson Orin Nano (8 GB).
Files in this repo
| Role | Filename | Size | SHA-256 |
|---|---|---|---|
encoder_onnx |
sam2.1_hiera_large_encoder.onnx |
812.9 MB | 0062225519ac4a9b⦠|
decoder_onnx |
sam2.1_hiera_large_decoder.onnx |
27.8 MB | 5c2fb75ebe9b3073β¦ |
How to load
- encoder_onnx:
onnxruntime.InferenceSessionβ inputimage (1,3,1024,1024) f32, outputsimage_embed,high_res_feats_0/1 - decoder_onnx:
onnxruntime.InferenceSessionβ feed encoder outputs +point_coords (1,N,2) f32(1024-space px) +point_labels (1,N) int32+ zeroedmask_input/has_mask_input
The .engine artifact is hardware-specific to Jetson Orin Nano (Ampere sm_87, TensorRT 10.3, CUDA 12.6, FP16). It will not load on other Jetson families, other TensorRT versions, or x86 GPUs. Other users should rebuild from the .onnx via python -m tools.build_engines in the linked GitHub repo.
Build environment
- JetPack tegra release: # R36 (release), REVISION: 4.7, GCID: 42132812, BOARD: generic, EABI: aarch64, DATE: Thu Sep 18 22:54:44 UTC 2025
- CUDA: Cuda compilation tools, release 12.6, V12.6.68
- TensorRT: 10.3.0
Attribution
Original weights: sam2.1_hiera_large.pt from https://dl.fbaipublicfiles.com/segment_anything_2/092824/ (facebookresearch/sam2). Exported via the wrappers in image/sam2/export_sam2.py (opset 17, torch.onnx.export).
License
Apache 2.0, per facebookresearch/sam2. No additional restrictions imposed by this mirror.
- Downloads last month
- -
# Use SAM2 with images import torch from sam2.sam2_image_predictor import SAM2ImagePredictor predictor = SAM2ImagePredictor.from_pretrained(uyiosa/sam2.1-hiera-large-onnx-jetson-orin) with torch.inference_mode(), torch.autocast("cuda", dtype=torch.bfloat16): predictor.set_image(<your_image>) masks, _, _ = predictor.predict(<input_prompts>)