Demo Video
Project Description
In this project, the RC car is connected to a A.I. model and is operated by it to drive on its own. For the RC car to drive, the A.I. must be driven around a circuit and record the inputs and photos. Once the A.I. model has all the data, it can train itself and learn how to drive on the track.
Check out the project's Github!Capturing the User Input
In order to train the TensorFlow model, Arduino and Raspberry Pi were used to record the user input data while I was driving the RC around the test track. This data was used to train the Tensorflow Model later on.
RC Remote was modified to use Arduino to capture the user input, and Raspberry Pi on the RC to store the data.
Creating Training Data Set
While I was driving the RC car, the Raspberry Pi's webcam took a photo and saved the user's throttle and steering values.
A Pygame tool was made to manually debug any mistakes made by the model after its training. The recordings were stored in a folder like these.
How the Tensorflow Sees the World
Since, the AI only needs to follow the track, it just needs to see the yellow rope on the floor. Everything else can be ignored. Here is how the TensorFlow sees the world:
Creating a TensorFlow Model
Tensorflow Model needed to be compact enough to run from the Raspberry Pi. Therefore, the image from web camera had to use a low resolution of 160x120 to produce 30 actions per second.
Since the throttle value stayed constant around the track, the model only needed to generate a steering value. Because it produced just one output, the Raspberry Pi could run the model much faster.
Training the TensorFlow Model
90% of the data was reserved to train the AI model, and the last 10% is to test and measure the accuracy after its training.
This graph uses data from one of the training sessions, showing how more training (increasing the epoch) decreases the training loss. This proves that the model is learning from their own mistakes.
Here is the traing history, showing the val_loss (how much did the model get wrong) is decreasing using the 10% data set to measure the accuracy value.