Image Segmentation
kornia
segment-anything
sam / README.md
ducha-aiki's picture
Card: list sam_vit_h_4b8939.safetensors with provenance
b6e8348 verified
|
Raw History Blame Contribute Delete
2.91 kB
---
license: apache-2.0
tags:
- kornia
- image-segmentation
- segment-anything
---
# kornia/sam
Pretrained weights for **Segment Anything (SAM)**, used by `kornia.models.sam.Sam`.
SAM predicts object masks from point, box or mask prompts. It pairs a ViT image encoder with a lightweight prompt
encoder and mask decoder.
**Original repo:** [facebookresearch/segment-anything](https://github.com/facebookresearch/segment-anything)
## Weights
| File | Image encoder |
|------|---------------|
| `sam_vit_b_01ec64.safetensors` | ViT-B |
| `sam_vit_l_0b3195.safetensors` | ViT-L |
| `sam_vit_h_4b8939.safetensors` | ViT-H |
## Provenance
Each file holds the tensors of the upstream checkpoint with the same stem, unchanged: the same keys, dtypes, shapes
and bits. The kornia maintainers converted them (converter revision `0c3db846b2`). They checked that a model loaded
from either file has a bitwise-identical `state_dict()` and gives bitwise-identical image-encoder outputs.
| File | Upstream source | Source sha256 | sha256 |
|------|-----------------|---------------|--------|
| `sam_vit_b_01ec64.safetensors` | [`sam_vit_b_01ec64.pth`](https://dl.fbaipublicfiles.com/segment_anything/sam_vit_b_01ec64.pth) | `ec2df62732614e57411cdcf32a23ffdf28910380d03139ee0f4fcbe91eb8c912` | `fbf4c1ad844a2e9b867d89dc04a61f3ece19c57ebb7d8fcb6da92062a291d839` |
| `sam_vit_l_0b3195.safetensors` | [`sam_vit_l_0b3195.pth`](https://dl.fbaipublicfiles.com/segment_anything/sam_vit_l_0b3195.pth) | `3adcc4315b642a4d2101128f611684e8734c41232a17c648ed1693702a49a622` | `8e087bc0db5cfac2676ae69bb1b846fa1f6cc193fc0beb6be8fb14fc7406be41` |
| `sam_vit_h_4b8939.safetensors` | [`sam_vit_h_4b8939.pth`](https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth) | `a7bf3b02f3ebf1267aba913ff637d9a2d5c33d3173bb679e46d9f338c26f262e` | `1424ffbab6fa8218aeae5abb931549dcd2d68725220ed14a5d1b579aa503c3e7` |
The upstream ViT-B and ViT-L checkpoints store `mask_decoder.iou_token.weight` and `mask_decoder.mask_tokens.weight` as views
of one shared storage. The safetensors format forbids shared storage, so each is stored as its own copy with identical
values; loading a model copies them into separate parameters either way.
## License
Apache-2.0. The upstream README states that "The model is licensed under the Apache 2.0 license". See
[`LICENSE`](LICENSE), copied from facebookresearch/segment-anything. The SA-1B dataset has its own licence, which
does not apply to these weights.
## Citation
```bibtex
@article{kirillov2023segany,
title = {Segment Anything},
author = {Kirillov, Alexander and Mintun, Eric and Ravi, Nikhila and Mao, Hanzi and Rolland, Chloe and
Gustafson, Laura and Xiao, Tete and Whitehead, Spencer and Berg, Alexander C. and Lo, Wan-Yen and
Doll{\'a}r, Piotr and Girshick, Ross},
journal = {arXiv:2304.02643},
year = {2023}
}
```