Skip to content

jundaz/Anime-art-style-picture-super-resolution-using-CNN

Repository files navigation

Anime art style picture super resolution using CNN

Adapted from Framework of FSRCNN By D.Chao et al.
required package:
pytorch
numpy
Pillow
h5py
tqdm

use prepare.py to create custom dataset file for training:\

python prepare.py   --images-dir
                    directory to folder of image for training
                    --output-path
                    directory where you want to put the created file for training
                    --scale
                    factor of scaling in int (2-4)
                    --compress
                    --quality
                    level for compression in int (0-100)
                    do not use parameter compress and quality if no compression is required

use prepare.py to create custom dataset file for validation:

python prepare.py   --images-dir
                    directory to folder of image for validate
                    --output-path
                    directory where you want to put the created file for validate
                    --scale
                    factor of scaling in int (2-4)
                    --eval
                    --compress
                    --quality
                    level for compression in int (0-100)
                    do not use parameter compress and quality if no compression is required

use train.py to train your own dataset:

python train.py     --train-file
                    directory to training file(h5 file)
                    --eval-file
                    directory to validation file(h5 file)
                    --outputs-dir
                    where the weight file will be saved for future use
                    --scale
                    the factor of scaling you want to train the network for(need to be the same as 
                    the scale you set for your dataset)
                    --lr
                    learning rate (do not use anything larger than 1e-3)
                    --batch-size
                    batch size in int (I used 60, depends on your memeory size and cpu bandwidth)
                    --num-epochs
                    how many epochs you want to run in int (I ran 5)
                    --num-workers
                    the number of processes that generate batches in parallel in int
                    (I used 60, depends on your cpu and memory)

use test.py to test with your own pictures:

python test.py      --weights-file
                    directory to weight file generated by train.py
                    --image-file
                    directory to test image, most format should be supported
                    --compress
                    --quality
                    50
                    (should be the same as how you created the dataset for training
                    --crop
                    --top
                    760
                    --left
                    160
                    --side_len
                    300
                    (these 4 parameter is for crop a part of image as a square thumbnails, 
                    top and left indicate the start pixel in image, and the side_len
                    is used for indicating the size of the side length of the square sumnail)

I also provided weight for 4 different quality compression(50, 75, 95, lossless) with scaling factor of 2 in weight folder
Please see sample folder for sample of result used in the paper.

About

A super resolution CNN for Anime art style picture

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages