For those that live in a big city, just about everything related to driving can feel like the bane of their existence. Getting in the car often means dealing with congested roadways, waiting at stoplights, and stop-and-go traffic on the highways. And when finally arriving at the destination, all of that unpleasantness is followed by a search for an open parking spot — a task that makes sighting Bigfoot or Nessie seem like a piece of cake. This means circling around the general vicinity of the destination again and again, hoping to be in the right place at the right time to grab a spot just as someone else is leaving, but before someone else snags it. Then chances are the parking space will be a good distance away, making for a long walk that is inevitably concluded by noticing an open spot right next to the destination. Sound familiar?
Our first instinct may be to grumble about these sorts of problems, but of course that will not change anything. Fortunately for us all, there are people like engineer Inaki Nagore. When faced with parking problems in his own city, he chose to do something about it. With a boost from the Edge Impulse machine learning development platform, Nagore built a device that can scan a city street and wirelessly report if there are any open parking spaces. Using a tool like this, it could be possible to head straight to where the open spots are, rather than wandering around aimlessly or settling for an unnecessarily distant space.
Nagore began with the powerful Sony Spresense development board, with a six-core microcontroller capable of running even demanding object detection tasks at the edge. A Spresense camera was added in to give the device vision, and finally a Spresense LTE extension board was included to allow the device to wirelessly communicate its observations. A case was 3D-printed to keep all of the components together and protect them from the elements. With the help of a servo and swiveling base, the entire device was given the ability to scan a large area along a street.
The plan was to use an object detection algorithm and train it to recognize the difference between empty and occupied parking spots. To get there the model would need training data, so Nagore wrote a simple program that periodically woke up the Spresense and took pictures along a nearby street. After collecting a fairly small set of images, the data was transferred to Edge Impulse where the labeling queue was used to draw bounding boxes around parking spots — both empty and occupied.
Having completed the data collection process, Nagore built an impulse to analyze the images. It begins with a preprocessing step to resize the images and extract the most important features. Doing this upfront allows computational resource requirements to be reduced in subsequent steps — this is quite important when dealing with small microcontroller platforms. These features are then fed into an object detection model that can determine the locations of open and occupied parking spots.
The training process was kicked off, after which metrics were displayed to help assess the performance of the model. An F1 score of 87.4% was achieved, showing that a high degree of accuracy had been attained. This is an excellent result considering that only about 60 training images were supplied to the model. Should this project move beyond a proof of concept stage, it would be expected that the accuracy would improve considerably by supplying a larger set of training data.
All systems were go, so Nagore had only to deploy the Edge Impulse data analysis pipeline to the physical hardware to wrap things up. This was accomplished with a few clicks — a self-contained, downloadable Arduino library was selected that included everything needed to run object detections. Some additional logic was added to the Arduino sketch to periodically wake the device, run an inference, and transmit the inference results to the cloud over a cellular network.
By placing devices such as these throughout a city, for example mounted to street lamps, they could help to maintain an up-to-date map of open parking spaces. If this data were to be incorporated into existing smartphone map apps, it could help to lead drivers to the nearest available spots.
Nagore wrote up all of the details in his project page. Take a look and you might find some tips that will help you bring your own ideas to life.
Want to see Edge Impulse in action? Schedule a demo today.