ESPCN

  • 论文全称:Real-Time Single Image and Video Super-Resolution Using an Efficient Sub-Pixel Convolutional Neural Network
    来自CVPR2016
  • The downsampling operation is deterministic and known: to produce ILR from IHR, we first convolve IHR using a Gaussian filter - thus simulating the camera’s point spread function - then downsample the image by a factor of r
    产生模糊的图像不是简单的4个点取一个,而是先用高斯滤波器来卷积,再下采样,这样下采样到的像素能包括其周围像素点的信息
  • The deconvolution layer proposed in [50] can be seen as multiplication of each input pixel by a filter element-wise with stride r, and sums over the resulting output windows also known as backwards convolution
    deconv层可以认为是每个LR像素乘以同一个卷积核得到HR图像,重叠的地方相加
  • The other way to upscale a LR image is convolution with fractional stride of 1 r in the LR space as mentioned by [24], which can be naively implemented by interpolation, perforate [27] or un-pooling [49] from LR space to HR space followed by a convolution with a stride of 1 in HR space. These implementations increase the computational cost by a factor of r2, since convolution happens in HR space
    还要其它upscale的方式比如interp或up-pooling(perforate),得到HRsize的图片,再卷积
  • 而文中选择的upsample的方式比较特殊:

    先conv成r平方个channel的map,然后做位置变化,把每个location 的 r平方个channel的像素摆到一个r*r的正方形里面,变成一张HR,而且conv后是没有non-linear层的,在训练的时候采取相反的方式,把ground-truth的HR分割成r*r的网格然后变化位置变成r平方个channel的3-d map,计算per-pixel loss,会快很多
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
ESPCN(Efficient Sub-Pixel Convolutional Neural Network)是一种用于图像超分辨率的深度学习模型,它可以将低分辨率图像转换为高分辨率图像。下面是一个简单的ESPCN的PyTorch代码示例: ```python import torch import torch.nn as nn class ESPCN(nn.Module): def __init__(self, scale_factor): super(ESPCN, self).__init__() self.scale_factor = scale_factor self.conv1 = nn.Conv2d(3, 64, kernel_size=5, padding=2) self.conv2 = nn.Conv2d(64, 32, kernel_size=3, padding=1) self.conv3 = nn.Conv2d(32, 3 * (scale_factor ** 2), kernel_size=3, padding=1) self.pixel_shuffle = nn.PixelShuffle(scale_factor) def forward(self, x): x = nn.functional.relu(self.conv1(x)) x = nn.functional.relu(self.conv2(x)) x = self.pixel_shuffle(self.conv3(x)) return x # 创建ESPCN模型实例 scale_factor = 4 # 放大倍数 model = ESPCN(scale_factor) # 加载预训练模型参数(可选) # model.load_state_dict(torch.load('espcn.pth')) # 输入低分辨率图像 input_image = torch.randn(1, 3, 32, 32) # 输入图像尺寸为32x32 # 使用ESPCN模型进行超分辨率重建 output_image = model(input_image) print("输入图像尺寸:", input_image.size()) print("输出图像尺寸:", output_image.size()) ``` 上述代码定义了一个名为ESPCN的PyTorch模型类,其中包含了三个卷积层和一个像素重排层。在forward方法中,输入图像经过卷积和ReLU激活函数后,通过像素重排层进行上采样,最终得到高分辨率的图像输出。 你可以根据自己的需求修改模型的结构和参数,例如调整卷积层的通道数、卷积核大小等。此外,你还可以加载预训练的模型参数(如果有的话)来进行图像超分辨率的重建。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值