01/11/2020 at 19:04 •
---------- more ----------
The big list of improvements in this release:
- Using the video_port on the camera with JPEG images allows fast picture capture which was a big portion of the time.
- Cleaned up the control loop to make sure we did prediction and actions correctly. There were cases where the loop can stall and multiple actions could overlap causing incorrect behavior.
- The same angular app at http://HOST:8080/web/index.html can now be used for either autonomous or data collection.
- The control loop now runs without any additional delay.
- Doing a training loop down the middle of the path which always said "Turn Left" did a lot to improve the ML. Before it would wander out to the middle of the path and have left/right cycles which triggers the work around.
- Actions into automatic mode have strong probabilities.
- Training sets can now have custom routines for generating labels. That's allowed me to drive down the middle of the path and having the labels all say left.
- The bench is still my nemesis. It will drive straight at it, so I have to manually drive around it. I suspect I just need a lot more training material around the bench to reinforce the need to move to the middle of the path, instead of follow the left edge.
- I'm curious what would happen if I flipped all the images horizontally and flipped the left/right and did a training run. I suspect that would allow it to drive along either the left or right side of the path, but it might zig zag.
- I could increase the speed and shorten the duration of drive steps to improve the speed around the park.
- I should make the new interface the default and remove the original interface.
- It's getting to the point I should test different models, so being able to switch models from the user interface would be a nice feature.
- If others want to contribute to the project, I'm going to need to create more documentation to get them started. Now is a good time to jump in if you're interested.
12/21/2019 at 19:51 •
Performance of the robot in driving only mode is about 3x better. The robot can drive itself around the park in about 30 minutes instead of 90. The vast majority of the time is now spent while RVR is executing motion commands. More details below.---------- more ----------
I made a several important changes to improve performance:
- Stop taking pictures. There's no reason to take all the photos when we're just trying around the park. Those 7 pictures took 15 or 20 seconds.
- New angular app is much nicer and is continually sending commands without a delay, instead of waiting a few seconds to allow a human to reject the command before sending it.
- Switching from InceptionV3 to MobileNetV2 saved several seconds.
- Lowered the delay after sending commands to the RVR.
- The code now detects left/right cycles and works around them.
A few caveats:
- MobileNet takes longer to train than Inception. Since that's a one time cost, it's not a big issue.
- My current MobileNet isn't quite as accurate as the Inception network was. I will have to try letting it train longer and see if that can be improved.
- The robot will occasionally get in a cycle of left/right operations. Because the robot turns 5 degrees at a time, it's possible to cycle past the optimal position to go straight. My solution is to detect which of the two options (left or right) has the best straight acceptance, and move straight when that occurs. This quickly works around the problem at the cost of being somewhat out of the "optimal position".
- There seems to be some sort of buffering issue in the control portion that was exposed by lowering the delays between commands. The symptom is that commands sometimes take a long time to execute, a command executes for a short period, pauses, and then continues, or a few commands fire off in a row.
It's 185 steps to go around the park, but that's not counting the left and right turns. My guess is that it's closer to 300 commands, which means it's taking an average of 6 seconds per operation. It's clear when the operations are flowing smoothly that we can do a move and a predict in less than 3 seconds.
It seems that if we can improve this buffering/control issue it should be possible to double the performance. I think that's the next thing to look in to.
12/04/2019 at 20:24 •
Yesterday my autonomous robot successfully drove itself (*) around the park. 90 minutes to do a loop. There's more information on what I've done and my plans below.---------- more ----------
One detail I realized is that the image I was taking at 10 degrees left of the current path was problematic. I defaulted to including that image in the "turn right" class, but in many cases going straight when seeing that picture would be a perfectly valid choice and would often result in the robot following the left edge more closely.
So this time when I ran my training, I left out the 10 degree left images all together. Training with the 3 previous loops around the park took about 60 minutes with images on an SSD and a K80 GPU. I got to about 93% accuracy on the validation set.
Taking this to the park, I ran the existing code which takes all 7 pictures, shows me the predictions, and then waits for me to take action. It's about 185 steps around the park and this cycle takes about 30 seconds. So a 90 minute loop.
(*) There were about a half dozen spots in the loop where I had to correct the behavior of the robot. In a couple places it would get caught in a loop doing repeating left, right cycles. I noticed that often the drive straight choice was a close second option in one of the two cases. Therefore I believe this can be solved by noticing this pattern and picking the drive straight case in the correct position.
My robot's other nemesis is a concrete bench that sits on the path near the bottom right of the image. That spot requires that the robot move to the middle of the path to traverse the bench, then return to the left edge. It is learning the behavior, but is not quite there yet and needed a couple human "nudges."
My goal at this point is to lower the lap time. There's a few modifications that should make a big improvement.
- Don't take all 7 pictures. Turning, waiting to stabilize, and storing the images are time consuming.
- Don't wait for human intervention. Give the operator a moment to veto the operation, but trigger the next step automatically.
- Currently the prediction loop stores the image on the SD card, then reads it back to run predictions. Keeping the current image in memory should be faster.
- I'm currently training an InceptionV3 network for the image processing. That network is large and slow to run on a Raspberry Pi. I'd like to try using MobileNet V2, which should remove a few seconds per iteration.
- A bit more training material may handle a few of the problematic cases better.
I think getting operations down from 30 seconds to 10-20 seconds should be doable pretty easily.
11/29/2019 at 19:59 •
The DRVR code base and robot can now be operated with a cell phone to collect training data, and the training results in a neural network that produces what I think are good results. The code is in the git repository.---------- more ----------
The DRVR is operated in steps where it drives forward for 1 second at half speed, then takes 7 photos (3 left, 1 straight, 3 right) which are used in the machine learning process. The web interface lets the operator adjust the direction left or right, and trigger each step.
It's about 200 steps to drive around the park near my house. That results in 1400 images that can be automatically labelled as left, right, or straight. These images are used to train the InceptionV3 network.
I've done this twice, one with the standard Raspberry Pi Camera which as approximately 40 degree field of view in portrait mode. (Portrait mode was a mistake on my part with the 3D printed holder) driving down the middle of the sidewalk. You can see a time lapse of the path I choose here
The second run I replaced the camera with one that has 160 degree field of view where I drove it down the left side of the path. Timelapse:
In both cases the machine learning algorithm was able to reach approximately 92% accuracy using the automatically labelled images. Reviewing the errors, the choices made by the algorithm seem to be "reasonable" choices such as choosing to drive straight when faces +/- 10 degrees off the "optimal" path. I'm surprised the narrow field of view and wide field of view performed equally well so I need to investigate that further.
At this point I'm excited to update the code to allow the system to predict a choice and have the operator approve the action.
11/24/2019 at 01:05 •
DRVR is doing better data collection. It now has a web interface which makes it easier to operate from a cell phone in hotspot mode.