1 简介
FSRCNN 模型是汤晓鸥团队设计的一种基于卷积神经网络的单一图像超分辨率重建模型,是对 SRCNN 模型的改进,SRCNN 模型首先将一个低分辨率图像通过双三次插值放大到目标大小,再通过 3 层的卷积层做非线性映射,最后重建出高分辨率图像。SRCNN 的结构包含 3 层的神经网络,如图 1 所示,分别和传统的 SR 模型的三个步骤相对应,其中第 1 层卷积对应特征提取和表示,第 2 层卷积对应非线性映射,第 3 层卷积对应最后的重建。
2 部分代码
% =========================================================================
% Test code for Fast Super-Resolution Convolutional Neural Networks (FSRCNN)
%
% Reference
% Chao Dong, Chen Change Loy, Xiaoou Tang. Accelerating the Super-Resolution Convolutional Neural Networks,
% in Proceedings of European Conference on Computer Vision (ECCV), 2016
%
% =========================================================================
close all;
clear all;
%% set parameters
testfolder = 'test\Set5\';
up_scale = 3;
model = 'model\FSRCNN\x3.mat';
filepaths = dir(fullfile(testfolder,'*.bmp'));
psnr_bic = zeros(length(filepaths),1);
psnr_fsrcnn = zeros(length(filepaths),1);
for i = 1 : length(filepaths)
%% read ground truth image
[add,imname,type] = fileparts(filepaths(i).name);
im = imread([testfolder imname type]);
%% work on illuminance only
if size(im,3) > 1
im_ycbcr = rgb2ycbcr(im);
im = im_ycbcr(:, :, 1);
end
im_gnd = modcrop(im, up_scale);
im_gnd = single(im_gnd)/255;
im_l = imresize(im_gnd, 1/up_scale, 'bicubic');
%% FSRCNN
im_h = FSRCNN(model, im_l, up_scale);
%% bicubic interpolation
im_b = imresize(im_l, up_scale, 'bicubic');
%% remove border
if up_scale==3
im_h = shave_x3(uint8(im_h * 255), [up_scale, up_scale]);
else
im_h = shave(uint8(im_h * 255), [up_scale, up_scale]);
end
im_gnd = shave(uint8(im_gnd * 255), [up_scale, up_scale]);
im_b = shave(uint8(im_b * 255), [up_scale, up_scale]);
%% compute PSNR
psnr_bic(i) = compute_psnr(im_gnd,im_b);
psnr_fsrcnn(i) = compute_psnr(im_gnd,im_h);
%% save results
imwrite(im_b, [imname '_bic.bmp']);
imwrite(im_h, [imname '_FSRCNN.bmp']);
end
fprintf('Mean PSNR for Bicubic: %f dB\n', mean(psnr_bic));
fprintf('Mean PSNR for FSRCNN: %f dB\n', mean(psnr_fsrcnn));
3 仿真结果
4 参考文献
[1]雷为民, 王玉楠, 李锦环. 基于FSRCNN的图像超分辨率重建算法优化研究[J]. 传感器与微系统, 2020, 39(2):4.
博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。
部分理论引用网络文献,若有侵权联系博主删除。