{"id":79787,"date":"2020-09-08T20:27:57","date_gmt":"2020-09-08T14:57:57","guid":{"rendered":"https:\/\/techvidvan.com\/tutorials\/?p=79787"},"modified":"2026-06-03T14:55:21","modified_gmt":"2026-06-03T09:25:21","slug":"handwritten-digit-recognition-with-python-cnn","status":"publish","type":"post","link":"https:\/\/techvidvan.com\/tutorials\/handwritten-digit-recognition-with-python-cnn\/","title":{"rendered":"Handwritten Digit Recognition with Python &amp; CNN"},"content":{"rendered":"<p>Hello friends, \u2018Digits\u2019 are a part of our everyday life, be it License plate on our cars or bike, the price of a product, speed limit on a road, or details associated with a bank account. In the case of a text which is unclear, it is easier to guess the digits in comparison to the alphabets<\/p>\n<p>Machine Learning and Deep Learning are reducing human efforts in almost every field. Moreover, a solution achieved using ML and DL can power various applications at the same time, thereby reducing human effort and increasing the flexibility to use the solution. One such solution is a handwritten digit recognition system that can be used in postal mail sorting, bank check processing, form data entry, etc.<\/p>\n<h3>Convolution Neural Network<\/h3>\n<p>A Convolutional Neural Network or CNN is a Deep Learning Algorithm which is very effective in handling image classification tasks. It is able to capture the Temporal and Spatial dependencies in an image with the help of filters or kernels.<\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/09\/cnn-sliding-kernel.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-79792\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/09\/cnn-sliding-kernel.jpg\" alt=\"cnn sliding kernel\" width=\"580\" height=\"594\" \/><\/a><\/p>\n<p>The kernel is just like a small window sliding over the large window in order to extract the spatial features and in the end, we get feature maps.<\/p>\n<h3>MNIST Dataset<\/h3>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/09\/mnist-dataset.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-79793\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/09\/mnist-dataset.jpg\" alt=\"mnist dataset\" width=\"740\" height=\"717\" \/><\/a><\/p>\n<p style=\"text-align: center;\">Source: MNIST<\/p>\n<p>We are going to use the famous MNIST dataset for training our CNN model. The MNIST dataset was compiled with images of digits from various scanned documents and then normalized in size. Each image is of a dimension, 28&#215;28 i.e total 784 pixel values.<\/p>\n<p>You do not need to download the dataset from any external source as we will import it from keras.datasets<\/p>\n<h3>Layout of the basic idea<\/h3>\n<ol>\n<li>Firstly, we will train a CNN (Convolutional Neural Network) on MNIST dataset, which contains a total of 70,000 images of handwritten digits from 0-9 formatted as 28&#215;28-pixel monochrome images.<\/li>\n<li>For this, we will first split the dataset into train and test data with size 60,000 and 10,000 respectively.<\/li>\n<li>Then, we will preprocess the input data by reshaping the image and scaling the pixel values between 0 and 1.<\/li>\n<li>After that, we will design the neural network and train the model.<\/li>\n<li>After the model is trained, we will save it for future use.<\/li>\n<li>Next, we are going to use a webcam as an input to feed an image of a digit to our trained model.<\/li>\n<li>Our model will process the image to identify the digit and return a series of 10 numbers corresponding to the ten digits with an activation on the index of the proposed digit.<\/li>\n<\/ol>\n<h3>Download Handwritten Digit Recognition Code<\/h3>\n<p>Please download project source code: <a href=\"https:\/\/drive.google.com\/file\/d\/19cYR30iKiIYZeD83bIe6Kvd5cAJiqzzV\/view?usp=drive_link\"><strong>Handwritten Digit Recognition in Python<\/strong><\/a><\/p>\n<h3>File Structuring<\/h3>\n<h4>1. Train.py<\/h4>\n<p>We utilize the MNIST dataset to train our CNN model and then save the model in the current working directory.<\/p>\n<h4>2. RecognizeDigit.py<\/h4>\n<p>We load the saved model and use appropriate functions to capture video via webcam and pass it as an input to our model. Our model produces a prediction which is displayed to the user.<\/p>\n<h3>Libraries Required<\/h3>\n<p>Make sure that the following libraries are installed on your working machine before proceeding further<\/p>\n<ol>\n<li>Keras<\/li>\n<li>Tensorflow<\/li>\n<li>OpenCV<\/li>\n<li>Sklearn<\/li>\n<li>Numpy<\/li>\n<\/ol>\n<h3>Training the Model (Train.py)<\/h3>\n<p>Before we begin training, I would suggest you to train the model on Google colab as it offers training the model on GPU if your computer does not have one. It speeds up the training process by manifold and helps you achieve the final results much quicker.<\/p>\n<p>Simply open a Google Colab Notebook &gt; Edit &gt; Notebook Settings &gt; Hardware Accelerator &gt; GPU &gt; Save and Done..!!<\/p>\n<h4>1. Import the necessary libraries and modules<\/h4>\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<\/pre>\n<h4>2. Splitting the MNIST dataset into Train and Test<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">(x_train, y_train), (x_test, y_test) = mnist.load_data()\r\n<\/pre>\n<h4>3. Preprocessing the input data<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">num_of_trainImgs = x_train.shape[0] #60000 here\r\nnum_of_testImgs = x_test.shape[0] #10000 here\r\nimg_width = 28\r\nimg_height = 28\r\n \r\nx_train = x_train.reshape(x_train.shape[0], img_height, img_width, 1)\r\nx_test = x_test.reshape(x_test.shape[0], img_height, img_width, 1)\r\ninput_shape = (img_height, img_width, 1)\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\n<\/pre>\n<h4>4. Converting the class vectors to binary class<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">num_classes = 10\r\ny_train = keras.utils.to_categorical(y_train, num_classes)\r\ny_test = keras.utils.to_categorical(y_test, num_classes)\r\n<\/pre>\n<h4>5. Defining the model architecture<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">model = Sequential()\r\nmodel.add(Conv2D(32, kernel_size=(3, 3),\r\n                 activation='relu',\r\n                 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(128, activation='relu'))\r\nmodel.add(Dropout(0.5))\r\nmodel.add(Dense(num_classes, activation='softmax'))\r\n\r\n<\/pre>\n<h4>6. Compiling the model<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">model.compile(loss=keras.losses.categorical_crossentropy,\r\n              optimizer=keras.optimizers.Adadelta(),\r\n              metrics=['accuracy'])\r\n<\/pre>\n<h4>7. Fitting the model on training data<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">model.fit(x_train, y_train,\r\n          batch_size=128,\r\n          epochs=12,\r\n          verbose=1,\r\n          validation_data=(x_test, y_test))\r\n<\/pre>\n<p><strong>Output :<\/strong><\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/09\/model-training.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-79795\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/09\/model-training.jpg\" alt=\"model training\" width=\"1810\" height=\"936\" \/><\/a><\/p>\n<h4>8. Evaluating the model on test data<\/h4>\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])\r\n<\/pre>\n<p><strong>Output :<\/strong><\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/09\/test-accuracy.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-79796\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/09\/test-accuracy.jpg\" alt=\"test accuracy\" width=\"475\" height=\"156\" \/><\/a><\/p>\n<p>You might have observed that with the training, our test loss decreased significantly as we ran our model for 30 epochs and accuracy improved to over 89%. I may not sound like a good figure but let&#8217;s test out our model on the real-world input.<\/p>\n<h4>9. Saving the Model<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">model.save('trained_model.h5')\r\n<\/pre>\n<p><strong>Note :<\/strong> If you trained your model on Google Colab, then make sure you download the model in the project directory.<\/p>\n<h3>Digit Recognition<\/h3>\n<h4>1. Importing the necessary libraries<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">import numpy as np\r\nimport cv2\r\nfrom skimage import img_as_ubyte    \r\nfrom skimage.color import rgb2gray\r\nfrom keras.models import load_model\r\n<\/pre>\n<h4>2. Setting up the videoCapture<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">width = 640\r\nheight = 480\r\ncameraNo = 0\r\n \r\ncap = cv2.VideoCapture(cameraNo)\r\ncap.set(3,width)\r\ncap.set(4,height)\r\n<\/pre>\n<h4>3. Loading our pretrained model<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">model = load_model('trained_model.h5')\r\n<\/pre>\n<p><strong>Note :<\/strong> Steps D to N will be in the infinite while loop<\/p>\n<h4>4. Reading the Image<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">while True:\r\n  success, im_orig = cap.read()\r\n<\/pre>\n<h4>5. Converting the image to grayscale<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">img_gray = rgb2gray(img_original)\r\n<\/pre>\n<h4>6. Converting the result to uint8 range<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">img_gray_u8 = img_as_ubyte(img_gray)\r\n<\/pre>\n<h4>7. Thresholding<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">(thresh, im_binary) = cv2.threshold(img_gray_u8, 128, 255, cv2.THRESH_BINARY | cv2.THRESH_OTSU)<\/pre>\n<h4>8. Resizing the image<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">img_resized = cv2.resize(im_binary,(28,28))\r\n<\/pre>\n<h4>9. Inverting the image colours<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">im_gray_invert = 255 - img_resized\r\n  cv2.imshow(\"invert image\", im_gray_invert)\r\n<\/pre>\n<h4>10. Reshaping the image for final transmission<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">im_final = im_gray_invert.reshape(1,28,28,1)\r\n<\/pre>\n<h4>11. Transmitting the image to our model<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">ans = model.predict(im_final)\r\n<\/pre>\n<h4>12. Extracting the result from the array returned and printing the predicted value<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">ans = np.argmax(ans,axis=1)[0]\r\n  print(ans)\r\n<\/pre>\n<h4>13. Putting the predicted value as a text on webcam feed<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">cv2.putText(img_original,'Predicted Digit : '+str(ans),\r\n                    (50,50),cv2.FONT_HERSHEY_COMPLEX,\r\n                    1,(0,0,255),1)\r\n  cv2.imshow(\"Original Image\",img_original)\r\n<\/pre>\n<h4>14. Handling the exit<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">if cv2.waitKey(1) and 0xFF == ord('q'):\r\n    break\r\n<\/pre>\n<h4>15. Releasing the camera control and destroying all the windows<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">cap.release()\r\ncv2.destroyAllWindows()\r\n<\/pre>\n<h3>Plotting the Collage of Images of Digits from Dataset<\/h3>\n<p>Just in case, if you are curious and do not know how I made the above collage of images from the train dataset, let me show<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">(x_train, y_train),(x_test, y_test) = mnist.load_data()\r\n \r\nimport matplotlib.pyplot as plt\r\nfig, axes = plt.subplots(10, 10, figsize=(8, 8), subplot_kw={'xticks':[], 'yticks':[]}, gridspec_kw=dict(hspace=0.1, wspace=0.1))\r\nfor i, ax in enumerate(axes.flat):\r\n    ax.imshow(x_train[i], cmap='binary', interpolation='nearest')\r\n    ax.text(0.05, 0.05, str(y_train[i]),transform=ax.transAxes, color='green')\r\nplt.show()\r\n<\/pre>\n<p><strong>Explanation:<\/strong><\/p>\n<p>Just after we load our data via mnist.load_data(), we need to import matplotlib. The image we see is the collection of various subplots hence we define a 10&#215;10 subplot, meaning there are 100 images to be accommodated in the plot. You can see we have disabled both the xticks and yticks. In order to relate the image to its target we value, we also put a small text in the bottom left corner of the image. Gridspec_kw basically helps specify the gaps in between the plots, both horizontally and vertically. In the end, we display the plot using plot.show() method.<\/p>\n<h2>Summary<\/h2>\n<p>Hooray..!! You have successfully made a handwritten digit recognition system. Honestly, the intention was to make it work on real-life data, apart from the test dataset. Hence, you built something different from the usual tutorials. You can extend this project by adding the functionality of multi-digit recognition or you can completely create a new project from scratch. In this new project, you can ask the user to draw the digits with gestures and then detect them. Happy coding and all the best for great projects ahead.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello friends, \u2018Digits\u2019 are a part of our everyday life, be it License plate on our cars or bike, the price of a product, speed limit on a road, or details associated with a&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":79797,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[210],"tags":[2598,3251,204,483],"class_list":["post-79787","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-machine-learning","tag-deep-learning-project","tag-handwritten-digit-recognition","tag-machine-learning-project","tag-python-project"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Handwritten Digit Recognition with Python &amp; CNN - TechVidvan<\/title>\n<meta name=\"description\" content=\"Handwritten digit recognition with python and CNN - Recognize handwritten digits with machine learning and deep learning techniques\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/techvidvan.com\/tutorials\/handwritten-digit-recognition-with-python-cnn\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Handwritten Digit Recognition with Python &amp; CNN - TechVidvan\" \/>\n<meta property=\"og:description\" content=\"Handwritten digit recognition with python and CNN - Recognize handwritten digits with machine learning and deep learning techniques\" \/>\n<meta property=\"og:url\" content=\"https:\/\/techvidvan.com\/tutorials\/handwritten-digit-recognition-with-python-cnn\/\" \/>\n<meta property=\"og:site_name\" content=\"TechVidvan\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/TechVidvan\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-09-08T14:57:57+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-06-03T09:25:21+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/09\/Python-handwritten-digit-recognition.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"TechVidvan Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@vidvantech\" \/>\n<meta name=\"twitter:site\" content=\"@vidvantech\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"TechVidvan Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Handwritten Digit Recognition with Python &amp; CNN - TechVidvan","description":"Handwritten digit recognition with python and CNN - Recognize handwritten digits with machine learning and deep learning techniques","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:\/\/techvidvan.com\/tutorials\/handwritten-digit-recognition-with-python-cnn\/","og_locale":"en_US","og_type":"article","og_title":"Handwritten Digit Recognition with Python &amp; CNN - TechVidvan","og_description":"Handwritten digit recognition with python and CNN - Recognize handwritten digits with machine learning and deep learning techniques","og_url":"https:\/\/techvidvan.com\/tutorials\/handwritten-digit-recognition-with-python-cnn\/","og_site_name":"TechVidvan","article_publisher":"https:\/\/www.facebook.com\/TechVidvan\/","article_published_time":"2020-09-08T14:57:57+00:00","article_modified_time":"2026-06-03T09:25:21+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/09\/Python-handwritten-digit-recognition.jpg","type":"image\/jpeg"}],"author":"TechVidvan Team","twitter_card":"summary_large_image","twitter_creator":"@vidvantech","twitter_site":"@vidvantech","twitter_misc":{"Written by":"TechVidvan Team","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/techvidvan.com\/tutorials\/handwritten-digit-recognition-with-python-cnn\/#article","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/handwritten-digit-recognition-with-python-cnn\/"},"author":{"name":"TechVidvan Team","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/e9c26e74dd3d87421f7ada9433b8cd22"},"headline":"Handwritten Digit Recognition with Python &amp; CNN","datePublished":"2020-09-08T14:57:57+00:00","dateModified":"2026-06-03T09:25:21+00:00","mainEntityOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/handwritten-digit-recognition-with-python-cnn\/"},"wordCount":1016,"commentCount":0,"publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/handwritten-digit-recognition-with-python-cnn\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/09\/Python-handwritten-digit-recognition.jpg","keywords":["deep learning project","handwritten digit recognition","machine learning project","Python project"],"articleSection":["Machine Learning Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/techvidvan.com\/tutorials\/handwritten-digit-recognition-with-python-cnn\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/techvidvan.com\/tutorials\/handwritten-digit-recognition-with-python-cnn\/","url":"https:\/\/techvidvan.com\/tutorials\/handwritten-digit-recognition-with-python-cnn\/","name":"Handwritten Digit Recognition with Python &amp; CNN - TechVidvan","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/#website"},"primaryImageOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/handwritten-digit-recognition-with-python-cnn\/#primaryimage"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/handwritten-digit-recognition-with-python-cnn\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/09\/Python-handwritten-digit-recognition.jpg","datePublished":"2020-09-08T14:57:57+00:00","dateModified":"2026-06-03T09:25:21+00:00","description":"Handwritten digit recognition with python and CNN - Recognize handwritten digits with machine learning and deep learning techniques","breadcrumb":{"@id":"https:\/\/techvidvan.com\/tutorials\/handwritten-digit-recognition-with-python-cnn\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/techvidvan.com\/tutorials\/handwritten-digit-recognition-with-python-cnn\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/handwritten-digit-recognition-with-python-cnn\/#primaryimage","url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/09\/Python-handwritten-digit-recognition.jpg","contentUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/09\/Python-handwritten-digit-recognition.jpg","width":1200,"height":628,"caption":"Python handwritten digit recognition"},{"@type":"BreadcrumbList","@id":"https:\/\/techvidvan.com\/tutorials\/handwritten-digit-recognition-with-python-cnn\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/techvidvan.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"Handwritten Digit Recognition with Python &amp; CNN"}]},{"@type":"WebSite","@id":"https:\/\/techvidvan.com\/tutorials\/#website","url":"https:\/\/techvidvan.com\/tutorials\/","name":"TechVidvan Blogs","description":"","publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/techvidvan.com\/tutorials\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/techvidvan.com\/tutorials\/#organization","name":"TechVidvan","url":"https:\/\/techvidvan.com\/tutorials\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/logo\/image\/","url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/03\/techvidvan-logo-200x50-1.webp","contentUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/03\/techvidvan-logo-200x50-1.webp","width":200,"height":50,"caption":"TechVidvan"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/TechVidvan\/","https:\/\/x.com\/vidvantech"]},{"@type":"Person","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/e9c26e74dd3d87421f7ada9433b8cd22","name":"TechVidvan Team","description":"The TechVidvan Team delivers practical, beginner-friendly tutorials on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our experts are here to help you upskill and excel in today\u2019s tech industry."}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/79787","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/comments?post=79787"}],"version-history":[{"count":2,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/79787\/revisions"}],"predecessor-version":[{"id":448002,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/79787\/revisions\/448002"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media\/79797"}],"wp:attachment":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media?parent=79787"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/categories?post=79787"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/tags?post=79787"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}