Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Parking Detection

Overview

A system that can be used to automatically detect the available parking spaces in a local parking lot.
This system was in use by the municipality I live in, installed in a local parking lot: Municipality Website, System Website

Hardware

Actually, there are only two components in the system:

  • Raspberry Pi 4B
  • Camera (connected to the Raspberry)

These two are installed on a building next to the parking lot, so that the camera sees most of it, and an almost unobstructed view of the cars.

Machine Learning

The first step of the system is detecting all the cars visible in the image, something which requires a Machine Learning (AI) model. The most important factor for choosing a model was the accuracy, as long as the time was at most ~1min.
After checking the YOLOv5 model (which was very fast but inaccurate) and the Mask-RCNN model (which was very accurate but takes at least a minute for inference), I concluded that the latter was a better option.

Parking Spaces

The next step is selecting the parking spaces in the image itself and saving it to a pickle file.
After that, the detection script checks each parking space with each car and finds the IoU (Intersection over Union) of each pair. Then, It finds the maximum IoU for each parking space, and if it exceeds a specific thresold it is considered taken.

Code (detection and availability check)


Automations

I have added a text (on the top right) on the website that informs the citizens about the last time the data were updated.

I have also made a php script that runs every 10 minutes and sends an email to me and the municipality IT Manager if the system has not sent data in the last 10 minutes, so that I access it remotely and restart it.

Script code

The detection script is also being run at startup (with crontab), as well as in a loop (using a watch command), so that when it stops it is run again automatically.

Database

The availability data are then encoded to JSON and sent to an online database via some PHP files.

Website (Link)

The website consists of a map that:

  • Either shows each parking lot (and its status, using a red or green rectangle) individually, if the map is sufficiently zoomed in
  • Or shows a marker for each parking lot that contains information about the number of available parking spaces (if there is any, which is shown with the color of the marker

Website Code

About

A system that can be used to automatically detect the available parking spaces in a local parking lot.

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages