vietanhdev commited on
Commit
77dfc32
·
verified ·
1 Parent(s): f75045c

Correct SAM3 license metadata and provenance

Browse files
Files changed (3) hide show
  1. LICENSE +61 -0
  2. MANIFEST.json +57 -0
  3. README.md +48 -52
LICENSE ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ SAM License
2
+ Last Updated: November 19, 2025
3
+
4
+ “Agreement” means the terms and conditions for use, reproduction, distribution and modification of the SAM Materials set forth herein.
5
+
6
+
7
+ “SAM Materials” means, collectively, Documentation and the models, software and algorithms, including machine-learning model code, trained model weights, inference-enabling code, training-enabling code, fine-tuning enabling code, and other elements of the foregoing distributed by Meta and made available under this Agreement.
8
+
9
+ “Documentation” means the specifications, manuals and documentation accompanying
10
+ SAM Materials distributed by Meta.
11
+
12
+
13
+ “Licensee” or “you” means you, or your employer or any other person or entity (if you are entering into this Agreement on such person or entity’s behalf), of the age required under applicable laws, rules or regulations to provide legal consent and that has legal authority to bind your employer or such other person or entity if you are entering in this Agreement on their behalf.
14
+
15
+
16
+ “Meta” or “we” means Meta Platforms Ireland Limited (if you are located in or, if you are an entity, your principal place of business is in the EEA or Switzerland) or Meta Platforms, Inc. (if you are located outside of the EEA or Switzerland).
17
+
18
+
19
+ “Sanctions” means any economic or trade sanctions or restrictions administered or enforced by the United States (including the Office of Foreign Assets Control of the U.S. Department of the Treasury (“OFAC”), the U.S. Department of State and the U.S. Department of Commerce), the United Nations, the European Union, or the United Kingdom.
20
+
21
+
22
+ “Trade Controls” means any of the following: Sanctions and applicable export and import controls.
23
+
24
+ By using or distributing any portion or element of the SAM Materials, you agree to be bound by this Agreement.
25
+
26
+
27
+ 1. License Rights and Redistribution.
28
+
29
+
30
+ a. Grant of Rights. You are granted a non-exclusive, worldwide, non-transferable and royalty-free limited license under Meta’s intellectual property or other rights owned by Meta embodied in the SAM Materials to use, reproduce, distribute, copy, create derivative works of, and make modifications to the SAM Materials.
31
+
32
+ b. Redistribution and Use.
33
+ i. Distribution of SAM Materials, and any derivative works thereof, are subject to the terms of this Agreement. If you distribute or make the SAM Materials, or any derivative works thereof, available to a third party, you may only do so under the terms of this Agreement and you shall provide a copy of this Agreement with any such SAM Materials.
34
+
35
+
36
+ ii. If you submit for publication the results of research you perform on, using, or otherwise in connection with SAM Materials, you must acknowledge the use of SAM Materials in your publication.
37
+
38
+
39
+ iii. Your use of the SAM Materials must comply with applicable laws and regulations, including Trade Control Laws and applicable privacy and data protection laws.
40
+ iv. Your use of the SAM Materials will not involve or encourage others to reverse engineer, decompile or discover the underlying components of the SAM Materials.
41
+ v. You are not the target of Trade Controls and your use of SAM Materials must comply with Trade Controls. You agree not to use, or permit others to use, SAM Materials for any activities subject to the International Traffic in Arms Regulations (ITAR) or end uses prohibited by Trade Controls, including those related to military or warfare purposes, nuclear industries or applications, espionage, or the development or use of guns or illegal weapons.
42
+ 2. User Support. Your use of the SAM Materials is done at your own discretion; Meta does not process any information nor provide any service in relation to such use. Meta is under no obligation to provide any support services for the SAM Materials. Any support provided is “as is”, “with all faults”, and without warranty of any kind.
43
+
44
+
45
+ 3. Disclaimer of Warranty. UNLESS REQUIRED BY APPLICABLE LAW, THE SAM MATERIALS AND ANY OUTPUT AND RESULTS THEREFROM ARE PROVIDED ON AN “AS IS” BASIS, WITHOUT WARRANTIES OF ANY KIND, AND META DISCLAIMS ALL WARRANTIES OF ANY KIND, BOTH EXPRESS AND IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. YOU ARE SOLELY RESPONSIBLE FOR DETERMINING THE APPROPRIATENESS OF USING OR REDISTRIBUTING THE SAM MATERIALS AND ASSUME ANY RISKS ASSOCIATED WITH YOUR USE OF THE SAM MATERIALS AND ANY OUTPUT AND RESULTS.
46
+
47
+ 4. Limitation of Liability. IN NO EVENT WILL META OR ITS AFFILIATES BE LIABLE UNDER ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, TORT, NEGLIGENCE, PRODUCTS LIABILITY, OR OTHERWISE, ARISING OUT OF THIS AGREEMENT, FOR ANY LOST PROFITS OR ANY DIRECT OR INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL, EXEMPLARY OR PUNITIVE DAMAGES, EVEN IF META OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF ANY OF THE FOREGOING.
48
+
49
+ 5. Intellectual Property.
50
+
51
+
52
+ a. Subject to Meta’s ownership of SAM Materials and derivatives made by or for Meta, with respect to any derivative works and modifications of the SAM Materials that are made by you, as between you and Meta, you are and will be the owner of such derivative works and modifications.
53
+
54
+ b. If you institute litigation or other proceedings against Meta or any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the SAM Materials, outputs or results, or any portion of any of the foregoing, constitutes infringement of intellectual property or other rights owned or licensable by you, then any licenses granted to you under this Agreement shall terminate as of the date such litigation or claim is filed or instituted. You will indemnify and hold harmless Meta from and against any claim by any third party arising out of or related to your use or distribution of the SAM Materials.
55
+
56
+ 6. Term and Termination. The term of this Agreement will commence upon your acceptance of this Agreement or access to the SAM Materials and will continue in full force and effect until terminated in accordance with the terms and conditions herein. Meta may terminate this Agreement if you are in breach of any term or condition of this Agreement. Upon termination of this Agreement, you shall delete and cease use of the SAM Materials. Sections 3, 4 and 7 shall survive the termination of this Agreement.
57
+
58
+ 7. Governing Law and Jurisdiction. This Agreement will be governed and construed under the laws of the State of California without regard to choice of law principles, and the UN Convention on Contracts for the International Sale of Goods does not apply to this Agreement. The courts of California shall have exclusive jurisdiction of any dispute arising out of this Agreement.
59
+
60
+
61
+ 8. Modifications and Amendments. Meta may modify this Agreement from time to time; provided that they are similar in spirit to the current version of the Agreement, but may differ in detail to address new problems or concerns. All such changes will be effective immediately. Your continued use of the SAM Materials after any modification to this Agreement constitutes your agreement to such modification. Except as provided in this Agreement, no modification or addition to any provision of this Agreement will be binding unless it is in writing and signed by an authorized representative of both you and Meta.
MANIFEST.json ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema_version": 1,
3
+ "archive": {
4
+ "filename": "sam3_vit_h.zip",
5
+ "bytes": 3413511219,
6
+ "sha256": "1617436f9db7eb9dd69029c2c465d54b316c36c21143f0fde0d1be513f15b7d5"
7
+ },
8
+ "license": {
9
+ "name": "Meta SAM License",
10
+ "path": "LICENSE",
11
+ "upstream_url": "https://github.com/facebookresearch/sam3/blob/660a5e9e1b8b4c02c0ad97229b88a09a6e4ff5b7/LICENSE"
12
+ },
13
+ "provenance": {
14
+ "upstream_revision": "660a5e9e1b8b4c02c0ad97229b88a09a6e4ff5b7",
15
+ "exporter_revision": "35133ce8670e0d190ac10cc08efba9b9a443fb51"
16
+ },
17
+ "members": [
18
+ {
19
+ "path": "config.yaml",
20
+ "bytes": 283,
21
+ "sha256": "24ada0ff70476120a54d106ddf309c8434f26d43c25e5136d84cced67b0a95dd"
22
+ },
23
+ {
24
+ "path": "sam3_decoder.onnx",
25
+ "bytes": 129858120,
26
+ "sha256": "aca3109a1bf87d1589bf2a4a61c641fd97624152b21c6e9a5aa85735db398884"
27
+ },
28
+ {
29
+ "path": "sam3_decoder.onnx.data",
30
+ "bytes": 116523008,
31
+ "sha256": "afae2f057f4c6e2478589877aa3d361a0d863cdfdb8259f7eee903f529188ac6",
32
+ "referenced_by_graph": false
33
+ },
34
+ {
35
+ "path": "sam3_image_encoder.onnx",
36
+ "bytes": 2509348,
37
+ "sha256": "3dd676271e9c459463f7026d8ab2c6318672cd89511f89c30b34cdf0a2e67a3f"
38
+ },
39
+ {
40
+ "path": "sam3_image_encoder.onnx.data",
41
+ "bytes": 1828519936,
42
+ "sha256": "03bd50b0703e2b04e2193ca831b7f9d5ecf40bc5287cc59b1970f56ab800c995",
43
+ "referenced_by_graph": true
44
+ },
45
+ {
46
+ "path": "sam3_language_encoder.onnx",
47
+ "bytes": 1396738,
48
+ "sha256": "af80dffcd8fc369281b0422295244ba22f64e8424e9eefa111ac8966e9ea9ba6"
49
+ },
50
+ {
51
+ "path": "sam3_language_encoder.onnx.data",
52
+ "bytes": 1615200256,
53
+ "sha256": "1b03dabc657c1f2887d1b8ce2a3537467d4c033ea1f8c8be141fbca55e4b95f7",
54
+ "referenced_by_graph": true
55
+ }
56
+ ]
57
+ }
README.md CHANGED
@@ -1,5 +1,7 @@
1
  ---
