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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: agpl-3.0
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
- zh
|
| 6 |
+
pipeline_tag: zero-shot-image-classification
|
| 7 |
+
tags:
|
| 8 |
+
- immich
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
# Immich
|
| 13 |
+
|
| 14 |
+
Immich is an open-source intelligent photo album application that allows you to easily back up, organize, and manage your photos on your own server.
|
| 15 |
+
Immich helps you browse, search, and organize your photos and videos with ease, without compromising your privacy.
|
| 16 |
+
For the original project's official website and GitHub repository, please visit
|
| 17 |
+
|
| 18 |
+
- https://immich.app/
|
| 19 |
+
- https://github.com/immich-app/immich.
|
| 20 |
+
|
| 21 |
+
The goal of our project is to demonstrate deploying Immich on Raspberry Pi 5 or other x86-based main control platforms, extended with AX650N/AX8850 AI acceleration cards.
|
| 22 |
+
By leveraging these accelerator cards for computational offloading, we aim to enhance Immich's efficiency in processing photos.
|
| 23 |
+
Through this example, we hope to guide Immich users in expanding high-efficiency deployments of Immich across a broader range of hardware platforms by adding dedicated AI accelerator cards.
|
| 24 |
+
|
| 25 |
+
## Reference Links
|
| 26 |
+
|
| 27 |
+
We have open-sourced the modifications to the Immich codebase on GitHub: https://github.com/ZHEQIUSHUI/immich
|
| 28 |
+
|
| 29 |
+
## Support Platform
|
| 30 |
+
|
| 31 |
+
- AX650/AX8850
|
| 32 |
+
- AX650N DEMO Board
|
| 33 |
+
- [M4N-Dock(η±θ―ζ΄ΎPro)](https://wiki.sipeed.com/hardware/zh/maixIV/m4ndock/m4ndock.html)
|
| 34 |
+
- [M.2 Accelerator card](https://axcl-docs.readthedocs.io/zh-cn/latest/doc_guide_hardware.html)
|
| 35 |
+
|
| 36 |
+
## Support Models
|
| 37 |
+
|
| 38 |
+
In the Immich project, the CLIP model is the primary component with high computational demands for smart album features. To further improve accuracy,
|
| 39 |
+
we have adopted larger-parameter models: **CLIP-L/14-336** and **CN-CLIP-L/14-336**. Precompiled models optimized for Axera AI accelerator cards are available at the following links:
|
| 40 |
+
|
| 41 |
+
- [CLIP-L/14-336 (English)](https://huggingface.co/AXERA-TECH/ViT-L-14-336__axera)
|
| 42 |
+
- [CN-CLIP-L/14-336 (Chinese)](https://huggingface.co/AXERA-TECH/ViT-L-14-336-CN__axera)
|
| 43 |
+
|
| 44 |
+
### Performance Benchmarks
|
| 45 |
+
|
| 46 |
+
| Model | Input Shape | Latency (ms) | CMM Usage (MB) |
|
| 47 |
+
|-------|-------------|--------------|----------------|
|
| 48 |
+
| `cnclip_vit_l14_336px_vision_u16u8.axmodel` | 1 x 3 x 336 x 336 | 88.475 ms | 304 MB |
|
| 49 |
+
| `cnclip_vit_l14_336px_text_u16.axmodel` | 1 x 52 | 4.576 ms | 122 MB |
|
| 50 |
+
|
| 51 |
+
These models enable significantly faster image and text embedding generation on Axera-powered hardware,
|
| 52 |
+
greatly enhancing Immich's photo tagging, search, and organization capabilities while maintaining high accuracy.
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
## How to use
|
| 56 |
+
|
| 57 |
+
We use the Raspberry Pi 5βa platform with one of the largest user basesβas our example for demonstration.
|
| 58 |
+
However, the setup process can also be referenced and adapted for other aarch64 or x86 host platforms.
|
| 59 |
+
|
| 60 |
+
### Hardware Setup
|
| 61 |
+
Ensure the following hardware is properly configured:
|
| 62 |
+
|
| 63 |
+
A Raspberry Pi 5 with an M.2 AI accelerator card (e.g., AX650N) correctly installed.
|
| 64 |
+
Use a compatible M.2 HAT+ expansion board that supports 2280-length cards (most AX650 cards are 2280).
|
| 65 |
+
Confirm that the PCIe connection is active by checking with lspci:
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
```bash
|
| 69 |
+
lspci | grep -i axera
|
| 70 |
+
```
|
| 71 |
+
|
| 72 |
+
Expected output:
|
| 73 |
+
|
| 74 |
+
```text
|
| 75 |
+
0001:01:00.0 Multimedia controller: Axera Semiconductor Co., Ltd Device 0650 (rev 01)
|
| 76 |
+
```
|
| 77 |
+
|
| 78 |
+
### Software Environment Setup
|
| 79 |
+
Follow these steps to prepare the software environment on Raspberry Pi 5 (or other supported platforms):
|
| 80 |
+
|
| 81 |
+
#### Install AXCL Driver (Host-side)
|
| 82 |
+
Refer to the official AXCL documentation for detailed instructions:
|
| 83 |
+
|
| 84 |
+
[AXCL Setup Guide - Raspberry Pi 5](https://axcl-docs.readthedocs.io/zh-cn/latest/doc_guide_setup.html#raspberry-pi-5)
|
| 85 |
+
|
| 86 |
+
Key steps include:
|
| 87 |
+
|
| 88 |
+
Update Raspberry Pi firmware and enable PCIe:
|
| 89 |
+
```bash
|
| 90 |
+
sudo rpi-eeprom-update -a
|
| 91 |
+
```
|
| 92 |
+
|
| 93 |
+
Modify /boot/firmware/config.txt to enable PCIe:
|
| 94 |
+
|
| 95 |
+
```
|
| 96 |
+
dtparam=pciex1
|
| 97 |
+
[all]
|
| 98 |
+
dtoverlay=pciex1-compat-pi5,no-mip
|
| 99 |
+
```
|
| 100 |
+
|
| 101 |
+
Reboot and verify device detection using lspci.
|
| 102 |
+
Install the AXCL .deb package:
|
| 103 |
+
```bash
|
| 104 |
+
sudo apt install ./axcl_host_aarch64_Vxxx.deb
|
| 105 |
+
```
|
| 106 |
+
|
| 107 |
+
Source environment variables:
|
| 108 |
+
```bash
|
| 109 |
+
source /etc/profile
|
| 110 |
+
```
|
| 111 |
+
|
| 112 |
+
#### Install PyAXEngine (Python NPU Runtime)
|
| 113 |
+
Refer to the PyAXEngine documentation:
|
| 114 |
+
|
| 115 |
+
[PyAXEngine GitHub](https://github.com/AXERA-TECH/pyaxengine)
|
| 116 |
+
|
| 117 |
+
Install the Python wheel package for NPU inference:
|
| 118 |
+
|
| 119 |
+
```bash
|
| 120 |
+
pip install axengine-x.x.x-py3-none-any.whl
|
| 121 |
+
```
|
| 122 |
+
|
| 123 |
+
#### Verification: Check Installation Status
|
| 124 |
+
After completing the setup, run the following command to verify that the accelerator card is recognized and functioning:
|
| 125 |
+
|
| 126 |
+
```bash
|
| 127 |
+
axcl-smi
|
| 128 |
+
```
|
| 129 |
+
|
| 130 |
+
You should see output similar to:
|
| 131 |
+
|
| 132 |
+
```text
|
| 133 |
+
(base) axera@raspberrypi:~/samples/immich $ axcl-smi
|
| 134 |
+
+------------------------------------------------------------------------------------------------+
|
| 135 |
+
| AXCL-SMI V3.6.4_20250819020149 Driver V3.6.4_20250819020149 |
|
| 136 |
+
+-----------------------------------------+--------------+---------------------------------------+
|
| 137 |
+
| Card Name Firmware | Bus-Id | Memory-Usage |
|
| 138 |
+
| Fan Temp Pwr:Usage/Cap | CPU NPU | CMM-Usage |
|
| 139 |
+
|=========================================+==============+=======================================|
|
| 140 |
+
| 0 AX650N V3.6.4 | 0001:01:00.0 | 164 MiB / 945 MiB |
|
| 141 |
+
| -- 41C -- / -- | 1% 0% | 18 MiB / 7040 MiB |
|
| 142 |
+
+-----------------------------------------+--------------+---------------------------------------+
|
| 143 |
+
|
| 144 |
+
+------------------------------------------------------------------------------------------------+
|
| 145 |
+
| Processes: |
|
| 146 |
+
| Card PID Process Name NPU Memory Usage |
|
| 147 |
+
|================================================================================================|
|
| 148 |
+
```
|
| 149 |
+
If you see the AX650N card listed with valid memory usage, your hardware and software setup is successful.
|
| 150 |
+
|
| 151 |
+
### Setup
|
| 152 |
+
|
| 153 |
+
Download
|
| 154 |
+
|
| 155 |
+
```
|
| 156 |
+
hf download AXERA-TECH/immich --local-dir AXERA-TECH/immich
|
| 157 |
+
cd AXERA-TECH/immich
|
| 158 |
+
```
|
| 159 |
+
|
| 160 |
+
#### Setup immich server
|
| 161 |
+
|
| 162 |
+
```
|
| 163 |
+
sudo docker load -i ax-immich-server-aarch64.tar.gz
|
| 164 |
+
unzip docker-deploy.zip
|
| 165 |
+
cp example.env .env
|
| 166 |
+
sudo docker compose -f docker-compose.yml -f docker-compose.override.yml up -d
|
| 167 |
+
```
|
| 168 |
+
|
| 169 |
+
the following is
|
| 170 |
+
|
| 171 |
+
```
|
| 172 |
+
(immich) axera@raspberrypi:~/samples/immich $ sudo docker compose -f docker-compose.yml -f docker-compose.override.yml up -d
|
| 173 |
+
WARN[0000] /home/axera/samples/immich/docker-compose.override.yml: the attribute `version` is obsolete, it will be ignored, p lease remove it to avoid potential confusion
|
| 174 |
+
[+] Running 3/3
|
| 175 |
+
β Container immich_redis Running 0.0s
|
| 176 |
+
β Container immich_postgres Started 1.8s
|
| 177 |
+
β Container immich_server Started 1.3s
|
| 178 |
+
```
|
| 179 |
+
|
| 180 |
+
#### Download clip axmodel
|
| 181 |
+
|
| 182 |
+
```
|
| 183 |
+
cd ~/.cache/immich_ml/clip
|
| 184 |
+
hf download AXERA-TECH/ViT-L-14-336-CN__axera --local-dir ViT-L-14-336-CN__axera
|
| 185 |
+
```
|
| 186 |
+
|
| 187 |
+
the following is
|
| 188 |
+
|
| 189 |
+
```
|
| 190 |
+
(base) axera@raspberrypi:~/.cache/immich_ml/clip $ tree
|
| 191 |
+
.
|
| 192 |
+
βββ ViT-L-14-336-CN__axera
|
| 193 |
+
βββ config.json
|
| 194 |
+
βββ textual
|
| 195 |
+
βΒ Β βββ merges.txt
|
| 196 |
+
βΒ Β βββ model.axmodel
|
| 197 |
+
βΒ Β βββ special_tokens_map.json
|
| 198 |
+
βΒ Β βββ tokenizer_config.json
|
| 199 |
+
βΒ Β βββ tokenizer.json
|
| 200 |
+
βΒ Β βββ vocab.json
|
| 201 |
+
βββ visual
|
| 202 |
+
βββ model.axmodel
|
| 203 |
+
βββ preprocess_cfg.json
|
| 204 |
+
```
|
| 205 |
+
|
| 206 |
+
#### Setup ml_immich
|
| 207 |
+
|
| 208 |
+
Run the HTTP service of immich independently.
|
| 209 |
+
|
| 210 |
+
```
|
| 211 |
+
pip install -r requirements.txt
|
| 212 |
+
pip install immich_ml-1.129.0-py3-none-any.whl
|
| 213 |
+
python -m immich_ml
|
| 214 |
+
```
|
| 215 |
+
|
| 216 |
+
the following is
|
| 217 |
+
|
| 218 |
+
```
|
| 219 |
+
(immich) axera@raspberrypi:~/samples/immich $ python -m immich_ml
|
| 220 |
+
[10/08/25 11:11:40] INFO Starting gunicorn 23.0.0
|
| 221 |
+
[10/08/25 11:11:40] INFO Listening at: http://[::]:3003 (3145057)
|
| 222 |
+
[10/08/25 11:11:40] INFO Using worker: immich_ml.config.CustomUvicornWorker
|
| 223 |
+
[10/08/25 11:11:40] INFO Booting worker with pid: 3145062
|
| 224 |
+
[INFO] Available providers: ['AXCLRTExecutionProvider']
|
| 225 |
+
```
|
| 226 |
+
|
| 227 |
+
### Run
|
| 228 |
+
|
| 229 |
+
If the above setup completes successfully, and assuming your Raspberry Pi's IP address is 10.126.33.241,
|
| 230 |
+
you can access the Immich login page by opening a browser on any device within the same local network and navigating to
|
| 231 |
+
|
| 232 |
+
```
|
| 233 |
+
http://10.126.33.241:2283/
|
| 234 |
+
```
|
| 235 |
+
|
| 236 |
+

|
| 237 |
+
|
| 238 |
+
On first access, you will be prompted to register a new user account. Don't worry β everything runs offline on your Raspberry Pi.
|
| 239 |
+
If this is just for a demo or testing purpose, feel free to enter any username and password.
|
| 240 |
+
|
| 241 |
+
### Enable the Smart Search
|
| 242 |
+
|
| 243 |
+

|
| 244 |
+
|
| 245 |
+

|
| 246 |
+
|
| 247 |
+

|
| 248 |
+
|
| 249 |
+

|
| 250 |
+
|
| 251 |
+

|
| 252 |
+
|
| 253 |
+

|
| 254 |
+
|
| 255 |
+

|
| 256 |
+
|
| 257 |
+
## immich docs
|
| 258 |
+
|
| 259 |
+
For more usage information about Immich, please refer to the [Immich documentation](https://docs.immich.app/overview/quick-start/).
|
| 260 |
+
|