gablilli qqc1989 commited on
Commit
13a6f70
·
0 Parent(s):

Duplicate from AXERA-TECH/immich

Browse files

Co-authored-by: Qi Tang <qqc1989@users.noreply.huggingface.co>

.gitattributes ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ immich_ml-1.129.0-py3-none-any.whl filter=lfs diff=lfs merge=lfs -text
37
+ asset/axcl-status.png filter=lfs diff=lfs merge=lfs -text
38
+ asset/deduplication.png filter=lfs diff=lfs merge=lfs -text
39
+ asset/login.png filter=lfs diff=lfs merge=lfs -text
40
+ asset/mission-01.png filter=lfs diff=lfs merge=lfs -text
41
+ asset/settings-machine-learning-01.png filter=lfs diff=lfs merge=lfs -text
42
+ asset/settings-machine-learning-02.png filter=lfs diff=lfs merge=lfs -text
43
+ asset/settings.png filter=lfs diff=lfs merge=lfs -text
44
+ asset/text-to-image-retrieva-01.png filter=lfs diff=lfs merge=lfs -text
45
+ asset/text-to-image-retrieval-02.png filter=lfs diff=lfs merge=lfs -text
46
+ asset/rpi5-with-m.2-card.png filter=lfs diff=lfs merge=lfs -text
47
+ asset/immich-logo.png filter=lfs diff=lfs merge=lfs -text
48
+ asset/immich-screenshots.png filter=lfs diff=lfs merge=lfs -text
49
+ asset/text-to-image-retrieval-01.png filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,277 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
15
+ <p align="center">
16
+ <img src="asset/immich-logo.png" width="300" title="Login With Custom URL">
17
+ </p>
18
+ <h3 align="center">High performance self-hosted photo and video management solution</h3>
19
+ <br/>
20
+ <a href="https://immich.app">
21
+ <img src="asset/immich-screenshots.png" title="Main Screenshot">
22
+ </a>
23
+ <br/>
24
+ <p align="center">
25
+
26
+ 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.
27
+ Immich helps you browse, search, and organize your photos and videos with ease, without compromising your privacy.
28
+ For the original project's official website and GitHub repository, please visit
29
+
30
+ - https://immich.app/
31
+ - https://github.com/immich-app/immich.
32
+
33
+ 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.
34
+ By leveraging these accelerator cards for computational offloading, we aim to enhance Immich's efficiency in processing photos.
35
+ 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.
36
+
37
+ ## Reference Links
38
+
39
+ We have open-sourced the modifications to the Immich codebase on GitHub: https://github.com/ZHEQIUSHUI/immich
40
+
41
+ ## Support Platform
42
+
43
+ - AX650/AX8850
44
+ - AX650N DEMO Board
45
+ - [M4N-Dock(爱芯派Pro)](https://wiki.sipeed.com/hardware/zh/maixIV/m4ndock/m4ndock.html)
46
+ - [M.2 Accelerator card](https://axcl-docs.readthedocs.io/zh-cn/latest/doc_introduction.html#id4)
47
+
48
+ ## Support Models
49
+
50
+ In the Immich project, the CLIP model is the primary component with high computational demands for smart album features. To further improve accuracy,
51
+ 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:
52
+
53
+ - [CLIP-L/14-336 (English)](https://huggingface.co/AXERA-TECH/ViT-L-14-336__axera)
54
+ - [CN-CLIP-L/14-336 (Chinese)](https://huggingface.co/AXERA-TECH/ViT-L-14-336-CN__axera)
55
+
56
+ ### Performance Benchmarks
57
+
58
+ | Model | Input Shape | Latency (ms) | CMM Usage (MB) |
59
+ |-------|-------------|--------------|----------------|
60
+ | `cnclip_vit_l14_336px_vision_u16u8.axmodel` | 1 x 3 x 336 x 336 | 88.475 ms | 304 MB |
61
+ | `cnclip_vit_l14_336px_text_u16.axmodel` | 1 x 52 | 4.576 ms | 122 MB |
62
+
63
+ These models enable significantly faster image and text embedding generation on Axera-powered hardware,
64
+ greatly enhancing Immich's photo tagging, search, and organization capabilities while maintaining high accuracy.
65
+
66
+
67
+ ## How to use
68
+
69
+ We use the Raspberry Pi 5—a platform with one of the largest user bases—as our example for demonstration.
70
+ However, the setup process can also be referenced and adapted for other aarch64 or x86 host platforms.
71
+
72
+ ### Hardware Setup
73
+
74
+ ![](asset/rpi5-with-m.2-card.png)
75
+
76
+ Ensure the following hardware is properly configured:
77
+
78
+ A Raspberry Pi 5 with an M.2 AI accelerator card (e.g., AX650N) correctly installed.
79
+ Use a compatible M.2 HAT+ expansion board that supports 2280-length cards (most AX650 cards are 2280).
80
+ Confirm that the PCIe connection is active by checking with lspci:
81
+
82
+
83
+ ```bash
84
+ lspci | grep -i axera
85
+ ```
86
+
87
+ Expected output:
88
+
89
+ ```text
90
+ 0001:01:00.0 Multimedia controller: Axera Semiconductor Co., Ltd Device 0650 (rev 01)
91
+ ```
92
+
93
+ ### Software Environment Setup
94
+ Follow these steps to prepare the software environment on Raspberry Pi 5 (or other supported platforms):
95
+
96
+ #### Install AXCL Driver (Host-side)
97
+ Refer to the official AXCL documentation for detailed instructions:
98
+
99
+ [AXCL Setup Guide - Raspberry Pi 5](https://axcl-docs.readthedocs.io/zh-cn/latest/doc_guide_setup.html#raspberry-pi-5)
100
+
101
+ Key steps include:
102
+
103
+ Update Raspberry Pi firmware and enable PCIe:
104
+ ```bash
105
+ sudo rpi-eeprom-update -a
106
+ ```
107
+
108
+ Modify /boot/firmware/config.txt to enable PCIe:
109
+
110
+ ```
111
+ dtparam=pciex1
112
+ [all]
113
+ dtoverlay=pciex1-compat-pi5,no-mip
114
+ ```
115
+
116
+ Reboot and verify device detection using lspci.
117
+ Install the AXCL .deb package:
118
+ ```bash
119
+ sudo apt install ./axcl_host_aarch64_Vxxx.deb
120
+ ```
121
+
122
+ Source environment variables:
123
+ ```bash
124
+ source /etc/profile
125
+ ```
126
+
127
+ #### Install PyAXEngine (Python NPU Runtime)
128
+ Refer to the PyAXEngine documentation:
129
+
130
+ [PyAXEngine GitHub](https://github.com/AXERA-TECH/pyaxengine)
131
+
132
+ Install the Python wheel package for NPU inference:
133
+
134
+ ```bash
135
+ pip install axengine-x.x.x-py3-none-any.whl
136
+ ```
137
+
138
+ #### Verification: Check Installation Status
139
+ After completing the setup, run the following command to verify that the accelerator card is recognized and functioning:
140
+
141
+ ```bash
142
+ axcl-smi
143
+ ```
144
+
145
+ You should see output similar to:
146
+
147
+ ```text
148
+ (base) axera@raspberrypi:~/samples/immich $ axcl-smi
149
+ +------------------------------------------------------------------------------------------------+
150
+ | AXCL-SMI V3.6.4_20250819020149 Driver V3.6.4_20250819020149 |
151
+ +-----------------------------------------+--------------+---------------------------------------+
152
+ | Card Name Firmware | Bus-Id | Memory-Usage |
153
+ | Fan Temp Pwr:Usage/Cap | CPU NPU | CMM-Usage |
154
+ |=========================================+==============+=======================================|
155
+ | 0 AX650N V3.6.4 | 0001:01:00.0 | 164 MiB / 945 MiB |
156
+ | -- 41C -- / -- | 1% 0% | 18 MiB / 7040 MiB |
157
+ +-----------------------------------------+--------------+---------------------------------------+
158
+
159
+ +------------------------------------------------------------------------------------------------+
160
+ | Processes: |
161
+ | Card PID Process Name NPU Memory Usage |
162
+ |================================================================================================|
163
+ ```
164
+ If you see the AX650N card listed with valid memory usage, your hardware and software setup is successful.
165
+
166
+ ### Setup
167
+
168
+ Download
169
+
170
+ ```
171
+ hf download AXERA-TECH/immich --local-dir AXERA-TECH/immich
172
+ cd AXERA-TECH/immich
173
+ ```
174
+
175
+ #### Setup immich server
176
+
177
+ ```
178
+ sudo docker load -i ax-immich-server-aarch64.tar.gz
179
+ unzip docker-deploy.zip
180
+ cp example.env .env
181
+ sudo docker compose -f docker-compose.yml -f docker-compose.override.yml up -d
182
+ ```
183
+
184
+ the following is
185
+
186
+ ```
187
+ (immich) axera@raspberrypi:~/samples/immich $ sudo docker compose -f docker-compose.yml -f docker-compose.override.yml up -d
188
+ 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
189
+ [+] Running 3/3
190
+ ✔ Container immich_redis Running 0.0s
191
+ ✔ Container immich_postgres Started 1.8s
192
+ ✔ Container immich_server Started 1.3s
193
+ ```
194
+
195
+ #### Download clip axmodel
196
+
197
+ ```
198
+ cd ~/.cache/immich_ml/clip
199
+ hf download AXERA-TECH/ViT-L-14-336-CN__axera --local-dir ViT-L-14-336-CN__axera
200
+ ```
201
+
202
+ the following is
203
+
204
+ ```
205
+ (base) axera@raspberrypi:~/.cache/immich_ml/clip $ tree
206
+ .
207
+ ├── ViT-L-14-336-CN__axera
208
+ ├── config.json
209
+ ├── textual
210
+ │   ├── merges.txt
211
+ │   ├── model.axmodel
212
+ │   ├── special_tokens_map.json
213
+ │   ├── tokenizer_config.json
214
+ │   ├── tokenizer.json
215
+ │   └── vocab.json
216
+ └── visual
217
+ ├── model.axmodel
218
+ └── preprocess_cfg.json
219
+ ```
220
+
221
+ #### Setup ml_immich
222
+
223
+ Run the HTTP service of immich independently.
224
+
225
+ ```
226
+ pip install -r requirements.txt
227
+ pip install immich_ml-1.129.0-py3-none-any.whl
228
+ python -m immich_ml
229
+ ```
230
+
231
+ the following is
232
+
233
+ ```
234
+ (immich) axera@raspberrypi:~/samples/immich $ python -m immich_ml
235
+ [10/08/25 11:11:40] INFO Starting gunicorn 23.0.0
236
+ [10/08/25 11:11:40] INFO Listening at: http://[::]:3003 (3145057)
237
+ [10/08/25 11:11:40] INFO Using worker: immich_ml.config.CustomUvicornWorker
238
+ [10/08/25 11:11:40] INFO Booting worker with pid: 3145062
239
+ [INFO] Available providers: ['AXCLRTExecutionProvider']
240
+ ```
241
+
242
+ ### Run
243
+
244
+ If the above setup completes successfully, and assuming your Raspberry Pi's IP address is 10.126.33.241,
245
+ you can access the Immich login page by opening a browser on any device within the same local network and navigating to
246
+
247
+ ```
248
+ http://10.126.33.241:2283/
249
+ ```
250
+
251
+ ![](asset/login.png)
252
+
253
+ On first access, you will be prompted to register a new user account. Don't worry — everything runs offline on your Raspberry Pi.
254
+ If this is just for a demo or testing purpose, feel free to enter any username and password.
255
+
256
+ ### Enable the Smart Search
257
+
258
+ ![](asset/settings.png)
259
+
260
+ ![](asset/settings-machine-learning-01.png)
261
+
262
+ ![](asset/settings-machine-learning-02.png)
263
+
264
+ ![](asset/mission-01.png)
265
+
266
+ ![](asset/axcl-status.png)
267
+
268
+ ![](asset/deduplication.png)
269
+
270
+ ![](asset/text-to-image-retrieval-01.png)
271
+
272
+ ![](asset/text-to-image-retrieval-02.png)
273
+
274
+ ## immich docs
275
+
276
+ For more usage information about Immich, please refer to the [Immich documentation](https://docs.immich.app/overview/quick-start/).
277
+
asset/axcl-status.png ADDED

Git LFS Details

  • SHA256: 41211f7764bfc5f4be794fd6230b9e0f754da4615c3f7f87d7a86798dbaece8b
  • Pointer size: 131 Bytes
  • Size of remote file: 245 kB
asset/deduplication.png ADDED

Git LFS Details

  • SHA256: d6a16afd8b1f10c1164e439eae88d1d820198a6dcd37ee45d4006863c1f5fa37
  • Pointer size: 131 Bytes
  • Size of remote file: 255 kB
asset/immich-logo.png ADDED

Git LFS Details

  • SHA256: fd8c4505dae227ce7d9f5a1dfc98bc761cc78c7ed7ece0efad99cd4a1136e724
  • Pointer size: 131 Bytes
  • Size of remote file: 101 kB
asset/immich-screenshots.png ADDED

Git LFS Details

  • SHA256: 6298fc66795e48d58b7fdc441dd16817b4e1720016020e3b58e872b09672598b
  • Pointer size: 132 Bytes
  • Size of remote file: 1.88 MB
asset/login.png ADDED

Git LFS Details

  • SHA256: eb50acb482a9eacd577669018b02221193d763692259a8aa8d8d76ce26d7da91
  • Pointer size: 131 Bytes
  • Size of remote file: 116 kB
asset/mission-01.png ADDED

Git LFS Details

  • SHA256: 78cd47ae27dccfdcc05164792646e264fccd1c81268586f1fc8e2a3acfebc056
  • Pointer size: 131 Bytes
  • Size of remote file: 208 kB
asset/rpi5-with-m.2-card.png ADDED

Git LFS Details

  • SHA256: 3f8b6b4720c66b2dcabc4d6738089f5628d5cf4d380fea387eacd27785601ad3
  • Pointer size: 131 Bytes
  • Size of remote file: 222 kB
asset/settings-machine-learning-01.png ADDED

Git LFS Details

  • SHA256: e5788a150f2decfcda49eba7ed7a8ac09fda2f636a62e10fb9df64cf2f3b6141
  • Pointer size: 131 Bytes
  • Size of remote file: 249 kB
asset/settings-machine-learning-02.png ADDED

Git LFS Details

  • SHA256: bc1163b8e40a7d4754994fea208900bb462a3570f3f707c2a40fae9c2a59303f
  • Pointer size: 131 Bytes
  • Size of remote file: 235 kB
asset/settings.png ADDED

Git LFS Details

  • SHA256: 4ef7dc95ea187fbc3042cc1ab36a5cdd41225878ddc9df9cb4acf060c9cb4f8b
  • Pointer size: 131 Bytes
  • Size of remote file: 195 kB
asset/text-to-image-retrieval-01.png ADDED

Git LFS Details

  • SHA256: 4283ade2179b841f3a299f7fc5e4efbad58e59f36c7801c15db107ec59e34bcc
  • Pointer size: 132 Bytes
  • Size of remote file: 1.14 MB
asset/text-to-image-retrieval-02.png ADDED

Git LFS Details

  • SHA256: 8f871b19e4e4d5c05a990cd8b0f2c73015f4742e3503e69dd42bbfae69747ce8
  • Pointer size: 132 Bytes
  • Size of remote file: 1.19 MB
ax-immich-server-aarch64.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2065c46fd63cbe45c9a85edf90c1eefe1b4d7b0b0ecdc26cd8a4f4532d9358df
3
+ size 440458289
config.json ADDED
File without changes
docker-deploy.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:98bd8a50f9174b67b71c4412ba36b54adcad26fee06403a1cb531e607624c324
3
+ size 7739
immich_ml-1.129.0-py3-none-any.whl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7aadeb142fae5468a1b72e618bd5ed40f5ea0e67f2056b5818afba0c5cb1e614
3
+ size 105655
requirements.txt ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ gunicorn
2
+ pydantic
3
+ pydantic_settings
4
+ rich
5
+ uvicorn
6
+ orjson
7
+ fastapi
8
+ onnxruntime
9
+ pillow
10
+ huggingface_hub
11
+ tokenizers
12
+ opencv-python
13
+ insightface
14
+ aiocache
15
+ python-multipart
16
+ cffi
17
+ ml_dtypes