AI-Camera

AICamera: Real-Time High-Speed Person Detection & Tracking

AICamera Demo

๐Ÿš€ Overview

AICamera is a high-performance, real-time object detection and tracking system built as part of a larger Computer Vision pipeline during a project at ExaWizards Inc. It focuses on accurate person detection and tracking, optimized for deployment on NVIDIA GPUs using TensorRT. The system leverages the speed and accuracy of YOLOv8 for detection and combines it with DeepSORT for robust multi-object tracking.

This submodule was designed to act as a core engine in downstream applications such as real-time surveillance, retail analytics, and smart camera systems โ€” with a strong emphasis on efficiency, modularity, and real-world deployability.


๐Ÿง  Key Technologies


โš™๏ธ How It Works

  1. Input Capture: Reads video frames from a file or webcam using OpenCV.
  2. Preprocessing: Resizes and normalizes images for inference.
  3. Detection (YOLOv8 + TensorRT): Outputs class labels, bounding boxes, and confidence scores.
  4. Tracking (DeepSORT + TensorRT ReID):

    • ReID crops extracted from detected persons.
    • TensorRT-optimized ReID model generates embeddings.
    • Kalman filter + cosine distance + IoU matching for identity preservation.
  5. Visualization: Annotated video with object IDs and bounding boxes.

โœ… Features


๐Ÿ–ฅ๏ธ System Requirements


๐Ÿ“ฆ Installation

1. Clone Repository

git clone https://github.com/abdur75648/AI-Camera.git
cd AI-Camera

2. Ensure NVIDIA Stack is Installed

Ensure you have the NVIDIA driver, CUDA, cuDNN, and TensorRT installed. You can check if they are installed correctly by running:

nvidia-smi

This should show your GPU information.

Follow NVIDIAโ€™s official documentation for installing the driver, CUDA, cuDNN, and TensorRT, if not already installed.

Ensure:

nvcc --version
trtexec --help

3. Install Python Dependencies

pip install --upgrade pip
pip install -r requirements.txt

4. Download ONNX Models

bash scripts/download_models.sh

5. Export TensorRT Engines

bash scripts/export_trt_engines.sh

This creates:


โ–ถ๏ธ Usage

Run on a video file:

python3 -m src.aicamera_tracker --input sample_input/sample_video.mp4 --show_display

Run on webcam:

python3 -m src.aicamera_tracker --webcam_id 0 --output_filename outputs/webcam_run.mp4 --show_display

Run with custom confidence threshold:

python3 -m src.aicamera_tracker --input video.mp4 --conf_thresh 0.4

๐Ÿ”ง Common CLI Options

Argument Description
--input Path to input video file
--webcam_id Webcam ID (default: 0)
--output_dir Output directory (default: outputs/)
--output_filename Output filename (auto-generated if not set)
--show_display Show live OpenCV display
--no_save Skip saving output video
--yolo_engine Path to YOLOv8 TensorRT engine
--reid_engine Path to ReID TensorRT engine
--conf_thresh Confidence threshold for detections
--device Inference device (default: cuda:0)

โšก Performance

Component Raw Engine Speed (GTX 1660Ti) Notes
YOLOv8n (TRT) ~400+ FPS Highly optimized inference
ReID (TRT) ~600+ FPS Fast identity embedding
End-to-End Pipeline ~30 FPS Varies by resolution, #objects

โš ๏ธ Enabling --show_display may reduce FPS due to rendering overhead. Disable for benchmarking.


โš™๏ธ Configuration

Update src/config.py to modify:


๐Ÿงฑ Project Structure

AICamera/
โ”œโ”€โ”€ assets/              # Demo assets
โ”œโ”€โ”€ models/              # Pretrained models (.onnx, .engine)
โ”‚   โ”œโ”€โ”€ detection/
โ”‚   โ””โ”€โ”€ reid/
โ”œโ”€โ”€ scripts/             # Scripts for model setup
โ”œโ”€โ”€ sample_input/        # Sample videos/images
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ aicamera_tracker.py
โ”‚   โ”œโ”€โ”€ config.py
โ”‚   โ”œโ”€โ”€ detector/        # YOLOv8 wrapper
โ”‚   โ”œโ”€โ”€ tracker/         # DeepSORT tracker
โ”‚   โ”‚   โ””โ”€โ”€ core/        # Core DeepSORT logic
โ”‚   โ”œโ”€โ”€ utils/           # Helper utilities
โ”‚   โ””โ”€โ”€ trt_utils/       # TensorRT engine handling
โ””โ”€โ”€ requirements.txt

๐Ÿ”ฎ Future Enhancements


๐Ÿ“„ License

Licensed under the MIT License. Youโ€™re free to use, modify, and distribute with attribution.


๐Ÿ™ Acknowledgements