mlboydaisuke commited on
Commit
a77e741
·
verified ·
1 Parent(s): 3924779

Add model card

Browse files
Files changed (1) hide show
  1. README.md +88 -0
README.md ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ library_name: coreml
4
+ pipeline_tag: image-segmentation
5
+ tags:
6
+ - coreml
7
+ - core-ml
8
+ - ios
9
+ - macos
10
+ - apple
11
+ - on-device
12
+ - anomaly-detection
13
+ - industrial-inspection
14
+ - mvtec-ad
15
+ - defect-detection
16
+ - arxiv:2303.14535
17
+ ---
18
+
19
+ # EfficientAD (MVTec bottle) — Core ML
20
+
21
+ *WACV 2024*
22
+
23
+ Visual anomaly detection for industrial inspection. Outputs a per-pixel anomaly heatmap plus a scalar score from a 256x256 image, so defects are localised rather than just flagged.
24
+
25
+ PDN-Small teacher/student pair plus an autoencoder: the anomaly map is the disagreement between teacher-student and autoencoder-student. This checkpoint is trained on the MVTec AD *bottle* category — retrain per category for other objects.
26
+
27
+ Core ML conversion of [openvinotoolkit/anomalib](https://github.com/openvinotoolkit/anomalib) for on-device inference on iPhone, iPad and Mac. Converted with `coremltools`; the packages are stateless, so all sequencing and buffering lives in your Swift code.
28
+
29
+ | | |
30
+ |---|---|
31
+ | Task | image segmentation |
32
+ | Upstream | [openvinotoolkit/anomalib](https://github.com/openvinotoolkit/anomalib) |
33
+ | Packages | 1 |
34
+ | Download size | 14 MB |
35
+ | Minimum iOS | 17.0 |
36
+
37
+ ## Files
38
+
39
+ | File | Size | Compute units | SHA-256 |
40
+ |---|---:|---|---|
41
+ | `EfficientAD_Bottle.mlpackage.zip` | 14 MB | `all` | - |
42
+ | **Total** | **14 MB** | | |
43
+
44
+ `compute_units` is not a suggestion -- it is the configuration the conversion was verified against. Moving a package to a different compute unit can silently change the numerics (FP16 attention overflow) or crash on the GPU.
45
+
46
+ ## Download
47
+
48
+ ```bash
49
+ hf download mlboydaisuke/coreml-zoo --include "efficientad/*" --local-dir ./efficientad
50
+ unzip './efficientad/efficientad/*.zip' -d ./efficientad
51
+ ```
52
+
53
+ ## Use in Swift
54
+
55
+ ```swift
56
+ import CoreML
57
+
58
+ let config = MLModelConfiguration()
59
+ config.computeUnits = .all // as converted — see the table above
60
+
61
+ // Unzip the .mlpackage, drop it into your Xcode target and Xcode compiles it
62
+ // at build time:
63
+ let model = try EfficientAD_Bottle(configuration: config)
64
+
65
+ // ...or compile a downloaded .mlpackage at runtime:
66
+ let compiled = try await MLModel.compileModel(at: mlpackageURL)
67
+ let model = try MLModel(contentsOf: compiled, configuration: config)
68
+ ```
69
+
70
+ ## Demo
71
+
72
+ - **Sample app** — [`sample_apps/EfficientADDemo`](https://github.com/john-rocky/CoreML-Models/tree/master/sample_apps/EfficientADDemo), a standalone SwiftUI project.
73
+ - **Models Zoo** — this model is downloadable and runnable inside the [Models Zoo app](https://apps.apple.com/app/id6762083207) on the App Store, no build required.
74
+
75
+ ## Conversion
76
+
77
+ - Script: [`convert_efficientad.py`](https://github.com/john-rocky/CoreML-Models/blob/master/conversion_scripts/convert_efficientad.py)
78
+ - Pitfalls hit during conversion (FP16 overflow, ANE buffer limits, stride handling): [`docs/coreml_conversion_notes.md`](https://github.com/john-rocky/CoreML-Models/blob/master/docs/coreml_conversion_notes.md)
79
+ - Model index: [CoreML-Models](https://github.com/john-rocky/CoreML-Models)
80
+
81
+ ## License
82
+
83
+ The conversion inherits the upstream license: **MIT**.
84
+
85
+ ## Credits
86
+
87
+ - Upstream authors: [openvinotoolkit/anomalib](https://github.com/openvinotoolkit/anomalib), 2023
88
+ - Core ML conversion: john-rocky (Daisuke Majima)