Downloads · 30 days
72
52% of all-time downloads
Mithil-AI/yolov8-license-plate-detector
yolov8-license-plate-detector is a object detection model from Mithil-AI. Use it when you need objects located in an image. It is set up for keras. The card lists the license as mit.
[](https://huggingface.co/Mithil-AI/yolov8-license-plate-detector) [](https://opensource.org/licenses/MIT) [](https://keras.io/)
Downloads · 30 days
72
52% of all-time downloads
All-time downloads
138
Public
Repo size
61 MB
Likes
0
Public
Click a slice to open those files.
.keras41.9 MB · 69%
From the Hugging Face model README
![]()
An end-to-end pipeline for training, optimizing, and deploying an edge-ready YOLOv8 License Plate Detection model using YOLOv8-XS and KerasCV. Built specifically for real-time edge-device deployment without requiring proprietary licenses (no Ultralytics license required).
📖 Read the full tutorial on Medium: [Medium blog]
This repository contains a streamlined Jupyter Notebook (license_plate_detection.ipynb) tailored for training an extra-small YOLOv8 object detection model. Built for scalability using a custom Roboflow Pascal VOC dataset, the workflow ensures that the final configuration is fully optimized for edge-device deployment. The final outputs include highly optimized exports for both TFLite (for Android/Edge TPU, featuring INT8 quantization) and CoreML (.mlpackage for iOS/macOS integration).
tf.data.Dataset preparation layer.yolo_v8_xs_backbone, which is deliberately shallow and heavily optimized for mobile processing constraints..tflite): Utilizes a representative data generator to perform precise INT8 weight quantization..mlpackage): Integrates cleanly into Swift/Xcode, actively utilizing ComputeUnit.ALL for Apple Neural Engine support.| Before Detection | After Detection |
|---|---|
![]() | ![]() |
The repository provides fully-trained, edge-optimized weights across multiple formats:
| Format | Filename | Size | Target Hardware / Platform | Description |
|---|---|---|---|---|
| Keras 3 | best_edge_detector.keras | ~41.9 MB | Python, Servers, GPUs | Raw Keras weights. Use for resuming training or running Python inference. |
| TFLite (INT8) | edge_detector_quantized.tflite | ~3.8 MB | Raspberry Pi, Android, Coral Edge TPU | INT8-quantized payload ready to drop into edge devices. |
| Apple CoreML | EdgeDetector.mlpackage.zip | ~6.3 MB | iOS, iPadOS, macOS | Extracted modern CoreML package for Apple's Neural Engine via Swift/Xcode. |
Install dependencies:
pip install tensorflow keras-cv huggingface_hub opencv-python matplotlib
Load the model from Hugging Face Hub (or locally) and run detection:
import cv2
import keras
import keras_cv
import tensorflow as tf
from huggingface_hub import hf_hub_download
# Download weights from Hugging Face Hub (or use local path)
model_path = hf_hub_download(
repo_id="Mithil-AI/yolov8-license-plate-detector",
filename="best_edge_detector.keras"
)
# Load model
inference_model = keras.models.load_model(model_path, compile=False)
# Configure strict NMS filtering (merging overlapping predictions)
inference_model.prediction_decoder = keras_cv.layers.MultiClassNonMaxSuppression(
bounding_box_format="xyxy",
from_logits=False,
max_detections=50,
iou_threshold=0.30,
confidence_threshold=0.50,
)
def load_and_preprocess(image_path):
img = cv2.imread(image_path)
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
orig_h, orig_w = img.shape[:2]
img_resized = cv2.resize(img, (416, 416))
img_tensor = tf.expand_dims(tf.cast(img_resized, tf.float32), axis=0)
return img, img_tensor, orig_w, orig_h
# Run inference
img, img_tensor, orig_w, orig_h = load_and_preprocess("images/before detection.jpg")
predictions = inference_model.predict(img_tensor, verbose=0)
boxes = predictions["boxes"][0]
classes = predictions["classes"][0]
confidences = predictions["confidence"][0]
import numpy as np
import tensorflow as tf
from huggingface_hub import hf_hub_download
tflite_path = hf_hub_download(
repo_id="Mithil-AI/yolov8-license-plate-detector",
filename="edge_detector_quantized.tflite"
)
interpreter = tf.lite.Interpreter(model_path=tflite_path)
interpreter.allocate_tensors()
input_details = interpreter.get_input_details()
output_details = interpreter.get_output_details()
input_data = np.zeros((1, 416, 416, 3), dtype=np.float32)
interpreter.set_tensor(input_details[0]["index"], input_data)
interpreter.invoke()
outputs = [interpreter.get_tensor(o["index"]) for o in output_details]
# Download and unzip CoreML package
hf download Mithil-AI/yolov8-license-plate-detector EdgeDetector.mlpackage.zip --local-dir .
unzip EdgeDetector.mlpackage.zip
Integrate EdgeDetector.mlpackage into Xcode and target Apple Neural Engine via ComputeUnit.ALL.
yolo_v8_xs_backbone via KerasCV)416 x 416 x 3 (Static tensor graph)fpn_depth=1)LicensePlate)1e-4 learning rate)
The execution notebook (license_plate_detection.ipynb) contains 10 distinct sections:
edge_detector_quantized.tflite.EdgeDetector.mlpackage.MIT License