Current application performs multiple object tracking for the detected people apart from optional segmentation/pose estimation tasks using YOLOv8 models.
It takes the *.mp4 video as an input, preprocesses it depending on the selected model parameters, runs the inference and outputs
the resulting video in *.avi format.
It also stores the model output in *.json format.
Simple Online Realtime Tracking (SORT) algorithm was chosen to perform objects tracking.
NOTE: videos for the above examples were taken at pexels.com
Through CLI interface user can select the model type which in its turn implies the specific task:
- Detection only
- Detection and segmentation
- Detection and pose estimation
It's possible to choose the model size (see the details below) as well as the output visualization options:
- Show the processed video frame-by-frame during the inference process
- Show the output video after the input is completely processed
Current application has been built on:
- Ubuntu 22.04
- C++ standard v17
- gcc >= 11.4 (installed by default)
- cmake >= 3.22 (see the installation instructions)
- make >= 4.3 (installed by default)
- OpenCV >= 4.9 (see the installation instructions)
- Onnxruntime 1.20 (included in this repository)
- Json (included in this repository)
- Google test >= 1.15 (deployed as a submodule)
- Clone this repo
cd ~ git clone https://github.com/cr0mwell/YOLOv8_object_tracking.git --recurse-submodules
- Follow the instructions in the script
to convert the original YOLOv8 model by Ultralytics and save it into
~/YOLOv8_object_tracking/models/yolo
folder.
Keep the following model name convention:YOlOv8<model_size>[-<seg>|<pose>].onnx
(F.e. YOLOv8n-seg.onnx, YOLOv8l-pose.onnx) - As an optional step, place your own video to process to the
~/YOLOv8_object_tracking/media
directory. Rename it toinput.mp4
. - Make a build directory in the top level directory:
cd ~/YOLOv8_object_tracking && mkdir build && cd build
- Compile:
cmake .. && make
- Run and enter the runtime options from command prompt:
./object_tracking
- Processed video can be found in
~/YOLOv8_object_tracking/media/output.avi
~/YOLOv8_object_tracking/json/session_dump.json
file contains all the model output results.- Optionaly run the unit tests:
./test
although the test coverage leaves much to be desired ;-)
This project is licensed under the Apache 2.0 License - see the LICENSE file for details.