Tensorflow2: Image Classification using Logistic Regression
This notebook is a tensorflow port of https://jovian.ml/aakashns/03-logistic-regression
Despite the structural differences in Tensorflow and PyTorch, I have tried to port the torch notebooks to tensorflow, which helps in learning both frameworks along with the course PyTorch: Zero to GANs by Aakash
Part 3 of "Tensorflow: Zero to GANs"
This post is the third in a series of tutorials on building deep learning models with tensorflow, an open source neural networks library. Check out the full series:
In this tutorial, we'll use our existing knowledge of PyTorch and linear regression to solve a very different kind of problem: image classification. We'll use the famous MNIST Handwritten Digits Database as our training dataset. It consists of 28px by 28px grayscale images of handwritten digits (0 to 9), along with labels for each image indicating which digit it represents. Here are some sample images from the dataset:
import numpy as np
import tensorflow as tf
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Reshape
Dataset import and exploration
Tensorflow2.x as of now has two ways of importing mnist dataset using tf.keras.datasets
and using a library called tensorflow_datasets
. Let's go through both approaches now.