📌 Jump straight to:
-
📜
main.py
: Launches the vehicle counter. -
🛠
utils.py
: Houses utility functions and classes for vehicle operations. -
⚙️
config.py
: Manages parameters such as model paths, video input, and display settings. -
📦
MODEL/
: (yolov4.weights
missing in this repo - download)- 🧠
yolov4.cfg
: YOLO model config. - 🔖
coco.names
: Recognizable classes by the model.
- 🧠
-
🎥
VIDEO/
:- 📹
video2.mp4
: A test sample.
- 📹
-
🔗 Clone this repository.
-
📦 Install dependencies:
pip install -r requirements.txt
-
⚙️ Adjust paths and parameters in config.py.
-
🏃♂️ Execute:
python main.py
-
🖱 In the new window, double-click to position the counting line. Watch as vehicle stats get tallied in real-time!
- 🕐 Real-time detection via YOLOv4.
- 📏 Uses Euclidean distance for tracking.
- 🖱 Set counting line with a double-click.
- 📦 Non-Max Suppression (NMS) to declutter overlapping boxes.
- 📊 Classifies and displays counts: Car 🚗, Motorbike 🏍, Bus 🚌, Truck 🚛.
VIDEO_PATH
: Pathway to your footage.INPUT_SIZE
: YOLO model's desired input dimensions.CONFIDENCE_THRESHOLD
: Desired confidence level for detections.NMS_THRESHOLD
: Non-max suppression's threshold.FONT_COLOR
,FONT_SIZE
,FONT_THICKNESS
: Style the on-screen text.CLASSES_FILE
: YOLO's class definitions file path.REQUIRED_CLASS_INDEX
: Indices of classes you wish to monitor.MODEL_CONFIG
: YOLO's config file path.MODEL_WEIGHTS
: YOLO's weight file path (download separately).
🛠 Tweak these in config.py to fit your scenario.