alonso.wtf

← Back to projects

Published on Wednesday, July 21, 2021

This was a graduation project that I made to get my licenciate degree in Universidad Fidelitas.

The project consisted of a software that would allow the clients of any business with a parking lot to know ahead of time the available spaces in almost real time. This was done by creating several components:

Client Website

an screenshot of a website containing a table with all the available spaces in a parking lot

The website contains a few administrative modules for creating users, parking space sections, parking spaces and manually override of the state of any parking space in the event of any error by the classification software. It also is available to any public user, but they would only see the parking spaces table.

The website was entirely made with ReactJS, Material-UI, a Python backend that uses Django and the database used was MySQL.

Dataset

The dataset used was one made by me in the parking lot of a business in Cartago, Costa Rica. It sported around 1173 full res images taken with a Nikon D5600, then they were cropped in patches of single parking spaces, giving a total of 4463 patches with a size of 224x224. The datases was divided in training with 3962 patches and test with 500. All photos were taken in the daylight in nice and calm conditions.

Model

The model used was EfficientNet-B0, at the time it was the state of the art in Deep Learning networks and the base model was efficient enough to be used in a Raspberry Pi 4 Model B 8GB version, so that were a few reasons why I chose it instead of MobileNet or NASNet which at the time were also good in mobile devices. It was fast and quite easy to use since it was implemented in Keras.

Results

The accuracy results were quite great for a small dataset, for 500 test images, the accuracy was of 99.2% so it performed nicely.

Then we have the Confusion Matrix to have another perspective:

a matrix containing the results of the confusion matrix, gibing out only 4 errors

As we can see from above for the 500 test images, only 4 were classified as free, even though they were a busy space, so only 4 errors in total.

Raspberry Pi functionality

Since piping images through the wire from several Raspberry Pi's was going to be hellish, I used the Raspberry Pi's for everything. A command line software written in Python, has the ability to setup the masks needed to tell the camera were to look for, then the images are cropped and they are send to the model to see what it thinks about it, finally all the results for all the masks available are send through and API to the Django Backend in order to be saved.

For the tests I used a simulated 46 parking spaces, the RPi could process from start to finish everything in 6-8 seconds and the interval to refresh the data was of 25 seconds, so it's pretty fast and it doesn't hurt since nobody can take their car from the parking lot in 5 seconds, so the need for real time processing is not that big, I think.

Finally

I condensed all the information in a blog post. Writing every detail about it would be quite big, so I only distilled the most important ideas. The project is not open source and I don't know if it will ever be, even though I still want to improve a lot this project, it has a lot of potential to be much better and it was pretty fun to do, ML and DL are quite fun to do, except when trying to learn the math behind it, although if you want to do something similar is not that hard, using Keras is quite easy.

← Back to projects