File size: 5,284 Bytes
5aa5943
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
---
library_name: onnxruntime
pipeline_tag: image-to-image
tags:
  - ic-light
  - image-relighting
  - onnx
  - android
  - mobile
  - nnapi
license: other
---

# IC-Light Android ONNX

An ONNX model package optimized for running IC-Light image relighting locally on Android devices.

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.

## Features

- On-device image relighting
- Text-guided lighting control
- Directional lighting control
- RMBG foreground extraction
- 512×512 image processing
- FP16 inference
- Android NNAPI acceleration
- Automatic CPU fallback
- In-app model download
- Local folder import

## Model Files

All files must remain in the repository root:

| File | Purpose | Approximate size |
|---|---|---:|
| `iclight_clip.onnx` | CLIP text encoder graph | 167 KB |
| `iclight_clip.onnx.data` | CLIP weights | 235 MB |
| `iclight_vae_enc.onnx` | VAE encoder graph | 108 KB |
| `iclight_vae_enc.onnx.data` | VAE encoder weights | 65 MB |
| `iclight_unet_fc.onnx` | IC-Light UNet graph | 903 KB |
| `iclight_unet_fc.onnx.data` | IC-Light UNet weights | 1.6 GB |
| `iclight_vae_dec.onnx` | VAE decoder graph | 138 KB |
| `iclight_vae_dec.onnx.data` | VAE decoder weights | 94 MB |
| `rmbg.onnx` | RMBG foreground extraction graph | 700 KB |
| `rmbg.onnx.data` | RMBG weights | 168 MB |

The complete model package is approximately 2.2 GB.

Each `.onnx` file and its corresponding `.onnx.data` file must remain in the same directory. Do not rename them.

## Automatic Download in the Android App

Enter the following Hugging Face repository ID in the IC-Light Android app:

```text
xay2001/ic-light-android
```

Then select:

```text
Download Models
```

The app supports:

- Download progress reporting
- Skipping completed files
- Resuming incomplete downloads
- Exact file-size validation
- Automatic model initialization after download

Models are stored at:

```text
/sdcard/Android/data/com.example.ic_light/files/iclight_models/
```

At least 4–5 GB of free storage is recommended.

## Local Folder Import

You may also download the complete repository to your phone and select:

```text
Import from Local Folder
```

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.

## Inference Pipeline

```text
Input image
   ↓
RMBG foreground extraction
   ↓
Foreground compositing on a neutral background
   ↓
VAE encoder
   ↓
CLIP prompt encoder
   ↓
IC-Light UNet denoising
   ↓
VAE decoder
   ↓
Relighted image
```

## Android Hardware Acceleration

The app requests hardware acceleration through the ONNX Runtime NNAPI Execution Provider:

- FP16 inference is enabled.
- On Android 10 and newer, the NNAPI reference CPU implementation is disabled.
- NNAPI prioritizes the NPU, DSP, or GPU exposed by the device.
- Unsupported operations fall back to ONNX Runtime CPU kernels.
- If NNAPI initialization fails, the app automatically falls back to CPU execution.

Actual NPU usage depends on the phone’s SoC, Android version, NNAPI driver, and supported model operators.

The Android emulator cannot use the Mac Metal GPU for model inference. It is suitable for functional testing but not for measuring NPU performance.

## Recommended Device Requirements

- Android 10 or newer
- ARM64 processor
- At least 8 GB of RAM
- At least 4–5 GB of free storage
- A Snapdragon or MediaTek platform with NNAPI support

The IC-Light UNet is relatively large. Entry-level and mid-range devices may experience long loading times, high memory usage, or slow inference.

## Direct Downloads

Individual files can be downloaded using:

```text
https://huggingface.co/xay2001/ic-light-android/resolve/main/<filename>?download=true
```

Example:

```text
https://huggingface.co/xay2001/ic-light-android/resolve/main/rmbg.onnx?download=true
```

## Upstream Projects

This model package is based on or references the following projects:

- [IC-Light](https://github.com/lllyasviel/IC-Light)
- [ONNX Runtime](https://onnxruntime.ai/)
- [Local Dream](https://github.com/xororz/local-dream)

Thanks to the original authors and the open-source community.

## Licensing and Usage

This repository contains model artifacts converted and organized for Android inference. It does not relicense upstream models or software.

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.

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.

## Disclaimer

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.