Skip to content

Repository files navigation

KTOB AI Security Guard

Computer-vision security and behavior analytics prototype built with YOLOv8, OpenCV, and Re-ID matching.

What It Does

  • Runs person detection and tracking on a live video source, webcam, RTSP stream, or local file.
  • Detects loitering and suspicious behavior using pose-based analytics.
  • Supports a multi-camera mode that matches the same person across different feeds with Re-ID.
  • Uses configurable thresholds and source settings in config.py.

Main Files

  • security_ai.py - single-camera behavior analytics pipeline.
  • multi_cam.py - multi-camera tracker with shared Re-ID.
  • reid.py - cross-camera identity matching engine.
  • behavior_analytics.py - behavior scoring and suspicion logic.
  • config.py - source, model, and threshold settings.

Requirements

  • Python 3.10 or newer is recommended.
  • A working installation of OpenCV and PyTorch.
  • YOLO weights in the project folder:
    • yolov8n.pt
    • yolov8n-pose.pt
  • For multi-camera Re-ID, the upstream deep-person-reid package from GitHub is required.

Install dependencies with:

pip install -r requirements.txt

Setup

  1. Clone or open the project folder.
  2. Install the dependencies listed in requirements.txt.
  3. Update config.py to point at your preferred video source.
  4. Make sure the YOLO weight files are present in the repository root.

Configuration

Edit config.py to choose the source and tune detection behavior.

  • SOURCE_TYPE controls the input type: file, webcam, youtube, or rtsp.
  • VIDEO_FILE_PATH, WEBCAM_INDEX, YOUTUBE_URL, and RTSP_URL hold the source values.
  • MODEL_WEIGHTS and POSE_WEIGHTS select the YOLO models.
  • LOITER_MIN_FRAMES, LOITER_PIXEL_THRESHOLD, and the REID_* values control behavior and matching sensitivity.

Run

Single-camera behavior analytics:

python security_ai.py

Multi-camera tracking with Re-ID:

python multi_cam.py

Controls

  • Press q to quit the viewer windows.
  • In the single-camera flow, click a person in the video window to lock on or reset the target, depending on the active pipeline behavior.

Notes

  • The project is tuned for testing and prototyping, not production deployment.
  • If YouTube playback is used, cap-from-youtube must be installed and the network must be reachable.
  • If the Re-ID package is unavailable, multi_cam.py will fall back to the single-camera path instructions.

About

This Project is to identify thieves in shops using CV/LSTM.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages