This Python script utilizes the YOLO (You Only Look Once) object detection algorithm to detect and track objects in a video feed. It offers options for real-time preview, object tracking, and exporting detected objects.
- Object Detection: Detects various objects in frames using YOLO models.
- Object Tracking: Enables object tracking for detected objects across frames.
- Export: Option to export cropped images of detected objects.
- Real-time Preview: Display real-time frame previews while processing.
- Python 3.x
- OpenCV (
cv2
) - Ultralytics
- Windows OS (for
msvcrt
usage)
-
Clone this repository:
git clone https://github.com/iegrsy/YOLOv8_Test.git
-
Install required packages:
pip install -r requirements.txt
When running the application, you can use the following parameters:
-s, --video_source
: File name or path of the video source. Default value:aoe.mp4
.-e, --export
: Option to export the processed video (True/False). Default value:False
.-p, --preview
: Option to enable preview mode (True/False). Default value:False
.--skip_frame_count
: Number of frames to skip. Default value:1
.
An example command to run the application:
python object_detector.py -s video.mp4 -p True -e True --skip_frame_count 2
This command runs the script on the 'aoe.mp4' video, enabling both object export and real-time preview.
Create dataset folder
cd build
mkdir datasets
cp -r person datasets/train
cp -r person datasets/test
cp -r person datasets/valid
Run training command
yolo task=classify mode=train data=datasets model=yolov8m-cls.pt epochs=2
This project is licensed under the MIT License.