grabbou commited on
Commit
c3d9cdc
·
verified ·
1 Parent(s): b27f6f0

Add EfficientSAM-Ti exported with apple/coreai-models

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ efficient-sam/efficient_sam_vitt_float32_static_p2.aimodel/main.mlirb filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model: yunyangx/EfficientSAM
4
+ pipeline_tag: mask-generation
5
+ library_name: coreai
6
+ tags:
7
+ - coreai
8
+ - ios
9
+ - image-segmentation
10
+ - react-native
11
+ ---
12
+
13
+ # EfficientSAM-Ti for Core AI
14
+
15
+ [EfficientSAM](https://github.com/yformer/EfficientSAM) ViT-Tiny (10M parameters) exported to Apple Core AI, unmodified, with the [`apple/coreai-models`](https://github.com/apple/coreai-models) recipe. It runs on iOS 27 and macOS 27 with the `ImageSegmenter` from the `CoreAISegmentation` product of `coreai-models`.
16
+
17
+ It segments the object at a point (a click) or in a box, one mask per prompt.
18
+
19
+ ## Files
20
+
21
+ `efficient-sam/` is a segmenter bundle: `metadata.json` and the exported model, float32, static shape, up to two points per prompt (39 MB).
22
+
23
+ ## Use
24
+
25
+ With [`@react-native-ai/core-ai`](https://github.com/callstackincubator/ai), download the folder and pass its path:
26
+
27
+ ```typescript
28
+ import { CoreAI } from '@react-native-ai/core-ai'
29
+
30
+ const result = await CoreAI.runTask(
31
+ 'segmentation',
32
+ { id: 'efficient-sam', sourceType: 'file', sourceUri: efficientSAMBundlePath },
33
+ { imageUri, data: { box: { x: 10, y: 50, width: 300, height: 400 } } },
34
+ {}
35
+ )
36
+ ```
37
+
38
+ In Swift:
39
+
40
+ ```swift
41
+ let segmenter = try await ImageSegmenter(resourcesAt: "efficient-sam")
42
+ let response = try await segmenter.segment(image: cgImage, pointQuery: query)
43
+ ```
44
+
45
+ ## Export
46
+
47
+ From [`apple/coreai-models`](https://github.com/apple/coreai-models) at `09ff139`, with `coreai-core` 1.0.0b3:
48
+
49
+ ```bash
50
+ cd models/efficient-sam
51
+ uv run export.py
52
+ ```
53
+
54
+ ## License
55
+
56
+ Apache-2.0, as the original model. EfficientSAM is by Y. Xiong et al., [EfficientSAM: Leveraged Masked Image Pretraining for Efficient Segment Anything](https://arxiv.org/abs/2312.00863).
efficient-sam/efficient_sam_vitt_float32_static_p2.aimodel/main.hash ADDED
@@ -0,0 +1 @@
 
 
1
+ �jN���&���v^?��S���"��a�
efficient-sam/efficient_sam_vitt_float32_static_p2.aimodel/main.mlirb ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:986a1d4eafd8ed2696c4eaa0765e3ff513b31853a711d0efa9221e0682ad618a
3
+ size 41062412
efficient-sam/efficient_sam_vitt_float32_static_p2.aimodel/metadata.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "creationDate" : "20261025T200920Z",
3
+ "assetVersion" : "2.0",
4
+ "description" : "EfficientSAM is a lightweight, promptable image segmentation model that uses a masked autoencoder pretrained ViT-Tiny encoder to reduce compute while preserving accuracy. Source: https:\/\/github.com\/yformer\/EfficientSAM",
5
+ "producer" : "coreai-core 1.0.0b3",
6
+ "author" : "Y. Xiong et al.",
7
+ "license" : "Apache-2.0"
8
+ }
efficient-sam/metadata.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata_version": "0.2",
3
+ "kind": "segmenter",
4
+ "name": "efficient_sam_vitt_float32_static_p2",
5
+ "assets": {
6
+ "main": "efficient_sam_vitt_float32_static_p2.aimodel"
7
+ }
8
+ }