

{"id":74254,"date":"2020-01-07T09:37:13","date_gmt":"2020-01-07T04:07:13","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=74254"},"modified":"2021-03-14T16:54:55","modified_gmt":"2021-03-14T11:24:55","slug":"python-deep-learning-project-handwritten-digit-recognition","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/python-deep-learning-project-handwritten-digit-recognition\/","title":{"rendered":"Deep Learning Project &#8211; Handwritten Digit Recognition using Python"},"content":{"rendered":"<div class='__iawmlf-post-loop-links' style='display:none;' data-iawmlf-post-links='[{&quot;id&quot;:1250,&quot;href&quot;:&quot;http:\\\/\\\/yann.lecun.com\\\/exdb\\\/mnist&quot;,&quot;archived_href&quot;:&quot;http:\\\/\\\/web-wp.archive.org\\\/web\\\/20251005191259\\\/http:\\\/\\\/yann.lecun.com\\\/exdb\\\/mnist\\\/&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2025-12-09 04:24:23&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2025-12-12 04:42:14&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2025-12-15 05:48:43&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2025-12-18 06:00:46&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2025-12-21 06:20:45&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2025-12-24 07:46:19&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2025-12-27 08:02:53&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2025-12-30 08:48:15&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-02 09:07:09&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-05 09:07:20&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-08 11:17:25&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-11 11:53:32&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-14 12:09:41&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-17 13:05:58&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-20 13:33:22&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-23 19:35:19&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-26 20:13:10&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-29 23:52:11&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-02 01:29:15&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-05 02:36:33&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-08 07:11:43&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-11 08:19:25&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-14 11:07:46&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-17 12:52:16&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-20 14:52:01&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-23 15:42:12&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-26 15:54:43&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-03-01 16:30:35&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-04 17:08:37&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-07 17:25:19&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-11 03:56:35&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-14 06:19:36&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-17 07:14:41&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-20 08:54:02&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-23 10:44:49&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-26 11:19:22&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-29 11:23:25&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-01 13:17:21&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-04 15:25:55&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-07 15:38:09&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-10 17:34:08&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-13 22:36:37&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-17 02:33:59&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-20 02:48:18&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-23 04:37:16&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-26 06:41:43&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-29 07:58:11&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-02 10:46:33&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-05 10:52:48&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-08 11:52:42&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-11 12:13:51&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-14 13:55:47&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-17 14:31:58&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-20 14:35:40&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-23 20:53:56&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-26 21:34:50&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-29 21:45:36&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-06-02 04:38:17&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-06-05 05:56:01&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-06-08 06:32:34&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-06-11 09:54:55&quot;,&quot;http_code&quot;:206}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-06-11 09:54:55&quot;,&quot;http_code&quot;:206},&quot;process&quot;:&quot;done&quot;},{&quot;id&quot;:1251,&quot;href&quot;:&quot;https:\\\/\\\/drive.google.com\\\/open?id=1hJiOlxctFH3uL2yTqXU_1f6c0zLr8V_K&quot;,&quot;archived_href&quot;:&quot;&quot;,&quot;redirect_href&quot;:&quot;https:\\\/\\\/drive.google.com\\\/file\\\/d\\\/1hJiOlxctFH3uL2yTqXU_1f6c0zLr8V_K\\\/view?usp=drive_open&quot;,&quot;checks&quot;:[],&quot;broken&quot;:false,&quot;last_checked&quot;:null,&quot;process&quot;:&quot;done&quot;}]'><\/div>\n<p><strong>Python Deep Learning Project<\/strong><\/p>\n<p>To make machines more intelligent, the developers are diving into machine learning and deep learning techniques. A human learns to perform a task by practicing and repeating it again and again so that it memorizes how to perform the tasks. Then the neurons in his brain automatically trigger and they can quickly perform the task they have learned. Deep learning is also very similar to this. It uses different types of neural network architectures for different types of problems. <strong>For example &#8211;<\/strong>\u00a0object recognition, image and sound classification, object detection, image segmentation, etc.<\/p>\n<p>This is the 11th project in the DataFlair\u2019s series of 20 Python projects. I suggest you to bookmark the previous projects:<\/p>\n<ol>\n<li><a href=\"https:\/\/data-flair.training\/blogs\/advanced-python-project-detecting-fake-news\/\">Fake News Detection Python Project\u00a0<\/a><\/li>\n<li><a href=\"https:\/\/data-flair.training\/blogs\/python-machine-learning-project-detecting-parkinson-disease\/\">Parkinson\u2019s Disease Detection Python Project\u00a0<\/a><\/li>\n<li><a href=\"https:\/\/data-flair.training\/blogs\/project-in-python-colour-detection\/\">Color Detection Python Project<\/a><\/li>\n<li><a href=\"https:\/\/data-flair.training\/blogs\/python-mini-project-speech-emotion-recognition\/\">Speech Emotion Recognition Python Project\u00a0<\/a><\/li>\n<li><a href=\"https:\/\/data-flair.training\/blogs\/project-in-python-breast-cancer-classification\/\">Breast Cancer Classification Python Project<\/a><\/li>\n<li><a href=\"https:\/\/data-flair.training\/blogs\/python-project-gender-age-detection\/\">Age and Gender Detection Python Project\u00a0<\/a><\/li>\n<li>Handwritten Digit Recognition Python Project<\/li>\n<li><a href=\"https:\/\/data-flair.training\/blogs\/python-chatbot-project\/\">Chatbot Python Project<\/a><\/li>\n<li><a href=\"https:\/\/data-flair.training\/blogs\/python-project-driver-drowsiness-detection-system\/\">Driver Drowsiness Detection Python Project<\/a><\/li>\n<li><a href=\"https:\/\/data-flair.training\/blogs\/python-project-traffic-signs-recognition\/\">Traffic Signs Recognition Python Project<\/a><\/li>\n<li><a href=\"https:\/\/data-flair.training\/blogs\/python-based-project-image-caption-generator-cnn\/\">Image Caption Generator Python Project<\/a><\/li>\n<\/ol>\n<h3>What is Handwritten Digit Recognition?<\/h3>\n<p>The handwritten digit recognition is the ability of computers to recognize human handwritten digits. It is a hard task for the machine because handwritten digits are not perfect and can be made with many different flavors. The handwritten digit recognition is the solution to this problem which uses the image of a digit and recognizes the digit present in the image.<\/p>\n<h3>About the Python Deep Learning Project<\/h3>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/01\/python-deep-learning-project-handwritten-digit-recognition.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-74318 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/01\/python-deep-learning-project-handwritten-digit-recognition.gif\" alt=\"python deep learning project - handwritten digit recognition\" width=\"960\" height=\"584\" \/><\/a><\/p>\n<p>In this article, we are going to implement a handwritten digit recognition app using the MNIST dataset. We will be using a special type of deep neural network that is <em><strong><a href=\"https:\/\/data-flair.training\/blogs\/convolutional-neural-networks-tutorial\/\">Convolutional Neural Networks<\/a><\/strong><\/em>. In the end, we are going to build a GUI in which you can draw the digit and recognize it straight away.<\/p>\n<h3>Prerequisites<\/h3>\n<p>The interesting Python project requires you to have basic knowledge of Python programming, deep learning with Keras library and the Tkinter library for building GUI.<\/p>\n<p>Install the necessary libraries for this project using this command:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">pip install numpy, tensorflow, keras, pillow,<\/pre>\n<h3>The MNIST dataset<\/h3>\n<p>This is probably one of the most popular datasets among machine learning and deep learning enthusiasts. The <a href=\"http:\/\/yann.lecun.com\/exdb\/mnist\/\">MNIST dataset<\/a> contains 60,000 training images of handwritten digits from zero to nine and 10,000 images for testing. So, the MNIST dataset has 10 different classes. The handwritten digits images are represented as a 28&#215;28 matrix where each cell contains grayscale pixel value.<\/p>\n<p><a href=\"https:\/\/drive.google.com\/open?id=1hJiOlxctFH3uL2yTqXU_1f6c0zLr8V_K\"><strong>Download the full source code for the project<\/strong><\/a><\/p>\n<h2>Building Python Deep Learning Project on Handwritten Digit Recognition<\/h2>\n<p>Below are the steps to implement the handwritten digit recognition project:<\/p>\n<h3>1. Import the libraries and load the dataset<\/h3>\n<p>First, we are going to import all the modules that we are going to need for training our model. The Keras library already contains some datasets and MNIST is one of them. So we can easily import the dataset and start working with it. The <strong>mnist.load_data()<\/strong> method returns us the training data, its labels and also the testing data and its labels.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">import keras\r\nfrom keras.datasets import mnist\r\nfrom keras.models import Sequential\r\nfrom keras.layers import Dense, Dropout, Flatten\r\nfrom keras.layers import Conv2D, MaxPooling2D\r\nfrom keras import backend as K\r\n\r\n# the data, split between train and test sets\r\n(x_train, y_train), (x_test, y_test) = mnist.load_data()\r\n\r\nprint(x_train.shape, y_train.shape)<\/pre>\n<h3>2. Preprocess the data<\/h3>\n<p>The image data cannot be fed directly into the model so we need to<strong> perform some operations and process the data<\/strong> to make it ready for our neural network. The dimension of the training data is (60000,28,28). The CNN model will require one more dimension so we reshape the matrix to shape (60000,28,28,1).<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">x_train = x_train.reshape(x_train.shape[0], 28, 28, 1)\r\nx_test = x_test.reshape(x_test.shape[0], 28, 28, 1)\r\ninput_shape = (28, 28, 1)\r\n\r\n# convert class vectors to binary class matrices\r\ny_train = keras.utils.to_categorical(y_train, num_classes)\r\ny_test = keras.utils.to_categorical(y_test, num_classes)\r\n\r\nx_train = x_train.astype('float32')\r\nx_test = x_test.astype('float32')\r\nx_train \/= 255\r\nx_test \/= 255\r\nprint('x_train shape:', x_train.shape)\r\nprint(x_train.shape[0], 'train samples')\r\nprint(x_test.shape[0], 'test samples')<\/pre>\n<h3>3. Create the model<\/h3>\n<p>Now we will <strong>create our CNN model<\/strong> in Python data science project. A CNN model generally consists of convolutional and pooling layers. It works better for data that are represented as grid structures, this is the reason why CNN works well for image classification problems. The dropout layer is used to deactivate some of the neurons and while training, it reduces offer fitting of the model. We will then compile the model with the Adadelta optimizer.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">batch_size = 128\r\nnum_classes = 10\r\nepochs = 10\r\n\r\nmodel = Sequential()\r\nmodel.add(Conv2D(32, kernel_size=(3, 3),activation='relu',input_shape=input_shape))\r\nmodel.add(Conv2D(64, (3, 3), activation='relu'))\r\nmodel.add(MaxPooling2D(pool_size=(2, 2)))\r\nmodel.add(Dropout(0.25))\r\nmodel.add(Flatten())\r\nmodel.add(Dense(256, activation='relu'))\r\nmodel.add(Dropout(0.5))\r\nmodel.add(Dense(num_classes, activation='softmax'))\r\n\r\nmodel.compile(loss=keras.losses.categorical_crossentropy,optimizer=keras.optimizers.Adadelta(),metrics=['accuracy'])<\/pre>\n<h3>4. Train the model<\/h3>\n<p>The<strong> model.fit() function<\/strong> of Keras will start the training of the model. It <strong>takes the training data, validation data, epochs, and batch size.<\/strong><\/p>\n<p>It takes some time to train the model. After training, we save the weights and model definition in the \u2018mnist.h5\u2019 file.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">hist = model.fit(x_train, y_train,batch_size=batch_size,epochs=epochs,verbose=1,validation_data=(x_test, y_test))\r\nprint(\"The model has successfully trained\")\r\n\r\nmodel.save('mnist.h5')\r\nprint(\"Saving the model as mnist.h5\")<\/pre>\n<h3>5. Evaluate the model<\/h3>\n<p>We have 10,000 images in our dataset which will be used to<strong> evaluate how good our model works<\/strong>. The testing data was not involved in the training of the data therefore, it is new data for our model. The MNIST dataset is well balanced so we can get around 99% accuracy.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">score = model.evaluate(x_test, y_test, verbose=0)\r\nprint('Test loss:', score[0])\r\nprint('Test accuracy:', score[1])<\/pre>\n<h3>6. Create GUI to predict digits<\/h3>\n<p>Now for the GUI, we have created a new file in which we <strong>build an interactive window to draw digits on canvas<\/strong> and with a button, we can recognize the digit. The Tkinter library comes in the Python standard library. We have created a function <strong>predict_digit()<\/strong> that takes the image as input and then uses the trained model to predict the digit.<\/p>\n<p>Then we <strong>create the App class<\/strong> which is responsible for building the GUI for our app. We create a canvas where we can draw by capturing the mouse event and with a button, we trigger the predict_digit() function and display the results.<\/p>\n<p>Here\u2019s the full code for our gui_digit_recognizer.py file:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">from keras.models import load_model\r\nfrom tkinter import *\r\nimport tkinter as tk\r\nimport win32gui\r\nfrom PIL import ImageGrab, Image\r\nimport numpy as np\r\n\r\nmodel = load_model('mnist.h5')\r\n\r\ndef predict_digit(img):\r\n    #resize image to 28x28 pixels\r\n    img = img.resize((28,28))\r\n    #convert rgb to grayscale\r\n    img = img.convert('L')\r\n    img = np.array(img)\r\n    #reshaping to support our model input and normalizing\r\n    img = img.reshape(1,28,28,1)\r\n    img = img\/255.0\r\n    #predicting the class\r\n    res = model.predict([img])[0]\r\n    return np.argmax(res), max(res)\r\n\r\nclass App(tk.Tk):\r\n    def __init__(self):\r\n        tk.Tk.__init__(self)\r\n\r\n        self.x = self.y = 0\r\n\r\n        # Creating elements\r\n        self.canvas = tk.Canvas(self, width=300, height=300, bg = \"white\", cursor=\"cross\")\r\n        self.label = tk.Label(self, text=\"Thinking..\", font=(\"Helvetica\", 48))\r\n        self.classify_btn = tk.Button(self, text = \"Recognise\", command =         self.classify_handwriting) \r\n        self.button_clear = tk.Button(self, text = \"Clear\", command = self.clear_all)\r\n\r\n        # Grid structure\r\n        self.canvas.grid(row=0, column=0, pady=2, sticky=W, )\r\n        self.label.grid(row=0, column=1,pady=2, padx=2)\r\n        self.classify_btn.grid(row=1, column=1, pady=2, padx=2)\r\n        self.button_clear.grid(row=1, column=0, pady=2)\r\n\r\n        #self.canvas.bind(\"&lt;Motion&gt;\", self.start_pos)\r\n        self.canvas.bind(\"&lt;B1-Motion&gt;\", self.draw_lines)\r\n\r\n    def clear_all(self):\r\n        self.canvas.delete(\"all\")\r\n\r\n    def classify_handwriting(self):\r\n        HWND = self.canvas.winfo_id() # get the handle of the canvas\r\n        rect = win32gui.GetWindowRect(HWND) # get the coordinate of the canvas\r\n        im = ImageGrab.grab(rect)\r\n\r\n        digit, acc = predict_digit(im)\r\n        self.label.configure(text= str(digit)+', '+ str(int(acc*100))+'%')\r\n\r\n    def draw_lines(self, event):\r\n        self.x = event.x\r\n        self.y = event.y\r\n        r=8\r\n        self.canvas.create_oval(self.x-r, self.y-r, self.x + r, self.y + r, fill='black')\r\n\r\napp = App()\r\nmainloop()<\/pre>\n<p><strong>Screenshots:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/01\/python-machine-learning-project-output-as-number-2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-74274\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/01\/python-machine-learning-project-output-as-number-2.png\" alt=\"python machine learning project output as number 2\" width=\"520\" height=\"376\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/01\/python-machine-learning-project-output-as-number-2.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/01\/python-machine-learning-project-output-as-number-2-150x108.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/01\/python-machine-learning-project-output-as-number-2-300x217.png 300w\" sizes=\"auto, (max-width: 520px) 100vw, 520px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/01\/python-machine-learning-project-output-as-number-5.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-74275\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/01\/python-machine-learning-project-output-as-number-5.png\" alt=\"python machine learning project output as number 5\" width=\"521\" height=\"370\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/01\/python-machine-learning-project-output-as-number-5.png 521w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/01\/python-machine-learning-project-output-as-number-5-150x107.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/01\/python-machine-learning-project-output-as-number-5-300x213.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/01\/python-machine-learning-project-output-as-number-5-520x369.png 520w\" sizes=\"auto, (max-width: 521px) 100vw, 521px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/01\/python-project-output-as-number-6.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-74276\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/01\/python-project-output-as-number-6.png\" alt=\"python project output as number 6\" width=\"522\" height=\"375\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/01\/python-project-output-as-number-6.png 522w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/01\/python-project-output-as-number-6-150x108.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/01\/python-project-output-as-number-6-300x216.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/01\/python-project-output-as-number-6-520x374.png 520w\" sizes=\"auto, (max-width: 522px) 100vw, 522px\" \/><\/a><\/p>\n<h2>Summary<\/h2>\n<p>In this article, we have successfully built a Python deep learning project on handwritten digit recognition app. We have built and trained the Convolutional neural network which is very effective for image classification purposes. Later on, we build the GUI where we draw a digit on the canvas then we classify the digit and show the results.<\/p>\n<p><em><strong>Want to get hired as a Python expert? Practice the <a href=\"https:\/\/data-flair.training\/blogs\/top-python-interview-questions-answer\/\">150+ Python Interview Questions<\/a> by DataFlair<\/strong><\/em><\/p>\n<p>Do share your views regarding the intermediate Python project in the comment section.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Python Deep Learning Project To make machines more intelligent, the developers are diving into machine learning and deep learning techniques. A human learns to perform a task by practicing and repeating it again and&#46;&#46;&#46;<\/p>\n","protected":false},"author":7,"featured_media":74296,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[36],"tags":[21686,21661,21101,21662,21685,21082,21584,21583],"class_list":["post-74254","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-machine-learning","tag-deep-learning-project","tag-handwritten-digit-recognition","tag-learning-python-project","tag-project-based-on-python","tag-python-deep-learning-project","tag-python-project","tag-python-project-example","tag-python-project-idea"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Deep Learning Project - Handwritten Digit Recognition using Python - DataFlair<\/title>\n<meta name=\"description\" content=\"Work on the Python deep learning project to build a handwritten digit recognition app using MNIST dataset, convolutional neural network and a GUI.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/python-deep-learning-project-handwritten-digit-recognition\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Deep Learning Project - Handwritten Digit Recognition using Python - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Work on the Python deep learning project to build a handwritten digit recognition app using MNIST dataset, convolutional neural network and a GUI.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/python-deep-learning-project-handwritten-digit-recognition\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-01-07T04:07:13+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-03-14T11:24:55+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/01\/python-machine-learning-project-handwritten-digit-recognition-1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"802\" \/>\n\t<meta property=\"og:image:height\" content=\"420\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Deep Learning Project - Handwritten Digit Recognition using Python - DataFlair","description":"Work on the Python deep learning project to build a handwritten digit recognition app using MNIST dataset, convolutional neural network and a GUI.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/python-deep-learning-project-handwritten-digit-recognition\/","og_locale":"en_US","og_type":"article","og_title":"Deep Learning Project - Handwritten Digit Recognition using Python - DataFlair","og_description":"Work on the Python deep learning project to build a handwritten digit recognition app using MNIST dataset, convolutional neural network and a GUI.","og_url":"https:\/\/data-flair.training\/blogs\/python-deep-learning-project-handwritten-digit-recognition\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2020-01-07T04:07:13+00:00","article_modified_time":"2021-03-14T11:24:55+00:00","og_image":[{"width":802,"height":420,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/01\/python-machine-learning-project-handwritten-digit-recognition-1.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/python-deep-learning-project-handwritten-digit-recognition\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/python-deep-learning-project-handwritten-digit-recognition\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/beb0cab24b7aa54423a3b50e669a9dcd"},"headline":"Deep Learning Project &#8211; Handwritten Digit Recognition using Python","datePublished":"2020-01-07T04:07:13+00:00","dateModified":"2021-03-14T11:24:55+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/python-deep-learning-project-handwritten-digit-recognition\/"},"wordCount":947,"commentCount":175,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/python-deep-learning-project-handwritten-digit-recognition\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/01\/python-machine-learning-project-handwritten-digit-recognition-1.jpg","keywords":["deep learning project","Handwritten digit recognition","learning python project","project based on python","python deep learning project","Python project","python project example","python project idea"],"articleSection":["Machine Learning Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/python-deep-learning-project-handwritten-digit-recognition\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/python-deep-learning-project-handwritten-digit-recognition\/","url":"https:\/\/data-flair.training\/blogs\/python-deep-learning-project-handwritten-digit-recognition\/","name":"Deep Learning Project - Handwritten Digit Recognition using Python - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/python-deep-learning-project-handwritten-digit-recognition\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/python-deep-learning-project-handwritten-digit-recognition\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/01\/python-machine-learning-project-handwritten-digit-recognition-1.jpg","datePublished":"2020-01-07T04:07:13+00:00","dateModified":"2021-03-14T11:24:55+00:00","description":"Work on the Python deep learning project to build a handwritten digit recognition app using MNIST dataset, convolutional neural network and a GUI.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/python-deep-learning-project-handwritten-digit-recognition\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/python-deep-learning-project-handwritten-digit-recognition\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/python-deep-learning-project-handwritten-digit-recognition\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/01\/python-machine-learning-project-handwritten-digit-recognition-1.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/01\/python-machine-learning-project-handwritten-digit-recognition-1.jpg","width":802,"height":420,"caption":"python deep learning project - handwritten digit recognition"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/python-deep-learning-project-handwritten-digit-recognition\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Machine Learning Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/machine-learning\/"},{"@type":"ListItem","position":3,"name":"Deep Learning Project &#8211; Handwritten Digit Recognition using Python"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/beb0cab24b7aa54423a3b50e669a9dcd","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/c322416204232f4dd97ef3901b0a499a5d34d7ba7fe333f4bfe53a907873d293?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/c322416204232f4dd97ef3901b0a499a5d34d7ba7fe333f4bfe53a907873d293?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c322416204232f4dd97ef3901b0a499a5d34d7ba7fe333f4bfe53a907873d293?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team specializes in creating clear, actionable content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Backed by industry expertise, we make learning easy and career-oriented for beginners and pros alike.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam3\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/74254","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=74254"}],"version-history":[{"count":13,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/74254\/revisions"}],"predecessor-version":[{"id":74319,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/74254\/revisions\/74319"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/74296"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=74254"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=74254"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=74254"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}