https://github.com/yjn870/FSRCNN-pytorch
时间: 2023-11-15 14:07:19 浏览: 197
FSRCNN-pytorch是一个基于PyTorch框架实现的快速超分辨率卷积神经网络。它可以将低分辨率图像转换为高分辨率图像,从而提高图像的清晰度和质量。该项目的GitHub链接为https://github.com/yjn870/FSRCNN-pytorch。
代码示例:
```python
import torch
import torch.nn as nn
class FSRCNN(nn.Module):
def __init__(self, upscale_factor=3, d=56, s=12, m=4):
super(FSRCNN, self).__init__()
self.first_part = nn.Sequential(
nn.Conv2d(1, d, kernel_size=5, padding=5//2),
nn.PReLU()
)
self.layers = []
for _ in range(m):
self.layers.append(nn.Sequential(
nn.Conv2d(d, d, kernel_size=3, padding=3//2),
nn.BatchNorm2d(d),
nn.PReLU()
))
self.mid_part = nn.Sequential(*self.layers)
self.last_part = nn.Sequential(
nn.Conv2d(d, s, kernel_size=3, padding=3//2),
nn.BatchNorm2d(s)
)
self.upscale = nn.Sequential(
nn.Conv2d(s, s * (upscale_factor ** 2), kernel_size=3, padding=3//2),
nn.PixelShuffle(upscale_factor),
nn.PReLU()
)
def forward(self, x):
x = self.first_part(x)
x = self.mid_part(x)
x = self.last_part(x)
x = self.upscale(x)
return x
```
阅读全文