mlboydaisuke commited on
Commit
937aead
·
verified ·
1 Parent(s): 2585161

Add model card

Browse files
Files changed (1) hide show
  1. README.md +91 -0
README.md ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ license_name: bria-rmbg-1.4
4
+ license_link: https://huggingface.co/briaai/RMBG-1.4
5
+ library_name: coreml
6
+ pipeline_tag: image-segmentation
7
+ base_model: briaai/RMBG-1.4
8
+ base_model_relation: quantized
9
+ tags:
10
+ - coreml
11
+ - core-ml
12
+ - ios
13
+ - macos
14
+ - apple
15
+ - on-device
16
+ - background-removal
17
+ - salient-object-detection
18
+ ---
19
+
20
+ # RMBG-1.4 — Core ML
21
+
22
+ *BRIA AI, 2023*
23
+
24
+ High-quality background removal. Outputs foreground with alpha mask. 1024×1024 input.
25
+
26
+ Core ML conversion of [briaai/RMBG-1.4](https://huggingface.co/briaai/RMBG-1.4) 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 segmentation |
31
+ | Upstream | [briaai/RMBG-1.4](https://huggingface.co/briaai/RMBG-1.4) |
32
+ | Packages | 1 |
33
+ | Download size | 37 MB |
34
+ | Minimum iOS | 17.0 |
35
+ | Peak RAM | ~300 MB |
36
+
37
+ ## Files
38
+
39
+ | File | Size | Compute units | SHA-256 |
40
+ |---|---:|---|---|
41
+ | `RMBG_1_4.mlpackage.zip` | 37 MB | `cpuOnly` | `a80dbb5f04c922a8…` |
42
+ | **Total** | **37 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 "rmbg/*" --local-dir ./rmbg_1_4
50
+ unzip './rmbg_1_4/rmbg/*.zip' -d ./rmbg_1_4
51
+ ```
52
+
53
+ ## Use in Swift
54
+
55
+ ```swift
56
+ import CoreML
57
+
58
+ let config = MLModelConfiguration()
59
+ config.computeUnits = .cpuOnly // 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 RMBG_1_4(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/RMBGDemo`](https://github.com/john-rocky/CoreML-Models/tree/master/sample_apps/RMBGDemo), 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_rmbg.py`](https://github.com/john-rocky/CoreML-Models/blob/master/conversion_scripts/convert_rmbg.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: **Bria RMBG-1.4 License**.
84
+ See [https://huggingface.co/briaai/RMBG-1.4](https://huggingface.co/briaai/RMBG-1.4).
85
+
86
+ > Non-commercial without a separate agreement with Bria.
87
+
88
+ ## Credits
89
+
90
+ - Upstream authors: [briaai/RMBG-1.4](https://huggingface.co/briaai/RMBG-1.4), 2023
91
+ - Core ML conversion: john-rocky (Daisuke Majima)