Add model card
Browse files
README.md
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: other
|
| 3 |
+
license_name: non-commercial-research
|
| 4 |
+
license_link: https://github.com/WuZongWei6/Pixelization
|
| 5 |
+
library_name: coreml
|
| 6 |
+
pipeline_tag: image-to-image
|
| 7 |
+
tags:
|
| 8 |
+
- coreml
|
| 9 |
+
- core-ml
|
| 10 |
+
- ios
|
| 11 |
+
- macos
|
| 12 |
+
- apple
|
| 13 |
+
- on-device
|
| 14 |
+
- pixel-art
|
| 15 |
+
- style-transfer
|
| 16 |
+
- siggraph-asia-2022
|
| 17 |
+
---
|
| 18 |
+
|
| 19 |
+
# Pixelization — Core ML
|
| 20 |
+
|
| 21 |
+
*Cell-Controllable Pixel Art, SIGGRAPH Asia 2022*
|
| 22 |
+
|
| 23 |
+
Turn any photo into pixel art. Aliasing-aware generator + anti-alias refinement. Drag the cell-size slider (2–8) to change pixel block size — the network runs once per photo, the slider only re-snaps the grid. 512×512 input. Non-commercial research use only.
|
| 24 |
+
|
| 25 |
+
Core ML conversion of [WuZongWei6/Pixelization](https://github.com/WuZongWei6/Pixelization) 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.
|
| 26 |
+
|
| 27 |
+
| | |
|
| 28 |
+
|---|---|
|
| 29 |
+
| Task | image to image |
|
| 30 |
+
| Upstream | [WuZongWei6/Pixelization](https://github.com/WuZongWei6/Pixelization) |
|
| 31 |
+
| Packages | 1 |
|
| 32 |
+
| Download size | 35 MB |
|
| 33 |
+
| Minimum iOS | 17.0 |
|
| 34 |
+
| Peak RAM | ~250 MB |
|
| 35 |
+
|
| 36 |
+
## Files
|
| 37 |
+
|
| 38 |
+
| File | Size | Compute units | SHA-256 |
|
| 39 |
+
|---|---:|---|---|
|
| 40 |
+
| `Pixelization_512.mlpackage.zip` | 35 MB | `cpuAndNeuralEngine` | `f9eac7e8fa6487a4…` |
|
| 41 |
+
| **Total** | **35 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 "pixelization/*" --local-dir ./pixelization
|
| 49 |
+
unzip './pixelization/pixelization/*.zip' -d ./pixelization
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
+
## Use in Swift
|
| 53 |
+
|
| 54 |
+
```swift
|
| 55 |
+
import CoreML
|
| 56 |
+
|
| 57 |
+
let config = MLModelConfiguration()
|
| 58 |
+
config.computeUnits = .cpuAndNeuralEngine // 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 Pixelization_512(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/PixelizationDemo`](https://github.com/john-rocky/CoreML-Models/tree/master/sample_apps/PixelizationDemo), 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_pixelization.py`](https://github.com/john-rocky/CoreML-Models/blob/master/conversion_scripts/convert_pixelization.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: **Research use only**.
|
| 83 |
+
See [https://github.com/WuZongWei6/Pixelization](https://github.com/WuZongWei6/Pixelization).
|
| 84 |
+
|
| 85 |
+
> Upstream ships no LICENSE file; the paper repo states research use only.
|
| 86 |
+
|
| 87 |
+
## Credits
|
| 88 |
+
|
| 89 |
+
- Upstream authors: [WuZongWei6/Pixelization](https://github.com/WuZongWei6/Pixelization), 2022
|
| 90 |
+
- Core ML conversion: john-rocky (Daisuke Majima)
|