With the dramatic rise in gas prices hitting many parts of the world in recent months, many people are looking for ways to trim their transportation budget. Some prominent voices have been suggesting that people consider buying an electric vehicle to sidestep high fuel prices. This is unrealistic in most cases, however. If someone is having trouble paying to fill up their gas tank, they are unlikely to be in a position to purchase an expensive electric car. Another less discussed option that may help some to save a bit of cash is bicycling. Of course this is not an option in all cases — a 20-mile commute to work is unreasonable, but if your workplace is across town, bicycling may be just what you need.
The problem with riding a bicycle for everyday transportation needs is that sharing the road with cars can be quite dangerous. In fact, every year about two percent of deaths associated with motor vehicle crashes are attributed to bicyclists. Adam Taylor often gets around his hometown by bicycle, but has long been concerned about the danger of vehicle drivers not seeing bicyclists on the road. He thought that if cars had warning systems that could alert the driver when a bicyclist was nearby, it might prevent them from inadvertently hitting a bicyclist riding in their blind spot while making a turn. With no such feature having widespread availability in vehicles, he set about building a device with Edge Impulse that could be used to retrofit unequipped cars.
Taylor’s idea was to point a camera at the vehicle’s blind spot and detect if a bicyclist is present. When detected, the device would sound a buzzer, or send some other signal to act as an alert to the driver. The goal was to make the device as low-cost as possible so that it can be widely deployed, but in order to do computer vision tasks, it also needs to be very capable. With these requirements, a Himax WE-I Plus EVB Endpoint AI development board was chosen, which has a 400MHz WE-I Plus ASIC, 2 MB of SRAM, and an onboard 640x480 pixel image sensor. While these are great specs for a tiny development board, Taylor’s plan will need a machine learning object detection pipeline to make it work.
Traditionally, object detection is very computationally intensive, which means it is not much of an option on such small compute platforms as the Himax WE-I Plus. With the recent release of Edge Impulse’s ground-breaking FOMO algorithm, it is now possible to do real-time object detection 30 times faster than MobileNet SSD, and with less than 220 KB of RAM. This was just what Taylor needed to make his idea a reality, so he got to work building a FOMO object detection pipeline in Edge Impulse Studio.
As is typically the case, this process begins by collecting data to train the model. Taylor sought out open source images of cyclists on the Internet, and managed to collect about 100 images. This is quite a small dataset, but should be sufficient for a proof of concept. Before deploying in the real world, it would be important to get a more diverse set of images with differing weather and lighting conditions to ensure that the resulting model is sufficiently robust.
The images were uploaded to Edge Impulse, then the labeling queue was used to help draw bounding boxes around the cyclists in each image. The remainder of the impulse was rounded out with an image processing step followed by a FOMO object detection neural network. The first round of training did not produce a good result, so Taylor made a few changes to the impulse. He set the image preprocessing step to resize the images, and also adjusted some of the model hyperparameters and increased the number of training cycles. After this, a round of training resulted in a very nice 81.82% accuracy rate. Now the model was ready to be deployed and tested out on the physical hardware.
The Himax WE-I Plus is fully supported by Edge Impulse, so the deployment process can generate a native binary to flash the board with. After updating the firmware, the Live Classification tool in Edge Impulse allowed Taylor to view the images captured by the Himax WE-I Plus’s camera in real time, along with any objects that are detected. He ran a number of tests, and found that the device was successfully detecting cyclists, as was hoped.
This first step was a simple way to prove that the device Taylor dreamed up can be made a reality. With some more data collection and real world testing, a device like this one may someday keep cyclists safer on the road. Do not waste time spinning your wheels trying to figure out how to build your own cyclist detector, pedal on over to Taylor’s project page for the information you need.
Want to see Edge Impulse in action? Schedule a demo today.