Anime Super Resolution πΌοΈ enhances anime-style images using a fine-tuned Real-ESRGAN model, optimized for clarity and detail. Built on the RealESRGAN_x4plus model, it leverages a private dataset of 27,052 high-resolution (1920x1080) anime frames πΈ. The project offers tools for data processing, training, inference, and an interactive Gradio demo, accessible on platforms like Colab, Kaggle, and locally π.
-
Anime-Specific Upscaling π¨: Fine-tuned Real-ESRGAN for high-quality anime image super-resolution.
-
Large Anime Dataset π: 27,052 high-res anime frames for robust training.
-
Interactive Gradio Demo π₯οΈ: Easy model testing via HuggingFace-hosted interface.
-
Multi-Platform Support π: Runs on Colab, Kaggle, JupyterLab, and more.
-
Data Processing Tools π οΈ: Scripts for multiscale dataset creation and meta-info generation.
-
Flexible Training/Inference βοΈ: Customizable configurations for training and upscaling.
-
Open-Source π: MIT-licensed, built with PyTorch, NumPy, and Pillow.
-
Local/Cloud Compatibility βοΈ: Supports local Gradio app and cloud-based execution.
This notebook provides a step-by-step guide to finetune the Real-ESRGAN model for enhancing anime-style images. It covers data preparation, model configuration, training, and evaluation, optimized for clarity and reproducibility.
The dataset is privately extracted from anime films, comprising 27,052 images with a resolution of 1920x1080. Please read at Download Dataset if you want to use this dataset.
The Data Structure is
data/ π
βββ anime-images-raw/ π
β βββ frame_0001.jpg πΈ
β βββ frame_0001_1.jpg π·
β βββ ... πΈ
βββ anime-images-multiscale/ π
β βββ frame_0001T0.png πΈ
β βββ frame_0001T1.png πΈ
β βββ frame_0001T2.png πΈ
β βββ frame_0001T3.png πΈ
β βββ frame_0001_10T0.png πΈ
β βββ frame_0001_10T1.png πΈ
β βββ frame_0001_10T2.png πΈ
β βββ frame_0001_10T3.png πΈ
β βββ ... πΈ
βββ meta_info/ π
βββ meta_info_multiscale.txt π
To proceed with the topic, please consult the section on Real-ESRGAN Data Processing for Training for comprehensive details and guidance.
The Real-ESRGAN-Anime-finetuning model was developed by fine-tuning the pre-trained model, leveraging its robust foundation to enhance performance specifically for anime-style image super-resolution tasks.
Explore the interactive demo hosted on HuggingFace:
Below is a screenshot of the SlimFace Demo GUI:
To run the Gradio application locally at the default address localhost:7860
, execute:
python apps/gradio_app.py
git clone https://github.com/danhtran2mind/Anime-Super-Resolution
cd Anime-Super-Resolution
pip install -e .
pip install -r requirements/requirements_inference.txt
-
Download only model checkpoint for Inference
python scripts/download_ckpts.py
-
For training from
Real-ESRGAN
Model checkpointpython scripts/download_ckpts.py --base_model_only
-
For training from
Real-ESRGAN-Anime-finetuning
Model checkpointpython scripts/download_ckpts.py --full_ckpts
More detail you can read at Download Model Checkpoints.
python scripts/setup_third_party.py
python scripts/download_datasets.py \
--dataset_id "<huggingface_dataset_id>"
--huggingface_token "<your_huggingface_token>"
More detail you can read at Download Dataset.
First you need see the data structure at Data Structure. Then execute below scripts to process dataset.
- Create
multiscale
Folderpython src/third_party/Real-ESRGAN/scripts/generate_multiscale_DF2K.py \ --input ./data/anime-images-raw \ --output ./data/anime-images-multiscale
- Create
meta_info_multiscale.txt
python src/third_party/Real-ESRGAN/scripts/generate_meta_info.py \ --input ./data/anime-images-raw ./data/anime-images-multiscale \ --root ./data ./data \ --meta_info "./data/meta_info/meta_info_multiscale.txt"
python src/anime_super_resolution/train.py \
--config "<your_model_config_yml_path>" \
--auto_resume
For more details and available options, refer to the Training Document.
You can see Real-ESRGAN Training, and BasicSR Training Options for more details.
python src/anime_super_resolution/infer.py \
--input_path tests/test_data/input_image.png \
--output_dir tests/test_data \
--suffix real_esrgan_anime \
--outscale 2 \
--model_path ckpts/Real-ESRGAN-Anime-finetuning/net_g_latest.pth
Example | Image Type | Image |
---|---|---|
Ex. 1 | Original Image |
![]() |
Upscaled Image (2x) |
![]() |
|
Ex. 2 | Original Image |
![]() |
Upscaled Image (4x) |
![]() |
|
Ex. 3 | Original Image |
![]() |
Upscaled Image (6x) |
![]() |
|
Ex. 4 | Original Image |
![]() |
Upscaled Image (8x) |
![]() |
For more details and available options, refer to the Inference Document.
SlimFace requires the following environment:
- Python: 3.10 or higher
- Key Libraries: Refer to Requirements Compatible for compatible dependencies.
-
This project leverages code from:
The Original Real-ESRGAN by
at
. Our own bug fixes and enhancements are available at
.
The Inference code by
at
. Our own bug fixes and enhancements are available at
-
You can explore more Model Hubs at:
HuggingFace Model Hub:
. Real-ESRGAN Model releases:
. You also download
Real-ESRGAN-Anime-finetuning
at