This week I spent refining my detection algorithm. After moving back to simple color and edge detection (from ML based models due to latency issues) there were challenging edge cases that I had to tackle like if there are other similarly colored objects on the feed and if there are different lighting conditions on the track. Here are the various strategies I used to solve these issues partially
- The program first requires you to select the car (by letting you draw a box around it) so that it can perform a color analysis.
- I could have done the color analysis in two ways that I have detailed below. I have implemented both and am still running tests to see which one performs better.
- Either select the top colors in the box
- Or selecting the top color and then looking for other similar shades – this method I thought would help in particular with different lighting conditions on the track where different shades could be more prominent. This is done by restricting the range of colors around the most prominent color.
- Once the top colors are selected I also need to decide how many I need to best represent the car – too many colors makes the masking of the frame useless as it captures a lot of the background. But sometimes a few colors represent the car better than just one. I let the detection algorithm decide by observing how much of the car it could detect without detecting additional environment for different numbers of colors.
- Once the camera detects the car, the detection algorithm is only permitted to search for the car in its immediate neighborhood in the next run.
- Testing what is the minimum threshold to qualify for detection that prevents capturing noise. (Changing the minimum contour size that the edge detection provides)
- Restricting the speed in which the detected box can grow (this will prevent noise from affecting it immediately)
Overall, I can currently track the car pretty well in stable lighting conditions and some color obstacles. However, the system is not completely robust and will require more testing in the final stretch of the project.
Along with this we also performed some integration testing and those details are present in the team report.