DeepPiCar: Deep Learning Autonomous Car based on Raspberry Pi

An overview of how to build a Raspberry Pi and TensorFlow powered, self-driving robotic car

By David Tian

Hacker, tinkerer, and engineer. I am passionate about machine learning, AI, and anything technology related.

Introduction

Today, Tesla, Google, Uber, and GM are all trying to create their own self-driving cars that can run on real-world roads. Many analysts predict that within the next 5 years, we will start to have fully autonomous cars running in our cities, and within 30 years, nearly ALL cars will be fully autonomous. Wouldn’t it be cool to build your very own self-driving car using some of the same techniques the big guys use? In this and next few articles, I will guide you through how to build your own physical, deep-learning, self-driving robotic car from scratch. You will be able to make your car detect and follow lanes, recognize and respond to traffic signs and people on the road in under a week. Here is a sneak peek at your final product.

Lane Following

Traffic Sign and People Detection (right) from DeepPiCar’s DashCam

Our Road Map

Part 2: I will list what hardware to buy and how to set them up. In short, you will need a Raspberry Pi board($50), SunFounder PiCar kit ($115), Google’s Edge TPU ($75) plus a few accessories, and how each part is important in later articles. The total cost of the materials is around $250–300. We will also install all the software drivers needed by Raspberry Pi and PiCar.

Raspberry Pi 3 B+

SunFounder PiCar-V Robotic Car Kit

Google Edge TPU Accelerator

Part 3: We will set up all the Computer Vision and Deep Learning software needed. The main software tools we use are Python (the de-facto programming language for Machine Learning/AI tasks), OpenCV (a powerful computer vision package) and Tensorflow (Google’s popular deep learning framework). Note all the software we use here are FREE and open source!

Part 4: With the (tedious) hardware and software setup out of the way, we will dive right into the FUN parts! Our first project is to use python and OpenCV to teach DeepPiCar to navigate autonomously on a winding single lane road by detecting lane lines and steer accordingly.

Step-by-Step Lane Detection

Part 5: we will train DeepPiCar to navigate the lane autonomously without having to explicitly write logic to control it, as was done in our first project. This is achieved by using “behavior cloning”, where we use just the videos of the road and the correct steering angles for each video frame to train DeepPiCar to drive itself. The implementation is inspired by NVIDIA’s DAVE-2 full-sized autonomous car, which uses a deep Convolutional Neural Network to detect road features and make the correct steering decisions.

Lane Following in Action

Lastly, in Part 6: We will use deep learning techniques such as single shot multi-box object detection and transfer learning to teach DeepPiCar to detect various (miniature) traffic signs and pedestrians on the road. And then we will teach it to stop at red lights and stop signs, go on green lights, stop to wait for a pedestrian to cross, and change its speed limit according to the posted speed signs, etc.

Traffic Signs and People Detection Model Training in TensorFlow

Prerequisite

Here are the prerequisites of these articles:

  • First and foremost is the willingness to tinker and break things. Unlike in a car simulator, where everything is deterministic and perfectly repeatable, real-world model cars can be unpredictable and you must be willing to get your hands dirty and start to tinker with both the hardware and software.
  • Basic Python programming skills. I will assume you know how to read python code and write functions, if statements and loops in python. Most of my code is well documented, specifically the harder to understand parts.
  • Basic Linux operating system knowledge. I will assume you know how to run commands in Bash shell in Linux, which is Raspberry Pi’s operating system. My articles will tell you exactly which commands to run, why we run them, and what to expect as output.
  • Lastly, you will need about $250-$300 to buy all the hardware and working PC (Windows/Mac or Linux). Again, all the software used will be free.

What’s Next

That’s all for the first article. I will see you in Part 2 where we will get our hands dirty and build a robotic car together!

Here are the links to the whole guide:

Part 1: Overview (This article)

Part 2: Raspberry Pi Setup and PiCar Assembly

Part 3: Make PiCar See and Think

Part 4: Autonomous Lane Navigation via OpenCV

Part 5: Autonomous Lane Navigation via Deep Learning

Part 6: Traffic Sign and Pedestrian Detection and Handling

Download Details:
Author: dctian
Source Code: https://github.com/dctian/DeepPiCar
License: GPL-3.0 License

#opencv  #python #deep-learning 

