mlboydaisuke commited on
Commit
f3d1567
·
verified ·
1 Parent(s): eff4bb3

Add model card

Browse files
Files changed (1) hide show
  1. README.md +87 -0
README.md ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ library_name: coreml
4
+ pipeline_tag: image-feature-extraction
5
+ tags:
6
+ - coreml
7
+ - core-ml
8
+ - ios
9
+ - macos
10
+ - apple
11
+ - on-device
12
+ - face-recognition
13
+ - face-embedding
14
+ - metric-learning
15
+ - arxiv:2204.00964
16
+ ---
17
+
18
+ # AdaFace IR-18 — Core ML
19
+
20
+ *CVPR 2022*
21
+
22
+ Face recognition embeddings. A 112x112 aligned face goes in, a 512-dim L2-normalised embedding comes out; compare two faces with a cosine similarity. AdaFace weights the margin by image quality during training, so low-quality and blurry faces degrade gracefully instead of collapsing together.
23
+
24
+ iResNet-18 backbone trained on CASIA-WebFace.
25
+
26
+ Core ML conversion of [mk-minchul/AdaFace](https://github.com/mk-minchul/AdaFace) 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.
27
+
28
+ | | |
29
+ |---|---|
30
+ | Task | image feature extraction |
31
+ | Upstream | [mk-minchul/AdaFace](https://github.com/mk-minchul/AdaFace) |
32
+ | Packages | 1 |
33
+ | Download size | 42 MB |
34
+ | Minimum iOS | 17.0 |
35
+
36
+ ## Files
37
+
38
+ | File | Size | Compute units | SHA-256 |
39
+ |---|---:|---|---|
40
+ | `AdaFace_IR18.mlpackage.zip` | 42 MB | `all` | - |
41
+ | **Total** | **42 MB** | | |
42
+
43
+ `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.
44
+
45
+ ## Download
46
+
47
+ ```bash
48
+ hf download mlboydaisuke/coreml-zoo --include "adaface/*" --local-dir ./adaface
49
+ unzip './adaface/adaface/*.zip' -d ./adaface
50
+ ```
51
+
52
+ ## Use in Swift
53
+
54
+ ```swift
55
+ import CoreML
56
+
57
+ let config = MLModelConfiguration()
58
+ config.computeUnits = .all // as converted — see the table above
59
+
60
+ // Unzip the .mlpackage, drop it into your Xcode target and Xcode compiles it
61
+ // at build time:
62
+ let model = try AdaFace_IR18(configuration: config)
63
+
64
+ // ...or compile a downloaded .mlpackage at runtime:
65
+ let compiled = try await MLModel.compileModel(at: mlpackageURL)
66
+ let model = try MLModel(contentsOf: compiled, configuration: config)
67
+ ```
68
+
69
+ ## Demo
70
+
71
+ - **Sample app** — [`sample_apps/AdaFaceDemo`](https://github.com/john-rocky/CoreML-Models/tree/master/sample_apps/AdaFaceDemo), a standalone SwiftUI project.
72
+ - **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.
73
+
74
+ ## Conversion
75
+
76
+ - Script: [`convert_adaface.py`](https://github.com/john-rocky/CoreML-Models/blob/master/conversion_scripts/convert_adaface.py)
77
+ - 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)
78
+ - Model index: [CoreML-Models](https://github.com/john-rocky/CoreML-Models)
79
+
80
+ ## License
81
+
82
+ The conversion inherits the upstream license: **MIT**.
83
+
84
+ ## Credits
85
+
86
+ - Upstream authors: [mk-minchul/AdaFace](https://github.com/mk-minchul/AdaFace), 2022
87
+ - Core ML conversion: john-rocky (Daisuke Majima)