Racing With An ANN by Arjav-Patel - 1


Car-driving AI in Unity

Unknown VersionUnknown LicenseUpdated 248 days agoCreated on September 18th, 2018
Go to source

Racing with an ANN

Here, we use the ANN from a previous project to train an ANN to drive a car around a racetrack using user collected data.

This ANN takes in 5 inputs:

  • distance from wall in the forward direction
  • distance from wall in the right direction
  • distance from wall in the left direction
  • distance from wall 45 degrees to the right
  • distance from wall 45 degrees to the left

And returns 2 outputs:

  • translation input
  • rotation input

The neural network is trained with user data (the user drives around the track) and input data is collected and sent to the ANN to train it. This data is then stored, and the neural network is trained with it. The updated weight matrix is also stored, should an optimal solution be found.

We noticed that training the ANN in such a fashion produced much worse results than the pong project. This is most likely due to the noise inherent in user-collected data. Furthermore, the actual data collection method could be improved. We noticed that there were many conflicting input/output data points, which when removed, produced much better results.

Here is a video of the ANN being trained, and then its performance afterwards.

It’s difficult to see, but in the top-right corner of the 3rd person view of the car screen, the changing white text tells us the progress of the ANN (percentage of 1000 iterations), the current alpha value, and the sum-squared error of each iteration.

To improve the ANN, we only update the weights when a given input, predicted output, and desired output trio produce a sum-square error that is less than the previous sum-square error. If this is true, than the alpha value is incremented slightly. Otherwise, the trio is tossed, and the alpha value is decremented slightly. This ensures that our ANN continously fits the data better, and does not perform worse the more data it is given.

Show all projects by Arjav-Patel