Interactive handwriting recognition app using pygame

at first

I made a simple handwriting recognition application by DNN using pygame, so I will explain it briefly. Using pygame, you can easily develop an application with interaction with just python, so I hope it will motivate people who are studying python or beginners. All the code is posted on github. It's okay to use it without permission.

Github : https://github.com/ozora-ogino/predict-handdrawingNumber_NN

In this development, Tensorflow is used to build DNN, and pygame is used for game development. We are also using the mnist dataset for training DNNs.

What is Pygame

Pygame is the most famous game library for creating 2D games in Python. To create a 2D game with Python, it is common to use a game library, and a simple breakout game can be created with about 160 lines of source code.

How to use

It is also posted on Github, but I will explain it again here.

First, clone the repository.

git clone https://github.com/ozora-ogino/predict-handdrawingNumber_NN/ 

Install the required packages from requirements.txt.

pip install -r requirements.txt

draw.py will be the main. We have a model that has already been trained, so it will work if you just run it.

python draw.py

If you want to learn the model again, please recreate the model with createModel.py.

python createMain.py

The definition of the model is Seki in model.py! Since it is done by number, you can execute it with NN as you like if you change it.

A screenshot of the execution result is posted on github.

When you run it, you will see the vinegar s clean for drawing numbers. If you draw a number and press Enter, the character will be recognized and the prediction result will be displayed on the terminal. Please close the screen when you are finished.

At the end

This time, I made a simple handwriting recognition application using pygaem. It's easy to make an app like this, so please arrange it and give it a try. This article was created for python beginners and those who want to know what pygame can do. I hope it helps someone.

I've started distributing python, programming, and necessary information as an engineer on instagram, so I'd be happy if you could follow me. !!

Recommended Posts

Interactive handwriting recognition app using pygame
Perform handwriting recognition using Pylearn2
Handwriting recognition using KNN in Python
Try using GCP Handwriting Recognition (OCR)
I tried handwriting recognition of runes with CNN using Keras
Age recognition using Pepper's API
I tried face recognition using Face ++
Visualize app reviews using wordcloud