๐ŸŽ™ Free live masterclass ยท Sun, 29 Nov, 7:00 pm IST ยท Java Full Stack roadmap Register free โ†’
Skills101

Object detection with YOLO

Detect and count objects (for example vehicles or helmets) in images and video, and train on your own labelled data.

Advancedโฑ 12โ€“18 hours๐Ÿชœ 7 stepsPythonUltralytics YOLOOpenCV

What you'll learn

  • โ—†How object detection differs from classification
  • โ—†Labelling data and the YOLO format
  • โ—†mAP and inference speed

What you'll build

  • โœ“Pretrained detection on video
  • โœ“Line-crossing counter
  • โœ“Custom training on your dataset
  • โœ“mAP report

Step-by-step guide

  1. 1

    Try a pretrained model

    pip install ultralytics; from ultralytics import YOLO; YOLO("yolov8n.pt").predict("traffic.mp4", show=True).

  2. 2

    Count objects

    Use tracking (model.track) and count IDs that cross a line you draw.

  3. 3

    Choose a custom task

    For example helmet / no-helmet; collect 300+ images.

  4. 4

    Label

    Use a labelling tool (Label Studio, CVAT or Roboflow) and export in YOLO format.

  5. 5

    Train

    Write data.yaml (paths, class names) and run model.train(data="data.yaml", epochs=50, imgsz=640).

  6. 6

    Evaluate

    Check mAP50 and mAP50-95 on the validation set; look at failure images.

  7. 7

    Deploy

    Export to ONNX and measure FPS on a laptop CPU.

๐Ÿš€ Make it stand out

  • +Alert when a rider without a helmet is detected
  • +Run on a Raspberry Pi
  • +Speed estimation