当前位置:   article > 正文

最新Python实现简单可学习的手写体识别_pynq上手写体识别_python实现手写体识别

python实现手写体识别

dim2 int not null,
dim3 int not null,
dim4 int not null,
dim5 int not null,
dim6 int not null,
dim7 int not null,
dim8 int not null)

drop table table5
create table table5
(dim0 int not null,
dim1 int not null,
dim2 int not null,
dim3 int not null,
dim4 int not null,
dim5 int not null,
dim6 int not null,
dim7 int not null,
dim8 int not null)

drop table table6
create table table6
(dim0 int not null,
dim1 int not null,
dim2 int not null,
dim3 int not null,
dim4 int not null,
dim5 int not null,
dim6 int not null,
dim7 int not null,
dim8 int not null)

drop table table7
create table table7
(dim0 int not null,
dim1 int not null,
dim2 int not null,
dim3 int not null,
dim4 int not null,
dim5 int not null,
dim6 int not null,
dim7 int not null,
dim8 int not null)

drop table table8
create table table8
(dim0 int not null,
dim1 int not null,
dim2 int not null,
dim3 int not null,
dim4 int not null,
dim5 int not null,
dim6 int not null,
dim7 int not null,
dim8 int not null)

drop table table9
create table table9
(dim0 int not null,
dim1 int not null,
dim2 int not null,
dim3 int not null,
dim4 int not null,
dim5 int not null,
dim6 int not null,
dim7 int not null,
dim8 int not null)


LearningDB.py程序如下:



  • 1
  • 2
  • 3
  • 4
  • 5

‘’’
LearningDB类
功能:定义数据库类,包含一个学习函数learn_data和一个识别函数identify_data
作者:PyLearn
博客: http://www.cnblogs.com/PyLearn/
最后修改日期: 2017/10/18
‘’’
import math
import pymssql

class LearningDB():

def \_\_init\_\_(self):
    self.conn = pymssql.connect(host='127.0.0.1',
                                user='sa',
                                password='123',
                                database='PyLearningDB',
                                charset='utf8')
    self.cursor = self.conn.cursor()
    self.sql = ''
    self.distance = 0.0
    self.conn.close()

def learn\_data(self, table, dim):
    '''
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13

学习数据,将数据存到对应的数据库
table指定哪个表,dim是维度数组
‘’’
learn_result = False

    try:
        if table < 0 or table > 9:
            raise Exception("错误!table的值为%d!" % table)
        for num in dim:
            if num < 0:
      
  • 1
  • 2
  • 3
  • 4
  • 5
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Monodyee/article/detail/722894
推荐阅读
相关标签
  

闽ICP备14008679号