# Tracker
## Supported Trackers
- [x] ByteTracker
- [x] BoT-SORT
## Usage
### python interface:
You can use the Python interface to track objects using the YOLO model.
```python
from ultralytics import YOLO
model = YOLO("yolov8n.pt") # or a segmentation model .i.e yolov8n-seg.pt
model.track(
source="video/streams",
stream=True,
tracker="botsort.yaml", # or 'bytetrack.yaml'
show=True,
)
```
You can get the IDs of the tracked objects using the following code:
```python
from ultralytics import YOLO
model = YOLO("yolov8n.pt")
for result in model.track(source="video.mp4"):
print(
result.boxes.id.cpu().numpy().astype(int)
) # this will print the IDs of the tracked objects in the frame
```
If you want to use the tracker with a folder of images or when you loop on the video frames, you should use the `persist` parameter to tell the model that these frames are related to each other so the IDs will be fixed for the same objects. Otherwise, the IDs will be different in each frame because in each loop, the model creates a new object for tracking, but the `persist` parameter makes it use the same object for tracking.
```python
import cv2
from ultralytics import YOLO
cap = cv2.VideoCapture("video.mp4")
model = YOLO("yolov8n.pt")
while True:
ret, frame = cap.read()
if not ret:
break
results = model.track(frame, persist=True)
boxes = results[0].boxes.xyxy.cpu().numpy().astype(int)
ids = results[0].boxes.id.cpu().numpy().astype(int)
for box, id in zip(boxes, ids):
cv2.rectangle(frame, (box[0], box[1]), (box[2], box[3]), (0, 255, 0), 2)
cv2.putText(
frame,
f"Id {id}",
(box[0], box[1]),
cv2.FONT_HERSHEY_SIMPLEX,
1,
(0, 0, 255),
2,
)
cv2.imshow("frame", frame)
if cv2.waitKey(1) & 0xFF == ord("q"):
break
```
## Change tracker parameters
You can change the tracker parameters by eding the `tracker.yaml` file which is located in the ultralytics/cfg/trackers folder.
## Command Line Interface (CLI)
You can also use the command line interface to track objects using the YOLO model.
```bash
yolo detect track source=... tracker=...
yolo segment track source=... tracker=...
yolo pose track source=... tracker=...
```
By default, trackers will use the configuration in `ultralytics/cfg/trackers`.
We also support using a modified tracker config file. Please refer to the tracker config files
in `ultralytics/cfg/trackers`.<br>
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
YOLOv8优化改进完整源码+运行说明(添加小目标检测头+GAM注意力机制+使用Wise_IoU损失).zip 【项目介绍】 项目基本介绍 本项目对著名的YOLOv8模型进行了多角度的改进优化,并在特定数据集上实现了精度的上涨 采用改进版本的YOLOv8模型与两个表现优良的跟踪器结合(botsort和bytetrack) 基于Vue和Flask开发了一个目标跟踪算法展示平台,平台提供了图像检测和视频跟踪两种功能 视频跟踪实现了在两种应用场景下简单功能(逆行检测和球员轨迹分析) YOLOv8目标检测组合优化改进(成功涨点): 1、添加GAM注意力机制; 添加部位为backbone: 2、添加小目标检测头; 新增检测4X4以上目标的检测头,提高对小目标的检测能力 3、替换为Wise_IoU损失函数 本项目中已将YOLOv8内置的CIoU替换为Wise-IoU 【说明】 【1】项目代码完整且功能都验证ok,确保稳定可靠运行后才上传。欢迎下载使用!在使用过程中,如有问题或建议,请及时私信沟通,帮助解答。 【2】项目主要针对各个计算机相关专业,包括计科、信息安全、数据科学与大数据技术、人
资源推荐
资源详情
资源评论

格式:rar 资源大小:567.4KB






























收起资源包目录





































































































共 454 条
- 1
- 2
- 3
- 4
- 5
资源评论


.whl
- 粉丝: 4205
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


最新资源
- ATC单片机电梯控制系统设计方案.doc
- 大数据在基层医院财务管理中的必要性及思路.docx
- 电力系统调度自动化规划设计内容深度规定.doc
- 大数据时代高速公路数字档案共享探析.docx
- 校园网络方案设计书实施方案书.doc
- 基于WindowsMySQL体系结构分析附性能优化技术研究.doc
- VB超市配送运输管理系统.doc
- 搬运机械手及其控制系统设计包括CAD图纸.doc
- 自动化技术在机械工程中的作用.docx
- 上半系统集成项目管理工程师.doc
- 发展物联网须警惕虚热.docx
- 中国网络招聘市场发展报告.pptx
- ATC单片机LED彩灯控制器的设计方案.doc
- BB、BC电子商务网站策划书.doc
- 单片机X点阵显示设计.doc
- 信息化与电子政务考试总复习题.doc
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



安全验证
文档复制为VIP权益,开通VIP直接复制