What is GEEK

Buddha Community

DeepPiCar: Deep Learning Autonomous Car based on Raspberry Pi
Marget D

Marget D

1618317562

Top Deep Learning Development Services | Hire Deep Learning Developer

View more: https://www.inexture.com/services/deep-learning-development/

We at Inexture, strategically work on every project we are associated with. We propose a robust set of AI, ML, and DL consulting services. Our virtuoso team of data scientists and developers meticulously work on every project and add a personalized touch to it. Because we keep our clientele aware of everything being done associated with their project so there’s a sense of transparency being maintained. Leverage our services for your next AI project for end-to-end optimum services.

#deep learning development #deep learning framework #deep learning expert #deep learning ai #deep learning services

Mikel  Okuneva

Mikel Okuneva

1603735200

Top 10 Deep Learning Sessions To Look Forward To At DVDC 2020

The Deep Learning DevCon 2020, DLDC 2020, has exciting talks and sessions around the latest developments in the field of deep learning, that will not only be interesting for professionals of this field but also for the enthusiasts who are willing to make a career in the field of deep learning. The two-day conference scheduled for 29th and 30th October will host paper presentations, tech talks, workshops that will uncover some interesting developments as well as the latest research and advancement of this area. Further to this, with deep learning gaining massive traction, this conference will highlight some fascinating use cases across the world.

Here are ten interesting talks and sessions of DLDC 2020 that one should definitely attend:

Also Read: Why Deep Learning DevCon Comes At The Right Time


Adversarial Robustness in Deep Learning

By Dipanjan Sarkar

**About: **Adversarial Robustness in Deep Learning is a session presented by Dipanjan Sarkar, a Data Science Lead at Applied Materials, as well as a Google Developer Expert in Machine Learning. In this session, he will focus on the adversarial robustness in the field of deep learning, where he talks about its importance, different types of adversarial attacks, and will showcase some ways to train the neural networks with adversarial realisation. Considering abstract deep learning has brought us tremendous achievements in the fields of computer vision and natural language processing, this talk will be really interesting for people working in this area. With this session, the attendees will have a comprehensive understanding of adversarial perturbations in the field of deep learning and ways to deal with them with common recipes.

Read an interview with Dipanjan Sarkar.

Imbalance Handling with Combination of Deep Variational Autoencoder and NEATER

By Divye Singh

**About: **Imbalance Handling with Combination of Deep Variational Autoencoder and NEATER is a paper presentation by Divye Singh, who has a masters in technology degree in Mathematical Modeling and Simulation and has the interest to research in the field of artificial intelligence, learning-based systems, machine learning, etc. In this paper presentation, he will talk about the common problem of class imbalance in medical diagnosis and anomaly detection, and how the problem can be solved with a deep learning framework. The talk focuses on the paper, where he has proposed a synergistic over-sampling method generating informative synthetic minority class data by filtering the noise from the over-sampled examples. Further, he will also showcase the experimental results on several real-life imbalanced datasets to prove the effectiveness of the proposed method for binary classification problems.

Default Rate Prediction Models for Self-Employment in Korea using Ridge, Random Forest & Deep Neural Network

By Dongsuk Hong

About: This is a paper presentation given by Dongsuk Hong, who is a PhD in Computer Science, and works in the big data centre of Korea Credit Information Services. This talk will introduce the attendees with machine learning and deep learning models for predicting self-employment default rates using credit information. He will talk about the study, where the DNN model is implemented for two purposes — a sub-model for the selection of credit information variables; and works for cascading to the final model that predicts default rates. Hong’s main research area is data analysis of credit information, where she is particularly interested in evaluating the performance of prediction models based on machine learning and deep learning. This talk will be interesting for the deep learning practitioners who are willing to make a career in this field.


#opinions #attend dldc 2020 #deep learning #deep learning sessions #deep learning talks #dldc 2020 #top deep learning sessions at dldc 2020 #top deep learning talks at dldc 2020

Rusty  Shanahan

Rusty Shanahan

1595193480

Autonomous Boats, Autonomous Tech world

Today, we’ll talk about something that is barely covered in the Autonomous Tech world…

It’s also something I’m not familiar with, so I’ll just be able to talk about it. Technology has enabled us to build self-driving cars, but actually, the most impactful changes will be around flying cars, and sea navigation.


