Views
No views yet
1# inference only
2pip install -r requirements-infer.txt
3# inference & evaluation
4pip install -r requirements-eval.txtpython download_edsr_benchmark.py to automatically download and extract the EDSR benchmark dataset into the datasets directory. After it completes, your datasets folder should have the following structure:1datasets/edsr_benchmark
2 └── B100
3 └── HR
4 ├── 3096.png
5 ├── ...
6 └── LR_bicubic/X2
7 ├── 3096x4.png
8 ├── ...
9 └── Set5
10 └── HR
11 ├── baby.png
12 ├── ...
13 └── LR_bicubic/X2
14 ├── babyx4.png
15 ├── ...1python onnx_inference.py --onnx sesr_nchw_fp32.onnx --input /Path/To/Image --out-dir outputs
2python onnx_inference.py --onnx sesr_nchw_int8.onnx --input /Path/To/Image --out-dir outputs--input: Accepts either a single image file path or a directory path. If it's a file, the script will process that image only. If it's a directory, the script will recursively scan for .png, .jpg, and .jpeg files and process all of them.--out-dir: Output directory where the restored images will be saved.--onnx: Path to the ONNX model file.--hq-dir: Directory containing high-quality (ground truth) images.--lq-dir: Directory containing low-quality (input) images.--out-dir: Output directory where evaluation results will be saved.--max-samples: (Optional) Limit the number of samples to evaluate. Useful for debugging. If not specified, all samples will be evaluated.-clean: (Optional) If specified, the generated super-resolution images will be deleted after evaluation to save disk space.1# ===================== eval int8 =====================
2python onnx_eval.py \
3 --onnx sesr_nchw_int8.onnx \
4 --hq-dir datasets/edsr_benchmark/Set5/HR \
5 --lq-dir datasets/edsr_benchmark/Set5/LR_bicubic/X2 \
6 --out-dir outputs/Set5 -clean
7
8python onnx_eval.py \
9 --onnx sesr_nchw_int8.onnx \
10 --hq-dir datasets/edsr_benchmark/Set14/HR \
11 --lq-dir datasets/edsr_benchmark/Set14/LR_bicubic/X2 \
12 --out-dir outputs/Set14 -clean
13
14python onnx_eval.py \
15 --onnx sesr_nchw_int8.onnx \
16 --hq-dir datasets/edsr_benchmark/B100/HR \
17 --lq-dir datasets/edsr_benchmark/B100/LR_bicubic/X2 \
18 --out-dir outputs/B100 -clean
19
20python onnx_eval.py \
21 --onnx sesr_nchw_int8.onnx \
22 --hq-dir datasets/edsr_benchmark/Urban100/HR \
23 --lq-dir datasets/edsr_benchmark/Urban100/LR_bicubic/X2 \
24 --out-dir outputs/Urban100 -clean
25
26
27# ===================== eval fp32 =====================
28python onnx_eval.py \
29 --onnx sesr_nchw_fp32.onnx \
30 --hq-dir datasets/edsr_benchmark/Set5/HR \
31 --lq-dir datasets/edsr_benchmark/Set5/LR_bicubic/X2 \
32 --out-dir outputs/Set5 -clean
33
34python onnx_eval.py \
35 --onnx sesr_nchw_fp32.onnx \
36 --hq-dir datasets/edsr_benchmark/Set14/HR \
37 --lq-dir datasets/edsr_benchmark/Set14/LR_bicubic/X2 \
38 --out-dir outputs/Set14 -clean
39
40python onnx_eval.py \
41 --onnx sesr_nchw_fp32.onnx \
42 --hq-dir datasets/edsr_benchmark/B100/HR \
43 --lq-dir datasets/edsr_benchmark/B100/LR_bicubic/X2 \
44 --out-dir outputs/B100 -clean
45
46python onnx_eval.py \
47 --onnx sesr_nchw_fp32.onnx \
48 --hq-dir datasets/edsr_benchmark/Urban100/HR \
49 --lq-dir datasets/edsr_benchmark/Urban100/LR_bicubic/X2 \
50 --out-dir outputs/Urban100 -clean| Model | Set5 | Set14 | B100 | Urban100 | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| PSNR(↑) | MS_SSIM(↑) | FID(↓) | PSNR(↑) | MS_SSIM(↑) | FID(↓) | PSNR(↑) | MS_SSIM (↑) | FID(↓) | PSNR(↑) | MS_SSIM(↑) | FID(↓) | |
| sesr(fp32) | 35.65 | 0.9971 | 26.46 | 30.98 | 0.9935 | 17.69 | 30.23 | 0.9921 | 17.00 | 28.84 | 0.9929 | 0.25 |
| sesr(int8) | 34.65 | 0.9952 | 28.37 | 30.46 | 0.9916 | 20.70 | 29.80 | 0.9900 | 19.38 | 28.25 | 0.9906 | 1.47 |
1@article{bhardwaj2021collapsible,
2 title={Collapsible Linear Blocks for Super-Efficient Super Resolution},
3 author={Bhardwaj, Kartikeya and Milosavljevic, Milos and O'Neil, Liam and Gope, Dibakar and Matas, Ramon and Chalfin, Alex and Suda, Naveen and Meng, Lingchuan and Loh, Danny},
4 journal={arXiv preprint arXiv:2103.09404},
5 year={2021}
6}