About
Multiple object tracking algorithm for object detection, instance segmentation and keypoints
Multiple object tracking algorithm using BoxMOT trackers for object detection, instance segmentation and keypoints.
BoxMOT provides several tracking algorithms such as OccluBoost, BoT-SORT, BoostTrack, StrongSORT, DeepOCSORT, ByteTrack, HybridSORT, OC-SORT and SFSORT.
🚀 Use with Ikomia API
1. Install Ikomia API
We strongly recommend using a virtual environment. If you're not sure where to start, we offer a tutorial here.
pip install ikomia
2. Create your workflow
from ikomia.dataprocess.workflow import Workflowfrom ikomia.utils.displayIO import displayimport cv2# Init your workflowwf = Workflow()# Add object detection algorithmdetector = wf.add_task(name="infer_yolo_26", auto_connect=True)# Add BoxMOT tracking algorithmtracking = wf.add_task(name="infer_boxmot_tracking", auto_connect=True)stream = cv2.VideoCapture(0)while True:# Read image from streamret, frame = stream.read()# Test if streaming is OKif not ret:continue# Run the workflow on current framewf.run_on(array=frame)# Get resultsimage_out = tracking.get_output(0)obj_track_out = tracking.get_output(1)# Displayimg_res = cv2.cvtColor(image_out.get_image_with_graphics(obj_track_out), cv2.COLOR_BGR2RGB)display(img_res, title="BoxMOT tracking", viewer="opencv")# Press 'q' to quit the streaming processif cv2.waitKey(1) & 0xFF == ord('q'):break# After the loop release the stream objectstream.release()# Destroy all windowscv2.destroyAllWindows()
☀️ Use with Ikomia Studio
Ikomia Studio offers a friendly UI with the same features as the API.
- If you haven't started using Ikomia Studio yet, download and install it from this page.
- For additional guidance on getting started with Ikomia Studio, check out this blog post.
📝 Set algorithm parameters
- tracker (str) - Default 'occluboost': Tracking algorithm to use. Available values are 'occluboost', 'botsort', 'boosttrack', 'strongsort', 'deepocsort', 'bytetrack', 'hybridsort', 'ocsort' and 'sfsort'.
- reid (str) - Default 'osnet_x0_25_msmt17': Re-identification model used by trackers that support ReID.
- config (str) - Default '': Optional path to a custom tracker configuration file in YAML format.
- categories (str) - Default 'all': Categories of objects you want to track. Use a comma separated string to set multiple categories (ex: "dog,person,car").
- cuda (bool) - Default depends on CUDA availability: Enable CUDA acceleration when available.
- half (bool) - Default depends on CUDA availability: Enable half precision when CUDA is available.
Available ReID models in BoxMOT 21.0.0:
resnet50_market1501resnet50_dukemtmcreidresnet50_msmt17resnet50_fc512_market1501resnet50_fc512_dukemtmcreidresnet50_fc512_msmt17mlfn_market1501mlfn_dukemtmcreidmlfn_msmt17hacnn_market1501hacnn_dukemtmcreidhacnn_msmt17mobilenetv2_x1_0_market1501mobilenetv2_x1_0_dukemtmcreidmobilenetv2_x1_0_msmt17mobilenetv2_x1_4_market1501mobilenetv2_x1_4_dukemtmcreidmobilenetv2_x1_4_msmt17osnet_x1_0_market1501osnet_x1_0_dukemtmcreidosnet_x1_0_msmt17osnet_x0_75_market1501osnet_x0_75_dukemtmcreidosnet_x0_75_msmt17osnet_x0_5_market1501osnet_x0_5_dukemtmcreidosnet_x0_5_msmt17osnet_x0_25_market1501osnet_x0_25_dukemtmcreidosnet_x0_25_msmt17osnet_ibn_x1_0_msmt17osnet_ain_x1_0_msmt17lmbn_n_dukelmbn_n_marketlmbn_n_cuhk03_dclip_market1501clip_dukeclip_vericlip_vehicleid
This list is read from BoxMOT at runtime and may change with future BoxMOT releases. Check the upstream mikel-brostrom/boxmot repository for the latest available models.
from ikomia.dataprocess.workflow import Workflow# Init your workflowwf = Workflow()# Add detection algorithmdetector = wf.add_task(name="infer_yolo_26", auto_connect=True)# Add tracking algorithmtracking = wf.add_task(name="infer_boxmot_tracking", auto_connect=True)tracking.set_parameters({"tracker": "bytetrack","categories": "person,car","cuda": "True","half": "True",})
🔍 Explore algorithm outputs
Every algorithm produces specific outputs, yet they can be explored them the same way using the Ikomia API. For a more in-depth understanding of managing algorithm outputs, please refer to the documentation.
from ikomia.dataprocess.workflow import Workflow# Init your workflowwf = Workflow()# Add detection algorithmdetector = wf.add_task(name="infer_yolo_26", auto_connect=True)# Add tracking algorithmtracking = wf.add_task(name="infer_boxmot_tracking", auto_connect=True)# Run on your imagewf.run_on(url="https://raw.githubusercontent.com/Ikomia-dev/notebooks/main/examples/img/img_work.jpg")# Iterate over outputsfor output in tracking.get_outputs():# Print informationprint(output)# Export it to JSONoutput.to_json()
⏩ Advanced usage
Developer
Ikomia
License
GNU Affero General Public License v3.0
Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.
| Permissions | Conditions | Limitations |
|---|---|---|
Commercial use | License and copyright notice | Liability |
Modification | State changes | Warranty |
Distribution | Disclose source | |
Patent use | Network use is distribution | |
Private use | Same license |
This is not legal advice: this description is for informational purposes only and does not constitute the license itself. Provided by choosealicense.com.