A model for x2 real-world video super-resolution based on RealBasicVSR.
- Install PyTorch and torchvision following the official instructions, e.g.,
conda install pytorch==1.7.1 torchvision==0.8.2 torchaudio==0.7.2 cudatoolkit=10.1 -c pytorch
- Install mim and mmcv-full
pip install openmim
mim install mmcv-full
- Install mmedit
pip install mmedit
-
Download the pre-trained weights to
checkpoints/
. (Dropbox / Google Drive / OneDrive) -
Run the following command:
python inference_realbasicvsr.py ${CONFIG_FILE} ${CHECKPOINT_FILE} ${INPUT_DIR} ${OUTPUT_DIR} --max-seq-len=${MAX_SEQ_LEN} --is_save_as_png=${IS_SAVE_AS_PNG} --fps=${FPS}
This script supports both images and videos as inputs and outputs. You can simply change ${INPUT_DIR} and ${OUTPUT_DIR} to the paths corresponding to the video files, if you want to use videos as inputs and outputs. But note that saving to videos may induce additional compression, which reduces output quality.
For example:
- Images as inputs and outputs
python inference_realbasicvsr.py configs/inference_vsr_x2.py checkpoints/RealBasicVSR_x2.pth data/demo_000 results/demo_000
- Video as input and output
python inference_realbasicvsr.py configs/inference_vsr_x2.py checkpoints/RealBasicVSR_x2.pth data/demo_001.mp4 results/demo_001.mp4 --fps=12.5
We only train the second stage from pre-trained weights on REDS dataset. (Dropbox / Google Drive / OneDrive)
We crop the REDS dataset into sub-images for faster I/O. Please follow the instructions below:
- Put the original REDS dataset in
./data
- Resize the original REDS dataset:
python generate_rescale.py
- Run the following command:
python crop_sub_images.py --data-root ./data/REDS --scales 2
Then we just train the second stage from pre-trained weights.
mim train mmedit configs/vsr_train_st2_128x128.py --gpus 8
Note: We use UDM10 with bicubic downsampling for validation and use VideoLQ for test. You can also download it from here and download the VideoLQ dataset using Dropbox / Google Drive / OneDrive.