⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 digitrecogview.h

📁 用bp实现的数字识别程序
💻 H
字号:
// DigitRecogView.h : interface of the CDigitRecogView class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_DIGITRECOGVIEW_H__920CEF69_CA48_4662_868C_38833FC48572__INCLUDED_)
#define AFX_DIGITRECOGVIEW_H__920CEF69_CA48_4662_868C_38833FC48572__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#define NN_NUMBERS	9		//包含的数的个数
#define NN_RESX		5		//X方向的长度
#define NN_RESY		7		//Y方向的长度
#define NN_NOISY	25		//噪声数据的数目
#define NN_MAXITER	5000	//最大循环次数
#include "backprop.h"

class CDigitRecogView : public CView
{
protected: // create from serialization only
	CDigitRecogView();
	DECLARE_DYNCREATE(CDigitRecogView)

// Attributes
public:
	CDigitRecogDoc* GetDocument();

	BPNN *net;
	BOOL draw;
		//保存测试数据
	int		m_bTestData[NN_NUMBERS][NN_RESX * NN_RESY];
	//保存标准训练数据
	int		m_bNumbers[NN_NUMBERS][NN_RESX * NN_RESY];
	//保存在标准训练数据加上噪声后的数据
	int		m_iNoisy[NN_NUMBERS * NN_NOISY][NN_RESX * NN_RESY];
	//要画的数字
	int		*m_ipDrawNum;
	//要显示的字符串
	bool	m_bDisplayString;
	//网络的权值数组
	float	m_fWeights[NN_NUMBERS][NN_RESX * NN_RESY];
	//循环次数
	int		m_icycles;
	//每次的训练输出值
	double	m_out[10000];
	CString m_Str;
	

// Operations
public:
	void SetTarget(double *t,double num);	
	void RunNet(BOOL training);	
	void DrawNumber(int *cell);

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CDigitRecogView)
	public:
	virtual void OnDraw(CDC* pDC);  // overridden to draw this view
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	protected:
	virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
	virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
	//}}AFX_VIRTUAL

// Implementation
public:
	virtual ~CDigitRecogView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// Generated message map functions
protected:
	//{{AFX_MSG(CDigitRecogView)
	afx_msg void OnPinput();
	afx_msg void OnPnoisy();
	afx_msg void OnPweights();
	afx_msg void OnPtrain();
	afx_msg void OnPerror();
	afx_msg void OnPrecog();
	afx_msg void OnBinput();
	afx_msg void OnBnoisy();
	afx_msg void OnCreate();
	afx_msg void OnBweights();
	afx_msg void OnBtrain();
	afx_msg void OnBrecog();
	afx_msg void OnBerror();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

#ifndef _DEBUG  // debug version in DigitRecogView.cpp
inline CDigitRecogDoc* CDigitRecogView::GetDocument()
   { return (CDigitRecogDoc*)m_pDocument; }
#endif

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_DIGITRECOGVIEW_H__920CEF69_CA48_4662_868C_38833FC48572__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -