idealo / image-super-resolution

🔎 Super-scale your images and run experiments with Residual Dense and Adversarial Networks.
https://idealo.github.io/image-super-resolution/
Apache License 2.0
4.66k stars 768 forks source link

Sample #210

Open alexanderpilch opened 3 years ago

alexanderpilch commented 3 years ago

Here're some scripts I've used in order to preprocess my images and train the model. Most of it is based on tickets in there/stolen from answers to tickets.

1) create a folder pics and the subfolders raw_training & raw_validation. Copy your raw images to those 2 folders. Unzip preprocess.zip in that folder 2) unzip script in pics folder 3) Install pythonmagick & imagemagick (in venv in pics folder) 4) run init.bat in order to create the subfolders 5) run python conversion.py in order to resize images (multiple of 64 pixel, max x dimension 2048). The results will be stored in high_res/training & high_res/validation. You just have to run that one once in order to prepare the raw images. Images with an alpha channel or grayscale colorpsace will cause crashes during training otherwise. 6) run process.bat in order to create the training data off the raw images (e.g. resizing with imagemagick, sharpening, compression artifacts,...) 7) run python check.py in order to verify, that each image does exist in all training/validation sets and that the colorspace is valid. This script will also keep the directories in sync. If there's an invalid file in there, it will get deleted in all of those folders.

8) unzip training.zip to root 9) run each training script after another. adjust the weights_generator variable in scripts 2 & 3 and point it to the location of the files from the previous step

Those scripts are pretty raw, but maybe they'll help you to get started with your own experiments.

training.zip preprocess.zip

alexanderpilch commented 3 years ago

Just cancel the 2nd training script, when you want to continue with script 3. The amount of epochs is probably much too high in 2 and I never ran it so long.