2
- license: apache-2.0
 
 
3
  pipeline_tag: image-segmentation
4
  library_name: onnx
5
  base_model: facebook/sam3
@@ -7,78 +9,72 @@ tags:
7
  - onnxruntime
8
  - onnx
9
  - segment-anything
10
- - segment-anything-3
11
  - image-segmentation
12
  - open-vocabulary
13
  - text-to-segmentation
14
- - edge-ai
15
- - anylabeling
16
  authors:
17
  - Viet-Anh Nguyen
18
  ---
19
 
20
- # Segment Anything 3 (SAM 3) ONNX Models
21
 
22
- ONNX export of Meta's [SAM 3](https://huggingface.co/facebook/sam3) — the open-vocabulary, text-promptable segmentation model — packaged for use with [`onnxruntime`](https://onnxruntime.ai) and [AnyLabeling](https://github.com/vietanhdev/anylabeling).
 
 
23
 
24
- ## Why this repo exists
25
 
26
- SAM 3 brings open-vocabulary text prompts to the SAM family: instead of clicking points or drawing boxes, you can describe the object in natural language and the model segments it. ONNX gives you a portable, dependency-light runtime that works in Python, C++, JavaScript, and most embedded targets. This is the export that AnyLabeling consumes for its smart-labeling features.
 
 
 
27
 
28
- ## Variants
29
 
30
- | File | Backbone | Size |
31
- |---|---|---|
32
- | `sam3_vit_h.zip` | ViT-H | 3.2 GB |
 
 
 
 
33
 
34
- The zip bundles the encoder + decoder + text-prompt encoder ONNX files for the ViT-H backbone.
 
 
35
 
36
- ## Quick start
37
 
38
- ```bash
39
- pip install huggingface_hub onnxruntime
40
- ```
 
 
41
 
42
- ```python
43
- from huggingface_hub import hf_hub_download
44
- import zipfile, onnxruntime as ort
45
 
46
- zip_path = hf_hub_download(repo_id="vietanhdev/segment-anything-3-onnx-models",
47
- filename="sam3_vit_h.zip")
48
- with zipfile.ZipFile(zip_path) as z:
49
- z.extractall("./sam3")
50
 
51
- # Inspect the unzipped files and load the components you need:
52
- import os
53
- for f in sorted(os.listdir("./sam3")):
54
- print(f)
55
- ```
56
 
57
- For the full text mask pipeline, see how AnyLabeling wires it: <https://github.com/vietanhdev/anylabeling>
 
 
58
 
59
- ## Use with AnyLabeling
60
 
61
- These models drop into AnyLabeling's auto-labeling backend without conversion. See the [AnyLabeling docs](https://github.com/vietanhdev/anylabeling) for the model-config wiring.
62
-
63
- ## Source weights
64
-
65
- Original SAM 3 weights and license: <https://huggingface.co/facebook/sam3>
66
-
67
- This repo redistributes the same weights in ONNX format. License unchanged from upstream (Apache 2.0).
68
 
69
  ## Citation
70
 
