# Multi-Object Tracking with Ultralytics YOLO
<img width="1024" src="https://user-images.githubusercontent.com/26833433/243418637-1d6250fd-1515-4c10-a844-a32818ae6d46.png" alt="YOLOv8 trackers visualization">
Object tracking in the realm of video analytics is a critical task that not only identifies the location and class of objects within the frame but also maintains a unique ID for each detected object as the video progresses. The applications are limitless—ranging from surveillance and security to real-time sports analytics.
## Why Choose Ultralytics YOLO for Object Tracking?
The output from Ultralytics trackers is consistent with standard object detection but has the added value of object IDs. This makes it easy to track objects in video streams and perform subsequent analytics. Here's why you should consider using Ultralytics YOLO for your object tracking needs:
- **Efficiency:** Process video streams in real-time without compromising accuracy.
- **Flexibility:** Supports multiple tracking algorithms and configurations.
- **Ease of Use:** Simple Python API and CLI options for quick integration and deployment.
- **Customizability:** Easy to use with custom trained YOLO models, allowing integration into domain-specific applications.
**Video Tutorial:** [Object Detection and Tracking with Ultralytics YOLOv8](https://www.youtube.com/embed/hHyHmOtmEgs?si=VNZtXmm45Nb9s-N-).
## Features at a Glance
Ultralytics YOLO extends its object detection features to provide robust and versatile object tracking:
- **Real-Time Tracking:** Seamlessly track objects in high-frame-rate videos.
- **Multiple Tracker Support:** Choose from a variety of established tracking algorithms.
- **Customizable Tracker Configurations:** Tailor the tracking algorithm to meet specific requirements by adjusting various parameters.
## Available Trackers
Ultralytics YOLO supports the following tracking algorithms. They can be enabled by passing the relevant YAML configuration file such as `tracker=tracker_type.yaml`:
- [BoT-SORT](https://github.com/NirAharon/BoT-SORT) - Use `botsort.yaml` to enable this tracker.
- [ByteTrack](https://github.com/ifzhang/ByteTrack) - Use `bytetrack.yaml` to enable this tracker.
The default tracker is BoT-SORT.
## Tracking
To run the tracker on video streams, use a trained Detect, Segment or Pose model such as YOLOv8n, YOLOv8n-seg and YOLOv8n-pose.
#### Python
```python
from ultralytics import YOLO
# Load an official or custom model
model = YOLO("yolov8n.pt") # Load an official Detect model
model = YOLO("yolov8n-seg.pt") # Load an official Segment model
model = YOLO("yolov8n-pose.pt") # Load an official Pose model
model = YOLO("path/to/best.pt") # Load a custom trained model
# Perform tracking with the model
results = model.track(
source="https://youtu.be/LNwODJXcvt4", show=True
) # Tracking with default tracker
results = model.track(
source="https://youtu.be/LNwODJXcvt4", show=True, tracker="bytetrack.yaml"
) # Tracking with ByteTrack tracker
```
#### CLI
```bash
# Perform tracking with various models using the command line interface
yolo track model=yolov8n.pt source="https://youtu.be/LNwODJXcvt4" # Official Detect model
yolo track model=yolov8n-seg.pt source="https://youtu.be/LNwODJXcvt4" # Official Segment model
yolo track model=yolov8n-pose.pt source="https://youtu.be/LNwODJXcvt4" # Official Pose model
yolo track model=path/to/best.pt source="https://youtu.be/LNwODJXcvt4" # Custom trained model
# Track using ByteTrack tracker
yolo track model=path/to/best.pt tracker="bytetrack.yaml"
```
As can be seen in the above usage, tracking is available for all Detect, Segment and Pose models run on videos or streaming sources.
## Configuration
### Tracking Arguments
Tracking configuration shares properties with Predict mode, such as `conf`, `iou`, and `show`. For further configurations, refer to the [Predict](https://docs.ultralytics.com/modes/predict/) model page.
#### Python
```python
from ultralytics import YOLO
# Configure the tracking parameters and run the tracker
model = YOLO("yolov8n.pt")
results = model.track(
source="https://youtu.be/LNwODJXcvt4", conf=0.3, iou=0.5, show=True
)
```
#### CLI
```bash
# Configure tracking parameters and run the tracker using the command line interface
yolo track model=yolov8n.pt source="https://youtu.be/LNwODJXcvt4" conf=0.3, iou=0.5 show
```
### Tracker Selection
Ultralytics also allows you to use a modified tracker configuration file. To do this, simply make a copy of a tracker config file (for example, `custom_tracker.yaml`) from [ultralytics/cfg/trackers](https://github.com/ultralytics/ultralytics/tree/main/ultralytics/cfg/trackers) and modify any configurations (except the `tracker_type`) as per your needs.
#### Python
```python
from ultralytics import YOLO
# Load the model and run the tracker with a custom configuration file
model = YOLO("yolov8n.pt")
results = model.track(
source="https://youtu.be/LNwODJXcvt4", tracker="custom_tracker.yaml"
)
```
#### CLI
```bash
# Load the model and run the tracker with a custom configuration file using the command line interface
yolo track model=yolov8n.pt source="https://youtu.be/LNwODJXcvt4" tracker='custom_tracker.yaml'
```
For a comprehensive list of tracking arguments, refer to the [ultralytics/cfg/trackers](https://github.com/ultralytics/ultralytics/tree/main/ultralytics/cfg/trackers) page.
## Python Examples
### Persisting Tracks Loop
Here is a Python script using OpenCV (`cv2`) and YOLOv8 to run object tracking on video frames. This script still assumes you have already installed the necessary packages (`opencv-python` and `ultralytics`). The `persist=True` argument tells the tracker than the current image or frame is the next in a sequence and to expect tracks from the previous image in the current image.
#### Python
```python
import cv2
from ultralytics import YOLO
# Load the YOLOv8 model
model = YOLO("yolov8n.pt")
# Open the video file
video_path = "path/to/video.mp4"
cap = cv2.VideoCapture(video_path)
# Loop through the video frames
while cap.isOpened():
# Read a frame from the video
success, frame = cap.read()
if success:
# Run YOLOv8 tracking on the frame, persisting tracks between frames
results = model.track(frame, persist=True)
# Visualize the results on the frame
annotated_frame = results[0].plot()
# Display the annotated frame
cv2.imshow("YOLOv8 Tracking", annotated_frame)
# Break the loop if 'q' is pressed
if cv2.waitKey(1) & 0xFF == ord("q"):
break
else:
# Break the loop if the end of the video is reached
break
# Release the video capture object and close the display window
cap.release()
cv2.destroyAllWindows()
```
Please note the change from `model(frame)` to `model.track(frame)`, which enables object tracking instead of simple detection. This modified script will run the tracker on each frame of the video, visualize the results, and display them in a window. The loop can be exited by pressing 'q'.
### Plotting Tracks Over Time
Visualizing object tracks over consecutive frames can provide valuable insights into the movement patterns and behavior of detected objects within a video. With Ultralytics YOLOv8, plotting these tracks is a seamless and efficient process.
In the following example, we demonstrate how to utilize YOLOv8's tracking capabilities to plot the movement of detected objects across multiple video frames. This script involves opening a video file, reading it frame by frame, and utilizing the YOLO model to identify and track various objects. By retaining the center points of the detected bounding boxes and connecting them, we can draw lines that represent the paths followed by the tra
没有合适的资源?快使用搜索试试~ 我知道了~
(源码)基于YOLOv8与多模态信息融合的智能牙科诊断系统.zip
共222个文件
py:148个
yaml:63个
sh:4个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 21 浏览量
2024-11-15
15:04:19
上传
评论
收藏 1.43MB ZIP 举报
温馨提示
# 基于YOLOv8与多模态信息融合的智能牙科诊断系统 ## 项目简介 本项目是一个基于YOLOv8框架的智能牙科诊断系统,旨在通过多模态信息融合技术,提高牙齿计数与病变类型识别的准确性。项目结合了最新的YOLOv8模型和Transformer编码技术,通过训练多个独立的模型和使用多头交叉注意力机制,实现了高效的牙齿位置检测和病变类型分类。 ## 项目的主要特性和功能 1. 牙齿位置检测采用YOLOv8模型,训练了三个独立的模型 (m1), (m2), (m3),分别用于不同层级的牙齿位置检测。 2. 病变类型识别针对非正常牙齿的具体病变类别,提出了基于多模态信息融合的注意力机制网络模型,综合文本和视觉模态数据进行分类。 3. 多模态信息融合通过Transformer编码和预训练的ResNet50进行特征提取,使用多头交叉注意力机制在特征图层面融合两种模态数据。
资源推荐
资源详情
资源评论
收起资源包目录
(源码)基于YOLOv8与多模态信息融合的智能牙科诊断系统.zip (222个子文件)
bus.jpg 134KB
zidane.jpg 49KB
README.md 14KB
README.md 3KB
README.md 2KB
framework.pdf 151KB
framework.png 654KB
augment.py 56KB
metrics.py 54KB
exporter.py 53KB
plotting.py 49KB
tasks.py 44KB
model.py 41KB
__init__.py 40KB
trainer.py 36KB
ops.py 33KB
loss.py 33KB
utils.py 32KB
results.py 31KB
autobackend.py 29KB
tiny_encoder.py 29KB
checks.py 29KB
block.py 28KB
torch_utils.py 28KB
encoders.py 26KB
predict.py 24KB
benchmarks.py 24KB
split_dota.py 24KB
loaders.py 24KB
dataset.py 23KB
downloads.py 23KB
__init__.py 22KB
head.py 21KB
explorer.py 21KB
train.py 20KB
transformer.py 20KB
byte_tracker.py 20KB
kalman_filter.py 19KB
converter.py 18KB
predictor.py 18KB
base.py 18KB
files.py 18KB
prompt.py 18KB
instance.py 17KB
val.py 17KB
validator.py 16KB
tal.py 16KB
session.py 16KB
comet.py 16KB
gmc.py 15KB
conv.py 15KB
mytrain.py 15KB
loss.py 15KB
val.py 13KB
tuner.py 13KB
heatmap.py 13KB
object_counter.py 12KB
transformer.py 12KB
dash.py 12KB
ops.py 12KB
utils.py 12KB
bot_sort.py 12KB
val.py 12KB
val.py 11KB
train.py 11KB
parking_management.py 10KB
build.py 10KB
amg.py 10KB
decoders.py 9KB
speed_estimation.py 9KB
wb.py 9KB
utils.py 9KB
distance_calculation.py 8KB
queue_management.py 8KB
tuner.py 8KB
base.py 8KB
clearml.py 8KB
__init__.py 7KB
nets.py 7KB
mlflow.py 7KB
val.py 7KB
model.py 7KB
ai_gym.py 7KB
val.py 7KB
train_world.py 7KB
build.py 6KB
matching.py 6KB
__init__.py 6KB
auth.py 6KB
dvc.py 6KB
predict.py 6KB
dataloader.py 6KB
autobatch.py 6KB
basetrack.py 6KB
tensorboard.py 6KB
neptune.py 6KB
triton.py 5KB
track.py 5KB
predict.py 5KB
model.py 5KB
共 222 条
- 1
- 2
- 3
资源评论
t0_54coder
- 粉丝: 2463
- 资源: 4951
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 柯尼卡美能达Bizhub C364e打印机驱动下载
- CMake 入门实战的源代码
- c7383c5d0009dfc59e9edf595bb0bcd0.zip
- 柯尼卡美能达Bizhub C266打印机驱动下载
- java游戏之我当皇帝那些年.zip开发资料
- 基于Matlab的汉明码(Hamming Code)纠错传输以及交织编码(Interleaved coding)仿真.zip
- 中国省级新质生产力发展指数数据(任宇新版本)2010-2023年.txt
- 基于Matlab的2Q-FSK移频键控通信系统仿真.zip
- 使用C++实现的常见算法
- travel-web-springboot【程序员VIP专用】.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功