Arizal Firdaus Bagus Pratama commited on
Commit
ab8f0d8
·
verified ·
1 Parent(s): cfbe3c0

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +80 -0
README.md ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ language: en
4
+ tags:
5
+ - computer-vision
6
+ - object-detection
7
+ - object-tracking
8
+ - detr
9
+ - sort
10
+ - pytorch
11
+ base_model:
12
+ - facebook/detr-resnet-50
13
+ ---
14
+
15
+ # Real-Time Object Tracking & Counting Pipeline with DETR and SORT
16
+
17
+ This repository demonstrates a complete pipeline for real-time object detection and tracking in video streams. It integrates a powerful pre-trained detection model (Facebook's DETR) with a classic and efficient tracking algorithm (SORT) to provide cumulative counts of unique objects.
18
+
19
+ This project serves as a proof-of-concept for building practical computer vision applications, such as automated traffic analysis, retail footfall counting, or security monitoring.
20
+
21
+ ![Project Demo](output_video_final_zone-ezgif.gif)`)
22
+
23
+ ## 🚀 Pipeline Overview
24
+
25
+ The system processes a video frame-by-frame, following these core steps:
26
+ 1. **Detection:** The **DETR** model identifies and provides bounding boxes for all target objects in the current frame.
27
+ 2. **Tracking:** The detections are passed to the **SORT** algorithm, which assigns a unique ID to each object and tracks its position over time.
28
+ 3. **Counting:** A "Count All Unique IDs" logic is implemented. The system maintains a list of all unique object IDs it has seen. When a new, previously unseen ID appears, the total count for its object class is incremented by one.
29
+
30
+ ## 🛠️ Core Components
31
+
32
+ This application is built by combining two key components:
33
+
34
+ * **Detector:** [**facebook/detr-resnet-50**](https://huggingface.co/facebook/detr-resnet-50). A state-of-the-art end-to-end object detector developed by Facebook AI. It is pre-trained on the COCO dataset, enabling it to recognize 80 common object categories.
35
+ * **Tracker:** [**SORT (Simple Online and Realtime Tracking)**](https://github.com/abewley/sort). A classic, lightweight, and efficient tracking algorithm that excels at maintaining object identities in real-time.
36
+
37
+ ## 🚀 Usage
38
+
39
+ There are two ways to explore this project, both available directly from this Hugging Face repository.
40
+
41
+ ### 1. Live Demo on Hugging Face Spaces (Recommended)
42
+
43
+ The easiest way to see this project in action is to use the interactive demo hosted in the "Spaces" tab of this repository. This allows you to upload your own video or use a sample directly in your browser without any installation.
44
+
45
+ 👉 [**Try the Live Demo Here!**](https://huggingface.co/spaces/RijalMuluk/detr-sort-object-counting)
46
+
47
+ ### 2. Local Installation (For Developers)
48
+
49
+ If you want to run the code on your own machine, you can clone this repository directly from Hugging Face.
50
+
51
+ 1. **Clone the Hugging Face repository:**
52
+ ```bash
53
+ git clone [https://huggingface.co/RijalMuluk/detr-sort-object-counting](https://huggingface.co/RijalMuluk/detr-sort-object-counting)
54
+ cd detr-sort-object-counting
55
+ ```
56
+
57
+ 2. **Create and activate a virtual environment:**
58
+ ```bash
59
+ python -m venv venv
60
+ source venv/bin/activate # On Windows: venv\Scripts\activate
61
+ ```
62
+
63
+ 3. **Install the required dependencies:**
64
+ ```bash
65
+ pip install -r requirements.txt
66
+ ```
67
+ *(**Catatan:** Disarankan untuk membuat file `requirements.txt` di repository Anda yang berisi semua library yang dibutuhkan)*
68
+
69
+ 4. **Run the Notebook:**
70
+ * The project notebook (`.ipynb`) is included in this repository.
71
+ * Place your input video file in the project directory.
72
+ * Open the notebook in a Jupyter environment and run all the cells. The processed video will be saved locally.
73
+
74
+ ## ⚠️ Limitations and Considerations
75
+
76
+ As a baseline proof-of-concept, this system has several known limitations:
77
+
78
+ * **Occlusion:** The SORT tracker's performance can degrade when objects are heavily occluded (i.e., hidden behind one another). This can sometimes lead to ID switches. More advanced trackers like DeepSORT or ByteTrack could be used to mitigate this.
79
+ * **Confidence Threshold:** The number of objects detected and subsequently tracked is highly sensitive to the `threshold` parameter set during detection. A low threshold may increase false positives, while a high one may miss valid objects.
80
+ * **Domain Specificity:** The underlying DETR model was trained on the COCO dataset. Its performance may vary on videos with different lighting conditions, camera angles, or object types not well-represented in COCO.