How giriharan007/human-detection-using-yolov8n works
Purpose and Entry Point
This is a local, real-time human-detection prototype. Its sole executable entry point is the Jupyter notebook at human.ipynb, which is intended to be run interactively with access to a webcam. The repository contains no deployable service, API, or packaged application.
Runtime and Dependencies
The runtime is Python 3.7+ in Jupyter. Core execution depends on Ultralytics YOLOv8n over PyTorch for inference, OpenCV for webcam capture, annotation, and display, and Pygame Mixer for local audio playback. The notebook may load local YOLO weights or cause Ultralytics to download them on first use; this is the only stated external-network dependency.
Paths:
• human.ipynb
• README.md
Camera Capture Stage
OpenCV owns the continuous input loop: initialize the local webcam, acquire frames, and keep processing until the interactive session exits. Frames are in-memory image arrays and form the pipeline’s primary data boundary between hardware input and model inference.
Path:
• human.ipynb
Detection and Filtering Stage
Each captured frame is submitted to the Ultralytics YOLOv8 Nano detector. YOLO returns detection results containing bounding boxes, confidence values, and COCO class IDs. Application logic filters those results to class 0 only, intentionally discarding all non-person detections before any alerting or persistence action.
Path:
• human.ipynb
Detection Fan-Out Actions
A positive person detection fans out into three local side effects: bounding-box/confidence annotation on the current frame, alert-sound playback, and image capture persistence. These actions are coupled to the per-frame detection decision; the README does not describe deduplication, cooldowns, batching, or event storage.
Paths:
• human.ipynb
• README.md
Presentation and Persistence Boundary
The annotated frame is displayed through OpenCV as the live output feed, while detections are saved to the local filesystem for later review. The intended artifacts named in the documentation are a model file, an MP3 alarm, and a captured-image directory, but they are not present in the supplied tree; notebook execution therefore depends on these being provisioned externally or generated/downloaded.
Paths:
• human.ipynb
• README.md
Operational Characteristics
The architecture is single-process, workstation-bound, and state-light: camera input, inference, UI display, audio, and disk writes occur in the notebook’s live processing loop. Performance and availability depend on local webcam access, PyTorch/YOLO execution capability, display support, audio-device support, and writable local storage. No database, cloud service, queue, authentication layer, or multi-user boundary is represented.
Path:
• human.ipynb
Main entry points: human.ipynb Person filter · README.md README.md
Components 13
Interactive Runtime
Single-process local notebook execution.
- human.ipynb · Interactive Python 3.7+ application runtime.
human.ipynb - YOLO model weights · Provisioned locally or downloaded by Ultralytics on first use.
- README.md · Documents artifacts and notebook operation.
README.md
Detection Loop
Per-frame in-memory processing pipeline.
- Local webcam
- OpenCV capture loop · Acquires in-memory image frames until session exit.
human.ipynb - YOLOv8n detector · Runs Ultralytics object detection per frame.
human.ipynb - Person filter · Retains COCO class 0 detections only.
human.ipynb
Local Outputs
Workstation-bound presentation and side effects.
- Frame annotation · Draws person boxes and confidence on the current frame.
human.ipynb - Live output feed
human.ipynb - Alert playback · Plays a local alarm for each positive detection.
human.ipynb - Alarm MP3 · Must be provisioned for audio alerts.
- Detection image save · Persists detected-frame captures for later review.
human.ipynb - Captured-image directory · Writable external artifact destination.
Connections 12
- human.ipynb → OpenCV capture loop: runs
- Local webcam → OpenCV capture loop: frames
- OpenCV capture loop → YOLOv8n detector: image frame
- YOLO model weights → YOLOv8n detector: loads
- YOLOv8n detector → Person filter: boxes, confidence, class IDs
- Person filter → Frame annotation: person detected
- Frame annotation → Live output feed: annotated frame
- Person filter → Alert playback: person detected
- Alarm MP3 → Alert playback: audio asset
- Person filter → Detection image save: person detected
- Detection image save → Captured-image directory: writes images
- README.md → human.ipynb: usage guidance