Skip to content

Yazdi9/SuperResolution_Animation_Video

Repository files navigation

AnimeSR: Learning Real-World Super-Resolution Models for Animation Videos

Yanze Wu, Xintao Wang, Gen Li, Ying Shan

Video Demos

SuperResolution videos stored at outputs/outvideo folder

MEGA SpongeBob Super Resolution

MEGA MonkyFights Super Resolution

Video Frames Demos(Left:LowResolution Video Frame(Before) Right:SuperResolution(After))

Dependencies and Installation

  • Python >= 3.7
  • PyTorch >= 1.7
  • Other required packages in requirements.txt

Installation

  1. Clone repo

    git clone https://github.com/TencentARC/AnimeSR.git
    cd AnimeSR
  2. Install

    # Install dependent packages
    pip install -r requirements.txt
    
    # Install AnimeSR
    python setup.py develop

Quick Inference

Download the pre-trained AnimeSR models [Google Drive], and put them into the weights folder. Currently, the available pre-trained models are:

  • AnimeSR_v1-PaperModel.pth: v1 model, also the paper model. You can use this model for paper results reproducing.
  • AnimeSR_v2.pth: v2 model. Compare with v1, this version has better naturalness, fewer artifacts, and better texture/background restoration. If you want better results, use this model.

AnimeSR supports both frames and videos as input for inference. We provide several sample test cases in google drive, you can download it and put them to inputs folder.

Inference on Frames

python scripts/inference_animesr_frames.py -i inputs/tom_and_jerry -n AnimeSR_v2 --expname animesr_v2 --save_video_too --fps 20

After run the above command, you will get the SR frames in results/animesr_v2/frames and the SR video in results/animesr_v2/videos.

Inference on Video

# single gpu and single process inference
CUDA_VISIBLE_DEVICES=0 python scripts/inference_animesr_video.py -i inputs/TheMonkeyKing1965.mp4 -n AnimeSR_v2 -s 4 --expname animesr_v2 --num_process_per_gpu 1 --suffix 1gpu1process
# single gpu and multi process inference (you can use multi-processing to improve GPU utilization)
CUDA_VISIBLE_DEVICES=0 python scripts/inference_animesr_video.py -i inputs/TheMonkeyKing1965.mp4 -n AnimeSR_v2 -s 4 --expname animesr_v2 --num_process_per_gpu 3 --suffix 1gpu3process
# multi gpu and multi process inference
CUDA_VISIBLE_DEVICES=0,1 python scripts/inference_animesr_video.py -i inputs/TheMonkeyKing1965.mp4 -n AnimeSR_v2 -s 4 --expname animesr_v2 --num_process_per_gpu 3 --suffix 2gpu6process

SR videos are saved in results/animesr_v2/videos/$video_name folder.