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| 9 |
+
|
| 10 |
+
<p align="center">
|
| 11 |
+
<img src="./assets/showcase2.gif" alt="showcase">
|
| 12 |
+
</p>
|
| 13 |
+
|
| 14 |
+
# LivePortrait
|
| 15 |
+
|
| 16 |
+
This version of LivePortrait has been converted to run on the Axera NPU using **w8a16** quantization.
|
| 17 |
+
|
| 18 |
+
This model has been optimized with the following:
|
| 19 |
+
|
| 20 |
+
Compatible with Pulsar2 version: 3.4
|
| 21 |
+
|
| 22 |
+
## Convert tools links:
|
| 23 |
+
|
| 24 |
+
For those who are interested in model conversion:
|
| 25 |
+
|
| 26 |
+
- [the original repo](https://huggingface.co/KwaiVGI/LivePortrait)
|
| 27 |
+
- [Github for LivePortrait](https://github.com/AXERA-TECH/LivePortrait.axera)
|
| 28 |
+
|
| 29 |
+
## Support Platform
|
| 30 |
+
- AX650/AX8850
|
| 31 |
+
- [M4N-Dock(η±θ―ζ΄ΎPro)](https://wiki.sipeed.com/hardware/zh/maixIV/m4ndock/m4ndock.html)
|
| 32 |
+
- [M.2 Accelerator card](https://axcl-docs.readthedocs.io/zh-cn/latest/doc_guide_hardware.html)
|
| 33 |
+
|
| 34 |
+
## How to use
|
| 35 |
+
|
| 36 |
+
Download all files from this repository to the device.
|
| 37 |
+
|
| 38 |
+
```
|
| 39 |
+
(py310) axera@dell:~/samples/LivePortrait$ tree -L 2
|
| 40 |
+
.
|
| 41 |
+
βββ assets
|
| 42 |
+
βΒ Β βββ examples
|
| 43 |
+
βββ config.json
|
| 44 |
+
βββ python
|
| 45 |
+
βΒ Β βββ axmodels
|
| 46 |
+
βΒ Β βββ cropper.py
|
| 47 |
+
βΒ Β βββ infer_onnx.py
|
| 48 |
+
βΒ Β βββ infer.py
|
| 49 |
+
βΒ Β βββ pretrained_weights
|
| 50 |
+
βΒ Β βββ requirements.txt
|
| 51 |
+
βΒ Β βββ utils
|
| 52 |
+
βββ README.md
|
| 53 |
+
|
| 54 |
+
7 directories, 6 files
|
| 55 |
+
```
|
| 56 |
+
|
| 57 |
+
### python env requirement
|
| 58 |
+
|
| 59 |
+
#### pyaxengine
|
| 60 |
+
|
| 61 |
+
https://github.com/AXERA-TECH/pyaxengine
|
| 62 |
+
|
| 63 |
+
```
|
| 64 |
+
wget https://github.com/AXERA-TECH/pyaxengine/releases/download/0.1.3.rc1/axengine-0.1.3-py3-none-any.whl
|
| 65 |
+
pip install axengine-0.1.3-py3-none-any.whl
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
#### others
|
| 69 |
+
|
| 70 |
+
```
|
| 71 |
+
pip install -r python/requirements.txt
|
| 72 |
+
```
|
| 73 |
+
|
| 74 |
+
## Inference with AX650 or AX8850 Host, such as AX650 DEMO BOARD, M4N-DOCK(η±θ―ζ΄ΎPro)
|
| 75 |
+
|
| 76 |
+
```
|
| 77 |
+
TODO
|
| 78 |
+
```
|
| 79 |
+
|
| 80 |
+
## Inference with M.2 Accelerator card
|
| 81 |
+
|
| 82 |
+
[What is M.2 Accelerator card?](https://axcl-docs.readthedocs.io/zh-cn/latest/doc_guide_hardware.html), Show this DEMO based on x86.
|
| 83 |
+
|
| 84 |
+
### Image
|
| 85 |
+
|
| 86 |
+
```
|
| 87 |
+
(py310) axera@dell:~/samples/LivePortrait$ python ./python/infer.py --source ./assets/examples/source/s0.jpg --driving ./assets/examples/driving/d8.jpg --models ./python/axmodels/ --output-dir ./axmodel_infer
|
| 88 |
+
[INFO] Available providers: ['AXCLRTExecutionProvider']
|
| 89 |
+
[INFO] Using provider: AXCLRTExecutionProvider
|
| 90 |
+
[INFO] SOC Name: AX650N
|
| 91 |
+
[INFO] VNPU type: VNPUType.DISABLED
|
| 92 |
+
[INFO] Compiler version: 3.3 144960ad
|
| 93 |
+
[INFO] Using provider: AXCLRTExecutionProvider
|
| 94 |
+
[INFO] SOC Name: AX650N
|
| 95 |
+
[INFO] VNPU type: VNPUType.DISABLED
|
| 96 |
+
[INFO] Compiler version: 3.3 144960ad
|
| 97 |
+
[INFO] Using provider: AXCLRTExecutionProvider
|
| 98 |
+
[INFO] SOC Name: AX650N
|
| 99 |
+
[INFO] VNPU type: VNPUType.DISABLED
|
| 100 |
+
[INFO] Compiler version: 3.3 0f7260e8
|
| 101 |
+
[INFO] Using provider: AXCLRTExecutionProvider
|
| 102 |
+
[INFO] SOC Name: AX650N
|
| 103 |
+
[INFO] VNPU type: VNPUType.DISABLED
|
| 104 |
+
[INFO] Compiler version: 3.3 144960ad
|
| 105 |
+
FaceAnalysisDIY warmup time: 0.024s
|
| 106 |
+
[20:02:20] LandmarkRunner warmup time: 0.031s human_landmark_runner.py:95
|
| 107 |
+
2025-05-29 20:02:20.727 | INFO | __main__:main:727 - Start making driving motion template...
|
| 108 |
+
2025-05-29 20:02:20.972 | INFO | __main__:main:747 - Prepared pasteback mask done.
|
| 109 |
+
2025-05-29 20:02:21.449 | INFO | __main__:main:787 - The output of image-driven portrait animation is an image.
|
| 110 |
+
2025-05-29 20:02:25.475 | DEBUG | __main__:warp_decode:647 - warp time: 4.017s
|
| 111 |
+
2025-05-29 20:02:25.892 | INFO | __main__:main:881 - Animated image: ./axmodel_infer/s0--d8.jpg
|
| 112 |
+
2025-05-29 20:02:25.892 | INFO | __main__:main:882 - Animated image with concat: ./axmodel_infer/s0--d8_concat.jpg
|
| 113 |
+
2025-05-29 20:02:25.904 | DEBUG | __main__:<module>:894 - LivePortrait axmodel infer time: 8.165s
|
| 114 |
+
(py310) axera@dell:~/samples/LivePortrait$
|
| 115 |
+
```
|
| 116 |
+
|
| 117 |
+
Here, `--models` specifies the storage path for the `*.axmodel model`.
|
| 118 |
+
|
| 119 |
+
The output of axmodel-infer is as follows:
|
| 120 |
+
|
| 121 |
+

|
| 122 |
+

|
| 123 |
+
|
| 124 |
+
### Video
|
| 125 |
+
|
| 126 |
+
```
|
| 127 |
+
python3 ./python/infer.py --source ./assets/examples/source/s0.jpg --driving ./assets/examples/driving/d0.mp4 --models ./python/axmodels/ --output-dir ./axmodel_infer
|
| 128 |
+
```
|
| 129 |
+
|
| 130 |
+
The output of `axmodel-infer` is as follows:
|
| 131 |
+
|
| 132 |
+
**s0--d0_concat_axmodel**
|
| 133 |
+
|
| 134 |
+
https://github.com/user-attachments/assets/2c2a1380-a686-498d-bab7-1cf4f990edaf
|
| 135 |
+
|
| 136 |
+
**s0--d0_axmodel**
|
| 137 |
+
|
| 138 |
+
https://github.com/user-attachments/assets/873cec20-0e85-44df-9811-cd3a2aaa7730
|