File size: 2,447 Bytes
1a66a6c
 
c310477
1a66a6c
 
 
 
 
 
 
 
 
c310477
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
---
title: Construction App
emoji: 🚜
colorFrom: indigo
colorTo: indigo
sdk: gradio
sdk_version: 6.10.0
app_file: app.py
pinned: false
short_description: detect excavators and put it as active or not qctive
---

# Equipment Utilization & Activity Classification Prototype

This application is an AI-powered monitoring tool for construction machinery, specifically designed to track and analyze **Excavator** activities in real-time. It uses computer vision to distinguish between different operational states like digging, dumping, and idling.

##  Live Demo on Hugging Face
This space provides an interactive interface to upload construction site videos and get a full breakdown of machine utilization and activity logs.

## πŸ“‹ Core Features
* **Intelligent Tracking:** Uses `DeepSort` to maintain unique IDs for each machine across the video.
* **Articulated Motion Analysis:** A specialized algorithm that monitors the **Arm/Bucket** movement separately from the **Tracks**, allowing the system to detect activity even when the machine is not moving its base.
* **Activity Classification:** * `DIGGING`: Active arm movement with downward trajectory.
    * `DUMPING`: Active arm movement with upward trajectory.
    * `SWINGING/LOADING`: Horizontal movement of the body/arm.
    * `WAITING`: Stationary state (Idle).
* **Detailed Analytics:** Outputs a downloadable **JSON report** containing total active seconds, idle time, and utilization percentage.

##  Tech Stack
* **Model:** YOLOv26 (Custom trained `best.pt`).
* **Tracking:** DeepSort Real-time.
* **Inference:** Ultralytics & OpenCV.
* **Interface:** Gradio.

## πŸš€ How to use it here:
1.  **Upload Video:** Drag and drop your mp4/avi video into the "Upload Video" box.
2.  **Select Classes:** Choose the equipment class from the list (e.g., `excavator`).
3.  **Submit:** Wait for the AI to process the frames.
4.  **Results:** * Watch the **Processed Video** with live bounding boxes and activity labels.
    * View the **JSON Output** for a summary of the machine's performance.
    * **Download** the full report for your records.

## πŸ“Š JSON Output Example
The app provides structured data for every detected machine:
```json
{
  "equipment_id": "EX-001",
  "utilization": {
    "current_state": "ACTIVE",
    "current_activity": "DIGGING",
    "motion_source": "arm_only"
  },
  "time_analytics": {
    "total_tracked_seconds": 15.0,
    "utilization_percent": 83.3
  }
}