devilyouwei commited on
Commit
df834eb
·
verified ·
1 Parent(s): 48016a8

Add YOLOv8 Seg n, s, and m Core ML packages

Browse files
README.md ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: agpl-3.0
3
+ library_name: coremltools
4
+ pipeline_tag: image-segmentation
5
+ tags:
6
+ - coreml
7
+ - apple-silicon
8
+ - yolo
9
+ - instance-segmentation
10
+ - macos
11
+ ---
12
+
13
+ # YOLOv8 Instance Segmentation — Core ML
14
+
15
+ Ready-to-use Core ML conversions of Ultralytics YOLOv8 Seg for instance segmentation on Apple Silicon. The `n`, `s`, and `m` variants are provided as `.mlpackage` models for use with the CPU, GPU, and Apple Neural Engine.
16
+
17
+ These models power local computer-vision apps in [Hugging Mac](https://github.com/devilyouwei/hugging-mac), an open-source platform for building AI apps, services, games, plugins, and agents on macOS.
18
+
19
+ ## Models
20
+
21
+ | Variant | Package size | Best for |
22
+ |---|---:|---|
23
+ | `yolov8n-seg` | 7.0 MB | Lowest latency and resource usage |
24
+ | `yolov8s-seg` | 23.8 MB | Balanced speed and accuracy |
25
+ | `yolov8m-seg` | 54.8 MB | Higher accuracy |
26
+
27
+ ## Provenance and conversion
28
+
29
+ - Source: [Ultralytics assets v8.2.0](https://github.com/ultralytics/assets/releases/tag/v8.2.0)
30
+ - Task: COCO 80-class object detection and instance segmentation
31
+ - Input size: fixed `640 × 640`, batch size 1
32
+ - Precision: FP16 conversion
33
+ - NMS: not embedded; apply confidence filtering and NMS after inference
34
+
35
+ ## Input and output
36
+
37
+ | Name | Type | Shape | Description |
38
+ |---|---|---|---|
39
+ | `image` | RGB image | `640 × 640` | Letterboxed model input |
40
+ | `predictions` | FP32 multi-array | `1 × 116 × 8400` | Boxes, class scores, and mask coefficients |
41
+ | `prototypes` | FP32 multi-array | `1 × 32 × 160 × 160` | Prototype masks used to reconstruct instance masks |
42
+
43
+ ## Core ML example
44
+
45
+ ```python
46
+ from pathlib import Path
47
+
48
+ import coremltools as ct
49
+ from huggingface_hub import snapshot_download
50
+ from PIL import Image, ImageOps
51
+
52
+ root = Path(snapshot_download(
53
+ repo_id="hugging-mac/yolov8-seg-coreml",
54
+ allow_patterns=["yolov8n-seg.mlpackage/**"],
55
+ ))
56
+ model = ct.models.MLModel(
57
+ root / "yolov8n-seg.mlpackage",
58
+ compute_units=ct.ComputeUnit.ALL,
59
+ )
60
+ image = ImageOps.pad(
61
+ Image.open("image.jpg").convert("RGB"),
62
+ (640, 640),
63
+ color=(114, 114, 114),
64
+ )
65
+ outputs = model.predict({"image": image})
66
+ print(outputs["predictions"].shape) # (1, 116, 8400)
67
+ print(outputs["prototypes"].shape) # (1, 32, 160, 160)
68
+ ```
69
+
70
+ The outputs are raw. See the [Hugging Mac YOLOv8 Seg SDK](https://github.com/devilyouwei/hugging-mac/tree/main/packages/hugging_mac_sdk/src/hugging_mac_sdk/models/yolov8_seg) for complete preprocessing, NMS, mask reconstruction, and coordinate restoration.
71
+
72
+ ## Integrity
73
+
74
+ | Package | Directory SHA-256 |
75
+ |---|---|
76
+ | `yolov8n-seg.mlpackage` | `40e067215baf17be1d4c1a63483538d0fa39c5d0f231cb63248c404e929ce9bc` |
77
+ | `yolov8s-seg.mlpackage` | `ab06bcad128a494510f6451c22cdebb79a58db01f628e9a9a60216b246691399` |
78
+ | `yolov8m-seg.mlpackage` | `685049dbc644c5f9abd088aa398942b052d3256819dfe7bf27456e7136c0e6a5` |
79
+
80
+ ## License
81
+
82
+ The converted models retain the upstream Ultralytics licensing terms and are published under AGPL-3.0. Review Ultralytics licensing requirements before commercial or closed-source use. Hugging Mac is not affiliated with or endorsed by Ultralytics.
yolov8m-seg.mlpackage.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3405dc451c356f0c37a1a206a3470e27d07345f09eeea78b3588ea576e97d3a0
3
+ size 50596823
yolov8m-seg.mlpackage/Data/com.apple.CoreML/model.mlmodel ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e881a33a2881190d4a7a7f35b45f3bf635c0aa1f9e646948bdc8540b2ad71d45
3
+ size 161904
yolov8m-seg.mlpackage/Data/com.apple.CoreML/weights/weight.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f79d1a84966ea3f839a0bb8b0a507c30e1a19a6bdf84c6cafbd2b5909ebc288f
3
+ size 54600864
yolov8m-seg.mlpackage/Manifest.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "fileFormatVersion": "1.0.0",
3
+ "itemInfoEntries": {
4
+ "3014FAB2-6B65-4FB6-BD58-C914F663EC60": {
5
+ "author": "com.apple.CoreML",
6
+ "description": "CoreML Model Specification",
7
+ "name": "model.mlmodel",
8
+ "path": "com.apple.CoreML/model.mlmodel"
9
+ },
10
+ "61DDA162-39FD-483C-AC87-5C6BBA33F6E6": {
11
+ "author": "com.apple.CoreML",
12
+ "description": "CoreML Model Weights",
13
+ "name": "weights",
14
+ "path": "com.apple.CoreML/weights"
15
+ }
16
+ },
17
+ "rootModelIdentifier": "3014FAB2-6B65-4FB6-BD58-C914F663EC60"
18
+ }
yolov8n-seg.mlpackage.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f11e4c2ff74cd35251bd8ca13f43ac09e6b984bfc456610db2de987cb5478192
3
+ size 6360986
yolov8n-seg.mlpackage/Data/com.apple.CoreML/model.mlmodel ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f069a38f5959c101f4b9561207873b9907de059a163ba5b320ddebb53cc211db
3
+ size 131782
yolov8n-seg.mlpackage/Data/com.apple.CoreML/weights/weight.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d06a19d1b40df0d18b165ff40732fbd8779f5b1e38c7866c60b89fceab69ce9a
3
+ size 6869472
yolov8n-seg.mlpackage/Manifest.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "fileFormatVersion": "1.0.0",
3
+ "itemInfoEntries": {
4
+ "4D1CDC94-4335-42C1-9800-B00FC7F7F1E1": {
5
+ "author": "com.apple.CoreML",
6
+ "description": "CoreML Model Specification",
7
+ "name": "model.mlmodel",
8
+ "path": "com.apple.CoreML/model.mlmodel"
9
+ },
10
+ "C1E1C281-59EE-4D4D-8595-9C11DB48B715": {
11
+ "author": "com.apple.CoreML",
12
+ "description": "CoreML Model Weights",
13
+ "name": "weights",
14
+ "path": "com.apple.CoreML/weights"
15
+ }
16
+ },
17
+ "rootModelIdentifier": "4D1CDC94-4335-42C1-9800-B00FC7F7F1E1"
18
+ }
yolov8s-seg.mlpackage.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a97a885f5000993df137e1be3e4e66893cec4dd18720ecc87ed292234efe97ef
3
+ size 21960158
yolov8s-seg.mlpackage/Data/com.apple.CoreML/model.mlmodel ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:42f7c557303dfde0625b8749cb95b2719d3daff3b92c78b00e6891d7cfe279d0
3
+ size 132003
yolov8s-seg.mlpackage/Data/com.apple.CoreML/weights/weight.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c5a848aae8fe9c15dbc7ab4537960cf2538fa289bbcfab9382b78ca47ace2eda
3
+ size 23681632
yolov8s-seg.mlpackage/Manifest.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "fileFormatVersion": "1.0.0",
3
+ "itemInfoEntries": {
4
+ "591106FC-B381-44D5-BE38-C968130E8FA0": {
5
+ "author": "com.apple.CoreML",
6
+ "description": "CoreML Model Weights",
7
+ "name": "weights",
8
+ "path": "com.apple.CoreML/weights"
9
+ },
10
+ "89F723A2-77FB-4F4C-B6AF-6078EC221DEF": {
11
+ "author": "com.apple.CoreML",
12
+ "description": "CoreML Model Specification",
13
+ "name": "model.mlmodel",
14
+ "path": "com.apple.CoreML/model.mlmodel"
15
+ }
16
+ },
17
+ "rootModelIdentifier": "89F723A2-77FB-4F4C-B6AF-6078EC221DEF"
18
+ }