All Projects
Computer Vision

YOLOv8 Smart Parking Detection

Binary parking occupancy (free vs not-free) with YOLOv8n. Test mAP50=0.942, mAP50-95=0.798. Early stopped at epoch 74. 30 CVAT-annotated images (22/4/4). Inference: 9 free + 21 occupied per lot @ 41.2ms.

0.942
Test mAP50
0.994
Val mAP50
0.798
Test mAP50-95
41.2ms / image
Inference speed
Dataset

30 CVAT-annotated parking lot images (22/4/4 split)

Approach

CVAT polygon → YOLO bbox → YOLOv8n fine-tuning (early stopped ep 74)

Tech Stack
PythonYOLOv8n (Ultralytics)CVAT XMLAdamWTesla T4 GPU
Keywords
YOLOv8Object DetectionCVATParkingReal-timeCustom Dataset
Visualizations6 Charts
Deep Dive

Parking space occupancy detection using YOLOv8n on a custom CVAT-annotated dataset.

Dataset & Annotation

  • 30 parking lot images with CVAT polygon annotations
  • 2 classes: free_parking_space / not_free_parking_space
  • Train: 22 / Val: 4 / Test: 4 (stratified by class ratio)
  • Annotations converted from CVAT XML polygons to YOLO normalized bboxes

CVAT XML → YOLO Conversion

# For each polygon in CVAT XML:
x_min, y_min = min(pts_x), min(pts_y)
x_max, y_max = max(pts_x), max(pts_y)
cx = ((x_min + x_max) / 2) / img_width    # normalized center x
cy = ((y_min + y_max) / 2) / img_height   # normalized center y
w  = (x_max - x_min) / img_width
h  = (y_max - y_min) / img_height

Training Config

ParameterValue
ModelYOLOv8n (3.01M params, 73 layers, 8.1 GFLOPs)
Max epochs100
Early stoppingpatience=10 → stopped at epoch 74
Batch size16
Image size640
OptimizerAdamW

Validation Results (best model, 4 images)

MetricValue
mAP500.994
mAP50-950.880
Precision0.982
Recall0.989

Test Set Results (4 images, 110 instances)

ClassPrecisionRecallmAP50mAP50-95
Free spaces0.9590.7090.9180.782
Not-free spaces0.8940.9350.9670.814
Overall0.9260.8220.9420.798

Inference Demo (single 352×640 image)

  • Detected: 9 free + 21 not-free parking spaces
  • Speed: 2.2ms preprocess + 41.2ms inference + 1.4ms postprocess @ confidence=0.25

Application Real-time parking management: camera → YOLOv8n → occupancy counts → display board update. Despite only 30 training images, pretrained COCO weights transfer the object detection priors effectively to this domain-specific binary classification task.