xay2001 commited on
Commit
5aa5943
·
verified ·
1 Parent(s): e0a4c96

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +172 -0
README.md ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: onnxruntime
3
+ pipeline_tag: image-to-image
4
+ tags:
5
+ - ic-light
6
+ - image-relighting
7
+ - onnx
8
+ - android
9
+ - mobile
10
+ - nnapi
11
+ license: other
12
+ ---
13
+
14
+ # IC-Light Android ONNX
15
+
16
+ An ONNX model package optimized for running IC-Light image relighting locally on Android devices.
17
+
18
+ This repository provides the models required by the IC-Light Android app, including foreground extraction, text encoding, VAE encoding and decoding, and the IC-Light UNet. The models run with ONNX Runtime Android and use NNAPI to prioritize the NPU, DSP, or GPU available on the device.
19
+
20
+ ## Features
21
+
22
+ - On-device image relighting
23
+ - Text-guided lighting control
24
+ - Directional lighting control
25
+ - RMBG foreground extraction
26
+ - 512×512 image processing
27
+ - FP16 inference
28
+ - Android NNAPI acceleration
29
+ - Automatic CPU fallback
30
+ - In-app model download
31
+ - Local folder import
32
+
33
+ ## Model Files
34
+
35
+ All files must remain in the repository root:
36
+
37
+ | File | Purpose | Approximate size |
38
+ |---|---|---:|
39
+ | `iclight_clip.onnx` | CLIP text encoder graph | 167 KB |
40
+ | `iclight_clip.onnx.data` | CLIP weights | 235 MB |
41
+ | `iclight_vae_enc.onnx` | VAE encoder graph | 108 KB |
42
+ | `iclight_vae_enc.onnx.data` | VAE encoder weights | 65 MB |
43
+ | `iclight_unet_fc.onnx` | IC-Light UNet graph | 903 KB |
44
+ | `iclight_unet_fc.onnx.data` | IC-Light UNet weights | 1.6 GB |
45
+ | `iclight_vae_dec.onnx` | VAE decoder graph | 138 KB |
46
+ | `iclight_vae_dec.onnx.data` | VAE decoder weights | 94 MB |
47
+ | `rmbg.onnx` | RMBG foreground extraction graph | 700 KB |
48
+ | `rmbg.onnx.data` | RMBG weights | 168 MB |
49
+
50
+ The complete model package is approximately 2.2 GB.
51
+
52
+ Each `.onnx` file and its corresponding `.onnx.data` file must remain in the same directory. Do not rename them.
53
+
54
+ ## Automatic Download in the Android App
55
+
56
+ Enter the following Hugging Face repository ID in the IC-Light Android app:
57
+
58
+ ```text
59
+ xay2001/ic-light-android
60
+ ```
61
+
62
+ Then select:
63
+
64
+ ```text
65
+ Download Models
66
+ ```
67
+
68
+ The app supports:
69
+
70
+ - Download progress reporting
71
+ - Skipping completed files
72
+ - Resuming incomplete downloads
73
+ - Exact file-size validation
74
+ - Automatic model initialization after download
75
+
76
+ Models are stored at:
77
+
78
+ ```text
79
+ /sdcard/Android/data/com.example.ic_light/files/iclight_models/
80
+ ```
81
+
82
+ At least 4–5 GB of free storage is recommended.
83
+
84
+ ## Local Folder Import
85
+
86
+ You may also download the complete repository to your phone and select:
87
+
88
+ ```text
89
+ Import from Local Folder
90
+ ```
91
+
92
+ Choose the directory containing all 10 model files. The app verifies that the required files are present before importing them into its private model directory.
93
+
94
+ ## Inference Pipeline
95
+
96
+ ```text
97
+ Input image
98
+ ↓
99
+ RMBG foreground extraction
100
+ ↓
101
+ Foreground compositing on a neutral background
102
+ ↓
103
+ VAE encoder
104
+ ↓
105
+ CLIP prompt encoder
106
+ ↓
107
+ IC-Light UNet denoising
108
+ ↓
109
+ VAE decoder
110
+ ↓
111
+ Relighted image
112
+ ```
113
+
114
+ ## Android Hardware Acceleration
115
+
116
+ The app requests hardware acceleration through the ONNX Runtime NNAPI Execution Provider:
117
+
118
+ - FP16 inference is enabled.
119
+ - On Android 10 and newer, the NNAPI reference CPU implementation is disabled.
120
+ - NNAPI prioritizes the NPU, DSP, or GPU exposed by the device.
121
+ - Unsupported operations fall back to ONNX Runtime CPU kernels.
122
+ - If NNAPI initialization fails, the app automatically falls back to CPU execution.
123
+
124
+ Actual NPU usage depends on the phone’s SoC, Android version, NNAPI driver, and supported model operators.
125
+
126
+ The Android emulator cannot use the Mac Metal GPU for model inference. It is suitable for functional testing but not for measuring NPU performance.
127
+
128
+ ## Recommended Device Requirements
129
+
130
+ - Android 10 or newer
131
+ - ARM64 processor
132
+ - At least 8 GB of RAM
133
+ - At least 4–5 GB of free storage
134
+ - A Snapdragon or MediaTek platform with NNAPI support
135
+
136
+ The IC-Light UNet is relatively large. Entry-level and mid-range devices may experience long loading times, high memory usage, or slow inference.
137
+
138
+ ## Direct Downloads
139
+
140
+ Individual files can be downloaded using:
141
+
142
+ ```text
143
+ https://huggingface.co/xay2001/ic-light-android/resolve/main/<filename>?download=true
144
+ ```
145
+
146
+ Example:
147
+
148
+ ```text
149
+ https://huggingface.co/xay2001/ic-light-android/resolve/main/rmbg.onnx?download=true
150
+ ```
151
+
152
+ ## Upstream Projects
153
+
154
+ This model package is based on or references the following projects:
155
+
156
+ - [IC-Light](https://github.com/lllyasviel/IC-Light)
157
+ - [ONNX Runtime](https://onnxruntime.ai/)
158
+ - [Local Dream](https://github.com/xororz/local-dream)
159
+
160
+ Thanks to the original authors and the open-source community.
161
+
162
+ ## Licensing and Usage
163
+
164
+ This repository contains model artifacts converted and organized for Android inference. It does not relicense upstream models or software.
165
+
166
+ The IC-Light source repository is distributed under the Apache License 2.0. However, the underlying diffusion model, CLIP model, RMBG model, training data, and model weights may each be subject to separate licenses and usage restrictions.
167
+
168
+ Before using, modifying, or redistributing these files, review and comply with all applicable upstream licenses. Until commercial rights for every dependency are confirmed, research, educational, and non-commercial use is recommended.
169
+
170
+ ## Disclaimer
171
+
172
+ Model outputs may be inaccurate, inappropriate, or biased. Users are responsible for reviewing generated results and for ensuring that deployment and usage comply with applicable laws, licenses, and policies.