Skip to content
phevyyPublic

About

An autonomous robot simulation that patrols a parking lot, detects vehicles in disabled spots, and classifies their license plates as authorized or unauthorized using YOLO11. Built with Python, Pygame, and PyTorch.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ParkGuard — autonomous parking-lot patrol with YOLO11 plate checks

🚗 ParkGuard

Smart parking disabled-spot enforcement: an autonomous patrol robot + YOLO11
Akıllı Otopark Engelli Araç Kontrol Sistemi

Python YOLO11 PyTorch Pygame mAP50

English · Türkçe

ParkGuard simulation: patrol robot, disabled spots, a detected violation and the live dashboard

Live simulation: blue = disabled spot · red frame = violation · green frame = authorized disabled plate · right: robot dashboard


📌 Overview

A robotics course project. An autonomous robot patrols a parking lot and checks whether the vehicles parked in disabled spots are authorized. When the robot reaches an occupied disabled spot, it reads the plate and classifies it as disabled or normal with a YOLO11 model. It logs every scan to CSV and writes a session summary on exit.

✨ Features

  • 2D top-down parking lot: 18 spots in two blocks. Each round, 3–5 of them are randomly turned into disabled spots.
  • Turkish license plates: authorized vehicles carry the blue ♿ emblem on the plate.
  • 5-state robot FSM: PATROLLING → APPROACHING → SCANNING → REPORTING → RETURNING
  • YOLO11s plate classifier trained on 1,800 synthetic plate images, mAP50 = 0.995
  • Live dashboard: last-scan preview, YOLO confidence bar, violation log and scenario selector
  • Auto-refresh: once every disabled spot is scanned, the vehicles and the layout are renewed
  • Logging: violations.csv (per scan) and session_summary.txt (on exit)

🧠 Model

Model YOLO11s (Ultralytics), imgsz = 160
Data 1,800 synthetic plates (900 disabled + 900 normal), generated with Pillow by generate_dataset.py
Training up to 60 epochs with early stopping (patience = 15). Stopped at epoch 21, ~2 min on an RTX 3050 Ti
Result mAP50 = 0.995 · mAP50-95 = 0.995
Training curves Normalized confusion matrix

🚀 Getting Started

git clone https://github.com/phevyy/ParkGuard.git
cd ParkGuard/Robotik
pip install -r requirements.txt     # or run setup.bat on Windows
python simulation.py

The trained model (models/best.pt) is included, so no training is needed. A CUDA GPU is optional.

Controls

Key Action
1 Low-violation scenario: 85% of disabled spots hold authorized vehicles
2 Medium-violation scenario (45%)
3 High-violation scenario (8%)
R Refresh vehicles (keep the current disabled-spot layout)
SPACE Add a test violation to an empty disabled spot
ESC Exit and save the session summary

Re-training the model

python generate_dataset.py   # 1,800 synthetic plate images → dataset/
python train.py              # trains YOLO11s → models/best.pt

📂 Project Structure

Robotik/
├── simulation.py        # Entry point: main loop, scenarios, controls
├── parking.py           # Parking lot, spots, disabled-spot logic
├── vehicle.py           # Vehicle sprites and license-plate rendering
├── robot.py             # Patrol robot with a 5-state FSM
├── detector.py          # YOLO11 inference + plate preview
├── ui.py                # Right-hand dashboard
├── logger.py            # CSV logging and session summary
├── iso_utils.py         # Isometric drawing helpers
├── generate_dataset.py  # Synthetic training-data generator
├── train.py             # YOLO11 training script
├── dataset/             # Synthetic images + YOLO labels
└── models/
    ├── best.pt          # Trained model used by the simulation
    └── plate_detector/  # Training run: curves, confusion matrix, weights

Generated at runtime and git-ignored: violations.csv, session_summary.txt


🇹🇷 Türkçe

Robotik dersi projesi. Otopark simülasyonunda otonom bir devriye robotu, engelli park yerlerine park eden araçların yetkili olup olmadığını denetler. Robot, dolu bir engelli yere geldiğinde plakayı okur ve YOLO11 modeliyle engelli ya da normal olarak sınıflandırır. Her tarama violations.csv dosyasına kaydedilir, çıkışta da oturum özeti yazılır.

  • 2 blokta 18 park yeri. Her turda bunların 3–5 tanesi rastgele engelli yer olarak belirlenir.
  • Türk plakaları. Yetkili araçların plakasında mavi ♿ amblemi bulunur.
  • 5 durumlu robot FSM: PATROLLING → APPROACHING → SCANNING → REPORTING → RETURNING
  • 1.800 sentetik plaka görseliyle eğitilmiş YOLO11s modeli. Early stopping ile 21. epoch'ta durdu, mAP50 = 0.995
  • Canlı panel: son tarama önizlemesi, YOLO güven çubuğu, ihlal kayıtları ve senaryo seçici

Çalıştırma:

git clone https://github.com/phevyy/ParkGuard.git
cd ParkGuard/Robotik
pip install -r requirements.txt     # Windows'ta setup.bat da kullanılabilir
python simulation.py

Kontroller: 1 / 2 / 3 az / orta / çok ihlal senaryosu · R araçları yenile · SPACE test ihlali ekle · ESC çıkış ve oturum özeti

Modeli yeniden eğitmek için: python generate_dataset.py ardından python train.py

About

An autonomous robot simulation that patrols a parking lot, detects vehicles in disabled spots, and classifies their license plates as authorized or unauthorized using YOLO11. Built with Python, Pygame, and PyTorch.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages