infer_bytetrack
About
Infer ByteTrack for object tracking
Multiple object tracking algorithm for object detection using ByteTrack.
🚀 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_v7", auto_connect=True)# Add ByteTrack tracking algorithmtracking = wf.add_task(name="infer_bytetrack", 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_detect_out = tracking.get_output(1)# Displayimg_res = cv2.cvtColor(image_out.get_image_with_graphics(obj_detect_out), cv2.COLOR_BGR2RGB)display(img_res, title="ByteTrack", 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
- categories (str) - Default 'all': Categories of objects you want to track. Use a comma separated string to set multiple categories (ex: "dog,person,car").
- conf_thres (float) - Default '0.25': Object detection confidence threshold
- conf_thres_match (float) - Default '0.7': Threshold for considering an assignment valid.
- track_buffer (int) - Default '30': Buffer size.
from ikomia.dataprocess.workflow import Workflow# Init your workflowwf = Workflow()# Add algorithmalgo = wf.add_task(name="infer_bytetrack", auto_connect=True)algo.set_parameters({"param1": "value1","param2": "value2",...})
🔍 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_v7", auto_connect=True)# Add algorithmtrack = wf.add_task(name="infer_bytetrack", 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 track.get_outputs():# Print informationprint(output)# Export it to JSONoutput.to_json()
Developer
Ikomia
License
MIT License
A short and simple permissive license with conditions only requiring preservation of copyright and license notices. Licensed works, modifications, and larger works may be distributed under different terms and without source code.
Permissions | Conditions | Limitations |
---|---|---|
Commercial use | License and copyright notice | Liability |
Modification | Warranty | |
Distribution | ||
Private use |
This is not legal advice: this description is for informational purposes only and does not constitute the license itself. Provided by choosealicense.com.