Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,148 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Super Resolution Model Comparison
|
| 2 |
+
|
| 3 |
+
π **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.
|
| 4 |
+
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
## Features
|
| 8 |
+
|
| 9 |
+
- **Image Upload**: Upload low-resolution images in PNG, JPG, or JPEG formats.
|
| 10 |
+
- **Model Comparison**: Enhance the uploaded image using three popular super-resolution models:
|
| 11 |
+
- **SRCNN**: Super-Resolution Convolutional Neural Network.
|
| 12 |
+
- **VDSR**: Very Deep Super-Resolution Network.
|
| 13 |
+
- **EDSR**: Enhanced Deep Super-Resolution Network.
|
| 14 |
+
- **Visual Comparison**: View the enhanced output for each model side-by-side.
|
| 15 |
+
- **Performance Metrics**:
|
| 16 |
+
- **Processing Time**: Time taken by each model to process the image.
|
| 17 |
+
- **Image Quality**:
|
| 18 |
+
- **PSNR** (Peak Signal-to-Noise Ratio): Measures the quality of the enhanced image compared to the original.
|
| 19 |
+
- **SSIM** (Structural Similarity Index): Assesses structural similarity between the images.
|
| 20 |
+
- **Download Enhanced Images**: Download the enhanced images generated by each model.
|
| 21 |
+
|
| 22 |
+
---
|
| 23 |
+
|
| 24 |
+
## Installation
|
| 25 |
+
|
| 26 |
+
### Prerequisites
|
| 27 |
+
|
| 28 |
+
- Python 3.8 or above
|
| 29 |
+
- Pip package manager
|
| 30 |
+
|
| 31 |
+
### Steps
|
| 32 |
+
|
| 33 |
+
1. **Clone the Repository**
|
| 34 |
+
```bash
|
| 35 |
+
git clone <repository-url>
|
| 36 |
+
cd <repository-folder>
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
2. **Install Dependencies**
|
| 40 |
+
```bash
|
| 41 |
+
pip install -r requirements.txt
|
| 42 |
+
```
|
| 43 |
+
|
| 44 |
+
3. **Download Pre-trained Weights**
|
| 45 |
+
- Place the pre-trained model weights in the `checkpoints/` directory:
|
| 46 |
+
- `srcnn_best.pth` for SRCNN
|
| 47 |
+
- `vdsr_best.pth` for VDSR
|
| 48 |
+
- `edsr_best.pth` for EDSR
|
| 49 |
+
|
| 50 |
+
4. **Run the Application**
|
| 51 |
+
```bash
|
| 52 |
+
streamlit run app.py
|
| 53 |
+
```
|
| 54 |
+
|
| 55 |
+
---
|
| 56 |
+
|
| 57 |
+
## Usage
|
| 58 |
+
|
| 59 |
+
1. Open the application in your browser (default URL: `http://localhost:8501`).
|
| 60 |
+
2. Upload a low-resolution image using the file uploader.
|
| 61 |
+
3. View the enhanced images generated by each model.
|
| 62 |
+
4. Compare the performance and quality metrics for each model.
|
| 63 |
+
5. Download the enhanced images for further use.
|
| 64 |
+
|
| 65 |
+
---
|
| 66 |
+
|
| 67 |
+
## File Structure
|
| 68 |
+
|
| 69 |
+
```
|
| 70 |
+
.
|
| 71 |
+
βββ app.py # Main Streamlit application script
|
| 72 |
+
βββ models/ # Directory for model definitions
|
| 73 |
+
β βββ srcnn.py # SRCNN model
|
| 74 |
+
β βββ vdsr.py # VDSR model
|
| 75 |
+
β βββ edsr.py # EDSR model
|
| 76 |
+
βββ checkpoints/ # Directory for storing pre-trained weights
|
| 77 |
+
β βββ srcnn_best.pth
|
| 78 |
+
β βββ vdsr_best.pth
|
| 79 |
+
β βββ edsr_best.pth
|
| 80 |
+
βββ requirements.txt # Python dependencies
|
| 81 |
+
βββ README.md # Documentation
|
| 82 |
+
```
|
| 83 |
+
|
| 84 |
+
---
|
| 85 |
+
|
| 86 |
+
## Dependencies
|
| 87 |
+
|
| 88 |
+
Install the required Python libraries:
|
| 89 |
+
- `torch`: PyTorch for deep learning.
|
| 90 |
+
- `torchvision`: Image transformations and utilities.
|
| 91 |
+
- `streamlit`: Interactive web interface.
|
| 92 |
+
- `pillow`: Image processing library.
|
| 93 |
+
- `numpy`: Numerical operations.
|
| 94 |
+
- `scikit-image`: Image quality metrics (PSNR, SSIM).
|
| 95 |
+
|
| 96 |
+
---
|
| 97 |
+
|
| 98 |
+
## Models
|
| 99 |
+
|
| 100 |
+
### 1. SRCNN
|
| 101 |
+
- A shallow neural network for super-resolution.
|
| 102 |
+
- Faster but may have lower performance on complex images.
|
| 103 |
+
|
| 104 |
+
### 2. VDSR
|
| 105 |
+
- A deeper network providing improved results at the cost of longer processing time.
|
| 106 |
+
|
| 107 |
+
### 3. EDSR
|
| 108 |
+
- Enhanced deep network specifically designed for high-quality super-resolution.
|
| 109 |
+
|
| 110 |
+
---
|
| 111 |
+
|
| 112 |
+
## Metrics
|
| 113 |
+
|
| 114 |
+
- **PSNR**: Measures the similarity of the enhanced image to the original in terms of pixel-level accuracy. Higher values indicate better quality.
|
| 115 |
+
- **SSIM**: Evaluates the structural similarity of the enhanced image to the original. Higher values indicate better preservation of structural features.
|
| 116 |
+
|
| 117 |
+
---
|
| 118 |
+
|
| 119 |
+
## Customization
|
| 120 |
+
|
| 121 |
+
### Adding New Models
|
| 122 |
+
1. Add the new model definition to the `models/` directory.
|
| 123 |
+
2. Update the `load_model()` function in `app.py` to include the new model.
|
| 124 |
+
|
| 125 |
+
### Updating Pre-trained Weights
|
| 126 |
+
Place updated weights in the `checkpoints/` directory with the naming convention `<model_name>_best.pth`.
|
| 127 |
+
|
| 128 |
+
---
|
| 129 |
+
|
| 130 |
+
## Future Enhancements
|
| 131 |
+
|
| 132 |
+
- Support for real-time video super-resolution.
|
| 133 |
+
- Integration with additional state-of-the-art super-resolution models.
|
| 134 |
+
- GPU acceleration for faster processing.
|
| 135 |
+
|
| 136 |
+
---
|
| 137 |
+
|
| 138 |
+
## License
|
| 139 |
+
|
| 140 |
+
This project is open-source and available under the MIT License.
|
| 141 |
+
|
| 142 |
+
---
|
| 143 |
+
|
| 144 |
+
## Contact
|
| 145 |
+
|
| 146 |
+
For queries or contributions, reach out via GitHub or email.
|
| 147 |
+
|
| 148 |
+
Happy enhancing! π
|