71
- ```bibtex
72
- @misc{nguyen2026sam3_onnx,
73
- author = {Nguyen, Viet-Anh and {Neural Research Lab}},
74
- title = {SAM 3 ONNX Models},
75
- year = {2026},
76
- url = {https://huggingface.co/vietanhdev/segment-anything-3-onnx-models}
77
- }
78
- ```
79
-
80
- For the underlying model, cite Meta's SAM 3 release (see <https://huggingface.co/facebook/sam3> for the canonical citation).
81
-
82
- ## Acknowledgments
83
-
84
- Thanks to Meta AI Research for releasing SAM 3 with open weights. This repo packages their work for edge inference.
 
1
  ---
2
+ license: other
3
+ license_name: sam-license
4
+ license_link: https://github.com/facebookresearch/sam3/blob/660a5e9e1b8b4c02c0ad97229b88a09a6e4ff5b7/LICENSE
5
  pipeline_tag: image-segmentation
6
  library_name: onnx
7
  base_model: facebook/sam3
 
9
  - onnxruntime
10
  - onnx
11
  - segment-anything
 
12
  - image-segmentation
13
  - open-vocabulary
14
  - text-to-segmentation
15
+ - anylearning
 
16
  authors:
17
  - Viet-Anh Nguyen
18
  ---
19
 
20
+ # SAM3 ViT-H ONNX graph triplet for AnyLearning
21
 
22
+ This repository contains an ONNX conversion of Meta's SAM3 ViT-H model for
23
+ text, point, box, and combined-prompt segmentation in AnyLearning inference and
24
+ its authenticated server.
25
 
26
+ ## License
27
 
28
+ The model weights and converted ONNX artifacts remain subject to Meta's
29
+ **SAM License**, not Apache-2.0. Read [LICENSE](LICENSE) before downloading,
30
+ using, or redistributing the model. The exporter/runtime wrapper used for the
31
+ conversion is MIT-licensed; that code license does not relicense the weights.
32
 
33
+ ## Immutable provenance
34
 
35
+ - Upstream model/code revision:
36
+ `facebookresearch/sam3@660a5e9e1b8b4c02c0ad97229b88a09a6e4ff5b7`
37
+ - Exporter revision:
38
+ `vietanhdev/samexporter@35133ce8670e0d190ac10cc08efba9b9a443fb51`
39
+ - Archive: `sam3_vit_h.zip`
40
+ - Archive SHA-256:
41
+ `1617436f9db7eb9dd69029c2c465d54b316c36c21143f0fde0d1be513f15b7d5`
42
 
43
+ `MANIFEST.json` records every archive member's exact byte size and SHA-256.
44
+ AnyLearning verifies the three graph files and every referenced external tensor
45
+ file independently before creating ONNX Runtime sessions.
46
 
47
+ ## Graph contract
48
 
49
+ | Role | Input | Outputs |
50
+ | --- | --- | --- |
51
+ | Image encoder | RGB `uint8` CHW `[3,1008,1008]` | six FPN/position feature maps |
52
+ | Language encoder | CLIP tokens `int64` `[1,32]` | attention mask, memory, embeddings |
53
+ | Decoder | image/language features and one fixed geometric slot | boxes, scores, native-size masks |
54
 
55
+ The decoder graph in this bundle emits processed boxes, scores, and masks. Its
56
+ historical `.data` companion is present in the original archive but is not
57
+ referenced by the decoder graph; AnyLearning does not load it.
58
 
59
+ ## Safe download and extraction
 
 
 
60
 
61
+ Treat model archives as untrusted data. Verify the archive digest, require the
62
+ exact members and sizes from `MANIFEST.json`, reject links and unexpected paths,
63
+ and extract each approved member to an explicit destination. Avoid generic
64
+ archive extraction calls.
 
65
 
66
+ The graph triplet is several gigabytes. Keep downloads resumable, enforce disk
67
+ and memory quotas, and use AnyLearning's digest-addressed external-data loader
68
+ instead of reading all tensor files into Python memory.
69
 
70
+ ## Validation
71
 
72
+ The pinned bundle is tested with real images through both in-process inference
73
+ and the password-authenticated HTTP server. Retained reports cover text,
74
+ text-plus-point, and box prompts, deterministic repeated results, load/unload
75
+ cycles, stage timings, peak RSS, editable polygons, and visual inspection.
 
 
 
76
 
77
  ## Citation
78
 
79
+ Please cite Meta's canonical SAM3 release for the underlying model and record
80
+ this repository revision when using this ONNX conversion.