A server using TFOD2 custom trained model to localize on the numberplate in an image and after that using Cloud Vision API to extract characters from the image.
├───ANPR_centernet_resnet50_model
│ ├───checkpoint
│ └───saved_model
│ ├───assets
│ └───variables
├───object_detection
├───image_to_text.py
├───label_map.pbtxt
├───requirements.txt
├───stripe_customer.py
├───translation-322819-fd44443f9785.json
└───official
To use the object detection model, we need "official" folder from official and "object_detection" folder from object_detection
-
Create a virtual env using any python version >= 3.7.
-
Install the required dependencies and run the following command in the project folder:
pip install -r requirements.txt
- To start local server:
uvicorn image_to_text:app --port 8000 --host 0.0.0.0
- After logging in as root user, run this commaand:
apt update
-
Create a project folder. Our folder lies at /app/python_server. Use scp command to transfer files to VM or clone this repo using git.
-
We are going to use python3 which comes preinstalled in most linux VMs. But we need to install pip separately using:
apt-get install python3-pip
📝 Note: Ideally it's advised to create a virtual python environment and then install all the packages.
- Install the required dependencies and run the following command in the project folder:
pip install -r requirements.txt
-
To keep the server running, we need to create a service file in the path /etc/systemd/system/toll-booth.service. We will be using gunicorn server for deployment whose commands are already mentioned in the file.
-
To start the service
systemctl start toll-booth.service
And to keep the server running even after reboot, run the following command:
systemctl enable toll-booth.service