{"id":22645760,"url":"https://github.com/voldien/superresolution","last_synced_at":"2026-04-29T17:39:54.943Z","repository":{"id":225500323,"uuid":"645856324","full_name":"voldien/SuperResolution","owner":"voldien","description":"Machine Learning - Super Resolution","archived":false,"fork":false,"pushed_at":"2024-10-24T09:58:50.000Z","size":251,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-03T18:16:41.176Z","etag":null,"topics":["machine-learning","model","super-resolution","tensorflow"],"latest_commit_sha":null,"homepage":"https://www.codeintrinsic.com/machine-learning-super-resolution-stylized-anime-artsyle/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/voldien.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-26T15:41:38.000Z","updated_at":"2024-10-16T18:14:56.000Z","dependencies_parsed_at":"2024-03-24T10:21:17.241Z","dependency_job_id":"917d2045-93ef-4a19-a353-dae60149cf87","html_url":"https://github.com/voldien/SuperResolution","commit_stats":null,"previous_names":["voldien/superresolution"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voldien%2FSuperResolution","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voldien%2FSuperResolution/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voldien%2FSuperResolution/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voldien%2FSuperResolution/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/voldien","download_url":"https://codeload.github.com/voldien/SuperResolution/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246145922,"owners_count":20730649,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["machine-learning","model","super-resolution","tensorflow"],"created_at":"2024-12-09T06:07:11.973Z","updated_at":"2026-04-29T17:39:54.938Z","avatar_url":"https://github.com/voldien.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Super Resolution - Machine Learning\n\n[![Super Resolution Linux](https://github.com/voldien/SuperResolution/actions/workflows/ci.yaml/badge.svg)](https://github.com/voldien/SuperResolution/actions/workflows/ci.yaml)\n[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)\n[![GitHub release](https://img.shields.io/github/release/voldien/SuperResolution.svg)](https://github.com/voldien/SuperResolution/releases)\n\nA SuperResolution training program for creating/training upscaling machine learning model, developed for educational\npurposes only. The result may vary between training data and hyperparameter, the example are from own trained model.\n\nProject Was developed using **Python 3.9**\n\n## Features\n\n### Model Architecture\n\n* **EDSR** - Enhanced Deep Residual Networks for Single Image Super-Resolution\n* **VDR** - Very Deep Convolutional Network\n* **AE** - AutoEncoder Super Resolution\n* **DCNN** - Deep Convolutional Super Resolution Neural Network\n* **Resnet** - Residual Network Deep Convolutional Super Resolution Neural Network\n* **SRGAN** - GAN (Generative Adversarial Network) based Super Resolution Network\n\n### Loss/Cost Function\n\n* **SSIM** - Structural similarity index measure\n* **MSA** - Mean Square Absolute\n* **MSE** - Mean Square Error\n* **VGG16** - Perceptible Loss Error Function\n* **VGG19** - Perceptible Loss Error Function\n\n## Basic Program Command Line\n\nThe most basic command line. Using the default option.\n\n```bash\npython superresolution/SuperResolution.py --data-set-directory /path_to_training_data/\n```\n\n### EDSR - Enhanced Deep Residual Networks for Single Image Super-Resolution\n\n```basha\npython superresolution/SuperResolution.py --batch-size 16 --epochs 10 --image-size 128 128 --output-image-size 256 256 --model edsr --learning-rate 0.0003 --decay-rate 0.9 --decay-step 10000 --color-space rgb --loss-fn msa --shuffle-data-set-size 1024 --show-psnr --data-set-directory /path_to_training_data/   --output-dir image-super-resolution-result/\n```\n\n![Gangsta Anime EDSR Super Resolution Example from Trained model](https://github.com/voldien/SuperResolution/assets/9608088/1951a0c3-cebb-4ea8-818e-4a04bf28e116)\n![Amagi Brilliant Park Anime EDSR Super Resolution Example from Trained model](https://github.com/voldien/SuperResolution/assets/9608088/17609c40-3b86-4a0d-a562-20d71359655a)\n\n### VDR - Very Deep Convolutional Network\n\n```bash\npython superresolution/SuperResolution.py  --batch-size 16 --epochs 10 --image-size 128 128 --output-image-size 256 256 --model vdr --learning-rate 0.0003 --color-space rgb --loss-fn msa --shuffle-data-set-size 512 --show-psnr --data-set-directory /path_to_training_data/ --output-dir image-super-resolution-result/\n```\n\n![Gangsta Anime EDSR Super Resolution Example from Trained model](https://github.com/voldien/SuperResolution/assets/9608088/24cccb38-807f-4454-bbc6-35ad9e03b57f)\n![Amagi Brilliant Park Anime EDSR Super Resolution Example from Trained model](https://github.com/voldien/SuperResolution/assets/9608088/153792f5-c35a-4fae-8bba-aed47c8902de)\n\n### AE - AutoEncoder Super Resolution\n\n```bash\npython superresolution/SuperResolution.py  --batch-size 16 --epochs 10 --image-size 128 128 --output-image-size 256 256 --model dcsr-ae --learning-rate 0.0003 --color-space rgb --loss-fn msa --shuffle-data-set-size 512 --show-psnr --data-set-directory /path_to_training_data/ --output-dir image-super-resolution-result/\n```\n\n![Gangsta Anime EDSR Super Resolution Example from Trained model](https://github.com/voldien/SuperResolution/assets/9608088/0dac4554-6169-4662-9401-204feac33846)\n![Amagi Brilliant Park Anime EDSR Super Resolution Example from Trained model](https://github.com/voldien/SuperResolution/assets/9608088/bc77e853-a5e8-4eac-880b-e6d7a5f3c801)\n\n### DCNN - Deep Convolutional Super Resolution Neural Network\n\n```bash\npython superresolution/SuperResolution.py --batch-size 16 --epochs 10 --image-size 128 128 --output-image-size 256 256 --model cnnsr --learning-rate 0.002 --color-space rgb --loss-fn msa --shuffle-data-set-size 512 --show-psnr --data-set-directory /path_to_training_data/ --output-dir image-super-resolution-result/\n```\n\n![Gangsta Anime EDSR Super Resolution Example from Trained model](https://github.com/voldien/SuperResolution/assets/9608088/f164b778-296d-4ded-b658-ef46d8e77910)\n![Amagi Brilliant Park Anime EDSR Super Resolution Example from Trained model](https://github.com/voldien/SuperResolution/assets/9608088/e5c33097-72ed-4c42-92a4-3a24d45b2110)\n\n### Resnet - Residual Network Deep Convolutional Super Resolution Neural Network\n\n```bash\npython superresolution/SuperResolution.py --batch-size 16 --epochs 10 --image-size 128 128 --output-image-size 256 256 --model dcsr-resnet --learning-rate 0.0003 --color-space rgb --loss-fn msa --shuffle-data-set-size 512 --show-psnr --data-set-directory /path_to_training_data/ --output-dir image-super-resolution-result/ \n```\n\n### SuperResolution Training Program Argument\n\n```bash\nusage: SuperResolution [-h] [--epochs EPOCHS] [--batch-size BATCH_SIZE] [--use-checkpoint] [--checkpoint-filepath CHECKPOINT_DIR] [--checkpoint-every-epoch CHECKPOINT_EVERY_NTH_EPOCH] [--learning-rate LEARNING_RATE] [--device DEVICES] [--cpu] [--gpu]\n                       [--distribute-strategy {mirror}] [--verbosity VERBOSITY] [--use-float16] [--cache-ram] [--cache-file CACHE_PATH] [--shuffle-data-set-size DATASET_SHUFFLE_SIZE] [--data-set-directory TRAIN_DIRECTORY_PATHS]\n                       [--validation-data-directory VALIDATION_DIRECTORY_PATHS] [--test-data-directory TEST_DIRECTORY_PATHS] [--image-size INPUT_IMAGE_SIZE INPUT_IMAGE_SIZE] [--output-image-size OUTPUT_IMAGE_SIZE OUTPUT_IMAGE_SIZE] [--seed SEED]\n                       [--color-space {rgb,lab}] [--color-channels {1,3,4}] [--optimizer {adam,rmsprop,sgd,adadelta}] [--disable-validation] [--config CONFIG] [--model-filename MODEL_FILEPATH] [--output-dir OUTPUT_DIR] [--example-batch EXAMPLE_NTH_BATCH]\n                       [--example-batch-grid-size EXAMPLE_NTH_BATCH_GRID_SIZE] [--show-psnr] [--metrics {psnr,ssim}] [--decay-rate LEARNING_RATE_DECAY] [--decay-step LEARNING_RATE_DECAY_STEP] [--model {dcsr,dscr-post,dscr-pre,edsr,dcsr-ae,dcsr-resnet,vdsr,srgan}]\n                       [--loss-fn {mse,ssim,msa,psnr,vgg16,vgg19,none}]\n\nSuper Resolution Training Model Program\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --epochs EPOCHS       Set the number of passes that the training set will be trained against.\n  --batch-size BATCH_SIZE\n                        number of training element per each batch, during training.\n  --use-checkpoint      Set the path the checkpoint will be saved/loaded.\n  --checkpoint-filepath CHECKPOINT_DIR\n                        Set the path the checkpoint will be saved/loaded.\n  --checkpoint-every-epoch CHECKPOINT_EVERY_NTH_EPOCH\n                        Set how often the checkpoint will be update, per epoch.\n  --learning-rate LEARNING_RATE\n                        Set the initial Learning Rate\n  --device DEVICES      Select the device explicitly that will be used.\n  --cpu                 Explicit use the CPU as the compute device.\n  --gpu                 Explicit use of GPU\n  --distribute-strategy {mirror}\n                        Select Distribute Strategy.\n  --verbosity VERBOSITY\n                        Set the verbosity level of the program\n  --use-float16         Hint the usage of Float 16 (FP16) in the model.\n  --cache-ram           Use System Memory (RAM) as Cache storage.\n  --cache-file CACHE_PATH\n                        Set the cache file path that will be used to store dataset cached data.\n  --shuffle-data-set-size DATASET_SHUFFLE_SIZE\n                        Set the size of the shuffle buffer size, zero disables shuffling.\n  --data-set-directory TRAIN_DIRECTORY_PATHS\n                        Directory path where the images are located dataset images\n  --validation-data-directory VALIDATION_DIRECTORY_PATHS\n                        Directory path where the images are located dataset images\n  --test-data-directory TEST_DIRECTORY_PATHS\n                        Directory path where the images are located dataset images\n  --image-size INPUT_IMAGE_SIZE INPUT_IMAGE_SIZE\n                        Set the size of the images in width and height for the model.\n  --output-image-size OUTPUT_IMAGE_SIZE OUTPUT_IMAGE_SIZE\n                        Set the size of the images in width and height for the model.\n  --seed SEED           Set the random seed\n  --color-space {rgb,lab}\n                        Select Color Space used in the model.\n  --color-channels {1,3,4}\n                        Select Number of channels in the color space. GrayScale, RGB and RGBA.\n  --optimizer {adam,rmsprop,sgd,adadelta}\n                        Select optimizer to be used\n  --disable-validation  Select if use data validation step.\n  --config CONFIG       Config File - Json.\n  --model-filename MODEL_FILEPATH\n                        Define file path that the generator model will be saved at.\n  --output-dir OUTPUT_DIR\n                        Set the output directory that all the models and results will be stored at\n  --example-batch EXAMPLE_NTH_BATCH\n                        Set the number of train batches between saving work in progress result.\n  --example-batch-grid-size EXAMPLE_NTH_BATCH_GRID_SIZE\n                        Set the grid size of number of example images.\n  --show-psnr           Set the grid size of number of example images.\n  --metrics {psnr,ssim}\n                        Set what metric to capture.\n  --decay-rate LEARNING_RATE_DECAY\n                        Set Learning rate Decay.\n  --decay-step LEARNING_RATE_DECAY_STEP\n                        Set Learning rate Decay Step.\n  --model {dcsr,dscr-post,dscr-pre,edsr,dcsr-ae,dcsr-resnet,vdsr,srgan}\n                        Set which model type to use.\n  --loss-fn {mse,ssim,msa,psnr,vgg16,vgg19,none}\n                        Set Loss Function\n```\n\n### Evolution Program - HyperParameter\n\nThe Evolution Program allow sto try multiple variable combination in order to find a good set of variable configuration.\nSimilar to hyperparameter testing.\n\n```bash\npython3 superresolution/super-resolution-evolution-test.py  --epochs 8 --batch 32 rgb  --image-size 128 128  --data-set-directory /path_to_training_data/ --validation-data-directory /path_to_validation_data/   --output-dir evolution_test/\n```\n\nArgument options\n\n```bash\nusage: SuperResolution Model Evolution [-h] [--epochs EPOCHS] [--batch-size BATCH_SIZE] [--use-checkpoint] [--checkpoint-filepath CHECKPOINT_DIR] [--checkpoint-every-epoch CHECKPOINT_EVERY_NTH_EPOCH] [--learning-rate LEARNING_RATE]\n                                       [--device DEVICES] [--cpu] [--gpu] [--distribute-strategy {mirror}] [--verbosity VERBOSITY] [--use-float16] [--cache-ram] [--cache-file CACHE_PATH] [--shuffle-data-set-size DATASET_SHUFFLE_SIZE]\n                                       [--data-set-directory TRAIN_DIRECTORY_PATHS] [--validation-data-directory VALIDATION_DIRECTORY_PATHS] [--test-data-directory TEST_DIRECTORY_PATHS] [--image-size INPUT_IMAGE_SIZE INPUT_IMAGE_SIZE]\n                                       [--output-image-size OUTPUT_IMAGE_SIZE OUTPUT_IMAGE_SIZE] [--seed SEED] [--color-space {rgb,lab}] [--color-channels {1,3,4}] [--optimizer {adam,rmsprop,sgd,adadelta}] [--disable-validation] [--config CONFIG]\n                                       [--output-dir OUTPUT_DIR] [--models [{cnnsr,dcsr,edsr,dcsr-ae,dcsr-resnet,vdsr,srgan,esrgan} ...]] [--loss-functions [{mse,ssim,msa,vgg16,vgg19} ...]] [--optimizer-evolution [{adam,rmsprop,sgd,adadelta} ...]]\n\nSuper Resolution Training Model Evolution Program\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --epochs EPOCHS       Set the number of passes that the training set will be trained against.\n  --batch-size BATCH_SIZE\n                        number of training element per each batch, during training.\n  --use-checkpoint      Set the path the checkpoint will be saved/loaded.\n  --checkpoint-filepath CHECKPOINT_DIR\n                        Set the path the checkpoint will be saved/loaded.\n  --checkpoint-every-epoch CHECKPOINT_EVERY_NTH_EPOCH\n                        Set how often the checkpoint will be update, per epoch.\n  --learning-rate LEARNING_RATE\n                        Set the initial Learning Rate\n  --device DEVICES      Select the device explicitly that will be used.\n  --cpu                 Explicit use the CPU as the compute device.\n  --gpu                 Explicit use of GPU\n  --distribute-strategy {mirror}\n                        Select Distribute Strategy.\n  --verbosity VERBOSITY\n                        Set the verbosity level of the program\n  --use-float16         Hint the usage of Float 16 (FP16) in the model.\n  --cache-ram           Use System Memory (RAM) as Cache storage.\n  --cache-file CACHE_PATH\n                        Set the cache file path that will be used to store dataset cached data.\n  --shuffle-data-set-size DATASET_SHUFFLE_SIZE\n                        Set the size of the shuffle buffer size, zero disables shuffling.\n  --data-set-directory TRAIN_DIRECTORY_PATHS\n                        Directory path where the images are located dataset images\n  --validation-data-directory VALIDATION_DIRECTORY_PATHS\n                        Directory path where the images are located dataset images\n  --test-data-directory TEST_DIRECTORY_PATHS\n                        Directory path where the images are located dataset images\n  --image-size INPUT_IMAGE_SIZE INPUT_IMAGE_SIZE\n                        Set the input training images size. Low Resolution (LR).\n  --output-image-size OUTPUT_IMAGE_SIZE OUTPUT_IMAGE_SIZE\n                        Set the size of the images in width and height for the model (HR).\n  --seed SEED           Set the random seed\n  --color-space {rgb,lab}\n                        Select Color Space used in the model.\n  --color-channels {1,3,4}\n                        Select Number of channels in the color space. GrayScale, RGB and RGBA.\n  --optimizer {adam,rmsprop,sgd,adadelta}\n                        Select optimizer to be used\n  --disable-validation  Disable validation if validation data is present.\n  --config CONFIG       Config File - Json.\n  --output-dir OUTPUT_DIR\n                        Set the output directory that all the models and results will be stored at\n  --models [{cnnsr,dcsr,edsr,dcsr-ae,dcsr-resnet,vdsr,srgan,esrgan} ...]\n                        Override what Model to include in training evolution.\n  --loss-functions [{mse,ssim,msa,vgg16,vgg19} ...]\n                        Override what Loss functions to include in training evolution.\n  --optimizer-evolution [{adam,rmsprop,sgd,adadelta} ...]\n                        Select optimizer to be used\n```\n\n## Upscale Image\n\nUpscaling images using pre-trained upscale model.\n\n### Upscale Single Image\n\nThe following allows to upscale a single image.\n\n```bash\npython3 superresolution/UpScaleUtil.py --model super-resolution-model-2113109.h5 --input-file low_res.png --save-output  high_res.png --batch 32 --color-space rgb\n```\n\n### Upscale Directory\n\nThe following allows to upscale a whole directory.\n\n```bash\npython3 superresolution/UpScaleUtil.py --model super-resolution-model-2113109.h5 --save-output  high_output_dir/ --input-file low_input_dir/ --batch 32 --color-space rgb\n```\n\n### Upscale Videos\n\nThe following allows to upscale video.\n\n```bash\npython3 superresolution/UpScaleVideo.py --model super-resolution-model-2113109.h5 --save-output  high_video/ --input-file video_directory/ --batch 32 --color-space rgb\n```\n\n## Installation Instructions\n\n### Setup Virtual Environment\n\npython3.11 or higher\n\n```bash\npython3 -m venv venv\nsource venv/bin/activate\n```\n\n## Installing Required Packages\n\n### CPU Only\n\n```bash\npip install -r requirements.txt\n```\n\n### Nvidia - CUDA\n\n```bash\npip install tensorflow[and-cuda]==2.16.1\npip install -r requirements.txt requirements_cuda.txt\n```\n\n### AMD - ROCM\n\n```bash\npip install -r requirements.txt requirements_rocm.txt\n```\n\n## Docker\n\n### AMD - ROCM\n\n```bash\ndocker build -t super-resolution-rocm -f Dockerfile.rocm .\ndocker run --network=host --device=/dev/kfd --device=/dev/dri --ipc=host --shm-size 16G --group-add video --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --name sr-rocm super-resolution-rocm \n```\n\n### Nvidia - CUDA\n\n```bash\nsudo apt-get install -y nvidia-container-toolkit\n```\n\n```bash\ndocker build -t super-resolution-cuda -f  Dockerfile.cuda .\ndocker run --network=host --gpus all --name sr-cuda super-resolution-cuda \n```\n\n## Convert Keras Model to TensorLite\n\n```bash\npython3 superresolution/generate_tflite.py --model super-resolution-model.keras --output model-lite.tflite\n```\n\n## Convert to ONNX\n\n```bash\npython3 -m tf2onnx.convert --saved-model tensorflow-model-path --output model.onnx\n```\n\n## Run Python In Background (Server)\n\nWhen running python script as background process, it will still be terminated if closing the terminal window. However,\nwith the **nohup** it can be run in the background as well close the terminal window.\n\n```bash\nnohup python3 superresolution/SuperResolution.py ...your arguments... \u0026\n```\n\n## License\n\nThis project is licensed under the GPL+3 License - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoldien%2Fsuperresolution","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvoldien%2Fsuperresolution","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoldien%2Fsuperresolution/lists"}