Image Segmentation
sam2
Safetensors
PyTorch
hiera
vision
hierarchical
encoder
meta
huggingface-compatible
Instructions to use nkkbr/hiera-base-plus-in-sam2.1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sam2
How to use nkkbr/hiera-base-plus-in-sam2.1 with sam2:
# Use SAM2 with images import torch from sam2.sam2_image_predictor import SAM2ImagePredictor predictor = SAM2ImagePredictor.from_pretrained(nkkbr/hiera-base-plus-in-sam2.1) 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(nkkbr/hiera-base-plus-in-sam2.1) 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
Initial upload
Browse files- config.json +41 -0
- model.safetensors +3 -0
config.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"HieraVisionModel"
|
| 4 |
+
],
|
| 5 |
+
"dim_mul": 2.0,
|
| 6 |
+
"drop_path_rate": 0.0,
|
| 7 |
+
"embed_dim": 112,
|
| 8 |
+
"global_att_blocks": [
|
| 9 |
+
12,
|
| 10 |
+
16,
|
| 11 |
+
20
|
| 12 |
+
],
|
| 13 |
+
"head_mul": 2.0,
|
| 14 |
+
"model_type": "hiera",
|
| 15 |
+
"num_heads": 2,
|
| 16 |
+
"q_pool": 3,
|
| 17 |
+
"q_stride": [
|
| 18 |
+
2,
|
| 19 |
+
2
|
| 20 |
+
],
|
| 21 |
+
"return_interm_layers": true,
|
| 22 |
+
"stages": [
|
| 23 |
+
2,
|
| 24 |
+
3,
|
| 25 |
+
16,
|
| 26 |
+
3
|
| 27 |
+
],
|
| 28 |
+
"torch_dtype": "float32",
|
| 29 |
+
"transformers_version": "4.40.0",
|
| 30 |
+
"weights_path": null,
|
| 31 |
+
"window_pos_embed_bkg_spatial_size": [
|
| 32 |
+
14,
|
| 33 |
+
14
|
| 34 |
+
],
|
| 35 |
+
"window_spec": [
|
| 36 |
+
8,
|
| 37 |
+
4,
|
| 38 |
+
14,
|
| 39 |
+
7
|
| 40 |
+
]
|
| 41 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:54a7c8e10b3bd31cb0804cafebb60d0ace9d2bb9689b83d431f0eb132a4afb04
|
| 3 |
+
size 274732744
|