Super Resolution Model Comparison
π Super Resolution Model Comparison is a web application built using Streamlit that allows users to upload a low-resolution image and compare its enhancement using various super-resolution models (SRCNN, VDSR, and EDSR). The application provides image quality metrics (PSNR and SSIM) and processing time for each model to assess their performance.
Features
- Image Upload: Upload low-resolution images in PNG, JPG, or JPEG formats.
- Model Comparison: Enhance the uploaded image using three popular super-resolution models:
- SRCNN: Super-Resolution Convolutional Neural Network.
- VDSR: Very Deep Super-Resolution Network.
- EDSR: Enhanced Deep Super-Resolution Network.
- Visual Comparison: View the enhanced output for each model side-by-side.
- Performance Metrics:
- Processing Time: Time taken by each model to process the image.
- Image Quality:
- PSNR (Peak Signal-to-Noise Ratio): Measures the quality of the enhanced image compared to the original.
- SSIM (Structural Similarity Index): Assesses structural similarity between the images.
- Download Enhanced Images: Download the enhanced images generated by each model.
Installation
Prerequisites
- Python 3.8 or above
- Pip package manager
Steps
Clone the Repository
git clone <repository-url> cd <repository-folder>
Install Dependencies
pip install -r requirements.txt
Download Pre-trained Weights
- Place the pre-trained model weights in the
checkpoints/
directory:srcnn_best.pth
for SRCNNvdsr_best.pth
for VDSRedsr_best.pth
for EDSR
- Place the pre-trained model weights in the
Run the Application
streamlit run app.py
Usage
- Open the application in your browser (default URL:
http://localhost:8501
). - Upload a low-resolution image using the file uploader.
- View the enhanced images generated by each model.
- Compare the performance and quality metrics for each model.
- Download the enhanced images for further use.
File Structure
.
βββ app.py # Main Streamlit application script
βββ models/ # Directory for model definitions
β βββ srcnn.py # SRCNN model
β βββ vdsr.py # VDSR model
β βββ edsr.py # EDSR model
βββ checkpoints/ # Directory for storing pre-trained weights
β βββ srcnn_best.pth
β βββ vdsr_best.pth
β βββ edsr_best.pth
βββ requirements.txt # Python dependencies
βββ README.md # Documentation
Dependencies
Install the required Python libraries:
torch
: PyTorch for deep learning.torchvision
: Image transformations and utilities.streamlit
: Interactive web interface.pillow
: Image processing library.numpy
: Numerical operations.scikit-image
: Image quality metrics (PSNR, SSIM).
Models
1. SRCNN
- A shallow neural network for super-resolution.
- Faster but may have lower performance on complex images.
2. VDSR
- A deeper network providing improved results at the cost of longer processing time.
3. EDSR
- Enhanced deep network specifically designed for high-quality super-resolution.
Metrics
- PSNR: Measures the similarity of the enhanced image to the original in terms of pixel-level accuracy. Higher values indicate better quality.
- SSIM: Evaluates the structural similarity of the enhanced image to the original. Higher values indicate better preservation of structural features.
Customization
Adding New Models
- Add the new model definition to the
models/
directory. - Update the
load_model()
function inapp.py
to include the new model.
Updating Pre-trained Weights
Place updated weights in the checkpoints/
directory with the naming convention <model_name>_best.pth
.
Future Enhancements
- Support for real-time video super-resolution.
- Integration with additional state-of-the-art super-resolution models.
- GPU acceleration for faster processing.
License
This project is open-source and available under the MIT License.
Contact
For queries or contributions, reach out via GitHub or email.
Happy enhancing! π
Evaluation results
- PSNR on DIV2Kself-reported30.500
- SSIM on DIV2Kself-reported0.850