This project delves into using Object Detection, Image Classification and OCR to build a vehicle identification system.
First we detect and track cars from an image using object detection. Then run image classification on the detected cars to identify their brands (Mercedes, Ferrari, Ford, etc). Next, we once again run object detection on the image to detect licence plates. After this, we run OCR on the detected licence plates to record the licence plate numbers of each car. Finally all of this is wrapped in a streamlit UI, which is used to accept an image as the input and displays the output image with annotations and data.
YOLOv8:
CLIP:
EasyOCR:
Streamlit:
Step 0:
Step 1:
git clone https://github.com/SumanthAppala/Vehicle_Identification_System.git
Step 2: Run the below command to install the required python libraries:
pip install -r requirements.txt
Step 3: In terminal run the below command:
streamlit run run_app.py
Step 4: Once the UI pops up in browser, upload an image from 'data/sample_images' and it will process and display the output image and text.
In the inference code, we use a 'SingletonMeta' type class. This ensures that only one instance of the class is created, no matter how many times it's called upon. This pattern can significantly reduce loading time as the initialization happens only once.
run_app.py: This is the main file that need to be run for the UI to open and accept inputs, as well as display the output.
run_app.py (CAR_BRANDS - line 9): This list can be modified to identify more/different car brands based on the requirement. No additional training is requires as it is a trained on millions of images. Currently it is set to identify 'BMW', 'Ferrari', 'Ford', 'Mercedes'.
data/sample_images: Contains the sample images which can be used to test this code on and analyse the output.
utils/inference.py: Contains the detection, classification and OCR logic as well as code.
utils/model_weights: Contains the yolo object detection weights for the car detection and licence plate detection systems.