埃尔法哥哥■卷积神经网络使用Python的手写数字识别( 三 )


# Grid structure
self.canvas.grid(row=0, column=0, pady=2, sticky=W, )
self.label.grid(row=0, column=1,pady=2, padx=2)
self.classify_btn.grid(row=1, column=1, pady=2, padx=2)
self.button_clear.grid(row=1, column=0, pady=2)
#self.canvas.bind(" ", self.start_pos)
self.canvas.bind(" ", self.draw_lines)
def clear_all(self):
self.canvas.delete("all")
def classify_handwriting(self):
HWND = self.canvas.winfo_id() # get the handle of the canvas
rect = win32gui.GetWindowRect(HWND) # get the coordinate of the canvas
im = ImageGrab.grab(rect)
digit, acc = predict_digit(im)
self.label.configure(text= str(digit)+', '+ str(int(acc*100))+'%')
def draw_lines(self, event):
self.x = event.x
self.y = event.y
r=8
self.canvas.create_oval(self.x-r, self.y-r, self.x + r, self.y + r, fill='black')
app = App()
mainloop()

埃尔法哥哥■卷积神经网络使用Python的手写数字识别
本文插图


埃尔法哥哥■卷积神经网络使用Python的手写数字识别
本文插图


埃尔法哥哥■卷积神经网络使用Python的手写数字识别
本文插图

结论
【埃尔法哥哥■卷积神经网络使用Python的手写数字识别】在本文中 , 我们已经在手写数字识别应用程序上成功构建了我们的项目 。 我们已经构建并训练了卷积神经网络 , 该网络对于图像分类非常有效 。 稍后 , 我们构建GUI , 在对话框上绘制一个数字 , 然后对数字进行分类并显示结果 。


推荐阅读