

{"id":14835,"date":"2018-05-15T05:48:09","date_gmt":"2018-05-15T05:48:09","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=14835"},"modified":"2021-05-14T11:00:24","modified_gmt":"2021-05-14T05:30:24","slug":"tensorflow-mnist-dataset","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/tensorflow-mnist-dataset\/","title":{"rendered":"TensorFlow MNIST Dataset and Softmax Regression"},"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;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-06-02 04:38:17&quot;,&quot;http_code&quot;:206},&quot;process&quot;:&quot;done&quot;}]'><\/div>\n<p><span style=\"font-weight: 400\">In our last <strong>TensorFlow Tutorial<\/strong>, we discussed <strong>TensorBoard<\/strong>. Today, we will see TensorFlow MNIST Dataset. This TensorFlow MNIST tutorial will teach us the meaning of TensorFlow MNIST.<\/span><\/p>\n<p><span style=\"font-weight: 400\"> Moreover, we will discuss softmax regression and implementation of MNIST dataset in TensorFlow. Also, we will see the training and accuracy of TensorFlow MNIST dataset.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Here, we will learn how to create a function that is a model for recognizing handwritten digits by looking at each pixel in the image, then using TensorFlow to train the model to predict the image by making it look at thousands of examples which are already labeled (supervised learning). <\/span><\/p>\n<p><span style=\"font-weight: 400\">You will then check the model\u2019s accuracy with a test dataset. Let\u2019s get started.<\/span><\/p>\n<p>&nbsp;<\/p>\n<h2><span style=\"font-weight: 400\">What is TensorFlow MNIST Dataset?<\/span><\/h2>\n<p><span style=\"font-weight: 400\">MNIST dataset in TensorFlow, containing information of handwritten digits spiltted into three parts:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Training Data (mnist.train) &#8211; 55000 datapoints<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Validation Data (mnist.validate) \u2013 5000 datapoints<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Test Data (mnist.test) &#8211; 10000 datapoints<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">And available on Yan Lecun\u2019s website, <\/span><a href=\"http:\/\/yann.lecun.com\/exdb\/mnist\/\"><span style=\"font-weight: 400\">http:\/\/yann.lecun.com\/exdb\/mnist\/<\/span><\/a><span style=\"font-weight: 400\"> . Now before we start, it is important to note that every datapoint has two parts: an image (x) and a corresponding label (y) describing the actual image and each image is a 28&#215;28 array, i.e. 784 numbers.<\/span><\/p>\n<p><span style=\"font-weight: 400\"> The label of the image is a number between 0 and 9 corresponding to the TensorFlow MNIST image. To download and use MNIST Dataset, use the following <strong>commands:<\/strong><\/span><\/p>\n<pre class=\"EnlighterJSRAW\">from tensorflow.examples.tutorials.mnist import input_data\r\nmnist = input_data.read_data_sets(\"MNIST_data\/\", one_hot=True)<\/pre>\n<div id=\"attachment_14843\" style=\"width: 1210px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/example-01.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-14843\" class=\"wp-image-14843 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/example-01.jpg\" alt=\"MNIST Dataset\" width=\"1200\" height=\"346\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/example-01.jpg 1200w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/example-01-150x43.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/example-01-300x87.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/example-01-768x221.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/example-01-1024x295.jpg 1024w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/a><p id=\"caption-attachment-14843\" class=\"wp-caption-text\">MNIST Dataset in TensorFlow<\/p><\/div>\n<h2>Softmax Regression in TensorFlow<\/h2>\n<p><span style=\"font-weight: 400\">As the label suggests, there are only ten possibilities of an TensorFlow MNIST to be from 0 to 9. Your aim is to look at an image and say with particular certainty (probability) that a given image is a particular digit. <\/span><\/p>\n<p><span style=\"font-weight: 400\">Softmax is usually used when there is a possibility of an object being one of several different possibilities as the regression gives you values between 0 and 1 that sum up to 1. Therefore, your approach should be simple.<\/span><\/p>\n<div id=\"attachment_14841\" style=\"width: 1210px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/softmax-regression-scalargraph-1.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-14841\" class=\"wp-image-14841 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/softmax-regression-scalargraph-1.png\" alt=\"TensorFlow MNIST Dataset- Softmax Regression\" width=\"1200\" height=\"628\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/softmax-regression-scalargraph-1.png 1200w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/softmax-regression-scalargraph-1-150x79.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/softmax-regression-scalargraph-1-300x157.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/softmax-regression-scalargraph-1-768x402.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/softmax-regression-scalargraph-1-1024x536.png 1024w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/a><p id=\"caption-attachment-14841\" class=\"wp-caption-text\">TensorFlow MNIST Dataset- Softmax Regression<\/p><\/div>\n<div id=\"attachment_14842\" style=\"width: 2634px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/softmax-regression-vectorequation-1.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-14842\" class=\"wp-image-14842 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/softmax-regression-vectorequation-1.png\" alt=\"TensorFlow MNIST Dataset- Softmax Regression\" width=\"2624\" height=\"640\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/softmax-regression-vectorequation-1.png 2624w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/softmax-regression-vectorequation-1-150x37.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/softmax-regression-vectorequation-1-300x73.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/softmax-regression-vectorequation-1-768x187.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/softmax-regression-vectorequation-1-1024x250.png 1024w\" sizes=\"auto, (max-width: 2624px) 100vw, 2624px\" \/><\/a><p id=\"caption-attachment-14842\" class=\"wp-caption-text\">TensorFlow MNIST Dataset- Softmax Regression<\/p><\/div>\n<p><span style=\"font-weight: 400\">First, you classify an TensorFlow MNIST image to be in a certain class and then represent it as a probability of being correct or not. Now, to tally up all the objects in a particular class, you can do a weighted sum of the pixel intensities. <\/span><\/p>\n<p><span style=\"font-weight: 400\">You also need to add a bias to concur that some things are more likely independent of the input. Softmax normalizes the weights and adds them up to one forming a probability distribution. <\/span><\/p>\n<p><span style=\"font-weight: 400\">What you are doing is nothing but exponentiating the inputs and then normalizing them. The thing to note is that no hypothesis has a negative or a zero weight.<\/span><\/p>\n<h2><span style=\"font-weight: 400\">Implementation of MNIST Dataset in TensorFlow<\/span><\/h2>\n<p><span style=\"font-weight: 400\">The benefit of using TensorFlow MNIST dataset classification is that it lets you describe a graph of interacting operations that run entirely outside Python.<\/span><\/p>\n<p><span style=\"font-weight: 400\">First, we import the TensorFlow library using<\/span><br \/>\n<strong>import tensorflow as tf<\/strong><\/p>\n<p><span style=\"font-weight: 400\">Then you create a placeholder, a value that you\u2019ll input when you ask the library to run a computation using <\/span><\/p>\n<pre class=\"EnlighterJSRAW\">x = tf.placeholder(tf.float32, [None, 784])<\/pre>\n<p><span style=\"font-weight: 400\">You should then add weights and biases to your model. Using <\/span><b><i>Variable, <\/i><\/b><span style=\"font-weight: 400\">which is a modifiable tensor that has a scope in the graph of interacting operations. <\/span><\/p>\n<pre class=\"EnlighterJSRAW\">W = tf.Variable(tf.zeros([784, 10]))\r\nb = tf.Variable(tf.zeros([10]))<\/pre>\n<p>Notice that shape of W is [784, 10] as you want to produce 10-dimensional vectors of evidence for different classes by multiplying 784-dimensional image vectors by it. You can add b to the output as it has a shape of [10].<\/p>\n<h2><span style=\"font-weight: 400\">TensorFlow MNIST &#8211; Training<\/span><\/h2>\n<p><span style=\"font-weight: 400\">You define a model by multiplying the feature matrix with the weight and add a bias to it, then running it through a softmax function.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">y = tf.nn.softmax(tf.matmul(x, W) + b)<\/pre>\n<p><span style=\"font-weight: 400\">You use a cost function or a mean squared error function to find the deviation of your results from the actual data. The less the error, the better is the model. Another very common function is the <\/span><i><span style=\"font-weight: 400\">cross-entropy<\/span><\/i><span style=\"font-weight: 400\">, which measures how inefficient your predictions are. <\/span><\/p>\n<p><span style=\"font-weight: 400\">The function is described as below, where y represents the predictions and y\u2019 is the actual distribution. You implement it by adding a placeholder <\/span><\/p>\n<pre class=\"EnlighterJSRAW\">y_ = tf.placeholder(tf.float32, [None, 10])<\/pre>\n<p><span style=\"font-weight: 400\">Then defining the <\/span><i style=\"font-family: Verdana, Geneva, sans-serif;font-weight: inherit\">cross-entropy <\/i><span style=\"font-weight: 400\">by<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">cross_entropy = tf.reduce_mean(-tf.reduce_sum(y_ * tf.log(y), reduction_indices=[1]))<\/pre>\n<p>Now, that you have successfully defined your model, it\u2019s time to train it. You can do this with the help of gradient descent and back propagation. There are many other optimization algorithms available as well such as logistic regression, dynamic relaxation and many more.<\/p>\n<p>But in the given example, you use gradient descent with a learning rate of 0.5 for cost function optimization.<\/p>\n<pre class=\"EnlighterJSRAW\">train_step = tf.train.GradientDescentOptimizer(0.5).minimize(cross_entropy)<\/pre>\n<p>Before training, you need to start a session and initialize the variable you created earlier.<\/p>\n<pre class=\"EnlighterJSRAW\">sess = tf.InteractiveSession()<\/pre>\n<p>This starts an interactive session and the variables are initialized by<\/p>\n<pre class=\"EnlighterJSRAW\">tf.global_variables_initializer().run()<\/pre>\n<p><span style=\"font-weight: 400\">Now, it\u2019s time to train it. You can change the number of epochs (iterations) to suit your model.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">for _ in range(1000):\r\n  batch_xs, batch_ys = mnist.train.next_batch(100)\r\n  sess.run(train_step, feed_dict={x: batch_xs, y_: batch_ys})<\/pre>\n<h2><span style=\"font-weight: 400\">Checking Accuracy With Test Dataset<\/span><\/h2>\n<p><span style=\"font-weight: 400\">You check the accuracy by comparing your results with a test dataset. Here, you can make use of <\/span><b>tf.argmax <\/b><span style=\"font-weight: 400\">\u00a0function which lets you know the index of the highest value in a tensor along a particular axis.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">correct_prediction = tf.equal(tf.argmax(y,1), tf.argmax(y_,1))<\/pre>\n<p><span style=\"font-weight: 400\">This gives you the list of Booleans and then you take the mean after converting to floating point numbers.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">accuracy = tf.reduce_mean(tf.cast(correct_prediction, tf.float32))<\/pre>\n<p><span style=\"font-weight: 400\">Then, you can print out the accuracy by <\/span><\/p>\n<pre class=\"EnlighterJSRAW\">print(sess.run(accuracy, feed_dict={x: mnist.test.images, y_: mnist.test.labels}))<\/pre>\n<p>So, this was all about TensorFlow MNIST Dataset and Softmax Regression tutorial. Hope you like our explanation.<\/p>\n<h2><span style=\"font-weight: 400\">Conclusion<\/span><\/h2>\n<p><span style=\"font-weight: 400\">Hence, we have learned TensorFlow\u00a0MNIST Dataset and Softmax Regression. Congratulations on your first use of a <strong>machine learning algorithm<\/strong>. Moreover, we discussed the implementation of the MNIST dataset in TensorFlow. We learned how to train a model and to get the best accuracy. <\/span><\/p>\n<p><span style=\"font-weight: 400\">The best TensorFlow MNIST models give an accuracy of around 97%. You might get an accuracy around 89-90 %, but don\u2019t frown. The more you work on it, the better you keep getting at it. <\/span><\/p>\n<p><span style=\"font-weight: 400\">Next up, is<strong> image recognition using TensorFlow<\/strong>. Furthermore, if you have any query, feel free to ask through the comment section.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In our last TensorFlow Tutorial, we discussed TensorBoard. Today, we will see TensorFlow MNIST Dataset. This TensorFlow MNIST tutorial will teach us the meaning of TensorFlow MNIST. Moreover, we will discuss softmax regression and&#46;&#46;&#46;<\/p>\n","protected":false},"author":6,"featured_media":54873,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[73],"tags":[2496,5362,6588,8754,8755,8756,8757,12976,12979,14575,14576],"class_list":["post-14835","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tensorflow","tag-checking-model-accuracy","tag-handwritten-digits","tag-implementation-of-dataset","tag-mnist-database","tag-mnist-dataset","tag-mnist-dataset-in-tensorflow","tag-mnist-tensorflow","tag-softmax-regression","tag-software-regression-in-tensorflow","tag-tensorflow-mnist","tag-tensorflow-mnist-dataset"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>TensorFlow MNIST Dataset and Softmax Regression - DataFlair<\/title>\n<meta name=\"description\" content=\"TensorFlow MNIST Dataset, Softmax Regression, Implementation of MNIST dataset in TensorFlow, training and checking model accuracy, MNIST Commands &amp; example\" \/>\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\/tensorflow-mnist-dataset\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"TensorFlow MNIST Dataset and Softmax Regression - DataFlair\" \/>\n<meta property=\"og:description\" content=\"TensorFlow MNIST Dataset, Softmax Regression, Implementation of MNIST dataset in TensorFlow, training and checking model accuracy, MNIST Commands &amp; example\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/tensorflow-mnist-dataset\/\" \/>\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=\"2018-05-15T05:48:09+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-05-14T05:30:24+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/MNIST-in-TensorFlow.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=\"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=\"6 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"TensorFlow MNIST Dataset and Softmax Regression - DataFlair","description":"TensorFlow MNIST Dataset, Softmax Regression, Implementation of MNIST dataset in TensorFlow, training and checking model accuracy, MNIST Commands & example","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\/tensorflow-mnist-dataset\/","og_locale":"en_US","og_type":"article","og_title":"TensorFlow MNIST Dataset and Softmax Regression - DataFlair","og_description":"TensorFlow MNIST Dataset, Softmax Regression, Implementation of MNIST dataset in TensorFlow, training and checking model accuracy, MNIST Commands & example","og_url":"https:\/\/data-flair.training\/blogs\/tensorflow-mnist-dataset\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2018-05-15T05:48:09+00:00","article_modified_time":"2021-05-14T05:30:24+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/MNIST-in-TensorFlow.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":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/tensorflow-mnist-dataset\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/tensorflow-mnist-dataset\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/2c58ecb4f73a39f0ef993f1ddfcd7b89"},"headline":"TensorFlow MNIST Dataset and Softmax Regression","datePublished":"2018-05-15T05:48:09+00:00","dateModified":"2021-05-14T05:30:24+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/tensorflow-mnist-dataset\/"},"wordCount":983,"commentCount":1,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/tensorflow-mnist-dataset\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/MNIST-in-TensorFlow.jpg","keywords":["Checking Model Accuracy","Handwritten digits","Implementation of dataset","MNIST Database","MNIST Dataset","MNIST Dataset in TensorFlow","MNIST TensorFlow","Softmax Regression","Software Regression in TensorFlow","Tensorflow MNIST","TensorFlow MNIST dataset"],"articleSection":["Tensorflow Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/tensorflow-mnist-dataset\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/tensorflow-mnist-dataset\/","url":"https:\/\/data-flair.training\/blogs\/tensorflow-mnist-dataset\/","name":"TensorFlow MNIST Dataset and Softmax Regression - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/tensorflow-mnist-dataset\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/tensorflow-mnist-dataset\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/MNIST-in-TensorFlow.jpg","datePublished":"2018-05-15T05:48:09+00:00","dateModified":"2021-05-14T05:30:24+00:00","description":"TensorFlow MNIST Dataset, Softmax Regression, Implementation of MNIST dataset in TensorFlow, training and checking model accuracy, MNIST Commands & example","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/tensorflow-mnist-dataset\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/tensorflow-mnist-dataset\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/tensorflow-mnist-dataset\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/MNIST-in-TensorFlow.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/MNIST-in-TensorFlow.jpg","width":1200,"height":628,"caption":"MNIST in TensorFlow"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/tensorflow-mnist-dataset\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Tensorflow Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/tensorflow\/"},{"@type":"ListItem","position":3,"name":"TensorFlow MNIST Dataset and Softmax Regression"}]},{"@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\/2c58ecb4f73a39f0ef993f1ddfcd7b89","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"The DataFlair Team provides industry-driven content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our expert educators focus on delivering value-packed, easy-to-follow resources for tech enthusiasts and professionals.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam2\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/14835","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\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=14835"}],"version-history":[{"count":9,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/14835\/revisions"}],"predecessor-version":[{"id":95002,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/14835\/revisions\/95002"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/54873"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=14835"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=14835"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=14835"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}