File size: 3,188 Bytes
4c44942
e4dbceb
4c44942
 
 
 
 
 
 
 
 
 
 
 
 
 
14dc819
4c44942
14dc819
 
 
4c44942
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a021116
4c44942
a021116
 
 
 
 
 
 
4c44942
a021116
4c44942
 
b5f9fc9
 
 
 
 
 
 
 
 
4c44942
 
 
14dc819
 
07864e8
 
14dc819
4c44942
 
 
 
a02b1e8
4c44942
 
 
 
 
 
 
 
 
 
 
 
 
07864e8
a021116
07864e8
 
 
 
 
 
 
 
a021116
 
 
 
 
 
 
 
 
 
 
 
 
 
 
fd40704
 
 
 
 
1410ce9
fd40704
a021116
 
 
1410ce9
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
---
pipeline_tag: image-to-image
---

# SuperResolution

This version of SuperResolution has been converted to run on the Axera NPU using **w8a8** quantization.

This model has been optimized with the following LoRA: 

Compatible with Pulsar2 version: 4.2

## Convert tools links:

For those who are interested in model conversion, you can try to export axmodel through 

- [The github repo of AXera Platform](https://github.com/AXERA-TECH/SuperResolution.axera)

- [How to Convert ONNX to axmodel](https://github.com/AXERA-TECH/SuperResolution.axera/tree/master/model_convert)

- [Pulsar2 tools](https://huggingface.co/AXERA-TECH/Pulsar2)


## Support Platform

- AX650
  - [M4N-Dock(็ˆฑ่ŠฏๆดพPro)](https://wiki.sipeed.com/hardware/zh/maixIV/m4ndock/m4ndock.html)
  - [M.2 Accelerator card](https://axcl-docs.readthedocs.io/zh-cn/latest/doc_guide_hardware.html)
  
|Chips|model|cost|
|--|--|--|
|AX650|EDSR|800 ms|
|     |ESPCN|22 ms|

## How to use

Download all files from this repository to the device

```

root@ax650:~/SuperResolution# tree -L 1
.
โ”œโ”€โ”€ assert
โ”œโ”€โ”€ config.json
โ”œโ”€โ”€ experiment
โ”œโ”€โ”€ model_convert
โ”œโ”€โ”€ python
โ”œโ”€โ”€ README.md
โ””โ”€โ”€ video

6 directories, 2 files
```

### Requirements

```
pip install -r python/requirements.txt
```

pyaxengine ๆ˜ฏ npu ็š„ python api๏ผŒ่ฏฆ็ป†ๅฎ‰่ฃ…่ฏทๅ‚่€ƒ: https://github.com/AXERA-TECH/pyaxengine


### Inference

Input Data:

```
โ””โ”€โ”€ video
    โ””โ”€โ”€ test_1920x1080.mp4
```

#### Inference with AX650 Host, such as M4N-Dock(็ˆฑ่ŠฏๆดพPro)

```
root@ax650 ~/SuperResolution # python python/run_axmodel.py --model model_convert/axmodel/edsr_baseline_x2_1.axmodel --scale 2 --dir_demo video/test_1920x1080.mp4
[INFO] Available providers:  ['AxEngineExecutionProvider']
[INFO] Using provider: AxEngineExecutionProvider
[INFO] Chip type: ChipType.MC50
[INFO] VNPU type: VNPUType.DISABLED
[INFO] Engine version: 2.12.0s
[INFO] Model type: 2 (triple core)
[INFO] Compiler version: 4.2 6bff2f67
100%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 267/267 [10:06<00:00,  2.27s/it]
Total time: 99.582 seconds for 267 frames
Average time: 0.373 seconds for each frame

```

The output file in `experiment/test_1920x1080_x2.avi`
![Example Image](video/2.png)

Output Data:

```
โ”œโ”€โ”€ experiment
โ”‚ย ย  โ””โ”€โ”€ test_1920x1080_x2.avi
```

#### Inference with M.2 Accelerator card

```bash
$ cd python
$ python gradio_demo.py

[INFO] Available providers:  ['AXCLRTExecutionProvider']
[INFO] Using provider: AXCLRTExecutionProvider
[INFO] SOC Name: AX650N
[INFO] VNPU type: VNPUType.DISABLED
[INFO] Compiler version: 4.2 6bff2f67
[INFO] Using provider: AXCLRTExecutionProvider
[INFO] SOC Name: AX650N
[INFO] VNPU type: VNPUType.DISABLED
[INFO] Compiler version: 4.2 6bff2f67
==================================================
๐ŸŒ SuperResolution ่ถ…ๅˆ†่พจ็އ Web UI ๅทฒๅฏๅŠจ๏ผ
๐Ÿ”— ๆœฌๅœฐ่ฎฟ้—ฎ: http://127.0.0.1:7860
๐Ÿ”— ๅฑ€ๅŸŸ็ฝ‘่ฎฟ้—ฎ: http://10.126.33.124:7860
==================================================
```
Then open the link in the browser to use the web UI:

![gradio_demo](./assert/gradio_demo.jpg)