Shared publicly  - 
Finally, I got a chance to write up my Neural Network self driving car project.
Ben Falconer (zed0)'s profile photoGuangyu Xiao's profile photoRamnath Babu T.J's profile photoNuno Nunes's profile photo
Hi Classmate,
Well done! I also intend to use NN for the FIFA games I've been playing.
Well that's just amazing! I just took Andrew Ng's course too, and I'm dying to put a neural network to use in some manner or another.
Cool, I like the 'complicated enough to get a result', but not TOO complicated approach! I have to ask though, can it navigate a corner?
Nice project. Did you duplicate the neural network in java from octave, if so what packages worded well?
Cool project. Really well done and thanks for the explanation of how you set it up.
For me I'm impressed with all the details you have figured out. Reading a streaming video and creating static images would be the next challenge to figure out.
Way cool! Thanks for the excellent explanation and diagrams showing how you put it all together!
David, I have only the utmost respect and admiration for this project of yours. Also, thank you for sharing your thought process and schematics. If you are familiar with MAKE magazine, you should let them know about this! The world needs to see how awesome this is!
Awesome, I was working on the ml course too. This helps me a lot
You did this in... one weekend??

Ah, you are at Google I see! It is rumored that well-run private industry work is often more cost effective than government research. Methinks you've just added a nice bit of evidence to that effect...
Well done mate :) I wish I could have continued taking the ML class. (life got in the way)
Very nice, I shall share this at our local Google Tech Group meetup tomorrow night.
HI David! Great application!!! Freshmen in a Yale (?!) class would do this with two phototransistors and photodiodes and a simple analog circuits. That works in real-time. Taking this to the next level: running in a real indoor corridor will surely require more neurons, a convolutional neural network. For all that a small cell-phone will not be able to run in real-time... but cool, really nice to see things applied!
Awesome project Dave! You inspired me to finally put the BeagleBone i purchased to good use. I just finished the ML course (well the relevant NN assignments) and I was wondering if you could post up a copy of the nnrccar.features file so I can get a better feel for how you had everything working since i dont have an Android phone to recreate it? Again Kudos on the awesome RC car!
Hi, nice project! I thought I'd give it a try with the guide you provided but as a complete newbie to ant and android I'm having a few problems. When I try to install the android app I get an error that does not exist. How do I generate this file?? Thanks for any help =D
+scott jenkins you can just create an empty file in the same directory as the build.xml file.
great work! you guys inspire us to use the learning of ml class.
Great job. I am almost finished a full size ecar that uses a mod/android/ Nook for control and an Arduino to interface with the car functions.
If I added some servos for steering it would be fun to make it self driving just like yours!!
The motorman..
I am almost ready to drive my RC car with your neural net. But I am having some trouble training it. Is there an additional README file for the "train/" routines to show the mods needed to exercise-4 (mlclass)? When I run the sample data, the y(i) used as an index in the nnCostFunction Y(i, :)= I(y(i), :); it causes an index of 0 and crashes.

I found the Dension WIRC unit to control the car via a wifi connection.

Hi +Dan Phelan - pleased you're giving this a shot! nnCostFunction is your own implementation, I think, so it's hard to give you advice on that. Where exactly is it crashing? Can you provide the few surrounding lines of context?

Thanks! I had a bug in the CostFunction that calculated a bad index for a matrix. And my Mac with 4gig could not handle the amount of training examples. I had to reduce the sample data rows to 2500.

Sorry if the next question is too basic...

When Driving in the Record mode, I never seem to get the nnrccar*.features file to write. I drive around for about 5-10 minutes, run into things, but can't find the training data?

The terminal log shows the following:
Driver: [java] Features writing to: /var/folders/IU/IUec2e-uHNSTna3ZspMPk++++TI/-Tmp-/nnrccar3913778878288859508.features

Thanks for your time,
Did you press 'r' to go into record mode in the driver app?
Yes, I pressed 'r' and the Driver window with the video feed shows
an R in the top left corner.
David,  I followed every instruction in the README, i recorded my first Training Set, which according to Driver was in /tmp/nnrccar...features, i copied that file to my mlclass/ex4 folder and i executed, then the nnrccar.m file, after 14 secs while fmingc was running, i got an error:
Training Neural Network...
error: subscript indices must be either positive integers or logicals.
error: /home/andfoy/mlclass/ex4/nnCostFunction.m at line 78, column 13
error: at line -1, column -1
error: /home/andfoy/mlclass/ex4/fmincg.m at line 77, column 12
error: /home/andfoy/mlclass/ex4/nnrccar.m at line 56, column 20

Exactly in this line: 
% y(k) - the great trick - we need to recode the labels as vectors %containing only values 0 or 1 (page 5 of ex4.pdf)
yk = zeros(num_labels, m);
for i=1:m,
I executed the ex4 exercise nornally, and it worked, so i don't know why my training set is throwing that error

Thanks in advance
Hi +Andrés Margffoy - glad you are giving this a try!

