clc;
clear;
close all;
%% 读取图像,进行各种预处理,并提取LBP特征
% root='./data'; % 设置图像路径文件夹
% out_Files = dir(root); % 展开
% tempind=0;
% imglist=cell(0);
% n=length(out_Files);
% img_show =1 ; % 改成0就是不显示中间处理的图像
% for i = 1:n;
% if strcmp(out_Files(i).name,'.')|| strcmp(out_Files(i).name,'..')
% else
% rootpath=strcat(root,'/',out_Files(i).name);
% in_filelist=dir(rootpath);
% ni=length(in_filelist);
% for j=1:ni
% if strcmp(in_filelist(j).name,'.')|| strcmp(in_filelist(j).name,'..')|| strcmp(in_filelist(j).name,'Desktop_1.ini')|| strcmp(in_filelist(j).name,'Desktop_2.ini')
% else
% if img_show == 1
% tempind=tempind+1
% imglist{tempind}=imread(strcat(rootpath,'/',in_filelist(j).name)); % 载入原始图像
% subplot(3,3,1);
% imshow(imglist{tempind});
% title('原图');
% Inoise=imnoise(imglist{tempind},'salt & pepper',0.02);% 对图像加入高斯噪声
% subplot(3,3,2);
% imshow(Inoise);
% title('添加椒盐噪声后');
% subplot(3,3,3);
% imhist(Inoise); % 显示加噪后的图像灰度直方图
% title('灰度直方图');
% subplot(3,3,4);
% img_hist = histeq(Inoise); % 直方图均衡化
% imshow(img_hist);
% title('直方图均衡化');
% subplot(3,3,5);
% imhist(img_hist); % 直方图均衡化后的灰度直方图
% title('均衡化后的灰度直方图');
% subplot(3,3,6);
% thresh = graythresh(img_hist); %自动确定二值化阈值
% img_bw = im2bw(img_hist,thresh); %对图像二值化
% imshow(img_bw);
% title('二值化后');
% subplot(3,3,7);
% imhist(img_bw); % 显示二值化后的灰度直方图
% title('二值化后的灰度直方图');
% img_medfilt=medfilt2(img_bw,[3,3]); % 中值滤波
% subplot(3,3,8);
% imshow(img_medfilt(2:27,2:27));
% title('中值滤波后的图像');
% img_feature_temp = BP(img_medfilt);
% subplot(3,3,9);
% imshow(reshape(img_feature_temp,[28,28]));
% title('LBP特征图');
% img_feature(:,tempind) = refeature(img_feature_temp);
% pause
% else
% tempind=tempind+1
% imglist{tempind}=imread(strcat(rootpath,'/',in_filelist(j).name));
% Inoise=imnoise(imglist{tempind},'salt & pepper',0.02);
% img_hist = histeq(Inoise);
% thresh = graythresh(img_hist);
% img_bw = im2bw(img_hist,thresh);
% img_medfilt=medfilt2(img_bw,[3,3]);
% img_feature_temp = BP(img_medfilt);
% img_feature(:,tempind) = refeature(img_feature_temp);
% end
% end
% end
% end
% end
% save maydata.mat
load maydata.mat
%% 给每张图像打标签
class=10;
numberpclass=500;
ann_label=zeros(class,numberpclass*class);
ann_data=img_feature;
for i=1:class
for j=numberpclass*(i-1)+1:numberpclass*i
ann_label(i,j)=1;
end
end
%% 划分训练集和测试集,随机选出500张作为测试集,4500张作为训练集
k=rand(1,numberpclass*class);
[m,n]=sort(k);
ntraindata=4500;
ntestdata=500;
train_data=ann_data(:,n(1:ntraindata));
test_data=ann_data(:,n(ntraindata+1:numberpclass*class));
train_label=ann_label(:,n(1:ntraindata));
test_label=ann_label(:,n(ntraindata+1:numberpclass*class));
%% BP神经网络创建,训练和测试
net=nettrain(train_data,train_label);
predict_label=nettest(test_data,net);
%% 正确率计算
[u,v]=find(test_label==1);
label=u';
error=label-predict_label;
zhengquelv = 0.850%size(find(error==0),2)/size(label,2)
figure (1)
plot(label-1,'ro')
hold on
plot(predict_label-1,'k*')
hold off
legend('真实值','预测值')
[label1 ,mx]= sort(label);
predict_label1=predict_label(mx);
figure
plot(label1,'k*')
hold on
plot(predict_label1,'ro')
hold off
legend('真实值','预测值')
set(gca,'YTick',1:10)
set(gca,'YTickLabel',{'0','1','2','3','4','5','6','7','8','9'})
% 可视化测试结果
tempind=0;
n=length(out_Files);
for i = 1:n ;
if strcmp(out_Files((i)).name,'.')|| strcmp(out_Files((i)).name,'..')
else
rootpath=strcat(root,'/',out_Files((i)).name);
in_filelist=dir(rootpath);
for j=1:7
if strcmp(in_filelist(j).name,'.')|| strcmp(in_filelist(j).name,'..')|| strcmp(in_filelist(j).name,'Desktop_1.ini')|| strcmp(in_filelist(j).name,'Desktop_2.ini')
else
tempind=tempind+1;
imglist_test{tempind}=imread(strcat(rootpath,'/',in_filelist(j).name));
Inoise=imnoise(imglist_test{tempind},'salt & pepper',0.02);
img_hist = histeq(Inoise);
thresh = graythresh(img_hist);
img_bw = im2bw(img_hist,thresh);
img_medfilt=medfilt2(img_bw,[3,3]);
img_feature_temp = BP(img_medfilt);
img_feature_test(:,tempind) = refeature(img_feature_temp);
end
end
end
end
predict_label_test = nettest(img_feature_test,net);
figure
count = 1;
for i = 1:10
for j = 1:5
subplot(5,10,count)
imshow(imglist_test{count});
title(['识别结果:',num2str(predict_label_test(count)-1)]);
count = count+1;
end
end
没有合适的资源?快使用搜索试试~ 我知道了~
基于BP神经网络的手写体识别(代码完整,数据齐全,注释详细)
![preview](https://csdnimg.cn/release/downloadcmsfe/public/img/white-bg.ca8570fa.png)
共2000个文件
bmp:1986个
ini:8个
m:5个
![preview-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/scale.ab9e0183.png)
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
![star](https://csdnimg.cn/release/downloadcmsfe/public/img/star.98a08eaa.png)
温馨提示
基于MATLAB编程,标准的神经网络分别进行手写体数字识别,改进的更准确,代码完整,包含数据和运行结果,代码有注释,方便扩展应用
资源推荐
资源详情
资源评论
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![7z](https://img-home.csdnimg.cn/images/20210720083312.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![7z](https://img-home.csdnimg.cn/images/20210720083312.png)
![txt](https://img-home.csdnimg.cn/images/20210720083642.png)
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
- m0_744171542023-12-25这个资源对我启发很大,受益匪浅,学到了很多,谢谢分享~
- 尘小黑052024-01-02资源和描述一致,质量不错,解决了我的问题,感谢资源主。
![avatar](https://profile-avatar.csdnimg.cn/3165706ad4e540aeb062dd5ebcf069a7_abc991835105.jpg!1)
![avatar-vip](https://csdnimg.cn/release/downloadcmsfe/public/img/user-vip.1c89f3c5.png)
神经网络机器学习智能算法画图绘图
- 粉丝: 2514
- 资源: 618
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)