This web application uses a pre-trained ESRGAN (Enhanced Super-Resolution Generative Adversarial Network) model to enhance images with 4x super-resolution.
- Upload images in JPG, JPEG, or PNG format
- 4x Super-resolution enhancement
- Download enhanced images
- User-friendly web interface
- Python 3.6+
- PyTorch
- OpenCV
- Flask
- NumPy
├── app.py # Flask web application
├── RRDBNet_arch.py # Model architecture definition
├── models/
│ └── RRDB_ESRGAN_x4.pth # Pre-trained model
├── templates/
│ ├── index.html # Home page template
│ └── result.html # Results page template
├── uploads/ # Temporary storage for uploaded images
└── results/ # Temporary storage for enhanced images
-
Clone this repository:
git clone <your-repository-url> cd <repository-name> -
Install the required dependencies:
pip install -r requirements.txt -
Make sure you have your pre-trained model file (
RRDB_ESRGAN_x4.pth) in themodels/directory.
-
Start the web server:
python app.py -
Open your web browser and go to:
http://127.0.0.1:5000/ -
Upload an image through the web interface and click "Enhance Image".
-
After processing, you'll be redirected to the results page where you can:
- View a comparison between original and enhanced images
- Download the enhanced image
- Choose to enhance another image
Create a requirements.txt file with the following dependencies:
flask==2.0.1
numpy==1.21.0
opencv-python==4.5.3.56
torch==1.9.0
torchvision==0.10.0
- Processing large images may take time depending on your hardware.
- The application is set to use CUDA if available, otherwise it will fall back to CPU.
- Maximum upload file size is limited to 16MB by default.