Since the 1920s, scientist and engineers already started to develop self-driving car based on limited technologies. After going into the 21st century, self-driving cars have gotten a lot improvement thanks for deep learning technologies. This article aims to record how myself and our team applied deep learning to make the RC car drive by itself.
IntroductionAs I know, there are two well known open sourced projects which are DeepRacer and Donkey Car. DeepRacer is Amazon's self driving RC car project based on Rein-force learning, Donkey Car was originally from MIT and it supports both supervised learning and reinforce learning. We choose the Donkey Car as our platform as it is easier to scale up to other deep learning algorithm and it has more resources available from the internet.
The Donkey Car platform provides user a set of hardware and software to help user create practical application of deep learning and computer vision in a robotic vehicle. hardware includes a RC car, a camera, a Raspberry Pi, two chargeable batteries and other driving recording/controlling related sensors. After setting up all software and hardware, Donkey Car provides user the ability to drive Donkey Car by using web browser and record all car status(images from front camera, angles and throttle value ). User can use the collected data to training their own deep learning model on their own computer, then import the model back to Donkey Car itself. After that, user can try to check the performance of their model by switching Donkey Car to self-driving mode. you can find more details here.
Anther good part of the Donkey Car is that you can easily customize your own hardware and software to improve driving performance very easily. For example, I added a radar at the font of my car to prevent car hit other object during self-driving mode.
What we can do with Donkey CarThe Donkey Car has a default preprocess procedure for all input (only image in default setting) and use "Nvidia autopilot" as the default model, it doesn't work well for most of scenarios. From my experiment, there's four ways that we can improve based on what Donkey Car provided for use:
1. Better strategies to collect data
The quality of data brings huge impact to the final model. If the data quality is not good, even the good model can't get good performance. there's three ways to improve the collected data quality:
- Use better controlling tool
Beside using gravity sensor from you phone or using key board to control the Donkey Car, install a joystick can help a lot to provide better controlling experience. RC car is moving relatively fast and the track is small, so vehicle is very easy out of control. maybe because I played too many computer games, joystick always let me feel more comfortable while controlling the Donkey Car. if you like computer games as well, joystick probably will be a better choice for you.
- Collect data with some personal routine
This tip is just my personal opinion, while I collect the data, I always intentionally let the car slight near to the right side, trying to let the model has more pattern's to following, by using heat map algorithm (will introduce later). looks like my model truly favor right side more than left side. but this is very hard to prove. maybe it doesn't matter that much.
As you can see from following heat map of my model, if we trained it with some pattern, your model can be easier find the patterns(It's right line in our case)
- Collect data with multiple variance
Since we only training data from our own track, so model is very easy to be "overfitting". For example, if there's a trash can near the corner, model probably will take trash can as a very important input to make turning decision. This will make the model hard to generalize to other tracks. and if your testing environment changed a bit, this model won't work as well as your expectation. so usually I collect data from both clock-wise can counterclockwise direction. Data augmentation will help to tackle this problem very well.
From following video, we can see model the model get a bit "overfitted" on window and trash can.
2. Adding some pre-processing logic
The main aim of data pre-processing is to balance the input data and make model can be generalized to other track and make our model more "robust" to handle the situation that haven't been captured in the training data. besides this, we also do some modification to the input image to apply other algorithms. you can find more details from here.
3. Modifying and fine tuning current model
There's few things we can do to make the default model work better. such as cropping the original image and etc. you can find me details from this post.
4. Using other models
there's few other models that I have tried:
- Cropped 2d_CNN
- Transfer_Learning
- 3D_CNN
- 3DCNN + RNN
- Double Q_Learning
- Ensembling model
Visualization can help us get better idea what our model is doing and support us to debug the model. From inspiration of this parer, I created a script that can apply "heat map" visualization functionality fro our donkey car model.
Salient object defection algorithm
In order to check the performance of my model on different track and monitor how my model make decision from driver(camera) perspective, I also created a algorithm for visualization driving:
Prediction visualization tool
Resources:I have putted some codes to GitHub, and also putted a small running demo below as well.
Comments
Please log in or sign up to comment.