This project is about locating the vehicle number plate and capturing the registration number from there using SSD object model and OCR technology.
This model has several use cases like - granting access to vehicles based on registration number - capturing parking violations - maintaining a record of vehicles entering and leaving a parking lot
This project uses SSD object detection model.
POST http://127.0.0.1/predict
Parameter | Type | Description |
---|---|---|
image |
string |
base64 notation of image |
To deploy this project, please follow the below steps in the same order
create environment
conda create -n <envname> python=3.6 -y
activate the environment
conda activate <envname>
install the requirements file
pip install -r requirements.txt
download the .pb file from below location and keep it in datasets/experiment_ssd/2018_07_25_14-00/exported_model
https://drive.google.com/drive/folders/1ZNUoxpuvylhEOAflXE6c_0JmaEuTnACF?usp=sharing
create a working directory to hold this project and use the below git commands to push work directory contents to your git repo
git init
git add . && git commit -m "first commit"
git remote add origin https://github.com/.......git
git branch -M main
git push origin main
- Go to GCP platform
- Create a project like ANPR (for example)
- Go to Navigation Menu (left hand corner) >> API & Services > Dashboard
- Enable API & Services
- Go/Search for Cloud Vision API and Enable
- Left side Credentials > Top Create Credentials > Generate API Key and copy this
- Open the project in pycharm
- Go to rest-server.py line 64 numberPlateVal = detect_license_plate(ik)
- Navigate to detect_license_plate method in getNumberPlateVals.py line 5 url, replace key= with the current key
- Start the service via python rest-server.py
- Go to https://base64.guru/converter/encode/image and convert selected image to base64 format.
- start Postman service
- POST with json format key "image" and value "base64 encoding of image" to URL http://127.0.0.1:5000/predict
- The output will be base64 string for the cropped portion of the image where the number plate is located and the value of number plate like "numberPlateVal": "KA01MR8041".
- This dict – key and value will come after passing thru the OCR
- In real time when getting data from camera, we do cv2.videocapture and cam.read to get continuous image from the camera.