Yolov8 源码解析(四)
comments: true
description: Explore the COCO-Pose dataset for advanced pose estimation. Learn about datasets, pretrained models, metrics, and applications for training with YOLO.
keywords: COCO-Pose, pose estimation, dataset, keypoints, COCO Keypoints 2017, YOLO, deep learning, computer vision
COCO-Pose Dataset
The COCO-Pose dataset is a specialized version of the COCO (Common Objects in Context) dataset, designed for pose estimation tasks. It leverages the COCO Keypoints 2017 images and labels to enable the training of models like YOLO for pose estimation tasks.
COCO-Pose Pretrained Models
Model | size (pixels) |
mAPpose 50-95 |
mAPpose 50 |
Speed CPU ONNX (ms) |
Speed A100 TensorRT (ms) |
params (M) |
FLOPs (B) |
---|---|---|---|---|---|---|---|
YOLOv8n-pose | 640 | 50.4 | 80.1 | 131.8 | 1.18 | 3.3 | 9.2 |
YOLOv8s-pose | 640 | 60.0 | 86.2 | 233.2 | 1.42 | 11.6 | 30.2 |
YOLOv8m-pose | 640 | 65.0 | 88.8 | 456.3 | 2.00 | 26.4 | 81.0 |
YOLOv8l-pose | 640 | 67.6 | 90.0 | 784.5 | 2.59 | 44.4 | 168.6 |
YOLOv8x-pose | 640 | 69.2 | 90.2 | 1607.1 | 3.73 | 69.4 | 263.2 |
YOLOv8x-pose-p6 | 1280 | 71.6 | 91.2 | 4088.7 | 10.04 | 99.1 | 1066.4 |
Key Features
- COCO-Pose builds upon the COCO Keypoints 2017 dataset which contains 200K images labeled with keypoints for pose estimation tasks.
- The dataset supports 17 keypoints for human figures, facilitating detailed pose estimation.
- Like COCO, it provides standardized evaluation metrics, including Object Keypoint Similarity (OKS) for pose estimation tasks, making it suitable for comparing model performance.
Dataset Structure
The COCO-Pose dataset is split into three subsets:
- Train2017: This subset contains a portion of the 118K images from the COCO dataset, annotated for training pose estimation models.
- Val2017: This subset has a selection of images used for validation purposes during model training.
- Test2017: This subset consists of images used for testing and benchmarking the trained models. Ground truth annotations for this subset are not publicly available, and the results are submitted to the COCO evaluation server for performance evaluation.
Applications
The COCO-Pose dataset is specifically used for training and evaluating deep learning models in keypoint detection and pose estimation tasks, such as OpenPose. The dataset's large number of annotated images and standardized evaluation metrics make it an essential resource for computer vision researchers and practitioners focused on pose estimation.
Dataset YAML
A YAML (Yet Another Markup Language) file is used to define the dataset configuration. It contains information about the dataset's paths, classes, and other relevant information. In the case of the COCO-Pose dataset, the coco-pose.yaml
file is maintained at https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/coco-pose.yaml.
!!! Example "ultralytics/cfg/datasets/coco-pose.yaml"
```py
--8<-- "ultralytics/cfg/datasets/coco-pose.yaml"
```
Usage
To train a YOLOv8n-pose model on the COCO-Pose dataset for 100 epochs with an image size of 640, you can use the following code snippets. For a comprehensive list of available arguments, refer to the model Training page.
!!! Example "Train Example"
=== "Python"
```py
from ultralytics import YOLO
# Load a model
model = YOLO("yolov8n-pose.pt") # load a pretrained model (recommended for training)
# Train the model
results = model.train(data="coco-pose.yaml", epochs=100, imgsz=640)
```
=== "CLI"
```py
# Start training from a pretrained *.pt model
yolo detect train data=coco-pose.yaml model=yolov8n-pose.pt epochs=100 imgsz=640
```
Sample Images and Annotations
The COCO-Pose dataset contains a diverse set of images with human figures annotated with keypoints. Here are some examples of images from the dataset, along with their corresponding annotations:
- Mosaiced Image: This image demonstrates a training batch composed of mosaiced dataset images. Mosaicing is a technique used during training that combines multiple images into a single image to increase the variety of objects and scenes within each training batch. This helps improve the model's ability to generalize to different object sizes, aspect ratios, and contexts.
The example showcases the variety and complexity of the images in the COCO-Pose dataset and the benefits of using mosaicing during the training process.
Citations and Acknowledgments
If you use the COCO-Pose dataset in your research or development work, please cite the following paper:
!!! Quote ""
=== "BibTeX"
```py
@misc{lin2015microsoft,
title={Microsoft COCO: Common Objects in Context},
author={Tsung-Yi Lin and Michael Maire and Serge Belongie and Lubomir Bourdev and Ross Girshick and James Hays and Pietro Perona and Deva Ramanan and C. Lawrence Zitnick and Piotr Dollár},
year={2015},
eprint={1405.0312},
archivePrefix={arXiv},
primaryClass={cs.CV}
}
```
We would like to acknowledge the COCO Consortium for creating and maintaining this valuable resource for the computer vision community. For more information about the COCO-Pose dataset and its creators, visit the COCO dataset website.
FAQ
What is the COCO-Pose dataset and how is it used with Ultralytics YOLO for pose estimation?
The COCO-Pose dataset is a specialized version of the COCO (Common Objects in Context) dataset designed for pose estimation tasks. It builds upon the COCO Keypoints 2017 images and annotations, allowing for the training of models like Ultralytics YOLO for detailed pose estimation. For instance, you can use the COCO-Pose dataset to train a YOLOv8n-pose model by loading a pretrained model and training it with a YAML configuration. For training examples, refer to the Training documentation.
How can I train a YOLOv8 model on the COCO-Pose dataset?
Training a YOLOv8 model on the COCO-Pose dataset can be accomplished using either Python or CLI commands. For example, to train a YOLOv8n-pose model for 100 epochs with an image size of 640, you can follow the steps below:
!!! Example "Train Example"
=== "Python"
```py
from ultralytics import YOLO
# Load a model
model = YOLO("yolov8n-pose.pt") # load a pretrained model (recommended for training)
# Train the model
results = model.train(data="coco-pose.yaml", epochs=100, imgsz=640)
```
=== "CLI"
```py
# Start training from a pretrained *.pt model
yolo detect train data=coco-pose.yaml model=yolov8n.pt epochs=100 imgsz=640
```
For more details on the training process and available arguments, check the training page.
What are the different metrics provided by the COCO-Pose dataset for evaluating model performance?
The COCO-Pose dataset provides several standardized evaluation metrics for pose estimation tasks, similar to the original COCO dataset. Key metrics include the Object Keypoint Similarity (OKS), which evaluates the accuracy of predicted keypoints against ground truth annotations. These metrics allow for thorough performance comparisons between different models. For instance, the COCO-Pose pretrained models such as YOLOv8n-pose, YOLOv8s-pose, and others have specific performance metrics listed in the documentation, like mAPpose50-95 and mAPpose50.
How is the dataset structured and split for the COCO-Pose dataset?
The COCO-Pose dataset is split into three subsets:
- Train2017: Contains a portion of the 118K COCO images, annotated for training pose estimation models.
- Val2017: Selected images for validation purposes during model training.
- Test2017: Images used for testing and benchmarking trained models. Ground truth annotations for this subset are not publicly available; results are submitted to the COCO evaluation server for performance evaluation.
These subsets help organize the training, validation, and testing phases effectively. For configuration details, explore the coco-pose.yaml
file available on GitHub.
What are the key features and applications of the COCO-Pose dataset?
The COCO-Pose dataset extends the COCO Keypoints 2017 annotations to include 17 keypoints for human figures, enabling detailed pose estimation. Standardized evaluation metrics (e.g., OKS) facilitate comparisons across different models. Applications of the COCO-Pose dataset span various domains, such as sports analytics, healthcare, and human-computer interaction, wherever detailed pose estimation of human figures is required. For practical use, leveraging pretrained models like those provided in the documentation (e.g., YOLOv8n-pose) can significantly streamline the process (Key Features).
If you use the COCO-Pose dataset in your research or development work, please cite the paper with the following BibTeX entry.
comments: true
description: Explore the compact, versatile COCO8-Pose dataset for testing and debugging object detection models. Ideal for quick experiments with YOLOv8.
keywords: COCO8-Pose, Ultralytics, pose detection dataset, object detection, YOLOv8, machine learning, computer vision, training data
COCO8-Pose Dataset
Introduction
Ultralytics COCO8-Pose is a small, but versatile pose detection dataset composed of the first 8 images of the COCO train 2017 set, 4 for training and 4 for validation. This dataset is ideal for testing and debugging object detection models, or for experimenting with new detection approaches. With 8 images, it is small enough to be easily manageable, yet diverse enough to test training pipelines for errors and act as a sanity check before training larger datasets.
This dataset is intended for use with Ultralytics HUB and YOLOv8.
Dataset YAML
A YAML (Yet Another Markup Language) file is used to define the dataset configuration. It contains information about the dataset's paths, classes, and other relevant information. In the case of the COCO8-Pose dataset, the coco8-pose.yaml
file is maintained at https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/coco8-pose.yaml.
!!! Example "ultralytics/cfg/datasets/coco8-pose.yaml"
```py
--8<-- "ultralytics/cfg/datasets/coco8-pose.yaml"
```
Usage
To train a YOLOv8n-pose model on the COCO8-Pose dataset for 100 epochs with an image size of 640, you can use the following code snippets. For a comprehensive list of available arguments, refer to the model Training page.
!!! Example "Train Example"
=== "Python"
```py
from ultralytics import YOLO
# Load a model
model = YOLO("yolov8n-pose.pt") # load a pretrained model (recommended for training)
# Train the model
results = model.train(data="coco8-pose.yaml", epochs=100, imgsz=640)
```
=== "CLI"
```py
# Start training from a pretrained *.pt model
yolo detect train data=coco8-pose.yaml model=yolov8n-pose.pt epochs=100 imgsz=640
```
Sample Images and Annotations
Here are some examples of images from the COCO8-Pose dataset, along with their corresponding annotations:
- Mosaiced Image: This image demonstrates a training batch composed of mosaiced dataset images. Mosaicing is a technique used during training that combines multiple images into a single image to increase the variety of objects and scenes within each training batch. This helps improve the model's ability to generalize to different object sizes, aspect ratios, and contexts.
The example showcases the variety and complexity of the images in the COCO8-Pose dataset and the benefits of using mosaicing during the training process.
Citations and Acknowledgments
If you use the COCO dataset in your research or development work, please cite the following paper:
!!! Quote ""
=== "BibTeX"
```py
@misc{lin2015microsoft,
title={Microsoft COCO: Common Objects in Context},
author={Tsung-Yi Lin and Michael Maire and Serge Belongie and Lubomir Bourdev and Ross Girshick and James Hays and Pietro Perona and Deva Ramanan and C. Lawrence Zitnick and Piotr Dollár},
year={2015},
eprint={1405.0312},
archivePrefix={arXiv},
primaryClass={cs.CV}
}
```
We would like to acknowledge the COCO Consortium for creating and maintaining this valuable resource for the computer vision community. For more information about the COCO dataset and its creators, visit the COCO dataset website.
FAQ
What is the COCO8-Pose dataset, and how is it used with Ultralytics YOLOv8?
The COCO8-Pose dataset is a small, versatile pose detection dataset that includes the first 8 images from the COCO train 2017 set, with 4 images for training and 4 for validation. It's designed for testing and debugging object detection models and experimenting with new detection approaches. This dataset is ideal for quick experiments with Ultralytics YOLOv8. For more details on dataset configuration, check out the dataset YAML file here.
How do I train a YOLOv8 model using the COCO8-Pose dataset in Ultralytics?
To train a YOLOv8n-pose model on the COCO8-Pose dataset for 100 epochs with an image size of 640, follow these examples:
!!! Example "Train Example"
=== "Python"
```py
from ultralytics import YOLO
# Load a model
model = YOLO("yolov8n-pose.pt")
# Train the model
results = model.train(data="coco8-pose.yaml", epochs=100, imgsz=640)
```
=== "CLI"
```py
yolo detect train data=coco8-pose.yaml model=yolov8n.pt epochs=100 imgsz=640
```
For a comprehensive list of training arguments, refer to the model Training page.
What are the benefits of using the COCO8-Pose dataset?
The COCO8-Pose dataset offers several benefits:
- Compact Size: With only 8 images, it is easy to manage and perfect for quick experiments.
- Diverse Data: Despite its small size, it includes a variety of scenes, useful for thorough pipeline testing.
- Error Debugging: Ideal for identifying training errors and performing sanity checks before scaling up to larger datasets.
For more about its features and usage, see the Dataset Introduction section.
How does mosaicing benefit the YOLOv8 training process using the COCO8-Pose dataset?
Mosaicing, demonstrated in the sample images of the COCO8-Pose dataset, combines multiple images into one, increasing the variety of objects and scenes within each training batch. This technique helps improve the model's ability to generalize across various object sizes, aspect ratios, and contexts, ultimately enhancing model performance. See the Sample Images and Annotations section for example images.
Where can I find the COCO8-Pose dataset YAML file and how do I use it?
The COCO8-Pose dataset YAML file can be found here. This file defines the dataset configuration, including paths, classes, and other relevant information. Use this file with the YOLOv8 training scripts as mentioned in the Train Example section.
For more FAQs and detailed documentation, visit the Ultralytics Documentation.
comments: true
description: Learn about Ultralytics YOLO format for pose estimation datasets, supported formats, COCO-Pose, COCO8-Pose, Tiger-Pose, and how to add your own dataset.
keywords: pose estimation, Ultralytics, YOLO format, COCO-Pose, COCO8-Pose, Tiger-Pose, dataset conversion, keypoints
Pose Estimation Datasets Overview
Supported Dataset Formats
Ultralytics YOLO format
The dataset label format used for training YOLO pose models is as follows:
- One text file per image: Each image in the dataset has a corresponding text file with the same name as the image file and the ".txt" extension.
- One row per object: Each row in the text file corresponds to one object instance in the image.
- Object information per row: Each row contains the following information about the object instance:
- Object class index: An integer representing the class of the object (e.g., 0 for person, 1 for car, etc.).
- Object center coordinates: The x and y coordinates of the center of the object, normalized to be between 0 and 1.
- Object width and height: The width and height of the object, normalized to be between 0 and 1.
- Object keypoint coordinates: The keypoints of the object, normalized to be between 0 and 1.
Here is an example of the label format for pose estimation task:
Format with Dim = 2
<class-index> <x> <y> <width> <height> <px1> <py1> <px2> <py2> ... <pxn> <pyn>
Format with Dim = 3
<class-index> <x> <y> <width> <height> <px1> <py1> <p1-visibility> <px2> <py2> <p2-visibility> <pxn> <pyn> <p2-visibility>
In this format, <class-index>
is the index of the class for the object,<x> <y> <width> <height>
are coordinates of bounding box, and <px1> <py1> <px2> <py2> ... <pxn> <pyn>
are the pixel coordinates of the keypoints. The coordinates are separated by spaces.
Dataset YAML format
The Ultralytics framework uses a YAML file format to define the dataset and model configuration for training Detection Models. Here is an example of the YAML format used for defining a detection dataset:
# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
path: ../datasets/coco8-pose # dataset root dir
train: images/train # train images (relative to 'path') 4 images
val: images/val # val images (relative to 'path') 4 images
test: # test images (optional)
# Keypoints
kpt_shape: [17, 3] # number of keypoints, number of dims (2 for x,y or 3 for x,y,visible)
flip_idx: [0, 2, 1, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13, 16, 15]
# Classes dictionary
names:
0: person
The train
and val
fields specify the paths to the directories containing the training and validation images, respectively.
names
is a dictionary of class names. The order of the names should match the order of the object class indices in the YOLO dataset files.
(Optional) if the points are symmetric then need flip_idx, like left-right side of human or face. For example if we assume five keypoints of facial landmark: [left eye, right eye, nose, left mouth, right mouth], and the original index is [0, 1, 2, 3, 4], then flip_idx is [1, 0, 2, 4, 3] (just exchange the left-right index, i.e. 0-1 and 3-4, and do not modify others like nose in this example).
Usage
!!! Example
=== "Python"
```py
from ultralytics import YOLO
# Load a model
model = YOLO("yolov8n-pose.pt") # load a pretrained model (recommended for training)
# Train the model
results = model.train(data="coco8-pose.yaml", epochs=100, imgsz=640)
```
=== "CLI"
```py
# Start training from a pretrained *.pt model
yolo detect train data=coco8-pose.yaml model=yolov8n-pose.pt epochs=100 imgsz=640
```
Supported Datasets
This section outlines the datasets that are compatible with Ultralytics YOLO format and can be used for training pose estimation models:
COCO-Pose
- Description: COCO-Pose is a large-scale object detection, segmentation, and pose estimation dataset. It is a subset of the popular COCO dataset and focuses on human pose estimation. COCO-Pose includes multiple keypoints for each human instance.
- Label Format: Same as Ultralytics YOLO format as described above, with keypoints for human poses.
- Number of Classes: 1 (Human).
- Keypoints: 17 keypoints including nose, eyes, ears, shoulders, elbows, wrists, hips, knees, and ankles.
- Usage: Suitable for training human pose estimation models.
- Additional Notes: The dataset is rich and diverse, containing over 200k labeled images.
- Read more about COCO-Pose
COCO8-Pose
- Description: Ultralytics COCO8-Pose is a small, but versatile pose detection dataset composed of the first 8 images of the COCO train 2017 set, 4 for training and 4 for validation.
- Label Format: Same as Ultralytics YOLO format as described above, with keypoints for human poses.
- Number of Classes: 1 (Human).
- Keypoints: 17 keypoints including nose, eyes, ears, shoulders, elbows, wrists, hips, knees, and ankles.
- Usage: Suitable for testing and debugging object detection models, or for experimenting with new detection approaches.
- Additional Notes: COCO8-Pose is ideal for sanity checks and CI checks.
- Read more about COCO8-Pose
Tiger-Pose
- Description: Ultralytics This animal pose dataset comprises 263 images sourced from a YouTube Video, with 210 images allocated for training and 53 for validation.
- Label Format: Same as Ultralytics YOLO format as described above, with 12 keypoints for animal pose and no visible dimension.
- Number of Classes: 1 (Tiger).
- Keypoints: 12 keypoints.
- Usage: Great for animal pose or any other pose that is not human-based.
- Read more about Tiger-Pose
Adding your own dataset
If you have your own dataset and would like to use it for training pose estimation models with Ultralytics YOLO format, ensure that it follows the format specified above under "Ultralytics YOLO format". Convert your annotations to the required format and specify the paths, number of classes, and class names in the YAML configuration file.
Conversion Tool
Ultralytics provides a convenient conversion tool to convert labels from the popular COCO dataset format to YOLO format:
!!! Example
=== "Python"
```py
from ultralytics.data.converter import convert_coco
convert_coco(labels_dir="path/to/coco/annotations/", use_keypoints=True)
```
This conversion tool can be used to convert the COCO dataset or any dataset in the COCO format to the Ultralytics YOLO format. The use_keypoints
parameter specifies whether to include keypoints (for pose estimation) in the converted labels.
FAQ
What is the Ultralytics YOLO format for pose estimation?
The Ultralytics YOLO format for pose estimation datasets involves labeling each image with a corresponding text file. Each row of the text file stores information about an object instance:
- Object class index
- Object center coordinates (normalized x and y)
- Object width and height (normalized)
- Object keypoint coordinates (normalized pxn and pyn)
For 2D poses, keypoints include pixel coordinates. For 3D, each keypoint also has a visibility flag. For more details, see Ultralytics YOLO format.
How do I use the COCO-Pose dataset with Ultralytics YOLO?
To use the COCO-Pose dataset with Ultralytics YOLO:
-
Download the dataset and prepare your label files in the YOLO format.
-
Create a YAML configuration file specifying paths to training and validation images, keypoint shape, and class names.
-
Use the configuration file for training:
from ultralytics import YOLO model = YOLO("yolov8n-pose.pt") # load pretrained model results = model.train(data="coco-pose.yaml", epochs=100, imgsz=640)
How can I add my own dataset for pose estimation in Ultralytics YOLO?
To add your dataset:
-
Convert your annotations to the Ultralytics YOLO format.
-
Create a YAML configuration file specifying the dataset paths, number of classes, and class names.
-
Use the configuration file to train your model:
from ultralytics import YOLO model = YOLO("yolov8n-pose.pt") results = model.train(data="your-dataset.yaml", epochs=100, imgsz=640)
For complete steps, check the Adding your own dataset section.
What is the purpose of the dataset YAML file in Ultralytics YOLO?
The dataset YAML file in Ultralytics YOLO defines the dataset and model configuration for training. It specifies paths to training, validation, and test images, keypoint shapes, class names, and other configuration options. This structured format helps streamline dataset management and model training. Here is an example YAML format:
path: ../datasets/coco8-pose
train: images/train
val: images/val
names:
0: person
Read more about creating YAML configuration files in Dataset YAML format.
How can I convert COCO dataset labels to Ultralytics YOLO format for pose estimation?
Ultralytics provides a conversion tool to convert COCO dataset labels to the YOLO format, including keypoint information:
from ultralytics.data.converter import convert_coco
convert_coco(labels_dir="path/to/coco/annotations/", use_keypoints=True)
This tool helps seamlessly integrate COCO datasets into YOLO projects. For details, refer to the Conversion Tool section.
comments: true
description: Explore Ultralytics Tiger-Pose dataset with 263 diverse images. Ideal for testing, training, and refining pose estimation algorithms.
keywords: Ultralytics, Tiger-Pose, dataset, pose estimation, YOLOv8, training data, machine learning, neural networks
Tiger-Pose Dataset
Introduction
Ultralytics introduces the Tiger-Pose dataset, a versatile collection designed for pose estimation tasks. This dataset comprises 263 images sourced from a YouTube Video, with 210 images allocated for training and 53 for validation. It serves as an excellent resource for testing and troubleshooting pose estimation algorithm.
Despite its manageable size of 210 images, tiger-pose dataset offers diversity, making it suitable for assessing training pipelines, identifying potential errors, and serving as a valuable preliminary step before working with larger datasets for pose estimation.
This dataset is intended for use with Ultralytics HUB and YOLOv8.
Watch: Train YOLOv8 Pose Model on Tiger-Pose Dataset Using Ultralytics HUB
Dataset YAML
A YAML (Yet Another Markup Language) file serves as the means to specify the configuration details of a dataset. It encompasses crucial data such as file paths, class definitions, and other pertinent information. Specifically, for the tiger-pose.yaml
file, you can check Ultralytics Tiger-Pose Dataset Configuration File.
!!! Example "ultralytics/cfg/datasets/tiger-pose.yaml"
```py
--8<-- "ultralytics/cfg/datasets/tiger-pose.yaml"
```
Usage
To train a YOLOv8n-pose model on the Tiger-Pose dataset for 100 epochs with an image size of 640, you can use the following code snippets. For a comprehensive list of available arguments, refer to the model Training page.
!!! Example "Train Example"
=== "Python"
```py
from ultralytics import YOLO
# Load a model
model = YOLO("yolov8n-pose.pt") # load a pretrained model (recommended for training)
# Train the model
results = model.train(data="tiger-pose.yaml", epochs=100, imgsz=640)
```
=== "CLI"
```py
# Start training from a pretrained *.pt model
yolo task=pose mode=train data=tiger-pose.yaml model=yolov8n-pose.pt epochs=100 imgsz=640
```
Sample Images and Annotations
Here are some examples of images from the Tiger-Pose dataset, along with their corresponding annotations:
- Mosaiced Image: This image demonstrates a training batch composed of mosaiced dataset images. Mosaicing is a technique used during training that combines multiple images into a single image to increase the variety of objects and scenes within each training batch. This helps improve the model's ability to generalize to different object sizes, aspect ratios, and contexts.
The example showcases the variety and complexity of the images in the Tiger-Pose dataset and the benefits of using mosaicing during the training process.
Inference Example
!!! Example "Inference Example"
=== "Python"
```py
from ultralytics import YOLO
# Load a model
model = YOLO("path/to/best.pt") # load a tiger-pose trained model
# Run inference
results = model.predict(source="https://youtu.be/MIBAT6BGE6U", show=True)
```
=== "CLI"
```py
# Run inference using a tiger-pose trained model
yolo task=pose mode=predict source="https://youtu.be/MIBAT6BGE6U" show=True model="path/to/best.pt"
```
Citations and Acknowledgments
The dataset has been released available under the AGPL-3.0 License.
FAQ
What is the Ultralytics Tiger-Pose dataset used for?
The Ultralytics Tiger-Pose dataset is designed for pose estimation tasks, consisting of 263 images sourced from a YouTube video. The dataset is divided into 210 training images and 53 validation images. It is particularly useful for testing, training, and refining pose estimation algorithms using Ultralytics HUB and YOLOv8.
How do I train a YOLOv8 model on the Tiger-Pose dataset?
To train a YOLOv8n-pose model on the Tiger-Pose dataset for 100 epochs with an image size of 640, use the following code snippets. For more details, visit the Training page:
!!! Example "Train Example"
=== "Python"
```py
from ultralytics import YOLO
# Load a model
model = YOLO("yolov8n-pose.pt") # load a pretrained model (recommended for training)
# Train the model
results = model.train(data="tiger-pose.yaml", epochs=100, imgsz=640)
```
=== "CLI"
```py
# Start training from a pretrained *.pt model
yolo task=pose mode=train data=tiger-pose.yaml model=yolov8n.pt epochs=100 imgsz=640
```
What configurations does the tiger-pose.yaml
file include?
The tiger-pose.yaml
file is used to specify the configuration details of the Tiger-Pose dataset. It includes crucial data such as file paths and class definitions. To see the exact configuration, you can check out the Ultralytics Tiger-Pose Dataset Configuration File.
How can I run inference using a YOLOv8 model trained on the Tiger-Pose dataset?
To perform inference using a YOLOv8 model trained on the Tiger-Pose dataset, you can use the following code snippets. For a detailed guide, visit the Prediction page:
!!! Example "Inference Example"
=== "Python"
```py
from ultralytics import YOLO
# Load a model
model = YOLO("path/to/best.pt") # load a tiger-pose trained model
# Run inference
results = model.predict(source="https://youtu.be/MIBAT6BGE6U", show=True)
```
=== "CLI"
```py
# Run inference using a tiger-pose trained model
yolo task=pose mode=predict source="https://youtu.be/MIBAT6BGE6U" show=True model="path/to/best.pt"
```
What are the benefits of using the Tiger-Pose dataset for pose estimation?
The Tiger-Pose dataset, despite its manageable size of 210 images for training, provides a diverse collection of images that are ideal for testing pose estimation pipelines. The dataset helps identify potential errors and acts as a preliminary step before working with larger datasets. Additionally, the dataset supports the training and refinement of pose estimation algorithms using advanced tools like Ultralytics HUB and YOLOv8, enhancing model performance and accuracy.
comments: true
description: Explore the Roboflow Carparts Segmentation Dataset for automotive AI applications. Enhance your segmentation models with rich, annotated data.
keywords: Carparts Segmentation Dataset, Roboflow, computer vision, automotive AI, vehicle maintenance, Ultralytics
Roboflow Universe Carparts Segmentation Dataset
The Roboflow Carparts Segmentation Dataset is a curated collection of images and videos designed for computer vision applications, specifically focusing on segmentation tasks related to car parts. This dataset provides a diverse set of visuals captured from multiple perspectives, offering valuable annotated examples for training and testing segmentation models.
Whether you're working on automotive research, developing AI solutions for vehicle maintenance, or exploring computer vision applications, the Carparts Segmentation Dataset serves as a valuable resource for enhancing accuracy and efficiency in your projects.
Watch: Carparts Instance Segmentation Using Ultralytics HUB
Dataset Structure
The data distribution within the Carparts Segmentation Dataset is organized as outlined below:
- Training set: Includes 3156 images, each accompanied by its corresponding annotations.
- Testing set: Comprises 276 images, with each one paired with its respective annotations.
- Validation set: Consists of 401 images, each having corresponding annotations.
Applications
Carparts Segmentation finds applications in automotive quality control, auto repair, e-commerce cataloging, traffic monitoring, autonomous vehicles, insurance processing, recycling, and smart city initiatives. It streamlines processes by accurately identifying and categorizing different vehicle components, contributing to efficiency and automation in various industries.
Dataset YAML
A YAML (Yet Another Markup Language) file is used to define the dataset configuration. It contains information about the dataset's paths, classes, and other relevant information. In the case of the Package Segmentation dataset, the carparts-seg.yaml
file is maintained at https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/carparts-seg.yaml.
!!! Example "ultralytics/cfg/datasets/carparts-seg.yaml"
```py
--8<-- "ultralytics/cfg/datasets/carparts-seg.yaml"
```
Usage
To train Ultralytics YOLOv8n model on the Carparts Segmentation dataset for 100 epochs with an image size of 640, you can use the following code snippets. For a comprehensive list of available arguments, refer to the model Training page.
!!! Example "Train Example"
=== "Python"
```py
from ultralytics import YOLO
# Load a model
model = YOLO("yolov8n-seg.pt") # load a pretrained model (recommended for training)
# Train the model
results = model.train(data="carparts-seg.yaml", epochs=100, imgsz=640)
```
=== "CLI"
```py
# Start training from a pretrained *.pt model
yolo segment train data=carparts-seg.yaml model=yolov8n-seg.pt epochs=100 imgsz=640
```
Sample Data and Annotations
The Carparts Segmentation dataset includes a diverse array of images and videos taken from various perspectives. Below, you'll find examples of data from the dataset along with their corresponding annotations:
- This image illustrates object segmentation within a sample, featuring annotated bounding boxes with masks surrounding identified objects. The dataset consists of a varied set of images captured in various locations, environments, and densities, serving as a comprehensive resource for crafting models specific to this task.
- This instance highlights the diversity and complexity inherent in the dataset, emphasizing the crucial role of high-quality data in computer vision tasks, particularly in the realm of car parts segmentation.
Citations and Acknowledgments
If you integrate the Carparts Segmentation dataset into your research or development projects, please make reference to the following paper:
!!! Quote ""
=== "BibTeX"
```py
@misc{ car-seg-un1pm_dataset,
title = { car-seg Dataset },
type = { Open Source Dataset },
author = { Gianmarco Russo },
howpublished = { \url{ https://universe.roboflow.com/gianmarco-russo-vt9xr/car-seg-un1pm } },
url = { https://universe.roboflow.com/gianmarco-russo-vt9xr/car-seg-un1pm },
journal = { Roboflow Universe },
publisher = { Roboflow },
year = { 2023 },
month = { nov },
note = { visited on 2024-01-24 },
}
```
We extend our thanks to the Roboflow team for their dedication in developing and managing the Carparts Segmentation dataset, a valuable resource for vehicle maintenance and research projects. For additional details about the Carparts Segmentation dataset and its creators, please visit the CarParts Segmentation Dataset Page.
FAQ
What is the Roboflow Carparts Segmentation Dataset?
The Roboflow Carparts Segmentation Dataset is a curated collection of images and videos specifically designed for car part segmentation tasks in computer vision. This dataset includes a diverse range of visuals captured from multiple perspectives, making it an invaluable resource for training and testing segmentation models for automotive applications.
How can I use the Carparts Segmentation Dataset with Ultralytics YOLOv8?
To train a YOLOv8 model on the Carparts Segmentation dataset, you can follow these steps:
!!! Example "Train Example"
=== "Python"
```py
from ultralytics import YOLO
# Load a model
model = YOLO("yolov8n-seg.pt") # load a pretrained model (recommended for training)
# Train the model
results = model.train(data="carparts-seg.yaml", epochs=100, imgsz=640)
```
=== "CLI"
```py
# Start training from a pretrained *.pt model
yolo segment train data=carparts-seg.yaml model=yolov8n-seg.pt epochs=100 imgsz=640
```
For more details, refer to the Training documentation.
What are some applications of Carparts Segmentation?
Carparts Segmentation can be widely applied in various fields such as:
- Automotive quality control
- Auto repair and maintenance
- E-commerce cataloging
- Traffic monitoring
- Autonomous vehicles
- Insurance claim processing
- Recycling initiatives
- Smart city projects
This segmentation helps in accurately identifying and categorizing different vehicle components, enhancing the efficiency and automation in these industries.
Where can I find the dataset configuration file for Carparts Segmentation?
The dataset configuration file for the Carparts Segmentation dataset, carparts-seg.yaml
, can be found at the following location: carparts-seg.yaml.
Why should I use the Carparts Segmentation Dataset?
The Carparts Segmentation Dataset provides rich, annotated data essential for developing high-accuracy segmentation models in automotive computer vision. This dataset's diversity and detailed annotations improve model training, making it ideal for applications like vehicle maintenance automation, enhancing vehicle safety systems, and supporting autonomous driving technologies. Partnering with a robust dataset accelerates AI development and ensures better model performance.
For more details, visit the CarParts Segmentation Dataset Page.
comments: true
description: Explore the COCO-Seg dataset, an extension of COCO, with detailed segmentation annotations. Learn how to train YOLO models with COCO-Seg.
keywords: COCO-Seg, dataset, YOLO models, instance segmentation, object detection, COCO dataset, YOLOv8, computer vision, Ultralytics, machine learning
COCO-Seg Dataset
The COCO-Seg dataset, an extension of the COCO (Common Objects in Context) dataset, is specially designed to aid research in object instance segmentation. It uses the same images as COCO but introduces more detailed segmentation annotations. This dataset is a crucial resource for researchers and developers working on instance segmentation tasks, especially for training YOLO models.
COCO-Seg Pretrained Models
Model | size (pixels) |
mAPbox 50-95 |
mAPmask 50-95 |
Speed CPU ONNX (ms) |
Speed A100 TensorRT (ms) |
params (M) |
FLOPs (B) |
---|---|---|---|---|---|---|---|
YOLOv8n-seg | 640 | 36.7 | 30.5 | 96.1 | 1.21 | 3.4 | 12.6 |
YOLOv8s-seg | 640 | 44.6 | 36.8 | 155.7 | 1.47 | 11.8 | 42.6 |
YOLOv8m-seg | 640 | 49.9 | 40.8 | 317.0 | 2.18 | 27.3 | 110.2 |
YOLOv8l-seg | 640 | 52.3 | 42.6 | 572.4 | 2.79 | 46.0 | 220.5 |
YOLOv8x-seg | 640 | 53.4 | 43.4 | 712.1 | 4.02 | 71.8 | 344.1 |
Key Features
- COCO-Seg retains the original 330K images from COCO.
- The dataset consists of the same 80 object categories found in the original COCO dataset.
- Annotations now include more detailed instance segmentation masks for each object in the images.
- COCO-Seg provides standardized evaluation metrics like mean Average Precision (mAP) for object detection, and mean Average Recall (mAR) for instance segmentation tasks, enabling effective comparison of model performance.
Dataset Structure
The COCO-Seg dataset is partitioned into three subsets:
- Train2017: This subset contains 118K images for training instance segmentation models.
- Val2017: This subset includes 5K images used for validation purposes during model training.
- Test2017: This subset encompasses 20K images used for testing and benchmarking the trained models. Ground truth annotations for this subset are not publicly available, and the results are submitted to the COCO evaluation server for performance evaluation.
Applications
COCO-Seg is widely used for training and evaluating deep learning models in instance segmentation, such as the YOLO models. The large number of annotated images, the diversity of object categories, and the standardized evaluation metrics make it an indispensable resource for computer vision researchers and practitioners.
Dataset YAML
A YAML (Yet Another Markup Language) file is used to define the dataset configuration. It contains information about the dataset's paths, classes, and other relevant information. In the case of the COCO-Seg dataset, the coco.yaml
file is maintained at https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/coco.yaml.
!!! Example "ultralytics/cfg/datasets/coco.yaml"
```py
--8<-- "ultralytics/cfg/datasets/coco.yaml"
```
Usage
To train a YOLOv8n-seg model on the COCO-Seg dataset for 100 epochs with an image size of 640, you can use the following code snippets. For a comprehensive list of available arguments, refer to the model Training page.
!!! Example "Train Example"
=== "Python"
```py
from ultralytics import YOLO
# Load a model
model = YOLO("yolov8n-seg.pt") # load a pretrained model (recommended for training)
# Train the model
results = model.train(data="coco-seg.yaml", epochs=100, imgsz=640)
```
=== "CLI"
```py
# Start training from a pretrained *.pt model
yolo detect train data=coco-seg.yaml model=yolov8n-seg.pt epochs=100 imgsz=640
```
Sample Images and Annotations
COCO-Seg, like its predecessor COCO, contains a diverse set of images with various object categories and complex scenes. However, COCO-Seg introduces more detailed instance segmentation masks for each object in the images. Here are some examples of images from the dataset, along with their corresponding instance segmentation masks:
- Mosaiced Image: This image demonstrates a training batch composed of mosaiced dataset images. Mosaicing is a technique used during training that combines multiple images into a single image to increase the variety of objects and scenes within each training batch. This aids the model's ability to generalize to different object sizes, aspect ratios, and contexts.
The example showcases the variety and complexity of the images in the COCO-Seg dataset and the benefits of using mosaicing during the training process.
Citations and Acknowledgments
If you use the COCO-Seg dataset in your research or development work, please cite the original COCO paper and acknowledge the extension to COCO-Seg:
!!! Quote ""
=== "BibTeX"
```py
@misc{lin2015microsoft,
title={Microsoft COCO: Common Objects in Context},
author={Tsung-Yi Lin and Michael Maire and Serge Belongie and Lubomir Bourdev and Ross Girshick and James Hays and Pietro Perona and Deva Ramanan and C. Lawrence Zitnick and Piotr Dollár},
year={2015},
eprint={1405.0312},
archivePrefix={arXiv},
primaryClass={cs.CV}
}
```
We extend our thanks to the COCO Consortium for creating and maintaining this invaluable resource for the computer vision community. For more information about the COCO dataset and its creators, visit the COCO dataset website.
FAQ
What is the COCO-Seg dataset and how does it differ from the original COCO dataset?
The COCO-Seg dataset is an extension of the original COCO (Common Objects in Context) dataset, specifically designed for instance segmentation tasks. While it uses the same images as the COCO dataset, COCO-Seg includes more detailed segmentation annotations, making it a powerful resource for researchers and developers focusing on object instance segmentation.
How can I train a YOLOv8 model using the COCO-Seg dataset?
To train a YOLOv8n-seg model on the COCO-Seg dataset for 100 epochs with an image size of 640, you can use the following code snippets. For a detailed list of available arguments, refer to the model Training page.
!!! Example "Train Example"
=== "Python"
```py
from ultralytics import YOLO
# Load a model
model = YOLO("yolov8n-seg.pt") # load a pretrained model (recommended for training)
# Train the model
results = model.train(data="coco-seg.yaml", epochs=100, imgsz=640)
```
=== "CLI"
```py
# Start training from a pretrained *.pt model
yolo detect train data=coco-seg.yaml model=yolov8n.pt epochs=100 imgsz=640
```
What are the key features of the COCO-Seg dataset?
The COCO-Seg dataset includes several key features:
- Retains the original 330K images from the COCO dataset.
- Annotates the same 80 object categories found in the original COCO.
- Provides more detailed instance segmentation masks for each object.
- Uses standardized evaluation metrics such as mean Average Precision (mAP) for object detection and mean Average Recall (mAR) for instance segmentation tasks.
What pretrained models are available for COCO-Seg, and what are their performance metrics?
The COCO-Seg dataset supports multiple pretrained YOLOv8 segmentation models with varying performance metrics. Here's a summary of the available models and their key metrics:
Model | size (pixels) |
mAPbox 50-95 |
mAPmask 50-95 |
Speed CPU ONNX (ms) |
Speed A100 TensorRT (ms) |
params (M) |
FLOPs (B) |
---|---|---|---|---|---|---|---|
YOLOv8n-seg | 640 | 36.7 | 30.5 | 96.1 | 1.21 | 3.4 | 12.6 |
YOLOv8s-seg | 640 | 44.6 | 36.8 | 155.7 | 1.47 | 11.8 | 42.6 |
YOLOv8m-seg | 640 | 49.9 | 40.8 | 317.0 | 2.18 | 27.3 | 110.2 |
YOLOv8l-seg | 640 | 52.3 | 42.6 | 572.4 | 2.79 | 46.0 | 220.5 |
YOLOv8x-seg | 640 | 53.4 | 43.4 | 712.1 | 4.02 | 71.8 | 344.1 |
How is the COCO-Seg dataset structured and what subsets does it contain?
The COCO-Seg dataset is partitioned into three subsets for specific training and evaluation needs:
- Train2017: Contains 118K images used primarily for training instance segmentation models.
- Val2017: Comprises 5K images utilized for validation during the training process.
- Test2017: Encompasses 20K images reserved for testing and benchmarking trained models. Note that ground truth annotations for this subset are not publicly available, and performance results are submitted to the COCO evaluation server for assessment.
comments: true
description: Discover the versatile and manageable COCO8-Seg dataset by Ultralytics, ideal for testing and debugging segmentation models or new detection approaches.
keywords: COCO8-Seg, Ultralytics, segmentation dataset, YOLOv8, COCO 2017, model training, computer vision, dataset configuration
COCO8-Seg Dataset
Introduction
Ultralytics COCO8-Seg is a small, but versatile instance segmentation dataset composed of the first 8 images of the COCO train 2017 set, 4 for training and 4 for validation. This dataset is ideal for testing and debugging segmentation models, or for experimenting with new detection approaches. With 8 images, it is small enough to be easily manageable, yet diverse enough to test training pipelines for errors and act as a sanity check before training larger datasets.
This dataset is intended for use with Ultralytics HUB and YOLOv8.
Dataset YAML
A YAML (Yet Another Markup Language) file is used to define the dataset configuration. It contains information about the dataset's paths, classes, and other relevant information. In the case of the COCO8-Seg dataset, the coco8-seg.yaml
file is maintained at https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/coco8-seg.yaml.
!!! Example "ultralytics/cfg/datasets/coco8-seg.yaml"
```py
--8<-- "ultralytics/cfg/datasets/coco8-seg.yaml"
```
Usage
To train a YOLOv8n-seg model on the COCO8-Seg dataset for 100 epochs with an image size of 640, you can use the following code snippets. For a comprehensive list of available arguments, refer to the model Training page.
!!! Example "Train Example"
=== "Python"
```py
from ultralytics import YOLO
# Load a model
model = YOLO("yolov8n-seg.pt") # load a pretrained model (recommended for training)
# Train the model
results = model.train(data="coco8-seg.yaml", epochs=100, imgsz=640)
```
=== "CLI"
```py
# Start training from a pretrained *.pt model
yolo detect train data=coco8-seg.yaml model=yolov8n-seg.pt epochs=100 imgsz=640
```
Sample Images and Annotations
Here are some examples of images from the COCO8-Seg dataset, along with their corresponding annotations:
- Mosaiced Image: This image demonstrates a training batch composed of mosaiced dataset images. Mosaicing is a technique used during training that combines multiple images into a single image to increase the variety of objects and scenes within each training batch. This helps improve the model's ability to generalize to different object sizes, aspect ratios, and contexts.
The example showcases the variety and complexity of the images in the COCO8-Seg dataset and the benefits of using mosaicing during the training process.
Citations and Acknowledgments
If you use the COCO dataset in your research or development work, please cite the following paper:
!!! Quote ""
=== "BibTeX"
```py
@misc{lin2015microsoft,
title={Microsoft COCO: Common Objects in Context},
author={Tsung-Yi Lin and Michael Maire and Serge Belongie and Lubomir Bourdev and Ross Girshick and James Hays and Pietro Perona and Deva Ramanan and C. Lawrence Zitnick and Piotr Dollár},
year={2015},
eprint={1405.0312},
archivePrefix={arXiv},
primaryClass={cs.CV}
}
```
We would like to acknowledge the COCO Consortium for creating and maintaining this valuable resource for the computer vision community. For more information about the COCO dataset and its creators, visit the COCO dataset website.
FAQ
What is the COCO8-Seg dataset, and how is it used in Ultralytics YOLOv8?
The COCO8-Seg dataset is a compact instance segmentation dataset by Ultralytics, consisting of the first 8 images from the COCO train 2017 set—4 images for training and 4 for validation. This dataset is tailored for testing and debugging segmentation models or experimenting with new detection methods. It is particularly useful with Ultralytics YOLOv8 and HUB for rapid iteration and pipeline error-checking before scaling to larger datasets. For detailed usage, refer to the model Training page.
How can I train a YOLOv8n-seg model using the COCO8-Seg dataset?
To train a YOLOv8n-seg model on the COCO8-Seg dataset for 100 epochs with an image size of 640, you can use Python or CLI commands. Here's a quick example:
!!! Example "Train Example"
=== "Python"
```py
from ultralytics import YOLO
# Load a model
model = YOLO("yolov8n-seg.pt") # Load a pretrained model (recommended for training)
# Train the model
results = model.train(data="coco8-seg.yaml", epochs=100, imgsz=640)
```
=== "CLI"
```py
# Start training from a pretrained *.pt model
yolo detect train data=coco8-seg.yaml model=yolov8n.pt epochs=100 imgsz=640
```
For a thorough explanation of available arguments and configuration options, you can check the Training documentation.
Why is the COCO8-Seg dataset important for model development and debugging?
The COCO8-Seg dataset is ideal for its manageability and diversity within a small size. It consists of only 8 images, providing a quick way to test and debug segmentation models or new detection approaches without the overhead of larger datasets. This makes it an efficient tool for sanity checks and pipeline error identification before committing to extensive training on large datasets. Learn more about dataset formats here.
Where can I find the YAML configuration file for the COCO8-Seg dataset?
The YAML configuration file for the COCO8-Seg dataset is available in the Ultralytics repository. You can access the file directly here. The YAML file includes essential information about dataset paths, classes, and configuration settings required for model training and validation.
What are some benefits of using mosaicing during training with the COCO8-Seg dataset?
Using mosaicing during training helps increase the diversity and variety of objects and scenes in each training batch. This technique combines multiple images into a single composite image, enhancing the model's ability to generalize to different object sizes, aspect ratios, and contexts within the scene. Mosaicing is beneficial for improving a model's robustness and accuracy, especially when working with small datasets like COCO8-Seg. For an example of mosaiced images, see the Sample Images and Annotations section.
comments: true
description: Explore the extensive Roboflow Crack Segmentation Dataset, perfect for transportation and public safety studies or self-driving car model development.
keywords: Roboflow, Crack Segmentation Dataset, Ultralytics, transportation safety, public safety, self-driving cars, computer vision, road safety, infrastructure maintenance, dataset
Roboflow Universe Crack Segmentation Dataset
The Roboflow Crack Segmentation Dataset stands out as an extensive resource designed specifically for individuals involved in transportation and public safety studies. It is equally beneficial for those working on the development of self-driving car models or simply exploring computer vision applications for recreational purposes.
Comprising a total of 4029 static images captured from diverse road and wall scenarios, this dataset emerges as a valuable asset for tasks related to crack segmentation. Whether you are delving into the intricacies of transportation research or seeking to enhance the accuracy of your self-driving car models, this dataset provides a rich and varied collection of images to support your endeavors.
Dataset Structure
The division of data within the Crack Segmentation Dataset is outlined as follows:
- Training set: Consists of 3717 images with corresponding annotations.
- Testing set: Comprises 112 images along with their respective annotations.
- Validation set: Includes 200 images with their corresponding annotations.
Applications
Crack segmentation finds practical applications in infrastructure maintenance, aiding in the identification and assessment of structural damage. It also plays a crucial role in enhancing road safety by enabling automated systems to detect and address pavement cracks for timely repairs.
Dataset YAML
A YAML (Yet Another Markup Language) file is employed to outline the configuration of the dataset, encompassing details about paths, classes, and other pertinent information. Specifically, for the Crack Segmentation dataset, the crack-seg.yaml
file is managed and accessible at https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/crack-seg.yaml.
!!! Example "ultralytics/cfg/datasets/crack-seg.yaml"
```py
--8<-- "ultralytics/cfg/datasets/crack-seg.yaml"
```
Usage
To train Ultralytics YOLOv8n model on the Crack Segmentation dataset for 100 epochs with an image size of 640, you can use the following code snippets. For a comprehensive list of available arguments, refer to the model Training page.
!!! Example "Train Example"
=== "Python"
```py
from ultralytics import YOLO
# Load a model
model = YOLO("yolov8n-seg.pt") # load a pretrained model (recommended for training)
# Train the model
results = model.train(data="crack-seg.yaml", epochs=100, imgsz=640)
```
=== "CLI"
```py
# Start training from a pretrained *.pt model
yolo segment train data=crack-seg.yaml model=yolov8n-seg.pt epochs=100 imgsz=640
```
Sample Data and Annotations
The Crack Segmentation dataset comprises a varied collection of images and videos captured from multiple perspectives. Below are instances of data from the dataset, accompanied by their respective annotations:
-
This image presents an example of image object segmentation, featuring annotated bounding boxes with masks outlining identified objects. The dataset includes a diverse array of images taken in different locations, environments, and densities, making it a comprehensive resource for developing models designed for this particular task.
-
The example underscores the diversity and complexity found in the Crack segmentation dataset, emphasizing the crucial role of high-quality data in computer vision tasks.
Citations and Acknowledgments
If you incorporate the crack segmentation dataset into your research or development endeavors, kindly reference the following paper:
!!! Quote ""
=== "BibTeX"
```py
@misc{ crack-bphdr_dataset,
title = { crack Dataset },
type = { Open Source Dataset },
author = { University },
howpublished = { \url{ https://universe.roboflow.com/university-bswxt/crack-bphdr } },
url = { https://universe.roboflow.com/university-bswxt/crack-bphdr },
journal = { Roboflow Universe },
publisher = { Roboflow },
year = { 2022 },
month = { dec },
note = { visited on 2024-01-23 },
}
```
We would like to acknowledge the Roboflow team for creating and maintaining the Crack Segmentation dataset as a valuable resource for the road safety and research projects. For more information about the Crack segmentation dataset and its creators, visit the Crack Segmentation Dataset Page.
FAQ
What is the Roboflow Crack Segmentation Dataset?
The Roboflow Crack Segmentation Dataset is a comprehensive collection of 4029 static images designed specifically for transportation and public safety studies. It is ideal for tasks such as self-driving car model development and infrastructure maintenance. The dataset includes training, testing, and validation sets, aiding in accurate crack detection and segmentation.
How do I train a model using the Crack Segmentation Dataset with Ultralytics YOLOv8?
To train an Ultralytics YOLOv8 model on the Crack Segmentation dataset, use the following code snippets. Detailed instructions and further parameters can be found on the model Training page.
!!! Example "Train Example"
=== "Python"
```py
from ultralytics import YOLO
# Load a model
model = YOLO("yolov8n-seg.pt") # load a pretrained model (recommended for training)
# Train the model
results = model.train(data="crack-seg.yaml", epochs=100, imgsz=640)
```
=== "CLI"
```py
# Start training from a pretrained *.pt model
yolo segment train data=crack-seg.yaml model=yolov8n-seg.pt epochs=100 imgsz=640
```
Why should I use the Crack Segmentation Dataset for my self-driving car project?
The Crack Segmentation Dataset is exceptionally suited for self-driving car projects due to its diverse collection of 4029 road and wall images, which provide a varied range of scenarios. This diversity enhances the accuracy and robustness of models trained for crack detection, crucial for maintaining road safety and ensuring timely infrastructure repairs.
What unique features does Ultralytics YOLO offer for crack segmentation?
Ultralytics YOLO offers advanced real-time object detection, segmentation, and classification capabilities that make it ideal for crack segmentation tasks. Its ability to handle large datasets and complex scenarios ensures high accuracy and efficiency. For example, the model Training, Predict, and Export modes cover comprehensive functionalities from training to deployment.
How do I cite the Roboflow Crack Segmentation Dataset in my research paper?
If you incorporate the Crack Segmentation Dataset into your research, please use the following BibTeX reference:
@misc{ crack-bphdr_dataset,
title = { crack Dataset },
type = { Open Source Dataset },
author = { University },
howpublished = { \url{ https://universe.roboflow.com/university-bswxt/crack-bphdr } },
url = { https://universe.roboflow.com/university-bswxt/crack-bphdr },
journal = { Roboflow Universe },
publisher = { Roboflow },
year = { 2022 },
month = { dec },
note = { visited on 2024-01-23 },
}
This citation format ensures proper accreditation to the creators of the dataset and acknowledges its use in your research.
comments: true
description: Explore the supported dataset formats for Ultralytics YOLO and learn how to prepare and use datasets for training object segmentation models.
keywords: Ultralytics, YOLO, instance segmentation, dataset formats, auto-annotation, COCO, segmentation models, training data
Instance Segmentation Datasets Overview
Supported Dataset Formats
Ultralytics YOLO format
The dataset label format used for training YOLO segmentation models is as follows:
- One text file per image: Each image in the dataset has a corresponding text file with the same name as the image file and the ".txt" extension.
- One row per object: Each row in the text file corresponds to one object instance in the image.
- Object information per row: Each row contains the following information about the object instance:
- Object class index: An integer representing the class of the object (e.g., 0 for person, 1 for car, etc.).
- Object bounding coordinates: The bounding coordinates around the mask area, normalized to be between 0 and 1.
The format for a single row in the segmentation dataset file is as follows:
<class-index> <x1> <y1> <x2> <y2> ... <xn> <yn>
In this format, <class-index>
is the index of the class for the object, and <x1> <y1> <x2> <y2> ... <xn> <yn>
are the bounding coordinates of the object's segmentation mask. The coordinates are separated by spaces.
Here is an example of the YOLO dataset format for a single image with two objects made up of a 3-point segment and a 5-point segment.
0 0.681 0.485 0.670 0.487 0.676 0.487
1 0.504 0.000 0.501 0.004 0.498 0.004 0.493 0.010 0.492 0.0104
!!! Tip "Tip"
- The length of each row does **not** have to be equal.
- Each segmentation label must have a **minimum of 3 xy points**: `<class-index> <x1> <y1> <x2> <y2> <x3> <y3>`
Dataset YAML format
The Ultralytics framework uses a YAML file format to define the dataset and model configuration for training Detection Models. Here is an example of the YAML format used for defining a detection dataset:
# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
path: ../datasets/coco8-seg # dataset root dir
train: images/train # train images (relative to 'path') 4 images
val: images/val # val images (relative to 'path') 4 images
test: # test images (optional)
# Classes (80 COCO classes)
names:
0: person
1: bicycle
2: car
# ...
77: teddy bear
78: hair drier
79: toothbrush
The train
and val
fields specify the paths to the directories containing the training and validation images, respectively.
names
is a dictionary of class names. The order of the names should match the order of the object class indices in the YOLO dataset files.
Usage
!!! Example
=== "Python"
```py
from ultralytics import YOLO
# Load a model
model = YOLO("yolov8n-seg.pt") # load a pretrained model (recommended for training)
# Train the model
results = model.train(data="coco8-seg.yaml", epochs=100, imgsz=640)
```
=== "CLI"
```py
# Start training from a pretrained *.pt model
yolo detect train data=coco8-seg.yaml model=yolov8n-seg.pt epochs=100 imgsz=640
```
Supported Datasets
Supported Datasets
- COCO: A comprehensive dataset for object detection, segmentation, and captioning, featuring over 200K labeled images across a wide range of categories.
- COCO8-seg: A compact, 8-image subset of COCO designed for quick testing of segmentation model training, ideal for CI checks and workflow validation in the
ultralytics
repository. - Carparts-seg: A specialized dataset focused on the segmentation of car parts, ideal for automotive applications. It includes a variety of vehicles with detailed annotations of individual car components.
- Crack-seg: A dataset tailored for the segmentation of cracks in various surfaces. Essential for infrastructure maintenance and quality control, it provides detailed imagery for training models to identify structural weaknesses.
- Package-seg: A dataset dedicated to the segmentation of different types of packaging materials and shapes. It's particularly useful for logistics and warehouse automation, aiding in the development of systems for package handling and sorting.
Adding your own dataset
If you have your own dataset and would like to use it for training segmentation models with Ultralytics YOLO format, ensure that it follows the format specified above under "Ultralytics YOLO format". Convert your annotations to the required format and specify the paths, number of classes, and class names in the YAML configuration file.
Port or Convert Label Formats
COCO Dataset Format to YOLO Format
You can easily convert labels from the popular COCO dataset format to the YOLO format using the following code snippet:
!!! Example
=== "Python"
```py
from ultralytics.data.converter import convert_coco
convert_coco(labels_dir="path/to/coco/annotations/", use_segments=True)
```
This conversion tool can be used to convert the COCO dataset or any dataset in the COCO format to the Ultralytics YOLO format.
Remember to double-check if the dataset you want to use is compatible with your model and follows the necessary format conventions. Properly formatted datasets are crucial for training successful object detection models.
Auto-Annotation
Auto-annotation is an essential feature that allows you to generate a segmentation dataset using a pre-trained detection model. It enables you to quickly and accurately annotate a large number of images without the need for manual labeling, saving time and effort.
Generate Segmentation Dataset Using a Detection Model
To auto-annotate your dataset using the Ultralytics framework, you can use the auto_annotate
function as shown below:
!!! Example
=== "Python"
```py
from ultralytics.data.annotator import auto_annotate
auto_annotate(data="path/to/images", det_model="yolov8x.pt", sam_model="sam_b.pt")
```
Argument | Type | Description | Default |
---|---|---|---|
data |
str |
Path to a folder containing images to be annotated. | None |
det_model |
str, optional |
Pre-trained YOLO detection model. Defaults to 'yolov8x.pt' . |
'yolov8x.pt' |
sam_model |
str, optional |
Pre-trained SAM segmentation model. Defaults to 'sam_b.pt' . |
'sam_b.pt' |
device |
str, optional |
Device to run the models on. Defaults to an empty string (CPU or GPU, if available). | '' |
output_dir |
str or None, optional |
Directory to save the annotated results. Defaults to a 'labels' folder in the same directory as 'data' . |
None |
The auto_annotate
function takes the path to your images, along with optional arguments for specifying the pre-trained detection and SAM segmentation models, the device to run the models on, and the output directory for saving the annotated results.
By leveraging the power of pre-trained models, auto-annotation can significantly reduce the time and effort required for creating high-quality segmentation datasets. This feature is particularly useful for researchers and developers working with large image collections, as it allows them to focus on model development and evaluation rather than manual annotation.
FAQ
What dataset formats does Ultralytics YOLO support for instance segmentation?
Ultralytics YOLO supports several dataset formats for instance segmentation, with the primary format being its own Ultralytics YOLO format. Each image in your dataset needs a corresponding text file with object information segmented into multiple rows (one row per object), listing the class index and normalized bounding coordinates. For more detailed instructions on the YOLO dataset format, visit the Instance Segmentation Datasets Overview.
How can I convert COCO dataset annotations to the YOLO format?
Converting COCO format annotations to YOLO format is straightforward using Ultralytics tools. You can use the convert_coco
function from the ultralytics.data.converter
module:
from ultralytics.data.converter import convert_coco
convert_coco(labels_dir="path/to/coco/annotations/", use_segments=True)
This script converts your COCO dataset annotations to the required YOLO format, making it suitable for training your YOLO models. For more details, refer to Port or Convert Label Formats.
How do I prepare a YAML file for training Ultralytics YOLO models?
To prepare a YAML file for training YOLO models with Ultralytics, you need to define the dataset paths and class names. Here's an example YAML configuration:
path: ../datasets/coco8-seg # dataset root dir
train: images/train # train images (relative to 'path')
val: images/val # val images (relative to 'path')
names:
0: person
1: bicycle
2: car
# ...
Ensure you update the paths and class names according to your dataset. For more information, check the Dataset YAML Format section.
What is the auto-annotation feature in Ultralytics YOLO?
Auto-annotation in Ultralytics YOLO allows you to generate segmentation annotations for your dataset using a pre-trained detection model. This significantly reduces the need for manual labeling. You can use the auto_annotate
function as follows:
from ultralytics.data.annotator import auto_annotate
auto_annotate(data="path/to/images", det_model="yolov8x.pt", sam_model="sam_b.pt")
This function automates the annotation process, making it faster and more efficient. For more details, explore the Auto-Annotation section.
comments: true
description: Explore the Roboflow Package Segmentation Dataset. Optimize logistics and enhance vision models with curated images for package identification and sorting.
keywords: Roboflow, Package Segmentation Dataset, computer vision, package identification, logistics, warehouse automation, segmentation models, training data
Roboflow Universe Package Segmentation Dataset
The Roboflow Package Segmentation Dataset is a curated collection of images specifically tailored for tasks related to package segmentation in the field of computer vision. This dataset is designed to assist researchers, developers, and enthusiasts working on projects related to package identification, sorting, and handling.
Containing a diverse set of images showcasing various packages in different contexts and environments, the dataset serves as a valuable resource for training and evaluating segmentation models. Whether you are engaged in logistics, warehouse automation, or any application requiring precise package analysis, the Package Segmentation Dataset provides a targeted and comprehensive set of images to enhance the performance of your computer vision algorithms.
Dataset Structure
The distribution of data in the Package Segmentation Dataset is structured as follows:
- Training set: Encompasses 1920 images accompanied by their corresponding annotations.
- Testing set: Consists of 89 images, each paired with its respective annotations.
- Validation set: Comprises 188 images, each with corresponding annotations.
Applications
Package segmentation, facilitated by the Package Segmentation Dataset, is crucial for optimizing logistics, enhancing last-mile delivery, improving manufacturing quality control, and contributing to smart city solutions. From e-commerce to security applications, this dataset is a key resource, fostering innovation in computer vision for diverse and efficient package analysis applications.
Dataset YAML
A YAML (Yet Another Markup Language) file is used to define the dataset configuration. It contains information about the dataset's paths, classes, and other relevant information. In the case of the Package Segmentation dataset, the package-seg.yaml
file is maintained at https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/package-seg.yaml.
!!! Example "ultralytics/cfg/datasets/package-seg.yaml"
```py
--8<-- "ultralytics/cfg/datasets/package-seg.yaml"
```
Usage
To train Ultralytics YOLOv8n model on the Package Segmentation dataset for 100 epochs with an image size of 640, you can use the following code snippets. For a comprehensive list of available arguments, refer to the model Training page.
!!! Example "Train Example"
=== "Python"
```py
from ultralytics import YOLO
# Load a model
model = YOLO("yolov8n-seg.pt") # load a pretrained model (recommended for training)
# Train the model
results = model.train(data="package-seg.yaml", epochs=100, imgsz=640)
```
=== "CLI"
```py
# Start training from a pretrained *.pt model
yolo segment train data=package-seg.yaml model=yolov8n-seg.pt epochs=100 imgsz=640
```
Sample Data and Annotations
The Package Segmentation dataset comprises a varied collection of images and videos captured from multiple perspectives. Below are instances of data from the dataset, accompanied by their respective annotations:
- This image displays an instance of image object detection, featuring annotated bounding boxes with masks outlining recognized objects. The dataset incorporates a diverse collection of images taken in different locations, environments, and densities. It serves as a comprehensive resource for developing models specific to this task.
- The example emphasizes the diversity and complexity present in the VisDrone dataset, underscoring the significance of high-quality sensor data for computer vision tasks involving drones.
Citations and Acknowledgments
If you integrate the crack segmentation dataset into your research or development initiatives, please cite the following paper:
!!! Quote ""
=== "BibTeX"
```py
@misc{ factory_package_dataset,
title = { factory_package Dataset },
type = { Open Source Dataset },
author = { factorypackage },
howpublished = { \url{ https://universe.roboflow.com/factorypackage/factory_package } },
url = { https://universe.roboflow.com/factorypackage/factory_package },
journal = { Roboflow Universe },
publisher = { Roboflow },
year = { 2024 },
month = { jan },
note = { visited on 2024-01-24 },
}
```
We express our gratitude to the Roboflow team for their efforts in creating and maintaining the Package Segmentation dataset, a valuable asset for logistics and research projects. For additional details about the Package Segmentation dataset and its creators, please visit the Package Segmentation Dataset Page.
FAQ
What is the Roboflow Package Segmentation Dataset and how can it help in computer vision projects?
The Roboflow Package Segmentation Dataset is a curated collection of images tailored for tasks involving package segmentation. It includes diverse images of packages in various contexts, making it invaluable for training and evaluating segmentation models. This dataset is particularly useful for applications in logistics, warehouse automation, and any project requiring precise package analysis. It helps optimize logistics and enhance vision models for accurate package identification and sorting.
How do I train an Ultralytics YOLOv8 model on the Package Segmentation Dataset?
You can train an Ultralytics YOLOv8n model using both Python and CLI methods. For Python, use the snippet below:
from ultralytics import YOLO
# Load a model
model = YOLO("yolov8n-seg.pt") # load a pretrained model
# Train the model
results = model.train(data="package-seg.yaml", epochs=100, imgsz=640)
For CLI:
# Start training from a pretrained *.pt model
yolo segment train data=package-seg.yaml model=yolov8n-seg.pt epochs=100 imgsz=640
Refer to the model Training page for more details.
What are the components of the Package Segmentation Dataset, and how is it structured?
The dataset is structured into three main components:
- Training set: Contains 1920 images with annotations.
- Testing set: Comprises 89 images with corresponding annotations.
- Validation set: Includes 188 images with annotations.
This structure ensures a balanced dataset for thorough model training, validation, and testing, enhancing the performance of segmentation algorithms.
Why should I use Ultralytics YOLOv8 with the Package Segmentation Dataset?
Ultralytics YOLOv8 provides state-of-the-art accuracy and speed for real-time object detection and segmentation tasks. Using it with the Package Segmentation Dataset allows you to leverage YOLOv8's capabilities for precise package segmentation. This combination is especially beneficial for industries like logistics and warehouse automation, where accurate package identification is critical. For more information, check out our page on YOLOv8 segmentation.
How can I access and use the package-seg.yaml file for the Package Segmentation Dataset?
The package-seg.yaml
file is hosted on Ultralytics' GitHub repository and contains essential information about the dataset's paths, classes, and configuration. You can download it from here. This file is crucial for configuring your models to utilize the dataset efficiently.
For more insights and practical examples, explore our Usage section.
comments: true
description: Learn how to use Multi-Object Tracking with YOLO. Explore dataset formats and see upcoming features for training trackers. Start with Python or CLI examples.
keywords: YOLO, Multi-Object Tracking, Tracking Datasets, Python Tracking Example, CLI Tracking Example, Object Detection, Ultralytics, AI, Machine Learning
Multi-object Tracking Datasets Overview
Dataset Format (Coming Soon)
Multi-Object Detector doesn't need standalone training and directly supports pre-trained detection, segmentation or Pose models. Support for training trackers alone is coming soon
Usage
!!! Example
=== "Python"
```py
from ultralytics import YOLO
model = YOLO("yolov8n.pt")
results = model.track(source="https://youtu.be/LNwODJXcvt4", conf=0.3, iou=0.5, show=True)
```
=== "CLI"
```py
yolo track model=yolov8n.pt source="https://youtu.be/LNwODJXcvt4" conf=0.3, iou=0.5 show
```
FAQ
How do I use Multi-Object Tracking with Ultralytics YOLO?
To use Multi-Object Tracking with Ultralytics YOLO, you can start by using the Python or CLI examples provided. Here is how you can get started:
!!! Example
=== "Python"
```py
from ultralytics import YOLO
model = YOLO("yolov8n.pt") # Load the YOLOv8 model
results = model.track(source="https://youtu.be/LNwODJXcvt4", conf=0.3, iou=0.5, show=True)
```
=== "CLI"
```py
yolo track model=yolov8n.pt source="https://youtu.be/LNwODJXcvt4" conf=0.3 iou=0.5 show
```
These commands load the YOLOv8 model and use it for tracking objects in the given video source with specific confidence (conf
) and Intersection over Union (iou
) thresholds. For more details, refer to the track mode documentation.
What are the upcoming features for training trackers in Ultralytics?
Ultralytics is continuously enhancing its AI models. An upcoming feature will enable the training of standalone trackers. Until then, Multi-Object Detector leverages pre-trained detection, segmentation, or Pose models for tracking without requiring standalone training. Stay updated by following our blog or checking the upcoming features.
Why should I use Ultralytics YOLO for multi-object tracking?
Ultralytics YOLO is a state-of-the-art object detection model known for its real-time performance and high accuracy. Using YOLO for multi-object tracking provides several advantages:
- Real-time tracking: Achieve efficient and high-speed tracking ideal for dynamic environments.
- Flexibility with pre-trained models: No need to train from scratch; simply use pre-trained detection, segmentation, or Pose models.
- Ease of use: Simple API integration with both Python and CLI makes setting up tracking pipelines straightforward.
- Extensive documentation and community support: Ultralytics provides comprehensive documentation and an active community forum to troubleshoot issues and enhance your tracking models.
For more details on setting up and using YOLO for tracking, visit our track usage guide.
Can I use custom datasets for multi-object tracking with Ultralytics YOLO?
Yes, you can use custom datasets for multi-object tracking with Ultralytics YOLO. While support for standalone tracker training is an upcoming feature, you can already use pre-trained models on your custom datasets. Prepare your datasets in the appropriate format compatible with YOLO and follow the documentation to integrate them.
How do I interpret the results from the Ultralytics YOLO tracking model?
After running a tracking job with Ultralytics YOLO, the results include various data points such as tracked object IDs, their bounding boxes, and the confidence scores. Here's a brief overview of how to interpret these results:
- Tracked IDs: Each object is assigned a unique ID, which helps in tracking it across frames.
- Bounding boxes: These indicate the location of tracked objects within the frame.
- Confidence scores: These reflect the model's confidence in detecting the tracked object.
For detailed guidance on interpreting and visualizing these results, refer to the results handling guide.
comments: true
description: Learn to create line graphs, bar plots, and pie charts using Python with guided instructions and code snippets. Maximize your data visualization skills!.
keywords: Ultralytics, YOLOv8, data visualization, line graphs, bar plots, pie charts, Python, analytics, tutorial, guide
Analytics using Ultralytics YOLOv8
Introduction
This guide provides a comprehensive overview of three fundamental types of data visualizations: line graphs, bar plots, and pie charts. Each section includes step-by-step instructions and code snippets on how to create these visualizations using Python.
Visual Samples
Line Graph | Bar Plot | Pie Chart |
---|---|---|
Why Graphs are Important
- Line graphs are ideal for tracking changes over short and long periods and for comparing changes for multiple groups over the same period.
- Bar plots, on the other hand, are suitable for comparing quantities across different categories and showing relationships between a category and its numerical value.
- Lastly, pie charts are effective for illustrating proportions among categories and showing parts of a whole.
!!! Analytics "Analytics Examples"
=== "Line Graph"
```py
import cv2
from ultralytics import YOLO, solutions
model = YOLO("yolov8s.pt")
cap = cv2.VideoCapture("Path/to/video/file.mp4")
assert cap.isOpened(), "Error reading video file"
w, h, fps = (int(cap.get(x)) for x in (cv2.CAP_PROP_FRAME_WIDTH, cv2.CAP_PROP_FRAME_HEIGHT, cv2.CAP_PROP_FPS))
out = cv2.VideoWriter("line_plot.avi", cv2.VideoWriter_fourcc(*"MJPG"), fps, (w, h))
analytics = solutions.Analytics(
type="line",
writer=out,
im0_shape=(w, h),
view_img=True,
)
total_counts = 0
frame_count = 0
while cap.isOpened():
success, frame = cap.read()
if success:
frame_count += 1
results = model.track(frame, persist=True, verbose=True)
if results[0].boxes.id is not None:
boxes = results[0].boxes.xyxy.cpu()
for box in boxes:
total_counts += 1
analytics.update_line(frame_count, total_counts)
total_counts = 0
if cv2.waitKey(1) & 0xFF == ord("q"):
break
else:
break
cap.release()
out.release()
cv2.destroyAllWindows()
```
=== "Multiple Lines"
```py
import cv2
from ultralytics import YOLO, solutions
model = YOLO("yolov8s.pt")
cap = cv2.VideoCapture("Path/to/video/file.mp4")
assert cap.isOpened(), "Error reading video file"
w, h, fps = (int(cap.get(x)) for x in (cv2.CAP_PROP_FRAME_WIDTH, cv2.CAP_PROP_FRAME_HEIGHT, cv2.CAP_PROP_FPS))
out = cv2.VideoWriter("multiple_line_plot.avi", cv2.VideoWriter_fourcc(*"MJPG"), fps, (w, h))
analytics = solutions.Analytics(
type="line",
writer=out,
im0_shape=(w, h),
view_img=True,
max_points=200,
)
frame_count = 0
data = {}
labels = []
while cap.isOpened():
success, frame = cap.read()
if success:
frame_count += 1
results = model.track(frame, persist=True)
if results[0].boxes.id is not None:
boxes = results[0].boxes.xyxy.cpu()
track_ids = results[0].boxes.id.int().cpu().tolist()
clss = results[0].boxes.cls.cpu().tolist()
for box, track_id, cls in zip(boxes, track_ids, clss):
# Store each class label
if model.names[int(cls)] not in labels:
labels.append(model.names[int(cls)])
# Store each class count
if model.names[int(cls)] in data:
data[model.names[int(cls)]] += 1
else:
data[model.names[int(cls)]] = 0
# update lines every frame
analytics.update_multiple_lines(data, labels, frame_count)
data = {} # clear the data list for next frame
else:
break
cap.release()
out.release()
cv2.destroyAllWindows()
```
=== "Pie Chart"
```py
import cv2
from ultralytics import YOLO, solutions
model = YOLO("yolov8s.pt")
cap = cv2.VideoCapture("Path/to/video/file.mp4")
assert cap.isOpened(), "Error reading video file"
w, h, fps = (int(cap.get(x)) for x in (cv2.CAP_PROP_FRAME_WIDTH, cv2.CAP_PROP_FRAME_HEIGHT, cv2.CAP_PROP_FPS))
out = cv2.VideoWriter("pie_chart.avi", cv2.VideoWriter_fourcc(*"MJPG"), fps, (w, h))
analytics = solutions.Analytics(
type="pie",
writer=out,
im0_shape=(w, h),
view_img=True,
)
clswise_count = {}
while cap.isOpened():
success, frame = cap.read()
if success:
results = model.track(frame, persist=True, verbose=True)
if results[0].boxes.id is not None:
boxes = results[0].boxes.xyxy.cpu()
clss = results[0].boxes.cls.cpu().tolist()
for box, cls in zip(boxes, clss):
if model.names[int(cls)] in clswise_count:
clswise_count[model.names[int(cls)]] += 1
else:
clswise_count[model.names[int(cls)]] = 1
analytics.update_pie(clswise_count)
clswise_count = {}
if cv2.waitKey(1) & 0xFF == ord("q"):
break
else:
break
cap.release()
out.release()
cv2.destroyAllWindows()
```
=== "Bar Plot"
```py
import cv2
from ultralytics import YOLO, solutions
model = YOLO("yolov8s.pt")
cap = cv2.VideoCapture("Path/to/video/file.mp4")
assert cap.isOpened(), "Error reading video file"
w, h, fps = (int(cap.get(x)) for x in (cv2.CAP_PROP_FRAME_WIDTH, cv2.CAP_PROP_FRAME_HEIGHT, cv2.CAP_PROP_FPS))
out = cv2.VideoWriter("bar_plot.avi", cv2.VideoWriter_fourcc(*"MJPG"), fps, (w, h))
analytics = solutions.Analytics(
type="bar",
writer=out,
im0_shape=(w, h),
view_img=True,
)
clswise_count = {}
while cap.isOpened():
success, frame = cap.read()
if success:
results = model.track(frame, persist=True, verbose=True)
if results[0].boxes.id is not None:
boxes = results[0].boxes.xyxy.cpu()
clss = results[0].boxes.cls.cpu().tolist()
for box, cls in zip(boxes, clss):
if model.names[int(cls)] in clswise_count:
clswise_count[model.names[int(cls)]] += 1
else:
clswise_count[model.names[int(cls)]] = 1
analytics.update_bar(clswise_count)
clswise_count = {}
if cv2.waitKey(1) & 0xFF == ord("q"):
break
else:
break
cap.release()
out.release()
cv2.destroyAllWindows()
```
=== "Area chart"
```py
import cv2
from ultralytics import YOLO, solutions
model = YOLO("yolov8s.pt")
cap = cv2.VideoCapture("path/to/video/file.mp4")
assert cap.isOpened(), "Error reading video file"
w, h, fps = (int(cap.get(x)) for x in (cv2.CAP_PROP_FRAME_WIDTH, cv2.CAP_PROP_FRAME_HEIGHT, cv2.CAP_PROP_FPS))
out = cv2.VideoWriter("area_plot.avi", cv2.VideoWriter_fourcc(*"MJPG"), fps, (w, h))
analytics = solutions.Analytics(
type="area",
writer=out,
im0_shape=(w, h),
view_img=True,
)
clswise_count = {}
frame_count = 0
while cap.isOpened():
success, frame = cap.read()
if success:
frame_count += 1
results = model.track(frame, persist=True, verbose=True)
if results[0].boxes.id is not None:
boxes = results[0].boxes.xyxy.cpu()
clss = results[0].boxes.cls.cpu().tolist()
for box, cls in zip(boxes, clss):
if model.names[int(cls)] in clswise_count:
clswise_count[model.names[int(cls)]] += 1
else:
clswise_count[model.names[int(cls)]] = 1
analytics.update_area(frame_count, clswise_count)
clswise_count = {}
if cv2.waitKey(1) & 0xFF == ord("q"):
break
else:
break
cap.release()
out.release()
cv2.destroyAllWindows()
```
Argument Analytics
Here's a table with the Analytics
arguments:
Name | Type | Default | Description |
---|---|---|---|
type |
str |
None |
Type of data or object. |
im0_shape |
tuple |
None |
Shape of the initial image. |
writer |
cv2.VideoWriter |
None |
Object for writing video files. |
title |
str |
ultralytics |
Title for the visualization. |
x_label |
str |
x |
Label for the x-axis. |
y_label |
str |
y |
Label for the y-axis. |
bg_color |
str |
white |
Background color. |
fg_color |
str |
black |
Foreground color. |
line_color |
str |
yellow |
Color of the lines. |
line_width |
int |
2 |
Width of the lines. |
fontsize |
int |
13 |
Font size for text. |
view_img |
bool |
False |
Flag to display the image or video. |
save_img |
bool |
True |
Flag to save the image or video. |
max_points |
int |
50 |
For multiple lines, total points drawn on frame, before deleting initial points. |
points_width |
int |
15 |
Width of line points highlighter. |
Arguments model.track
Name | Type | Default | Description |
---|---|---|---|
source |
im0 |
None |
source directory for images or videos |
persist |
bool |
False |
persisting tracks between frames |
tracker |
str |
botsort.yaml |
Tracking method 'bytetrack' or 'botsort' |
conf |
float |
0.3 |
Confidence Threshold |
iou |
float |
0.5 |
IOU Threshold |
classes |
list |
None |
filter results by class, i.e. classes=0, or classes=[0,2,3] |
verbose |
bool |
True |
Display the object tracking results |
Conclusion
Understanding when and how to use different types of visualizations is crucial for effective data analysis. Line graphs, bar plots, and pie charts are fundamental tools that can help you convey your data's story more clearly and effectively.
FAQ
How do I create a line graph using Ultralytics YOLOv8 Analytics?
To create a line graph using Ultralytics YOLOv8 Analytics, follow these steps:
- Load a YOLOv8 model and open your video file.
- Initialize the
Analytics
class with the type set to "line." - Iterate through video frames, updating the line graph with relevant data, such as object counts per frame.
- Save the output video displaying the line graph.
Example:
import cv2
from ultralytics import YOLO, solutions
model = YOLO("yolov8s.pt")
cap = cv2.VideoCapture("Path/to/video/file.mp4")
out = cv2.VideoWriter("line_plot.avi", cv2.VideoWriter_fourcc(*"MJPG"), fps, (w, h))
analytics = solutions.Analytics(type="line", writer=out, im0_shape=(w, h), view_img=True)
while cap.isOpened():
success, frame = cap.read()
if success:
results = model.track(frame, persist=True)
total_counts = sum([1 for box in results[0].boxes.xyxy])
analytics.update_line(frame_count, total_counts)
if cv2.waitKey(1) & 0xFF == ord("q"):
break
cap.release()
out.release()
cv2.destroyAllWindows()
For further details on configuring the Analytics
class, visit the Analytics using Ultralytics YOLOv8