πŸš— TanyaAI - Vehicle License Plate Detector (YOLOv8n)

OpenPathAI/detection-vehcile-plate-2287 License Plate Detection adalah model Computer Vision ringan berbasis YOLOv8 Nano yang di-fine-tune khusus untuk mendeteksi posisi plat nomor kendaraan secara presisi dan cepat (real-time).

Model ini dirancang untuk diintegrasikan ke dalam sistem ANPR (Automatic Number Plate Recognition), pemantauan lalu lintas CCTV, sistem parkir otomatis, maupun perangkat edge berspesifikasi rendah seperti Raspberry Pi atau server VPS berbasis CPU.


πŸ“Š Performa Model (Evaluation Metrics)

  1. Grafik utama yang menampilkan penurunan Loss dan peningkatan nilai mAP50 dan Precision Grafik Performa Pelatihan

  2. Menunjukkan seberapa akurat model membedakan antara area plat nomor (license-plate) dan latar belakang (background). Akurasi Model

  3. Grafik kurva keseimbangan antara Precision dan Recall. Grafik Kurva Grafik Kurva

  4. Contoh foto pengujian Visualisasi Prediksi Validasi


πŸš€ Cara Penggunaan (Usage)

1. Instalasi Dependency

Pastikan Anda sudah menginstal pustaka ultralytics dan huggingface_hub:

pip install ultralytics huggingface_hub opencv-python

2. Contoh script

Tempel script ini ke terminal anda, dan jalankan, secara otomatis akan mendownload dan menjalankan backend.

from fastapi import FastAPI, File, UploadFile, HTTPException
from fastapi.middleware.cors import CORSMiddleware
from ultralytics import YOLO
from huggingface_hub import hf_hub_download
from PIL import Image
import io
import base64

app = FastAPI(title="OpenPath - License Plate Detection API")

# Allow CORS
app.add_middleware(
    CORSMiddleware,
    allow_origins=["*"],
    allow_credentials=True,
    allow_methods=["*"],
    allow_headers=["*"],
)

# Load Model OpenPath
print("Loading OpenPath Model from Hugging Face...")
MODEL_PATH = hf_hub_download(
    repo_id="OpenPathAI/detection-vehcile-plate-2287",
    filename="weights/best.pt"
)
model = YOLO(MODEL_PATH)
print("βœ… Model OpenPath Ready!")

@app.get("/")
def root():
    return {"status": "online", "message": "OpenPath License Plate Detection Server Ready"}

@app.post("/detect")
async def detect_license_plate(file: UploadFile = File(...)):
    if not file.content_type.startswith("image/"):
        raise HTTPException(status_code=400, detail="File harus berupa gambar")

    contents = await file.read()
    image = Image.open(io.BytesIO(contents)).convert("RGB")

    results = model(image, conf=0.4)
    detections = []
    
    for result in results:
        for box in result.boxes:
            x1, y1, x2, y2 = map(int, box.xyxy[0].tolist())
            confidence = float(box.conf[0])

            cropped_plate = image.crop((x1, y1, x2, y2))
            
            buffered = io.BytesIO()
            cropped_plate.save(buffered, format="JPEG")
            crop_base64 = base64.b64encode(buffered.getvalue()).decode("utf-8")

            detections.append({
                "confidence": round(confidence, 2),
                "box": {"x1": x1, "y1": y1, "x2": x2, "y2": y2},
                "crop_base64": f"data:image/jpeg;base64,{crop_base64}"
            })

    return {
        "success": True,
        "total_plates_found": len(detections),
        "detections": detections
    }
Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Collection including OpenPathAI/YOLO-detection-vehcile-plate-2287