SRGAN On Custom Dataset: Learn how to train SRGAN on a custom dataset to achieve high-quality image super-resolution.
🏠 Homepage
Welcome to the SRGAN project! This repository contains code and instructions for training a Super-Resolution Generative Adversarial Network (SRGAN) on a custom dataset. SRGAN is a powerful neural network architecture that can upscale low-resolution images to high-resolution images with impressive detail and fidelity. The SRGAN model here are of two types:
- SRGAN_self_attention.py : This model incorporates self attention technique inside Generative Adversarial Network (GAN) architecture.
- srgan_model.py : This model is the normal GAN model that increases the resolution of the input image by 4.
- Custom Dataset Support: Train SRGAN on your custom dataset to achieve the best results for your specific use case.
- Flexible Environment: Easily set up and configure the environment using Anaconda and PyTorch.
- GPU & CPU Support: Train and test your model on both GPU and CPU hardware, depending on your resources.
- Simple Training & Testing: Straightforward commands for training and testing the SRGAN model.
Ensure you have the following prerequisites before proceeding with the installation:
- Anaconda
- Python 3.7+
- Conda
-
Clone the repository:
git clone https://github.com/Uddeshya1052/Super_Resolution.git cd Super_Resolution
-
Create and activate the conda environment:
Open the Anaconda prompt and navigate to the folder where you have your environment.yml file:
conda env create -f environment.yml conda activate srganenv_gpu
-
Set up the environment: Depending on your hardware, choose the appropriate PyTorch installation:
- GPU
conda install pytorch==1.1.0 torchvision==0.3.0 cudatoolkit=10.0 -c pytorch
- CPU
conda install pytorch-cpu==1.1.0 torchvision-cpu==0.3.0 cpuonly -c pytorch
- GPU
Train Your Model:
To train your model on a custom dataset, execute the following command:
python main.py --LR_path Custom_dataset/LR_Images --GT_path Custom_dataset/HR_images
- --LR_path: Path to your low-resolution training images.
- --GT_path: Path to your ground truth high-resolution images.
Test Your Model
python main.py --mode test_only --LR_path test_data --generator_path ./model/srgan_custom.pt
--mode test_only
: Set this flag to indicate testing mode.--LR_path
: Path to your low-resolution test images.--generator_path
: Path to your trained SRGAN generator model.
Contributions, issues, and feature requests are welcome! Feel free to check the issues page. You can also take a look at the contributing guide.
- Name: Uddeshya Srivastava
- GitHub: Uddeshya1052
- LinkedIn: Uddeshya Srivastava