Book Image

Hands-On Vision and Behavior for Self-Driving Cars

By : Luca Venturi, Krishtof Korda
Book Image

Hands-On Vision and Behavior for Self-Driving Cars

By: Luca Venturi, Krishtof Korda

Overview of this book

The visual perception capabilities of a self-driving car are powered by computer vision. The work relating to self-driving cars can be broadly classified into three components - robotics, computer vision, and machine learning. This book provides existing computer vision engineers and developers with the unique opportunity to be associated with this booming field. You will learn about computer vision, deep learning, and depth perception applied to driverless cars. The book provides a structured and thorough introduction, as making a real self-driving car is a huge cross-functional effort. As you progress, you will cover relevant cases with working code, before going on to understand how to use OpenCV, TensorFlow and Keras to analyze video streaming from car cameras. Later, you will learn how to interpret and make the most of lidars (light detection and ranging) to identify obstacles and localize your position. You’ll even be able to tackle core challenges in self-driving cars such as finding lanes, detecting pedestrian and crossing lights, performing semantic segmentation, and writing a PID controller. By the end of this book, you’ll be equipped with the skills you need to write code for a self-driving car running in a driverless car simulator, and be able to tackle various challenges faced by autonomous car engineers.
Table of Contents (17 chapters)
1
Section 1: OpenCV and Sensors and Signals
5
Section 2: Improving How the Self-Driving Car Works with Deep Learning and Neural Networks
12
Section 3: Mapping and Controls

A more efficient network

Training the previous model requires 686 seconds on my laptop, and achieves a validation accuracy of 74.5%, and a training accuracy of 91.4%. Ideally, to improve the efficiency, we want to keep accuracy at the same level while reducing the training time.

Let's check some of the convolutional layers:

Figure 6.2 – First convolutional layer, 32 channels

Figure 6.2 – First convolutional layer, 32 channels

We have already seen these activation graphs in Chapter 5, Deep Learning Workflow, and we know that channels that are black do not achieve a big activation, so they don't contribute much to the result. In practice, it looks like half of the channels are not in use. Let's try to halve the number of channels in every convolutional layer:

model.add(Conv2D(filters=16, kernel_size=(3, 3), activation='relu', input_shape=x_train.shape[1:], padding="same"))
model.add(Conv2D(filters=16, kernel_size=(3, 3), activation='relu',  ...