# 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/tracker/cfg 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/tracker/cfg`.
We also support using a modified tracker config file. Please refer to the tracker config files
in `ultralytics/tracker/cfg`.<br>
没有合适的资源?快使用搜索试试~ 我知道了~
基于YOLOv8和光流算法的车牌识别和测速项目
共510个文件
pyc:233个
py:143个
yaml:46个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 194 浏览量
2024-05-01
19:35:38
上传
评论
收藏 290.07MB ZIP 举报
温馨提示
基于YOLOv8和光流算法的车牌识别和测速项目
资源推荐
资源详情
资源评论
收起资源包目录
基于YOLOv8和光流算法的车牌识别和测速项目 (510个子文件)
events.out.tfevents.1684848629.mixxis-lc74o8uzgaqq-main.6293.0 21.72MB
events.out.tfevents.1686200149.zaier1.23356.0 88B
events.out.tfevents.1686199515.zaier1.23264.0 88B
events.out.tfevents.1686199542.zaier1.23328.0 88B
events.out.tfevents.1686200051.zaier1.4100.0 88B
best.bin 42.57MB
yolo_for_plate.bin 42.54MB
yolo_for_plate.bin 33.91MB
yolo_for_car.bin 32.18MB
best.bin 11.56MB
mars.bin 5.34MB
mybestLPRNet.bin 869KB
results.csv 17KB
.gitignore 190B
Car.iml 484B
train_LPRNet.ipynb 13KB
train_yolo.ipynb 8KB
train_batch1.jpg 514KB
train_batch0.jpg 497KB
train_batch2.jpg 470KB
val_batch1_pred.jpg 376KB
val_batch1_labels.jpg 371KB
val_batch0_pred.jpg 360KB
val_batch0_labels.jpg 354KB
val_batch2_pred.jpg 353KB
val_batch2_labels.jpg 347KB
labels_correlogram.jpg 225KB
labels.jpg 140KB
bus.jpg 134KB
001511.jpg 84KB
zidane.jpg 49KB
OIP.jpg 43KB
th.jpg 26KB
README.md 2KB
README.md 2KB
README.md 18B
new_test.mp4 20.75MB
test.mp4 18.87MB
result.mp4 1.8MB
.name 11B
yolo_for_plate.onnx 42.65MB
yolo_for_plate.onnx 36.53MB
yolo_for_car.onnx 32.29MB
best.onnx 11.67MB
mars.onnx 10.7MB
mybestLPRNet.onnx 1.85MB
mybestLPRNet.onnx 1.84MB
mars.pb 10.72MB
results.png 162KB
confusion_matrix.png 94KB
confusion_matrix_normalized.png 86KB
R_curve.png 81KB
F1_curve.png 78KB
P_curve.png 66KB
PR_curve.png 66KB
yolov8s.pt 21.53MB
yoloCar.pt 21.46MB
model_- 9 may 2023 11_18.pt 21.46MB
yolo_for_plate.pt 21.46MB
last.pt 21.46MB
best.pt 21.46MB
yolo_for_plate.pt 18.39MB
yolo_for_car.pt 16.26MB
yolov8n.pt 6.23MB
best.pt 5.94MB
mybestLPRNet.pt 1.73MB
mybestLPRNet2.pt 1.73MB
base_plate_lpr_losses.pt 13KB
losses2.pt 12KB
base_plate_lpr_acces.pt 895B
acces2.pt 877B
v5loader.py 50KB
metrics.py 43KB
exporter.py 39KB
augment.py 36KB
tasks.py 33KB
trainer.py 32KB
trainer-checkpoint.py 32KB
ops.py 28KB
__init__.py 27KB
plotting.py 24KB
results.py 24KB
autobackend.py 24KB
utils.py 23KB
encoders.py 22KB
torch_utils.py 22KB
model.py 22KB
model-checkpoint.py 22KB
kalman_filter.py 18KB
loss.py 18KB
loss-checkpoint.py 18KB
__init__.py 18KB
v5augmentations.py 17KB
head.py 17KB
transformer.py 16KB
predictor.py 16KB
OpenVino.py 16KB
benchmarks.py 15KB
mask_generator.py 15KB
checks.py 15KB
共 510 条
- 1
- 2
- 3
- 4
- 5
- 6
资源评论
hakesashou
- 粉丝: 4193
- 资源: 1083
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功