问答文章1 问答文章501 问答文章1001 问答文章1501 问答文章2001 问答文章2501 问答文章3001 问答文章3501 问答文章4001 问答文章4501 问答文章5001 问答文章5501 问答文章6001 问答文章6501 问答文章7001 问答文章7501 问答文章8001 问答文章8501 问答文章9001 问答文章9501

求基于BP神经网络的图像复原算法的matlab代码

发布网友 发布时间:2022-04-24 01:35

我来回答

3个回答

热心网友 时间:2023-10-18 23:32

function Solar_SAE
tic;
n = 300;
m=20;
train_x = [];
test_x = [];
for i = 1:n
%filename = strcat(['D:\Program Files\MATLAB\R2012a\work\DeepLearn\Solar_SAE\64_64_3train\' num2str(i,'%03d') '.bmp']);
%filename = strcat(['E:\matlab\work\c0\TrainImage' num2str(i,'%03d') '.bmp']);
filename = strcat(['E:\image restoration\3-(' num2str(i) ')-4.jpg']);
b = imread(filename);
%c = rgb2gray(b);
c=b;
[ImageRow ImageCol] = size(c);
c = reshape(c,[1,ImageRow*ImageCol]);
train_x = [train_x;c];
end
for i = 1:m
%filename = strcat(['D:\Program Files\MATLAB\R2012a\work\DeepLearn\Solar_SAE\64_64_3test\' num2str(i,'%03d') '.bmp']);
%filename = strcat(['E:\matlab\work\c0\TestImage' num2str(i+100,'%03d') '-1.bmp']);
filename = strcat(['E:\image restoration\3-(' num2str(i+100) ').jpg']);
b = imread(filename);
%c = rgb2gray(b);
c=b;
[ImageRow ImageCol] = size(c);
c = reshape(c,[1,ImageRow*ImageCol]);
test_x = [test_x;c];
end
train_x = double(train_x)/255;
test_x = double(test_x)/255;
%train_y = double(train_y);
%test_y = double(test_y);

% Setup and train a stacked denoising autoencoder (SDAE)
rng(0);
%sae = saesetup([4096 500 200 50]);
%sae.ae{1}.activation_function = 'sigm';
%sae.ae{1}.learningRate = 0.5;
%sae.ae{1}.inputZeroMaskedFraction = 0.0;

%sae.ae{2}.activation_function = 'sigm';
%sae.ae{2}.learningRate = 0.5
%%sae.ae{2}.inputZeroMaskedFraction = 0.0;

%sae.ae{3}.activation_function = 'sigm';
%sae.ae{3}.learningRate = 0.5;
%sae.ae{3}.inputZeroMaskedFraction = 0.0;

%sae.ae{4}.activation_function = 'sigm';
%sae.ae{4}.learningRate = 0.5;
%sae.ae{4}.inputZeroMaskedFraction = 0.0;

%opts.numepochs = 10;
%opts.batchsize = 50;
%sae = saetrain(sae, train_x, opts);
%visualize(sae.ae{1}.W{1}(:,2:end)');

% Use the SDAE to initialize a FFNN
nn = nnsetup([4096 1500 500 200 50 200 500 1500 4096]);
nn.activation_function = 'sigm';
nn.learningRate = 0.03;
nn.output = 'linear'; % output unit 'sigm' (=logistic), 'softmax' and 'linear'

%add pretrained weights
%nn.W{1} = sae.ae{1}.W{1};
%nn.W{2} = sae.ae{2}.W{1};
%nn.W{3} = sae.ae{3}.W{1};
%nn.W{4} = sae.ae{3}.W{2};
%nn.W{5} = sae.ae{2}.W{2};
%nn.W{6} = sae.ae{1}.W{2};
%nn.W{7} = sae.ae{2}.W{2};
%nn.W{8} = sae.ae{1}.W{2};

% Train the FFNN
opts.numepochs = 30;
opts.batchsize = 150;
tx = test_x(14,:);
nn1 = nnff(nn,tx,tx);
ty1 = reshape(nn1.a{9},64,64);

nn = nntrain(nn, train_x, train_x, opts);
toc;
tic;
nn2 = nnff(nn,tx,tx);
toc;
tic;
ty2 = reshape(nn2.a{9},64,64);
tx = reshape(tx,64,64);
tz = tx - ty2;
tz = im2bw(tz,0.1);
%imshow(tx);
%figure,imshow(ty2);
%figure,imshow(tz);
ty = cat(2,tx,ty2,tz);
montage(ty);
filename3 = strcat(['E:\image restoration\3.jpg']);
e=imread(filename3);

f= rgb2gray(e);
f=imresize(f,[64,64]);
%imshow(ty2);
f=double (f)/255;
[PSNR, MSE] = psnr(ty2,f)
imwrite(ty2,'E:\image restoration\bptest.jpg','jpg');
toc;
%visualize(ty);
%[er, bad] = nntest(nn, tx, tx);
%assert(er < 0.1, 'Too big error');

热心网友 时间:2023-10-18 23:32

已经发私信给你了追问没看到啊

追答百度的私信,我无语啊,留下我的邮箱吧,给我发信吧。ajitaiajitai@163.com

热心网友 时间:2023-10-18 23:33

去知网搜索吧

热心网友 时间:2023-10-18 23:32

function Solar_SAE
tic;
n = 300;
m=20;
train_x = [];
test_x = [];
for i = 1:n
%filename = strcat(['D:\Program Files\MATLAB\R2012a\work\DeepLearn\Solar_SAE\64_64_3train\' num2str(i,'%03d') '.bmp']);
%filename = strcat(['E:\matlab\work\c0\TrainImage' num2str(i,'%03d') '.bmp']);
filename = strcat(['E:\image restoration\3-(' num2str(i) ')-4.jpg']);
b = imread(filename);
%c = rgb2gray(b);
c=b;
[ImageRow ImageCol] = size(c);
c = reshape(c,[1,ImageRow*ImageCol]);
train_x = [train_x;c];
end
for i = 1:m
%filename = strcat(['D:\Program Files\MATLAB\R2012a\work\DeepLearn\Solar_SAE\64_64_3test\' num2str(i,'%03d') '.bmp']);
%filename = strcat(['E:\matlab\work\c0\TestImage' num2str(i+100,'%03d') '-1.bmp']);
filename = strcat(['E:\image restoration\3-(' num2str(i+100) ').jpg']);
b = imread(filename);
%c = rgb2gray(b);
c=b;
[ImageRow ImageCol] = size(c);
c = reshape(c,[1,ImageRow*ImageCol]);
test_x = [test_x;c];
end
train_x = double(train_x)/255;
test_x = double(test_x)/255;
%train_y = double(train_y);
%test_y = double(test_y);

% Setup and train a stacked denoising autoencoder (SDAE)
rng(0);
%sae = saesetup([4096 500 200 50]);
%sae.ae{1}.activation_function = 'sigm';
%sae.ae{1}.learningRate = 0.5;
%sae.ae{1}.inputZeroMaskedFraction = 0.0;

%sae.ae{2}.activation_function = 'sigm';
%sae.ae{2}.learningRate = 0.5
%%sae.ae{2}.inputZeroMaskedFraction = 0.0;

%sae.ae{3}.activation_function = 'sigm';
%sae.ae{3}.learningRate = 0.5;
%sae.ae{3}.inputZeroMaskedFraction = 0.0;

%sae.ae{4}.activation_function = 'sigm';
%sae.ae{4}.learningRate = 0.5;
%sae.ae{4}.inputZeroMaskedFraction = 0.0;

%opts.numepochs = 10;
%opts.batchsize = 50;
%sae = saetrain(sae, train_x, opts);
%visualize(sae.ae{1}.W{1}(:,2:end)');

% Use the SDAE to initialize a FFNN
nn = nnsetup([4096 1500 500 200 50 200 500 1500 4096]);
nn.activation_function = 'sigm';
nn.learningRate = 0.03;
nn.output = 'linear'; % output unit 'sigm' (=logistic), 'softmax' and 'linear'

%add pretrained weights
%nn.W{1} = sae.ae{1}.W{1};
%nn.W{2} = sae.ae{2}.W{1};
%nn.W{3} = sae.ae{3}.W{1};
%nn.W{4} = sae.ae{3}.W{2};
%nn.W{5} = sae.ae{2}.W{2};
%nn.W{6} = sae.ae{1}.W{2};
%nn.W{7} = sae.ae{2}.W{2};
%nn.W{8} = sae.ae{1}.W{2};

% Train the FFNN
opts.numepochs = 30;
opts.batchsize = 150;
tx = test_x(14,:);
nn1 = nnff(nn,tx,tx);
ty1 = reshape(nn1.a{9},64,64);

nn = nntrain(nn, train_x, train_x, opts);
toc;
tic;
nn2 = nnff(nn,tx,tx);
toc;
tic;
ty2 = reshape(nn2.a{9},64,64);
tx = reshape(tx,64,64);
tz = tx - ty2;
tz = im2bw(tz,0.1);
%imshow(tx);
%figure,imshow(ty2);
%figure,imshow(tz);
ty = cat(2,tx,ty2,tz);
montage(ty);
filename3 = strcat(['E:\image restoration\3.jpg']);
e=imread(filename3);

f= rgb2gray(e);
f=imresize(f,[64,64]);
%imshow(ty2);
f=double (f)/255;
[PSNR, MSE] = psnr(ty2,f)
imwrite(ty2,'E:\image restoration\bptest.jpg','jpg');
toc;
%visualize(ty);
%[er, bad] = nntest(nn, tx, tx);
%assert(er < 0.1, 'Too big error');

热心网友 时间:2023-10-18 23:32

已经发私信给你了追问没看到啊

追答百度的私信,我无语啊,留下我的邮箱吧,给我发信吧。ajitaiajitai@163.com

热心网友 时间:2023-10-18 23:33

去知网搜索吧
声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com
请问神舟笔记本售后问题,我是在x宝上买的准系统,要是坏了是不是随便去... 写出不 不 的成语三个。(简单的)。 做淘宝天猫客服兼职,是真的吗?还要押金 淘宝刷单兼职被骗了要怎样办 神舟电脑坏了怎么办? 不( )不( )(成语) 椭圆形的脸适合这个发型吗? 天猫店铺注册兼职是真的吗?可以做吗? 广州国际会展中心参观须知 2017年10月6号到2020年5月16号,一共有多少天,多少小时,多少分钟... matlab怎样根据数据恢复出图像? matlab figure中旋转后的图形如何复原 基于matlab运动模糊图像处理的源代码 匀速运动模糊视频如何恢复,求matlab程序 matlab启动后变成图片这种了,怎么给它还原回来 对于一些常用的图像复原方法,如何用MATLAB去实现?举例说明,附程序或函数 matlab图像复原维纳滤波,最小二乘方,L-R,盲去卷积图像复原比较的程序代码 基于matlab的图像复原的方法有哪些 matlab图像复原的方法有哪些 iPhone7plus 键盘背景怎么设置?谢谢啦 苹果7键盘怎么调出来? 魅族手机而忘了锁屏密码,又关不了机怎么办? 魅族手机忘了你锁屏密码怎么办? 魅族手机锁屏密码忘了怎么办?魅族手机没密码解锁方法? 河南省郑州市2018_2019学年八年级物理上学期期末考试试题 八年级上学期期末综合测评卷物理 八年级上学期各科目期末测试题,谢谢了,还有悬赏 关于初二上学期期末考试完的得与失总结200字就够了. 八年级上学期期末考试,物理的重点、考点、知识点的归纳? 初二上学期期末各科总结? 电话录音怎么查找 今年11月5日实习律师到期,最快多长时间拿律师证 要拿“律师执业证书”好像是要在律师事务所实习满一年是吗? 拿到法律从业资格证之后多久能拿到律师证? 京东新人一元购没有买就没有了 律师职业资格从知道司考成绩(已通过)到拿到律师证需要多久?已经在律所工作 我在微信里京东拼购的一元新人里买了东西今天发了详细信息过来我查上面的订单号却查不到,这是被骗了吗? 京东/淘宝天猫/拼多多一元购规则 京东/淘宝天猫/拼多多1元购怎么抢 ... 获得律师证书多久能拿到专利代理人证书 人人视频看不了,说“根据当地法律法规资源被删”,每一部都是,明明 通过国家司法考试要什么时候才能拿到律师证 京东/淘宝天猫/拼多多1元购是什么意思 真的能1元买到吗 如何抢到京东/... 视频缓存是下载的意思吗? 京东问题:新人一元购买不到东西,说本渠道今日商品已到达上限为什么别人总是24小时发起拼团而我拼不了 从准备司法考试到拿到律师证一般多久 京东新用户0.1元购物退款还能重新买吗? 京东1元秒杀苹果手机是真的吗 京东1元购撸货犯法吗? 一元购的回收? 公司年会流程-XX公司年会流程SOP