Book Image

Practical Computer Vision

By : Abhinav Dadhich
Book Image

Practical Computer Vision

By: Abhinav Dadhich

Overview of this book

In this book, you will find several recently proposed methods in various domains of computer vision. You will start by setting up the proper Python environment to work on practical applications. This includes setting up libraries such as OpenCV, TensorFlow, and Keras using Anaconda. Using these libraries, you'll start to understand the concepts of image transformation and filtering. You will find a detailed explanation of feature detectors such as FAST and ORB; you'll use them to find similar-looking objects. With an introduction to convolutional neural nets, you will learn how to build a deep neural net using Keras and how to use it to classify the Fashion-MNIST dataset. With regard to object detection, you will learn the implementation of a simple face detector as well as the workings of complex deep-learning-based object detectors such as Faster R-CNN and SSD using TensorFlow. You'll get started with semantic segmentation using FCN models and track objects with Deep SORT. Not only this, you will also use Visual SLAM techniques such as ORB-SLAM on a standard dataset. By the end of this book, you will have a firm understanding of the different computer vision techniques and how to apply them in your applications.
Table of Contents (12 chapters)

CNN in practice

We will now start with our implementation of a convolutional neural net in Keras. For our example case, we will train a network to classify Fashion-MNIST. This is a dataset of grayscale images of fashion products, of the size 28 x 28. The total number of images is 70,000, with 60,000 as training and 10,000 as a test. There are ten categories in this dataset, which are t-shirt, trousers, pullover, dress, coat, sandal, shirt, sneakers, bag, and ankle boots. Labels for each are marked with a category number from 0-9.

We can load this dataset as follows:

from keras.datasets import fashion_mnist
(x_train, y_train), (x_test, y_test) = fashion_mnist.load_data()

The previous code block doesn't output a visualization of the dataset, so following image is to show what dataset we will be using:

It will split the data into the train and test sets with both inputs...