Quick Start
🚀 Quick Start¶
Here's how to get started with FastALPR:
Predictions¶
from fast_alpr import ALPR
# You can also initialize the ALPR with custom plate detection and OCR models.
alpr = ALPR(
detector_model="yolo-v9-t-384-license-plate-end2end",
ocr_model="global-plates-mobile-vit-v2-model",
)
# The "assets/test_image.png" can be found in repo root dit
# You can also pass a NumPy array containing cropped plate image
alpr_results = alpr.predict("assets/test_image.png")
print(alpr_results)
Note
See reference for the available models.
Output:
Draw Results¶
You can also draw the predictions directly on the image:
import cv2
from fast_alpr import ALPR
# Initialize the ALPR
alpr = ALPR(
detector_model="yolo-v9-t-384-license-plate-end2end",
ocr_model="global-plates-mobile-vit-v2-model",
)
# Load the image
image_path = "assets/test_image.png"
frame = cv2.imread(image_path)
# Draw predictions on the image
annotated_frame = alpr.draw_predictions(frame)
# Display the result
cv2.imshow("ALPR Result", annotated_frame)
cv2.waitKey(0)
cv2.destroyAllWindows()
Output: