Home Download Team Contact Us User Dashboard Admin Dashboard

The Eye That Sees It All

Civic Eye

 

Real-Time Detection Local Privacy Evidence Logs

Features & Objectives

Discover the core capabilities driving Civic Eye's effectiveness.

AI-Powered Detection

Leverages the state-of-the-art YOLOv8 model for high-accuracy identification of traffic violations, starting with helmet usage detection.

🎯 Pinpoint Accuracy

Real-Time Analysis

Processes live video feeds from various sources (CCTV, webcams, files) to detect and classify violations instantly as they occur.

⏱️ Instant Violation Alerts

Automated Evidence Logging

Automatically captures and saves clear visual evidence (images/clips) of violations, complete with timestamps and metadata, stored securely locally or synced to the server.

🔍 Crystal-Clear Proof

Privacy-Focused Local Processing

All AI inference and data processing happen directly on your local machine, ensuring data privacy, security, and minimal latency before optional server sync.

✅ Secure & Private by Design

Centralized Web Dashboard

A secure web interface (civiceye.my) allows authorized personnel to efficiently review, manage, and analyze collected violation data synced from connected devices.

📊 Effortless Oversight

Reliable & Consistent

Designed for consistent operation, generating dependable, high-resolution evidence with accurate metadata for every detected violation.

🛡️ Dependable Monitoring


Detection & Server Workflow

From camera feed to cloud dashboard: how Civic Eye works online.

Workflow Diagram Placeholder
  1. 1

    Login to CivicEye

    Securely authenticate using your registered `civiceye.my` credentials to connect the local application to your account.

  2. 2

    Connect Video Source

    Select your input: link existing RTSP CCTV streams, activate a PC webcam, or choose a local video file for analysis.

  3. 3

    Real-Time AI Analysis

    The local application processes the video feed frame-by-frame using the YOLOv8 model to detect violations like 'Without Helmet'.

  4. 4

    Capture & Sync Evidence

    When a violation is confirmed, the system captures the frame evidence and metadata, then securely uploads it to your `civiceye.my` cloud account.

  5. 5

    Monitor on Web Dashboard

    Log in to the `civiceye.my` website to access the central dashboard, review synced violation logs, and manage evidence.


Technical Details

Built with standard, powerful tools for efficient local processing on accessible hardware.

  • OS: Windows 10+ or Linux
  • Processor: Intel i3+ / AMD Ryzen 3+
  • RAM: 4GB+ (8GB Recommended)
  • Storage: 5GB Free Space
  • Language: Python 3.8+
  • Core Lib: OpenCV
  • AI Model: YOLOv8
  • GPU: Optional (CUDA/ROCm)
civiceye.py

# Import necessary libraries
import cv2
import math
import cvzone
import os
from ultralytics import YOLO
import time # For timestamp
import requests # For server communication

# --- Configuration ---
API_ENDPOINT = "https://civiceye.my/api/log_violation" # Example endpoint
AUTH_TOKEN = "YOUR_API_TOKEN_HERE" # Get this after login
DEVICE_ID = "CAM_001" # Example device ID

# Get media input
media_input = input("Enter video path or leave blank for camera: ").strip()
cap = cv2.VideoCapture(0) if not media_input else cv2.VideoCapture(media_input)

# Load model and classes
model = YOLO("Weights/best.pt")
classNames = ['With Helmet', 'Without Helmet']

# --- Helper Function for Server Upload ---
def upload_violation(image_data, timestamp, frame_num):
    try:
        files = {'evidence_image': (f'{DEVICE_ID}_{timestamp}.jpg', image_data, 'image/jpeg')}
        payload = {
            'device_id': DEVICE_ID,
            'timestamp': timestamp,
            'frame_number': frame_num,
            'violation_type': 'Without Helmet'
        }
        headers = {'Authorization': f'Bearer {AUTH_TOKEN}'}

        response = requests.post(API_ENDPOINT, headers=headers, data=payload, files=files, timeout=10)
        if response.status_code == 200:
            print(f"Successfully uploaded violation for frame {frame_num}")
        else:
            print(f"Failed to upload violation: {response.status_code} - {response.text}")
    except requests.exceptions.RequestException as e:
        print(f"Network error during upload: {e}")
    except Exception as e:
        print(f"An error occurred during upload: {e}")

# --- Main Detection Loop ---
frame_count = 0
while True:
    success, img = cap.read()
    if not success: break

    results = model(img, stream=True)
    violation_detected_in_frame = False

    for r in results:
        for box in r.boxes:
            x1, y1, x2, y2 = map(int, box.xyxy[0])
            conf = math.ceil((box.conf[0] * 100)) / 100
            cls = int(box.cls[0])
            currentClass = classNames[cls]
            box_color = (0, 255, 0) if currentClass == "With Helmet" else (0, 0, 255)

            cvzone.cornerRect(img, (x1, y1, x2 - x1, y2 - y1), colorR=box_color)
            cvzone.putTextRect(img, f'{currentClass} {conf:.2f}',
                               (max(0, x1), max(35, y1)),
                               scale=1, thickness=1, colorR=box_color)

            if currentClass == "Without Helmet":
                violation_detected_in_frame = True

    # If violation detected, encode image and send to server
    if violation_detected_in_frame:
        timestamp_str = time.strftime("%Y-%m-%dT%H:%M:%S") # ISO format example
        # Encode image to JPEG format in memory
        _, buffer = cv2.imencode('.jpg', img)
        image_bytes = buffer.tobytes()
        # Call upload function (consider running in a separate thread for non-blocking UI)
        upload_violation(image_bytes, timestamp_str, frame_count)
        # Optional: Add a visual indicator on the frame that upload was attempted
        cvzone.putTextRect(img, "Violation Logged", (10, 30), scale=1, thickness=1, colorR=(0,0,255))


    frame_count += 1
    cv2.imshow("Civic Eye Detection", img)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

cap.release()
cv2.destroyAllWindows()
print("Detection finished.")
                    

Get Started with CivicEye

Download the latest version for your operating system and start improving traffic safety today. Access real-time violation detection powered by AI, right on your local machine.