# SRCNN
This repository is implementation of the ["Image Super-Resolution Using Deep Convolutional Networks"](https://arxiv.org/abs/1501.00092).
<center><img src="./thumbnails/fig1.png"></center>
## Differences from the original
- Added the zero-padding
- Used the Adam instead of the SGD
- Removed the weights initialization
## Requirements
- PyTorch 1.0.0
- Numpy 1.15.4
- Pillow 5.4.1
- h5py 2.8.0
- tqdm 4.30.0
## Train
The 91-image, Set5 dataset converted to HDF5 can be downloaded from the links below.
| Dataset | Scale | Type | Link |
|---------|-------|------|------|
| 91-image | 2 | Train | [Download](https://www.dropbox.com/s/2hsah93sxgegsry/91-image_x2.h5?dl=0) |
| 91-image | 3 | Train | [Download](https://www.dropbox.com/s/curldmdf11iqakd/91-image_x3.h5?dl=0) |
| 91-image | 4 | Train | [Download](https://www.dropbox.com/s/22afykv4amfxeio/91-image_x4.h5?dl=0) |
| Set5 | 2 | Eval | [Download](https://www.dropbox.com/s/r8qs6tp395hgh8g/Set5_x2.h5?dl=0) |
| Set5 | 3 | Eval | [Download](https://www.dropbox.com/s/58ywjac4te3kbqq/Set5_x3.h5?dl=0) |
| Set5 | 4 | Eval | [Download](https://www.dropbox.com/s/0rz86yn3nnrodlb/Set5_x4.h5?dl=0) |
Otherwise, you can use `prepare.py` to create custom dataset.
```bash
python train.py --train-file "BLAH_BLAH/91-image_x3.h5" \
--eval-file "BLAH_BLAH/Set5_x3.h5" \
--outputs-dir "BLAH_BLAH/outputs" \
--scale 3 \
--lr 1e-4 \
--batch-size 16 \
--num-epochs 400 \
--num-workers 8 \
--seed 123
```
## Test
Pre-trained weights can be downloaded from the links below.
| Model | Scale | Link |
|-------|-------|------|
| 9-5-5 | 2 | [Download](https://www.dropbox.com/s/rxluu1y8ptjm4rn/srcnn_x2.pth?dl=0) |
| 9-5-5 | 3 | [Download](https://www.dropbox.com/s/zn4fdobm2kw0c58/srcnn_x3.pth?dl=0) |
| 9-5-5 | 4 | [Download](https://www.dropbox.com/s/pd5b2ketm0oamhj/srcnn_x4.pth?dl=0) |
The results are stored in the same path as the query image.
```bash
python test.py --weights-file "BLAH_BLAH/srcnn_x3.pth" \
--image-file "data/butterfly_GT.bmp" \
--scale 3
```
## Results
We used the network settings for experiments, i.e., <a href="https://www.codecogs.com/eqnedit.php?latex={&space;f&space;}_{&space;1&space;}=9,{&space;f&space;}_{&space;2&space;}=5,{&space;f&space;}_{&space;3&space;}=5,{&space;n&space;}_{&space;1&space;}=64,{&space;n&space;}_{&space;2&space;}=32,{&space;n&space;}_{&space;3&space;}=1" target="_blank"><img src="https://latex.codecogs.com/gif.latex?{&space;f&space;}_{&space;1&space;}=9,{&space;f&space;}_{&space;2&space;}=5,{&space;f&space;}_{&space;3&space;}=5,{&space;n&space;}_{&space;1&space;}=64,{&space;n&space;}_{&space;2&space;}=32,{&space;n&space;}_{&space;3&space;}=1" title="{ f }_{ 1 }=9,{ f }_{ 2 }=5,{ f }_{ 3 }=5,{ n }_{ 1 }=64,{ n }_{ 2 }=32,{ n }_{ 3 }=1" /></a>.
PSNR was calculated on the Y channel.
### Set5
| Eval. Mat | Scale | SRCNN | SRCNN (Ours) |
|-----------|-------|-------|--------------|
| PSNR | 2 | 36.66 | 36.65 |
| PSNR | 3 | 32.75 | 33.29 |
| PSNR | 4 | 30.49 | 30.25 |
<table>
<tr>
<td><center>Original</center></td>
<td><center>BICUBIC x3</center></td>
<td><center>SRCNN x3 (27.53 dB)</center></td>
</tr>
<tr>
<td>
<center><img src="./data/butterfly_GT.bmp""></center>
</td>
<td>
<center><img src="./data/butterfly_GT_bicubic_x3.bmp"></center>
</td>
<td>
<center><img src="./data/butterfly_GT_srcnn_x3.bmp"></center>
</td>
</tr>
<tr>
<td><center>Original</center></td>
<td><center>BICUBIC x3</center></td>
<td><center>SRCNN x3 (29.30 dB)</center></td>
</tr>
<tr>
<td>
<center><img src="./data/zebra.bmp""></center>
</td>
<td>
<center><img src="./data/zebra_bicubic_x3.bmp"></center>
</td>
<td>
<center><img src="./data/zebra_srcnn_x3.bmp"></center>
</td>
</tr>
<tr>
<td><center>Original</center></td>
<td><center>BICUBIC x3</center></td>
<td><center>SRCNN x3 (28.58 dB)</center></td>
</tr>
<tr>
<td>
<center><img src="./data/ppt3.bmp""></center>
</td>
<td>
<center><img src="./data/ppt3_bicubic_x3.bmp"></center>
</td>
<td>
<center><img src="./data/ppt3_srcnn_x3.bmp"></center>
</td>
</tr>
</table>
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
保姆级使用教程:https://blog.csdn.net/qq_36584673/article/details/138836834 data:测试单张图像以及超分结果文件夹 datasets:数据集存放文件夹,包含训练集、验证集和测试集 Plt:Loss、PSNR、SSIM与Epoch关系曲线图存放位置 epochs:模型权重文件存放位置 dataset.py:封装数据集,h5转Tensor draw_evaluation.py:绘制Loss、PSNR、SSIM与Epoch的关系曲线图 test.py:测试单张图像超分结果 imresize.py:python实现matlab中的imresize train.py:训练SRCNN models.py:SRCNN模型实现 test_benchmark.py:测试benchmarks,控制台输出平均PSNR和SSIM utils.py:图像处理,计算指标工具集 代码详细使用说明,实现细节,请看上面的教程文章!
资源推荐
资源详情
资源评论
收起资源包目录
SRCNN-pytorch-master (2).zip (41个子文件)
SRCNN-pytorch-master
utils.py 5KB
thumbnails
fig1.png 192KB
imresize.py 5KB
data
butterfly_GT_srcnn_x4.bmp 192KB
butterfly_GT_bicubic_x2.bmp 192KB
butterfly_GT_srcnn_x2.bmp 192KB
butterfly_GT_plt_x2_SRCNN.png 639KB
butterfly_GT_bicubic_x3.bmp 191KB
butterfly_GT_bicubic_x4.bmp 192KB
butterfly_GT_plt_x3_SRCNN.png 620KB
butterfly_GT.bmp 192KB
butterfly_GT_plt_x4_SRCNN.png 611KB
butterfly_GT_srcnn_x3.bmp 191KB
models.py 541B
.idea
workspace.xml 4KB
misc.xml 266B
inspectionProfiles
profiles_settings.xml 174B
modules.xml 299B
deployment.xml 3KB
SRCNN-pytorch-master.iml 316B
.gitignore 50B
datasets
91-image_x4.h5 180.89MB
Set5_x4.h5 4.34MB
91-image_x3.h5 181.82MB
Set5_x2.h5 4.34MB
91-image_x2.h5 182.04MB
Set5_x3.h5 4.31MB
Plt
draw_evaluation.py 3KB
test_benchmark.py 4KB
datasets.py 934B
.gitignore 15B
epochs
x2
best_x2.pth 226KB
x3
best_x3.pth 226KB
x4
best_x4.pth 226KB
prepare.py 3KB
train.py 8KB
__pycache__
models.cpython-38.pyc 912B
utils.cpython-38.pyc 5KB
imresize.cpython-38.pyc 5KB
test.py 3KB
README.md 4KB
共 41 条
- 1
资源评论
- wanghaiYang1212024-05-26资源不错,内容挺好的,有一定的使用价值,值得借鉴,感谢分享。
- m0_524983562024-05-21资源很实用,内容详细,值得借鉴的内容很多,感谢分享。
十小大
- 粉丝: 1w+
- 资源: 2556
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功