Java教程

【手写数字识别】基于BP神经网络手写数字识别matlab源码含GUI

本文主要是介绍【手写数字识别】基于BP神经网络手写数字识别matlab源码含GUI,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

1 基于BP神经网络手写数字识别模型介绍

模型参考这里。

2 部分代码

function varargout = number_reconginize(varargin)
% NUMBER_RECONGINIZE MATLAB code for number_reconginize.fig
%      NUMBER_RECONGINIZE, by itself, creates a new NUMBER_RECONGINIZE or raises the existing
%      singleton*.
%
%      H = NUMBER_RECONGINIZE returns the handle to a new NUMBER_RECONGINIZE or the handle to
%      the existing singleton*.
%
%      NUMBER_RECONGINIZE('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in NUMBER_RECONGINIZE.M with the given input arguments.
%
%      NUMBER_RECONGINIZE('Property','Value',...) creates a new NUMBER_RECONGINIZE or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before number_reconginize_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to number_reconginize_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
​
% Edit the above text to modify the response to help number_reconginize
​
% Last Modified by GUIDE v2.5 06-Apr-2020 18:32:38
​
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @number_reconginize_OpeningFcn, ...
                   'gui_OutputFcn',  @number_reconginize_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end
​
if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
​
​
% --- Executes just before number_reconginize is made visible.
function number_reconginize_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to number_reconginize (see VARARGIN)
​
% Choose default command line output for number_reconginize
handles.output = hObject;
​
% Update handles structure
guidata(hObject, handles);
​
% UIWAIT makes number_reconginize wait for user response (see UIRESUME)
% uiwait(handles.figure1);
​
​
% --- Outputs from this function are returned to the command line.
function varargout = number_reconginize_OutputFcn(hObject, eventdata, handles) 
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
​
% Get default command line output from handles structure
varargout{1} = handles.output;
​
​
% --- Executes on button press in open_image.
function open_image_Callback(hObject, eventdata, handles)
% hObject    handle to open_image (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
[filename,pathname]=uigetfile({'*.png';'*.bmp';'*.tif';'*.jpg';'*.*'},'载入图像');
if isequal(filename,0)|isequal(pathname,0)
    errordlg('没有选中文件','出错');
    return;
else
    file=[pathname,filename];
    global S   %设置一个全局变量S,保存初始图像路径,以便之后的还原操作
    S=file;
    x=imread(file);
    set(handles.axes1,'HandleVisibility','ON');
    axes(handles.axes1);
    function edit1_Callback(hObject, eventdata, handles)
% hObject    handle to edit1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
​
% Hints: get(hObject,'String') returns contents of edit1 as text
%        str2double(get(hObject,'String')) returns contents of edit1 as a double
​
​
% --- Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

3 运行结果

在这里插入图片描述在这里插入图片描述在这里插入图片描述在这里插入图片描述在这里插入图片描述

在这里插入图片描述在这里插入图片描述在这里插入图片描述在这里插入图片描述

4 参考文献

[1]张彤, 肖南峰. 基于BP网络的数字识别方法[J]. 重庆理工大学学报(自然科学版), 2010.

5 代码下载

获取代码方式1:

完整代码已上传我的资源

获取代码方式2:

通过订阅博主博客付费专栏,凭支付凭证,私信博主,可获得此代码。

博主擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真

这篇关于【手写数字识别】基于BP神经网络手写数字识别matlab源码含GUI的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!