Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Python+flask how to build a website for CNN to recognize handwritten Chinese online

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

Python+flask how to build CNN online handwritten Chinese recognition website, I believe that many inexperienced people do not know what to do, so this paper summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.

A website built by python+flask is used, and then the handwritten Chinese characters of the mouse are obtained from the writing board of the web page, then transcoded and transmitted back to the background, and after image clipping, they are passed into the handwritten Chinese recognition model of CNN for recognition. Finally, the recognition results are generated through PIL, and finally asynchronously transmitted back to the web for display of the recognition results. There are more than 50000 Chinese characters in total, of which 3755 are commonly used. Here, we mainly recognize 3755 common Chinese characters.

Code acquisition:

You can get it by following Wechat's official account datayx and replying to handwriting recognition.

I. data set

At present, there are many excellent Chinese handwriting recognition data sets in China. For example: data released by the pattern recognition Laboratory of Beijing University of posts and Telecommunications (HCL2000), which is currently the largest offline handwritten Chinese character library, with a total of 1000 people writing. In addition to the Chinese character sample database, there is also a corresponding writer information database, which records the age, occupation, education and other information of the writer, which is used to study the relevant influencing factors. At present, this database is available to researchers free of charge. This paper uses the Chinese handwritten data set CASIA-HWDB (download address http://www.nlpr.ia.ac.cn/databases/handwriting/Home.html) shared by the Institute of Automation of the Chinese Academy of Sciences. The handwritten Chinese characters are inputted online by 187 people through the Wacom pen.

2. CNN structure:

The tensorflow library is used to realize the convolution neural network of [three convolution layers + three pooling layers + two full connection layers]. The structure is shown in the following figure:

The training pictures are all trimmed to the size of 64x64. Here I only train 3755 common Chinese characters. I add a convolution layer and pool layer to the model structure of CNN recognition numbers, and the other structures are similar.

It took me a long time to decompress the downloaded HWDB dataset and start the training. I finally iterated on GPU:GTX1050Ti for 12000 times and took several hours to take the first three most likely predictions.

Third, loading model

After 12000 iterations of the training model, I saved the training parameters in the checkpoint folder. However, due to the limitation of the size of a single file, the trained model files were downloaded from Baidu Cloud:

Link: https://pan.baidu.com/s/1eSWBIyI

Password: kv2r

Overwrite the checkpoint folder directly after download.

IV. Environment

Python 3.6.1

Flask 0.12.2

Tensorflow 1.3.0

Pillow 4.2.1

Pickleshare 0.7.4

Numpy 1.13.1

V. Operation

1. Clone the project, and then install the appropriate libraries according to the requirements of the environment (install using pip)

2. Download the trained model file from Baidu Cloud and put it in the corresponding checkpoint folder.

3. Use python run.py to run

4. Open a local browser and enter localhost:5000 to view it.

Those who have read this article have also read the following:

The mathematical basis of machine learning summarized by the great god, it is enough to master these.

Forecasting the price of goods based on the analysis of emotional tendency of comments and news

Practical case of xgboost model: predicting the traffic flow of road sections in the future

"21 projects to play Deep Learning: a detailed explanation of TensorFlow-based practice" the full version of PDF+ with book code

Constantly update resources

Deep learning, machine learning, data analysis, python

Search official account and add: datayx

Long press the picture, identify the QR code, and click on it.

After reading the above, have you mastered how python+flask can build an online website for CNN to recognize handwritten Chinese? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report