In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
How to do a handwritten number recognition web application, 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.
01
Enter the docker container
We use a docker container, which allows us to enter:
Docker ps-a
As shown in the figure above, find the container of the last run. On my side, the container name (NAMES) is suspicious_cori. To launch it, you can enter it at the terminal:
Docker start suspicious_cori
Then, the terminal enters:
Docker exec-I-t suspicious_cori bash
You can open an interactive mode terminal in the container.
Terminal input
Jupyter notebook
Create a new notebook
02
Load a trained model
Load the last trained model and enter it in the new notebook:
From keras.models import model_from_json
Model=model_from_json (open ('my_model_architecture.json'). Read ())
Model.load_weights ('my_model_weights.h6')
03
Read handwritten pictures that need to be identified
Introduce a library for reading pictures:
Import matplotlib.image as mpimg
Read the pictures located in the kerasStudy directory:
Img = mpimg.imread ('test.png')
''
Matplotlib only supports PNG images. Read the test.png in the same directory as the code. Note that the read img is already a np.array and has been normalized.
''
''
The png image above is a single-channel image (grayscale). If test.png is a rgb-channel image, you can convert it by rgb2gray. The code is as follows:
Def rgb2gray (rgb):
Return np.dot (rgb [...,: 3], [0.299, 0.587, 0.114])
Img = rgb2gray (img)
''
For the channel of the picture, we can see it visually in photoshop:
First, take a look at the dimensions of the image array read below:
Print (img.shape)
The output is (28,28)
Convert to the correct input format:
Img = img.reshape (1784)
Print it out and see:
Print (img.shape)
The output is (1784)
04
Recognized handwritten picture
Enter:
Pre=model.predict_classes (img)
Just print it out:
Print (pre)
Identified as 6:
1ax 1 [=]-0s [6] after reading the above, have you learned how to build a web application that recognizes handwritten numbers? 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.