This project simulates whole structure of software capable to handle paid parking. Fine-tuned YOLOv5 and easyOCR are used for fetching car plate from the image and read the code. Then this result is sent to the database with exact timestamp of arriving at the parking. After the payment exact timestamp of transfer is sent to database. After leaving the parking record is moved to another table which is a base to build dashboard.
This problem was solved with usege two object detection models: YOLOv5 and easyOCR. First one is capable to detect and recognize 80 diffrent classes including cars, animals etc. YOLOv5 is distinguished by it's accuracy and high efficiency performence. Second one allows to detect text from the image.
Althrough YOLOv5 is really powerful model, it doesn't recognize car licence plates. In this case re-training model was necessary. I've used Car License Plate Detection Dataset to learn model how to detect plates. Whole process is nested in `notebooks\fine-tune model.ipynb` and it's performence was checked in `notebooks\testing new model.ipynb`.
After solving plate detection problem next challange was to recognize text from the image. Perfect tool for that was easyOCR which handle with a lot of difficult problems. It may be confusing why I re-trained YOLO when easyOCR can detect text without any problem. Here occures first disadvantage of easyOCR - this model is to much efficient. Let's imagine the situation when arriving car has a sticker with some text - it would be detected and passed to the system too. Usage of YOLO allows to detect plate and cut the image around it. That's the easiest way to avoid errors. EasyOCR was constrained to detect only letters and digits to avoid passing some unallowed characters in the output. Another problem that occures was a gap between first and second part of plate's code. To handle that parameter `width_ths` was setted to 0.7.
To show more empirically how actually system works I've builded an app prototype which allows to load Your own image and guides You through the whole process. To open web app follow instructions below:
cd camera_app
streamlit run app.py
After that You should see UI like below:
After passing an image to the application You will see whole process step by step:
You might notice that the result was send to the database and it's right! Saved result is going to the main database of django website.
To open website follow instructions below:
cd payment_app
python manage.py runserver
You should see the website intefrace like below:
This absolutely simple UI allows You to pay for Your visit at the parking. In the prototype I passed an image with code ALR486. Let's find it out:
It works! As You can see, I didn't pass the whole code. Information passed in the form is looking for similiar codes and display all of them. I had only one code like that so only one has been displayed. You can click on the right code and You'll be moved to the details section:
You can see informations like Your plate's code, exact time when You scanned Your image and cost of the parking. You can pay for a parking by clicking on the button or You can go back to the main page if You accidentally clicked wrong plate. After button click You'll see an information like below:
After that Your code will be removed to another table which is core of a dashboard.
Dashboard allows You to truck current situation on parking, check trafic on parking and follow how many profit does it brings. It looks like below:
A. Number of cars currently at the parking per hour - plot is showing how many cars was present at the parking for each hour per day.
B. Number of cars arriving per hour - plot is presenting when and how many cars arriving to the parking.
C. Profit per day - line chart shows how many profit parking brings. It also display summary profit per month.
D. Currently occupied places - pie chart presents how many places are currently occupied.
E. Cars currently on parking - table shows cars currently on parking. You can check their plate's code and when exactly they arrived.
Dashboard is nested in dashboard
directory.