This article is based on an email I wrote to my mailing list — The original email is called “Startup Idea — Autonomous Boats”; it’s a concept where I explore the necessary steps we’ll need to build a startup around a specific topic.


Today, let’s take a look at Autonomous Boats.

How to start?

If we’re to build a startup, you must solve a problem that is Difficult, Urgent, and Recognized. After searching on Google, I found out that the biggest problem around boats is collisions.

Does that surprise you?

Over 90% of the world’s trade is carried by sea, the whole world is relying on the oceans, and the country which is the most concerned is the US. The U.S. economy is accounting for more than $352 billion in GDP and 3.1 million jobs, according to the National Oceanic and Atmospheric Administration (NOAA).

The biggest risk of collisions is at the port, or in crowded places.

Here is what happened between 2011 and 2016, in Europe only.

Image for post

I took this picture in a report from EMEA, just take a minute to read it here.

It’s full of fascinating facts.

Now, let’s see more precisely what we’re talking about.

Image for post

Today’s article is about solving this particular problem.

This problem costs millions (in reparations, and lost cargo) and continues to happen, that is growing with the number of boats. It’s also a problem we all acknowledged watching TITANIC sink.

It’s time we solve it.

Image for post


Autonomous Boats

Avoiding an accident when you’re driving a car is easy, you just turn the wheel a bit. Avoiding a cargo accident is much harder. Although I’ve never been in a cargo accident, my father has his boat license and I know how hard it is to maneuver in emergency situations.

Definition

So, how do we make boats autonomous? To be able to understand this, we must first define what“autonomous” means.

In self-driving vehicles, autonomy is measured by concrete facts.

In my self-driving car course, I describe the 5 levels of autonomy and how to target your market by selecting one of these levels.

Image for post

_In a self-driving car, autonomy is easily measured using the driver’s involvement, and the range of use-cases covered. _In autonomous boats, we only measure autonomy using 3 criterias:

  • No Autonomy — The current situation
  • Half Autonomy — Autonomous with a crew on board.
  • Full Autonomy — Autonomous, no crew on board.

I won’t talk about the remote-controlled boats, I wouldn’t know what to do with it.

**Autonomy is either on or off; the only criteria we’re using is the presence or absence of the crew. **In most my emails and articles, I’m telling you about the 4 pillars that make vehicles autonomous. It really applies everywhere, even in boats.

Let’s review how these 4 pillars work in autonomous boats.

#deep-learning #autonomous-cars #machine-learning #self-driving-cars #deep learning

Learn Transfer Learning for Deep Learning by implementing the project.

Project walkthrough on Convolution neural networks using transfer learning

From 2 years of my master’s degree, I found that the best way to learn concepts is by doing the projects. Let’s start implementing or in other words learning.

Problem Statement

Take an image as input and return a corresponding dog breed from 133 dog breed categories. If a dog is detected in the image, it will provide an estimate of the dog’s breed. If a human is detected, it will give an estimate of the dog breed that is most resembling the human face. If there’s no human or dog present in the image, we simply print an error.

Let’s break this problem into steps

  1. Detect Humans
  2. Detect Dogs
  3. Classify Dog breeds

For all these steps, we use pre-trained models.

Pre-trained models are saved models that were trained on a huge image-classification task such as Imagenet. If these datasets are huge and generalized enough, the saved weights can be used for multiple image detection task to get a high accuracy quickly.

Detect Humans

For detecting humans, OpenCV provides many pre-trained face detectors. We use OpenCV’s implementation of Haar feature-based cascade classifiers to detect human faces in images.

### returns "True" if face is detected in image stored at img_path
def face_detector(img_path):
    img = cv2.imread(img_path)
    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
    faces = face_cascade.detectMultiScale(gray)
    return len(faces) > 0

Image for post

Detect Dogs

For detecting dogs, we use a pre-trained ResNet-50 model to detect dogs in images, along with weights that have been trained on ImageNet, a very large, very popular dataset used for image classification and other vision tasks.

from keras.applications.resnet50 import ResNet50

### define ResNet50 model
ResNet50_model_detector = ResNet50(weights='imagenet')
### returns "True" if a dog is detected
def dog_detector(img_path):
    prediction = ResNet50_predict_labels(img_path)
    return ((prediction <= 268) & (prediction >= 151))

Classify Dog Breeds

For classifying Dog breeds, we use transfer learning

Transfer learning involves taking a pre-trained neural network and adapting the neural network to a new, different data set.

To illustrate the power of transfer learning. Initially, we will train a simple CNN with the following architecture:

Image for post

Train it for 20 epochs, and it gives a test accuracy of just 3% which is better than a random guess from 133 categories. But with more epochs, we can increase accuracy, but it takes up a lot of training time.

To reduce training time without sacrificing accuracy, we will train the CNN model using transfer learning.

#data-science #transfer-learning #project-based-learning #cnn #deep-learning #deep learning

Few Shot Learning — A Case Study (2)

In the previous blog, we looked into the fact why Few Shot Learning is essential and what are the applications of it. In this article, I will be explaining the Relation Network for Few-Shot Classification (especially for image classification) in the simplest way possible. Moreover, I will be analyzing the Relation Network in terms of:

  1. Effectiveness of different architectures such as Residual and Inception Networks
  2. Effects of transfer learning via using pre-trained classifier on ImageNet dataset

Moreover, effectiveness will be evaluated on the accuracy, time required for training, and the number of required training parameters.

Please watch the GitHub repository to check out the implementations and keep updated with further experiments.

Introduction to Few-Shot Classification

In few shot classification, our objective is to design a method which can identify any object images by analyzing few sample images of the same class. Let’s the take one example to understand this. Suppose Bob has a client project to design a 5 class classifier, where 5 classes can be anything and these 5 classes can even change with time. As discussed in previous blog, collecting the huge amount of data is very tedious task. Hence, in such cases, Bob will rely upon few shot classification methods where his client can give few set of example images for each classes and after that his system can perform classification young these examples with or without the need of additional training.

In general, in few shot classification four terminologies (N way, K shot, support set, and query set) are used.

  1. N way: It means that there will be total N classes which we will be using for training/testing, like 5 classes in above example.
  2. K shot: Here, K means we have only K example images available for each classes during training/testing.
  3. Support set: It represents a collection of all available K examples images from each classes. Therefore, in support set we have total N*K images.
  4. Query set: This set will have all the images for which we want to predict the respective classes.

At this point, someone new to this concept will have doubt regarding the need of support and query set. So, let’s understand it intuitively. Whenever humans sees any object for the first time, we get the rough idea about that object. Now, in future if we see the same object second time then we will compare it with the image stored in memory from the when we see it for the first time. This applied to all of our surroundings things whether we see, read, or hear. Similarly, to recognise new images from query set, we will provide our model a set of examples i.e., support set to compare.

And this is the basic concept behind Relation Network as well. In next sections, I will be giving the rough idea behind Relation Network and I will be performing different experiments on 102-flower dataset.

About Relation Network

The Core idea behind Relation Network is to learn the generalized image representations for each classes using support set such that we can compare lower dimensional representation of query images with each of the class representations. And based on this comparison decide the class of each query images. Relation Network has two modules which allows us to perform above two tasks:

  1. Embedding module: This module will extract the required underlying representations from each input images irrespective of the their classes.
  2. Relation Module: This module will score the relation of embedding of query image with each class embedding.

Training/Testing procedure:

We can define the whole procedure in just 5 steps.

  1. Use the support set and get underlying representations of each images using embedding module.
  2. Take the average of between each class images and get the single underlying representation for each class.
  3. Then get the embedding for each query images and concatenate them with each class’ embedding.
  4. Use the relation module to get the scores. And class with highest score will be the label of respective query image.
  5. [Only during training] Use MSE loss functions to train both (embedding + relation) modules.

Few things to know during the training is that we will use only images from the set of selective class, and during the testing, we will be using images from unseen classes. For example, from the 102-flower dataset, we will use 50% classes for training, and rest will be used for validation and testing. Moreover, in each episode, we will randomly select 5 classes to create the support and query set and follow the above 5 steps.

That is all need to know about the implementation point of view. Although the whole process is simple and easy to understand, I’ll recommend reading the published research paper, Learning to Compare: Relation Network for Few-Shot Learning, for better understanding.

#deep-learning #few-shot-learning #computer-vision #machine-learning #deep learning #deep learning