jchadwick commited on
Commit
3c58ec5
·
1 Parent(s): 1aefbd3

Add CoreML and tflite images

Browse files
v1/README.md ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Billiards YOLOv8n Model - Exported Formats (1280x1280)
2
+
3
+ ## Successfully Exported Models
4
+
5
+ ### CoreML
6
+ - **File**: `billiards-yolov8n.mlpackage`
7
+ - **Input Size**: 1280x1280 RGB
8
+ - **Size**: ~6.0 MB
9
+ - **Status**: ✅ Successfully exported
10
+ - **Platform**: iOS/macOS
11
+ - **Description**: CoreML package ready for Apple device inference
12
+
13
+ ### ONNX
14
+ - **File**: `billiards-yolov8n.onnx`
15
+ - **Input Size**: 1280x1280 (1x3x1280x1280 BCHW)
16
+ - **Format**: ONNX opset 19
17
+ - **Size**: 12.2 MB
18
+ - **Status**: ✅ Successfully exported
19
+ - **Platform**: Cross-platform
20
+ - **Description**: Universal format, can be used with ONNXRuntime or converted to other formats
21
+
22
+ ### TFLite (Float32)
23
+ - **File**: `billiards-yolov8n_float32.tflite`
24
+ - **Input Size**: 1280x1280
25
+ - **Size**: 12 MB
26
+ - **Status**: ✅ Successfully exported
27
+ - **Platform**: Android, Edge devices, TensorFlow Lite runtime
28
+ - **Description**: Full precision TFLite model
29
+
30
+ ### TFLite (Float16)
31
+ - **File**: `billiards-yolov8n_float16.tflite`
32
+ - **Input Size**: 1280x1280
33
+ - **Size**: 6.0 MB
34
+ - **Status**: ✅ Successfully exported
35
+ - **Platform**: Android, Edge devices, TensorFlow Lite runtime
36
+ - **Description**: Half precision TFLite model (smaller, slightly less accurate)
37
+
38
+ ## Model Details
39
+
40
+ - **Base Model**: YOLOv8n (Nano)
41
+ - **Training**: Custom billiards dataset
42
+ - **Input Size**: 1280x1280x3 RGB
43
+ - **Task**: Object detection
44
+ - **Output Shape**: (1, 6, 33600) - 6 classes, 33600 detections at 1280 resolution
45
+
46
+ ## Conversion Notes
47
+
48
+ ### CoreML
49
+ - Converted directly from PyTorch using Ultralytics export
50
+ - Ready for use with Core ML framework on iOS/macOS
51
+ - Optimized for Apple Neural Engine
52
+
53
+ ### ONNX
54
+ - Exported with opset 19 for broad compatibility
55
+ - Can be used as an intermediate format for other conversions
56
+ - Works with ONNXRuntime on all platforms
57
+
58
+ ### TFLite
59
+ - Converted via ONNX → TensorFlow SavedModel → TFLite pipeline using Docker
60
+ - Used `onnx2tf` tool with TensorFlow 2.19
61
+ - Two variants provided:
62
+ - Float32: Full precision, larger file
63
+ - Float16: Half precision, 50% smaller, minimal accuracy loss
64
+
65
+ ## Usage Examples
66
+
67
+ ### CoreML (Swift/iOS)
68
+ ```swift
69
+ let model = try billiards_yolov8n()
70
+ let input = billiards_yolov8nInput(image: pixelBuffer)
71
+ let output = try model.prediction(input: input)
72
+ ```
73
+
74
+ ### ONNX (Python)
75
+ ```python
76
+ import onnxruntime as ort
77
+ session = ort.InferenceSession("billiards-yolov8n.onnx")
78
+ output = session.run(None, {"images": input_tensor})
79
+ ```
80
+
81
+ ### TFLite (Python)
82
+ ```python
83
+ import tensorflow as tf
84
+ interpreter = tf.lite.Interpreter("billiards-yolov8n_float32.tflite")
85
+ interpreter.allocate_tensors()
86
+ # Run inference...
87
+ ```
88
+
89
+ ## File Sizes Summary
90
+
91
+ | Format | File | Size |
92
+ |--------|------|------|
93
+ | PyTorch | billiards-yolov8n.pt | 5.9 MB |
94
+ | CoreML | billiards-yolov8n.mlpackage | ~6.0 MB |
95
+ | ONNX | billiards-yolov8n.onnx | 12.2 MB |
96
+ | TFLite (FP32) | billiards-yolov8n_float32.tflite | 12 MB |
97
+ | TFLite (FP16) | billiards-yolov8n_float16.tflite | 6.0 MB |
v1/billiards-yolov8n.mlpackage/Data/com.apple.CoreML/model.mlmodel ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1b9f58b4e61d99ad6acc31efdb93bd0d6c3e7b71b02460b32535fdba5d49d6ed
3
+ size 116594
v1/billiards-yolov8n.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:b171b0650f21cbd5e9b31f99dca8daf4fe872a7a7e009f055d881e65309c99b3
3
+ size 6221952
v1/billiards-yolov8n.mlpackage/Manifest.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "fileFormatVersion": "1.0.0",
3
+ "itemInfoEntries": {
4
+ "576D694C-5517-406C-A111-0C8159D2F453": {
5
+ "author": "com.apple.CoreML",
6
+ "description": "CoreML Model Specification",
7
+ "name": "model.mlmodel",
8
+ "path": "com.apple.CoreML/model.mlmodel"
9
+ },
10
+ "57BABC12-6BC5-41F6-85A8-007CEECFCE2E": {
11
+ "author": "com.apple.CoreML",
12
+ "description": "CoreML Model Weights",
13
+ "name": "weights",
14
+ "path": "com.apple.CoreML/weights"
15
+ }
16
+ },
17
+ "rootModelIdentifier": "576D694C-5517-406C-A111-0C8159D2F453"
18
+ }
v1/billiards-yolov8n.onnx CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:ef2b2071ec237ee42f32e11d24c28b7872528622902a6c88f2d662929911a9d9
3
- size 12770726
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4691fd5588b4e14f57a7f44d6c5ed473d586edb87f1b3c0017e40ea333b9a60e
3
+ size 12770739
v1/billiards-yolov8n_float16.tflite ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:07cbe84a6283261782b2728b869dbe50c5a0c97afb8bbc218d27e5894fa5a616
3
+ size 6284064
v1/billiards-yolov8n_float32.tflite ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bf3a068bb4cc7eab72978cc102acf5e4925686a48fd75f7d084c05f1e00e9d4b
3
+ size 12482744