项目
https://github.com/fanqingsong/cnn_handwritten_chinese_recognition
使用
python+flask
搭建的一个网站,然后从网页的写字板上获取鼠标手写的汉字经过转码后传回后台,并经过图片裁剪处理之后传入CNN
手写中文识别的模型中进行识别,最后通过PIL
将识别结果生成图片,最后异步回传给web端进行识别结果展示。中文总共50,000
多汉字,常用的有3,755
个。这里主要对常见的3755
个汉字进行识别。
使用技术
前台:
1、 drawingboard.js 在canvas上手写汉字
并可以获取canvas手写汉字的图片编码 base64
2、 手写过程监控事件,实时收集canvas图片数据,通过ajax发往后台进行识别。
后台:
1、 flask -- web服务器框架
2、 tensorflow --- 加载汉字识别模型, 并根据输入的图片数据给出预测结果, 取最可能的前三个发往前台。
drawingboard
http://leimi.github.io/drawingboard.js/
This is a canvas based drawing app that you can integrate easily on your website.
drawingboard.js consists of a blank canvas surrounded by a few UI elements that control it: a color picker, a pencil, a paint can, an eraser, a pencil size chooser, navigations and reset buttons.
You can draw with mouse or touch on pretty much every browser that supports
<canvas>
. Didn't test that much on IE but hey, WIP.local and session storage are supported: your last drawing is restored when you come back on the website.
You can set a background image at initialization, or let the user drop one on the canvas.
The drawingboard is really lightweight, but also really simple: if you want something more complete, go look at similar projects at the bottom of this doc.