YOLOX-S -> Core AI: fp32 .aimodel + card (parity 1.000, device-verified iPhone 17 Pro)
Browse files- .gitattributes +1 -0
- README.md +69 -0
- yolox-s_float32.aimodel/main.hash +1 -0
- yolox-s_float32.aimodel/main.mlirb +3 -0
- yolox-s_float32.aimodel/metadata.json +7 -0
.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 |
+
yolox-s_float32.aimodel/main.mlirb filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
pipeline_tag: object-detection
|
| 4 |
+
library_name: coreai
|
| 5 |
+
tags:
|
| 6 |
+
- core-ai
|
| 7 |
+
- coreml
|
| 8 |
+
- object-detection
|
| 9 |
+
- yolox
|
| 10 |
+
- apple
|
| 11 |
+
base_model: Megvii-BaseDetection/YOLOX
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# YOLOX-S — Core AI
|
| 15 |
+
|
| 16 |
+
[YOLOX](https://github.com/Megvii-BaseDetection/YOLOX) (Megvii, Apache-2.0) converted to
|
| 17 |
+
Apple **Core AI** (`.aimodel`) — a single-stage **anchor-free** object detector running as
|
| 18 |
+
one static graph on every Apple compute unit (Mac GPU / iPhone GPU / Neural Engine). Part
|
| 19 |
+
of the [Core AI model zoo](https://github.com/john-rocky/coreai-model-zoo)
|
| 20 |
+
([model card](https://github.com/john-rocky/coreai-model-zoo/blob/main/zoo/yolox.md)).
|
| 21 |
+
|
| 22 |
+
The **dense-detector** counterpart to
|
| 23 |
+
[RF-DETR-CoreAI](https://huggingface.co/mlboydaisuke/RF-DETR-CoreAI): where the DETR family
|
| 24 |
+
needs no NMS, YOLOX is the classic `score = obj · cls` + **per-class NMS** pipeline.
|
| 25 |
+
|
| 26 |
+
## Bundle
|
| 27 |
+
|
| 28 |
+
- `yolox-s_float32.aimodel` — YOLOX-S, 640² input, 8.97M params, **fp32** (the ship dtype;
|
| 29 |
+
detection has no bandwidth-bound decode loop, so fp16 is no faster on the GPU and only adds
|
| 30 |
+
near-tie noise). 36 MB. Same bundle on macOS and iOS.
|
| 31 |
+
|
| 32 |
+
## Graph contract
|
| 33 |
+
|
| 34 |
+
```
|
| 35 |
+
input "image" [1,3,640,640] f32 BGR, 0-255, letterboxed (pad 114, top-left) — YOLOX-native (no /255, no mean/std)
|
| 36 |
+
output "preds" [1,8400,85] f32 [cx,cy,w,h, obj, cls_0..cls_79]; box DECODED to 640-px, obj/cls SIGMOID-ed (in-graph)
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
Host post-process: `score = obj · max_class`, threshold, **per-class NMS** (IoU 0.45), then
|
| 40 |
+
un-letterbox the survivors. Anchors A = 80² + 40² + 20² = 8400 (strides 8/16/32).
|
| 41 |
+
|
| 42 |
+
## Parity & speed (measured)
|
| 43 |
+
|
| 44 |
+
- **vs torch fp32:** head cosine **1.000000**, end-to-end detections IoU **1.000** on CPU and GPU.
|
| 45 |
+
- **M4 Max GPU: 4.80 ms / 208 FPS** (median). M4 Max CPU 57 ms.
|
| 46 |
+
- **iPhone 17 Pro** (Release, GPU, live camera): **~22 ms / 35–40 FPS** end-to-end; first-load
|
| 47 |
+
on-device specialization ~2.6 s (no AOT). The on-device gate reproduces the Mac fp32 oracle
|
| 48 |
+
**6/6** (cat 0.96/0.96, remote 0.86/0.86, bed 0.71, couch 0.54).
|
| 49 |
+
|
| 50 |
+
## Use (CoreAIKit)
|
| 51 |
+
|
| 52 |
+
```swift
|
| 53 |
+
import CoreAIKitVision
|
| 54 |
+
let detector = try await YOLOXDetector(model: .yoloxS) // downloads this repo
|
| 55 |
+
let detections = try await detector.detect(in: pixelBuffer, scoreThreshold: 0.3)
|
| 56 |
+
```
|
| 57 |
+
|
| 58 |
+
Live-camera + video reference app: **DetectCamera** in
|
| 59 |
+
[coreai-kit](https://github.com/john-rocky/coreai-kit).
|
| 60 |
+
|
| 61 |
+
## Convert it yourself
|
| 62 |
+
|
| 63 |
+
[`conversion/export_yolox.py`](https://github.com/john-rocky/coreai-model-zoo/blob/main/conversion/export_yolox.py)
|
| 64 |
+
— `--variant s --yolox-repo <YOLOX checkout> --weights yolox_s.pth`, gated end-to-end with
|
| 65 |
+
`--verify-image <img> --unit {cpu,gpu}`. The script also maps `nano`/`tiny`/`m`/`l`/`x`.
|
| 66 |
+
|
| 67 |
+
## License
|
| 68 |
+
|
| 69 |
+
Apache-2.0 — upstream YOLOX code and COCO-pretrained weights are Apache-2.0.
|
yolox-s_float32.aimodel/main.hash
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
�,o9v&�s��J�~�0����=�^�X#fE�
|
yolox-s_float32.aimodel/main.mlirb
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a82c6f397626d073cae74aa07ecd300211a991b3da3de85e1bfe58236645108f
|
| 3 |
+
size 36169985
|
yolox-s_float32.aimodel/metadata.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"assetVersion" : "2.0",
|
| 3 |
+
"description" : "YOLOX-s anchor-free single-stage detector (CSPDarknet + PAFPN + decoupled head). Input: BGR 0-255 letterboxed [1,3,S,S]; output preds [1,A,85] = decoded cxcywh pixels + obj + 80 sigmoid class scores. Host does score=obj*cls threshold + per-class NMS. https:\/\/github.com\/Megvii-BaseDetection\/YOLOX",
|
| 4 |
+
"author" : "Megvii (YOLOX); Core AI export: coreai-model-zoo",
|
| 5 |
+
"license" : "Apache-2.0",
|
| 6 |
+
"creationDate" : "20260628T073623Z"
|
| 7 |
+
}
|