ParkBill

A PARKING RECEIPT GENERATOR at your fingertips!

Astitva Singh
Analytics Vidhya
8 min readApr 23, 2021

--

Yes, your read it right. An easy-to-access and easy-to-use parking receipt generator.

Introduction:

In the past few years the number of vehicles around the world (specially in India) has increased drastically. Whether it is a personal vehicle say car, bike or it is a public transport vehicle that is, bus, truck, auto rickshaw. As a layman anyone can conclude that larger the population is, more the no. of vehicles in the country. Corresponding to this, huge requirement of parking area has also been commenced.

Vehicle parking has become a serious challenge for the country. To tackle this problem, different kinds of parking lots have been designed by the government or some private organization, such as bay parking, multistory parking, etc. But due to low manpower or some technical glitch present in the system of management, people are somewhat facing problems. Long lines for parking receipts or unfair charging for parking are the best examples that can be considered. This does not only lead to physical inconvenience to a person, but also mental stress and sometimes anxiety.

Keeping all types of inconveniences and in mind, presenting our project with the objective of providing a better and modern solution for generating the parking receipts.

Working:

The whole system is designed in such a way that a customer can generate his/her own parking receipt for about any long time, therefore being charged accordingly. For this, the person has to install a mobile application available on both android as well as iOS platform. The idea is pretty simple that a lot of time is devoted to a smartphone by an average person, so why not using this masterpiece tech for parking? Anyways, using this app a person can either capture his/her vehicle number plate or can upload the image of it from the gallery making sure the number plate is clearly visible. Also time period for the parking needs to be selected beforehand making the request and then the user will be only one button away from getting the parking receipt and that is, ‘submit’. The respective receipt will be generated which can be downloaded as a PDF or a user can take a screenshot of it as well.

Glimpse of technicality:

Let us dive into the technical approach for which you all were waiting for, perhaps!

OBJECT DETECTION: The developed model first detects the number plate portion from the image and then crops that entire portion for further processing.

OCR (Optical Character Recognition): The model successfully extracts the registration number of the vehicle from the cropped portion which is further saved in a database.

DATABASE: Required to maintain a record of vehicles that have acquired a receipt so that customer’s history can be maintained with the service and thus providing him/her with some monetary benefits in near future.

The system is implemented using Python and is deployed on AWS server, enabling real time detection.

Seems interesting? Be ready to get your hands dirty, as here is a brief explanation of its working. A step-by-step clarification will definitely make you feel good till last.

Object Detection: -

The task of classification of an object with localization is termed as Object localization and when an image contains more than a single object inside an image then that is termed as Object detection. Sounds weird? wait let me elaborate this.

It is basically detecting an object’s presence within an input image i.e. In which part of the image is that object situated and then creating a bounding box (rectangle box) around that object. So this whole process is termed as Object detection.

Classification v/s Detection

How to perform Object localization: -

The detection of object is performed using Anchor Box Prediction that helps in predicting the classes that are present in the input image. The output is a list of (4 + 1 + Number of classes) values, where 4 values represents the coordinates of bounding boxes i.e. bx, by, bh, bw.

(bx, by): the x , y coordinates of center point of the bounding box respectively.

bh : height of the bounding box.

bw: width of the bounding box.

And now comes the algorithm used.

YOLOv3: -

YOLOv3 is a real-time, single stage object detection model that builds on YOLOv2 (its predecessor) with several improvements. Few of the points to be noted are :-

Uses improved backbone network, darknet-53.

Uses skip connection to overcome diminishing gradient problem, known as Residual blocks.

Three scaled vector of size 52x52, 26x26 & 13x13 are used for detection and feed into detector.

Now as you have understood the bits and ticks, lets us talk about the fundamentals.

Here the job is divided into two segments, namely the frontend and the backend part. The frontend or simply client side part is having an application which is cross platform that is, android and IOS (as you already know). Whereas backend consists of server side scripting. All the processing part is handled by the server. So, further briefing you of these two majors.

Client side: -

As the idea is pretty simple, the users has to install this application in their smartphone in order to generate the parking receipt for their vehicles. The process is this easy and convenient that in order to do so firstly the customer will have to enter the time period for which they want to rent the parking and then they have to either upload an image from their mobile device’s gallery or they have an option to click the pic of the number plate on the go after parking their vehicle. Following which by just clicking on the submit button they will be able to generate the receipt.

App’s initial view

Once the receipt is generated either the customer can take the snapshot of the receipt or they too have an option to download the receipt, whichever suites them convince. Another option named clear is also provided at the bottom, in order to reset the app to default but note if the receipt hasn’t been saved then you might lose it and once done can’t be undo.

App after receiving response

Server side: -

The application is deployed on a RHEL8 (Red Hat Enterprise Linux 8) on an EC2 instance for the real time use scenario. The app is deployed using flask over a WSGI (Web Server Gateway Interface). This whole server side job is further divided into 3 sub jobs.

Job 1: -

Here firstly, the detection of portion of image that holds the details of the registration number of the vehicle. To get this done, transfer learning has been used on the YOLOv3 model, that is by-default pre-trained on COCO dataset. So, a model was developed on our custom dataset containing images of vehicles as such that their number plate is clearly visible. On successfully performing this transfer learning, the final weights file will be obtained. The obtained weight file along with the configuration file is used to detect the object in the image and extract its coordinates in the same way as we have discussed above in Object Detection. On successfully detecting the portion that contains the registration plate that very portion is cropped and is used for further processing.

Job 2: -

The cropped image of the registration/number plate obtained from the previous job is taken into account and is processed further using an API named OCR.space. The use of OCR space is preferred as the accuracy obtained for this was well better than most of the other OCR tools like tesseract & Microsoft vision API (in my use case scenario). In order to perform the OCR and extract the text from the image and api key needs to be generated and that key can be used to perform the task. The cropped image is sent over using a POST request along with the api key and in response a file is obtained that contains the extracted text.

Job 3: -

The text extracted from the previous job is obtained and is further stored in the database along with the start time and the end time of the parking. The end time is calculated using the current time when the request was made for the parking and to it adding the number of hours mentioned by the client while making the request. This data when entered in the database will provide us with the receipt number that is generated along with the request made. The generated receipt number along with the registration number and the start — end time for parking is sent back to the client side application and displayed over there.

So whenever any request is made from the client side the whole server side process is made into work and an appropriate result is provided to the client. Also, in case if any error takes place like client forgets to select an image or some error at server side, then an appropriate error message is displayed over to the client.

So, this was all about our receipt generating system. As we have arrived at the end, I would like to say that this whole idea has been possible just because of the smartphones we all have with us. Otherwise, it won’t be handy enough for a user to use this kind of service. Every technology has its respective pros and cons, but the thing is how one can make them into use as to make someone’s daily life much easier.

Thank you guys for reading our blog with your keen interest. A special thanks to Siddharth Sharma who has been to me like Ron was to Harry, thanks mate.

Furthermore, here is the link to our GitHub repository. You can check out the code from here.

A Quick Demo: -

Do watch this 2 minutes demo video for better understanding of all this Wingardium Leviosa.

--

--