3587jjh commited on
Commit
5412196
·
verified ·
1 Parent(s): 8a37386

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +79 -0
README.md ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Accelerating Image Super-Resolution Networks with Pixel-Level Classification
2
+ [![Project Page](https://img.shields.io/badge/Project-Page-green)](https://3587jjh.github.io/PCSR/)
3
+ [![arXiv](https://img.shields.io/badge/arXiv-2407.21448-b31b1b)](https://arxiv.org/abs/2407.21448)
4
+
5
+ <div align="justify">
6
+ <b>Abstract</b>: In recent times, the need for effective super-resolution (SR) techniques has surged, especially for large-scale images ranging 2K to 8K resolutions. For DNN-based SISR, decomposing images into overlapping patches is typically necessary due to computational constraints. In such patch-decomposing scheme, one can allocate computational resources differently based on each patch's difficulty to further improve efficiency while maintaining SR performance. However, this approach has a limitation: computational resources is uniformly allocated within a patch, leading to lower efficiency when the patch contain pixels with varying levels of restoration difficulty. To address the issue, we propose the Pixel-level Classifier for Single Image Super-Resolution (PCSR), a novel method designed to distribute computational resources adaptively at the pixel level. A PCSR model comprises a backbone, a pixel-level classifier, and a set of pixel-level upsamplers with varying capacities. The pixel-level classifier assigns each pixel to an appropriate upsampler based on its restoration difficulty, thereby optimizing computational resource usage. Our method allows for performance and computational cost balance during inference without re-training. Our experiments demonstrate PCSR's advantage over existing patch-distributing methods in PSNR-FLOP trade-offs across different backbone models and benchmarks.
7
+ </div>
8
+ <br>
9
+
10
+ ## Dependencies
11
+ - Python 3.7<br>
12
+ - Pytorch 1.13<br>
13
+ - NVIDIA GPU + CUDA<br>
14
+ - Python packages: `pip install numpy opencv-python pandas tqdm fast_pytorch_kmeans`
15
+
16
+ ## Demo
17
+ We offer a demo that can simulate 4x super-resolution using a single input image:
18
+ ```
19
+ python demo.py --img_path <image path> --k <value> [--adaptive] [--no_refinement]
20
+ ```
21
+ For a detailed description of the arguments and types of output, please refer to `demo.py` and the `results` directory.
22
+ <div style="display: flex;">
23
+ <figure style="margin: 0; text-align: center;">
24
+ <img src="results/PCSR_colored.png" style="width: 280px; height: 184px; object-fit: cover;"/>
25
+ <figcaption>Classification</figcaption>
26
+ </figure>
27
+ <figure style="margin: 0; text-align: center;">
28
+ <img src="results/PCSR.png" style="width: 280px; height: 184px; object-fit: cover;"/>
29
+ <figcaption>SR Result (X4)</figcaption>
30
+ </figure>
31
+ </div>
32
+
33
+ ## Train
34
+ We offer a variety of pretrained models available in the `save` directory.<br>
35
+
36
+ ### Data preprocessing
37
+ We use the DIV2K training set as our base.
38
+ ```
39
+ cd datasets/scripts
40
+ python data_augmentation.py
41
+ python extract_subimages.py
42
+ python generate_mod_LR_bic.py
43
+ ```
44
+ ### Run training scripts (example usage)
45
+ (Please move the pretrained model to a different directory to train a new model!)
46
+ ```
47
+ # original model
48
+ ./dist.sh train.py --config configs/carn-x4.yaml --gpu 0
49
+
50
+ # PCSR model (2-stage)
51
+ ./dist.sh train_pcsr.py --config configs/carn-pcsr-phase0.yaml --gpu 0,1
52
+ ./dist.sh train_pcsr.py --config configs/carn-pcsr-phase1.yaml --gpu 0
53
+ ```
54
+
55
+ ## Test
56
+ Please refer to `test.py` and `test_pcsr.py` for a detailed description of the arguments.
57
+ ```
58
+ # original model
59
+ python test.py --config <config path> --hr_data <hr foler> --lr_data <lr folder> --per_image --crop
60
+
61
+ # PCSR model (phase1)
62
+ python test_pcsr.py --config <config path> --hr_data <hr foler> --scale <integer scale> --per_image --crop --k 0 [--adaptive]
63
+ ```
64
+
65
+ ## Citation
66
+ ```
67
+ @misc{jeong2024acceleratingimagesuperresolutionnetworks,
68
+ title={Accelerating Image Super-Resolution Networks with Pixel-Level Classification},
69
+ author={Jinho Jeong and Jinwoo Kim and Younghyun Jo and Seon Joo Kim},
70
+ year={2024},
71
+ eprint={2407.21448},
72
+ archivePrefix={arXiv},
73
+ primaryClass={cs.CV},
74
+ url={https://arxiv.org/abs/2407.21448},
75
+ }
76
+ ```
77
+
78
+ ## Acknowledgement
79
+ This repo is based on [LIIF](https://github.com/yinboc/liif) and [KAIR](https://github.com/cszn/KAIR).