YOLO Lanyard Detector

Object detection model for detecting lanyards/ID badges on people.

Model Details

  • Architecture: YOLOv8 Nano
  • Task: Object Detection
  • Classes:
    • 0: lanyard (person wearing lanyard)
    • 1: no_lanyard (person not wearing lanyard)
  • Framework: Ultralytics YOLOv8

Performance

  • Validation mAP@0.5: 89.2%
  • Test mAP@0.5: 89.7%
  • Precision: 86.0%
  • Recall: 85.6%

Dataset

  • Total Images: 1720
  • Total Boxes: 3216
  • Train: 1204 images
  • Val: 258 images
  • Test: 258 images

Usage

from ultralytics import YOLO

# Load model
model = YOLO('best.pt')

# Predict
results = model('image.jpg')

# Process results
for result in results:
    boxes = result.boxes
    for box in boxes:
        class_id = int(box.cls[0])
        confidence = float(box.conf[0])
        x1, y1, x2, y2 = box.xyxy[0].cpu().numpy()
        
        if class_id == 0:
            print(f"Lanyard detected! Confidence: {confidence:.2f}")
        else:
            print(f"No lanyard. Confidence: {confidence:.2f}")

Real-Time Detection

# Webcam
results = model.predict(source=0, show=True)

# Video
results = model.predict(source='video.mp4', save=True)

Applications

  • School entrance monitoring
  • Office access control
  • Event security
  • Visitor management

SDG Impact

Addresses SDG 16 (Peace, Justice & Strong Institutions) by automating safety checks in educational institutions.

Training

  • Trained on Google Colab (FREE T4 GPU)
  • Training time: 0:20:53.094281
  • Optimizer: Adam
  • Data augmentation: Enabled

License

MIT License


Developed for: Goals in Code Hackathon 2026
Powered by: Featherless AI (Deployment Partner)

Downloads last month
33
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support