国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Python > 正文

Python3實現簡單可學習的手寫體識別(實例講解)

2020-02-16 10:26:52
字體:
來源:轉載
供稿:網友

1.前言

版本:Python3.6.1 + PyQt5 + SQL Server 2012

以前一直覺得,機器學習、手寫體識別這種程序都是很高大上很難的,直到偶然看到了這個視頻,聽了老師講的思路后,瞬間覺得原來這個并不是那么的難,原來我還是有可能做到的。

于是我開始順著思路打算用Python、PyQt、SQLServer做一個出來,看看能不能行。然而中間遇到了太多的問題,數據庫方面的問題有十幾個,PyQt方面的問題有接近一百個,還有數十個Python基礎語法的問題。但好在,通過不斷的Google,終于湊出了這么一個成品來。

最終還是把都湊在一個函數里的代碼重構了一下,改寫成了4個模塊:

main.py、Learning.py、LearningDB.py、LearningUI.py

其中LearningDB實現python與數據庫的交互,LearningUI實現界面的交互,Learning繼承LearningUI類添加上了與LearningDB數據庫類的交互,最后通過main主函數模塊運行程序。

其中涉及數據庫的知識可參考之前的文章:Python3操作SQL Server數據庫(實例講解),
涉及PyQt的知識可參考:Python3使用PyQt5制作簡單的畫板/手寫板

手寫體識別的主要思路是將手寫的字,用一個列表記錄其所經過的點,劃分為一個九宮格,然后數每個格子中點的數目,將數目轉化為所占總點數的百分比。然后兩兩保存的九維數,求他們之間的距離,距離越近代表越接近。

2.通過pymssql與數據庫的交互

因為使用程序之前先需要建表,建表我就直接使用SQL語句執行了:

create database PyLearningDBdrop table table0create table table0(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 table1create table table1(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 table2create table table2(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 table3create table table3(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 table4create table table4(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 table5create 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 table6create 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 table7create 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 table8create 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 table9create 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)            
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 新和县| 奇台县| 越西县| 公安县| 贺兰县| 吉安县| 五原县| 化德县| 成武县| 永清县| 寻甸| 荔波县| 朔州市| 宁南县| 明光市| 阳江市| 旬阳县| 东宁县| 宜兰市| 阜城县| 馆陶县| 昂仁县| 大理市| 冀州市| 永定县| 咸阳市| 东港市| 观塘区| 怀安县| 东阿县| 兰西县| 大石桥市| 渭源县| 扬中市| 辉县市| 恩平市| 金寨县| 桐城市| 彭山县| 吴忠市| 区。|