This Python script utilizes YOLO (You Only Look Once) for object detection in a video stream. It detects and tracks objects, focusing primarily on people within a specified region of interest.
- Ultralytics YOLO: YOLO implementation for object detection.
- OpenCV: Open Source Computer Vision Library.
- CVZone: Python library to make working with OpenCV easier.
- Install the necessary packages:
pip install opencv-python cvzone numpy shapely ultralytics
- Download YOLOv5 model weights from here and place them in a directory accessible from your script.
- Update the
model_weights_path
andvideo_path
variables in the script to point to your YOLO model weights file and the video file you want to process, respectively. - Run the script:
python yolo_video_processor.py
- The script will display the video with bounding boxes drawn around detected objects. Press 'q' to exit the video stream.
- Detects and tracks multiple classes of objects using YOLO.
- Specifically counts and tracks people within a defined region of interest.
- Draws bounding boxes around detected objects and displays the count of people in the lower region of the screen.
Contributions are welcome! If you find any issues or have suggestions for improvements, feel free to open an issue or submit a pull request on the GitHub repository.
This project is licensed under the MIT License - see the LICENSE file for details.