File size: 4,797 Bytes
db5f0b0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ad6c166
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
---
tags:
- super-resolution
- image-enhancement
- pytorch
- deep-learning
datasets:
- DIV2K
- Set5
license: mit
model-index:
- name: EDSR
  results:
  - task:
      name: Image Super-Resolution
      type: image-super-resolution
    dataset:
      name: DIV2K
      type: DIV2K
    metrics:
      - name: PSNR
        type: psnr
        value: 30.50
      - name: SSIM
        type: ssim
        value: 0.85
---

# 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

1. **Clone the Repository**
   ```bash
   git clone <repository-url>
   cd <repository-folder>
   ```

2. **Install Dependencies**
   ```bash
   pip install -r requirements.txt
   ```

3. **Download Pre-trained Weights**
   - Place the pre-trained model weights in the `checkpoints/` directory:
     - `srcnn_best.pth` for SRCNN
     - `vdsr_best.pth` for VDSR
     - `edsr_best.pth` for EDSR

4. **Run the Application**
   ```bash
   streamlit run app.py
   ```

---

## Usage

1. Open the application in your browser (default URL: `http://localhost:8501`).
2. Upload a low-resolution image using the file uploader.
3. View the enhanced images generated by each model.
4. Compare the performance and quality metrics for each model.
5. 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
1. Add the new model definition to the `models/` directory.
2. Update the `load_model()` function in `app.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! πŸš€