mlboydaisuke commited on
Commit
14af8db
·
verified ·
1 Parent(s): 52edb08

Add model card

Browse files
Files changed (1) hide show
  1. README.md +85 -0
README.md ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ library_name: coreml
4
+ pipeline_tag: image-to-image
5
+ tags:
6
+ - coreml
7
+ - core-ml
8
+ - ios
9
+ - macos
10
+ - apple
11
+ - on-device
12
+ - face-restoration
13
+ - gan
14
+ - arxiv:2101.04061
15
+ ---
16
+
17
+ # GFPGAN — Core ML
18
+
19
+ *Face Restoration, 2021*
20
+
21
+ Blind face restoration with generative facial prior. Restores degraded face photos to high quality. 512×512 input/output.
22
+
23
+ Core ML conversion of [TencentARC/GFPGAN](https://github.com/TencentARC/GFPGAN) 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.
24
+
25
+ | | |
26
+ |---|---|
27
+ | Task | image to image |
28
+ | Upstream | [TencentARC/GFPGAN](https://github.com/TencentARC/GFPGAN) |
29
+ | Packages | 1 |
30
+ | Download size | 298 MB |
31
+ | Minimum iOS | 17.0 |
32
+ | Peak RAM | ~600 MB |
33
+
34
+ ## Files
35
+
36
+ | File | Size | Compute units | SHA-256 |
37
+ |---|---:|---|---|
38
+ | `GFPGAN.mlpackage.zip` | 298 MB | `all` | `929d0ab30fa739bd…` |
39
+ | **Total** | **298 MB** | | |
40
+
41
+ `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.
42
+
43
+ ## Download
44
+
45
+ ```bash
46
+ hf download mlboydaisuke/coreml-zoo --include "gfpgan/*" --local-dir ./gfpgan
47
+ unzip './gfpgan/gfpgan/*.zip' -d ./gfpgan
48
+ ```
49
+
50
+ ## Use in Swift
51
+
52
+ ```swift
53
+ import CoreML
54
+
55
+ let config = MLModelConfiguration()
56
+ config.computeUnits = .all // as converted — see the table above
57
+
58
+ // Unzip the .mlpackage, drop it into your Xcode target and Xcode compiles it
59
+ // at build time:
60
+ let model = try GFPGAN(configuration: config)
61
+
62
+ // ...or compile a downloaded .mlpackage at runtime:
63
+ let compiled = try await MLModel.compileModel(at: mlpackageURL)
64
+ let model = try MLModel(contentsOf: compiled, configuration: config)
65
+ ```
66
+
67
+ ## Demo
68
+
69
+ - **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.
70
+
71
+ ## Conversion
72
+
73
+ - 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)
74
+ - Model index: [CoreML-Models](https://github.com/john-rocky/CoreML-Models)
75
+
76
+ ## License
77
+
78
+ The conversion inherits the upstream license: **Apache-2.0**.
79
+
80
+ > Apache-2.0 except the third-party components (StyleGAN2 / NVIDIA) listed in the upstream LICENSE.
81
+
82
+ ## Credits
83
+
84
+ - Upstream authors: [TencentARC/GFPGAN](https://github.com/TencentARC/GFPGAN), 2021
85
+ - Core ML conversion: john-rocky (Daisuke Majima)