It's possible that the structure of the octave code has changed in the ml-class exercise (I took the course before it was on coursera) because already outputs labels coded into the bit vector notation - e.g. for forward: 0 0 1 0 and forward and left: 1 0 1 0, so you don't need to do this relabelling in your nnCostFunction implementation.
What is the Neural Network topology? Can you explain me this please?
Thank you for this, David. I was feeling blue after not being able to figure out what was wrong with my week 5/ex 4 Octave program for Andrew Ng's Coursera Machine Learning.  I couldn't figure out what was wrong so I went surfing for neural networks and found your remote car page. I love it. It really cheered me up and will help me to keep on slogging through ML.  So timely -- Gov. Jerry Brown just signed that California law allowing self-driving cars. Perhaps you'd like to step up to a Mini or a Smart car?
hello, i had some trouble with the training, when i run nnrccar in octave it cant load data X and y because it runs out of time after 10 minutes
thank you
+Hanz Cuevas you may need to filter your data to get it to a reasonable sized # of rows to load.  How many rows are in your data file?  
my  input_layer_size  is 25344 that's written in nnrccar.h and in i have rows: 3862, which one i have to re-size?
+Hanz Cuevas the # of rows in is what you want to trim.  For what it's worth, my in the video had 3205 lines and it loads in about a minute on my machine (a 2011 MacBook Air)...
so i just delete some rows from the 3862 rows or there is a way to filter to a resonable size number of rows? my laptop is an hp-pavilion dv7
You can just delete some rows, yes (be sure to update the header on the first line to match).  You may find it more useful to filter out only rows that aren't adding much to the model.  Typically when you drive around you'll be going forwards only (rather than turning in either direction) a lot so many more inputs explaining when to go forwards aren't adding much value.  I've put a gist at  which contains a new version of which can limit the number of forward only rows (to 900, completely arbitrary number I made up).  You still need to edit the header after running this.
thank you so much, ill try again with this implementations
hello again
the and works but now when it runs it throws an error:
Training Neural Network...
error: subscript indices must be either positive integers or logicals
error: at line -1, column -1 outputs float and negative numbers, my code for ex4.m is from 2-2011 course
David.  Excellent project.  I'm going to see if I can get it to work with R but first I'm running into a problem.  I can't seem to get the Driver app installed.  It keeps giving me a bunch of compile errors.  i''m using ant version 1.8.2 and java 1.6 on Ubuntu.  any suggestions?
+Larry D'Agostino what are the compile errors you get?  Java 1.6 should work well (I assume you have the dependencies installed commons-math-2.2.jar and RXTXcomm.jar)
I believe I do have the dependencies installed.  first warning was includeantruntime was not set.  the next was package org.apache.commons.math.linear does not exist.  then there are a bunch more that are very similar
David, I got it working now.  I have it setup to control a car and able to drive it around my house.  Now I just need to get the Neurel Net setup.  This is a fun project!  The kids love controlling the car from the laptop.  What are the ways to adjust the Forward pulse in the Arduino sketch?
David, I'm running into some problems with creating the featues file.  After recording (and switching to manual mode) I see the FeatureWriter queue up the files but it never gets to a temp file.  It just stops on "FeatureWrite 1 pending   WF: 67  delta: -67".  I don't see anything after that.  Could there be a bug?  I wish I knew java.
Hello David, I have tried to implement your project but I get some error in running Octave file while loading X.dat and y.dat .It says memory error or Octave index out of range.I have a core2Duo processor with 2GB RAM.Should I change my system?Should I use 64 bit version of Octave instead?Please note I have already reduced the number of Rows to 2500. 
David,I also wish to know why do you record accelerometer features because I think you do not use it to train neural network.Will reducing this feature help or it is needed in some other part of code?
Hey David, Really nice project I'm also trying to implement it for my college project. This was a lot of help
Hey David, nice project. I want to implement it. I dont know much about java programming. I am still learning it. Please help me with the code. I imported the code in BlueJ but some errors are being shown.. Please help.
Dear +David Singleton 
My name is Tuan,
I am a friend from Vietnam, now I'm a student of the Pedagogical University.

I really want to be your friends but my foreign language skills are relatively poor. I hope you can understand what I say

 I did see a lot of projects that you did, I do not know if you are a computer science PhD or not, but I really enjoy the projects you do: How I Built a Neural Network Controlled Self Driving (RC ) Car

You know, I'm really a fan of the project you did. It was wonderful.
In Vietnam, this project is truly luxurious.

I have read very carefully what you wrote about it, I wish I could do something like your first. Simply because I enjoyed it.

I have designed complete electronic circuit boards, uploaded code to the Arduino succesfully.
And now I'm having a lot of problems of software. So I really need your support.
Let I show you some problem that I got:

1. If I create Mac-OS X virtual machine by VM Ware 11 so it can run it? Because I do not have Macbook (students in Vietnam is quite poor).
2. I still do not quite understand the "android , cpp-driver, Driver, train" folders.
What do I do on Mac-Os X?
How can I add the camera app on my phone?

If you have free time, please record your Macbook and your phone's screen ? Because I only use Windows 7 so i do not know everything.

I am very passionate about computer science, but in my country, everything deprivation and backwardness.
I'm trying to get a scholarship to abroad. I hope one day to be met and exchanged directly with you.

Best regards,
my email:
Add a comment...