Are you sure you want to delete this access key?
comments | description | keywords |
---|---|---|
true | Learn to simplify the logging of YOLO11 training with Comet ML. This guide covers installation, setup, real-time insights, and custom logging. | YOLO11, Comet ML, logging, machine learning, training, model checkpoints, metrics, installation, configuration, real-time insights, custom logging |
Logging key training details such as parameters, metrics, image predictions, and model checkpoints is essential in machine learningβit keeps your project transparent, your progress measurable, and your results repeatable.
Watch: How to Use Comet ML for Ultralytics YOLO Model Training Logs and Metrics π
Ultralytics YOLO11 seamlessly integrates with Comet ML, efficiently capturing and optimizing every aspect of your YOLO11 object detection model's training process. In this guide, we'll cover the installation process, Comet ML setup, real-time insights, custom logging, and offline usage, ensuring that your YOLO11 training is thoroughly documented and fine-tuned for outstanding results.
Comet ML is a platform for tracking, comparing, explaining, and optimizing machine learning models and experiments. It allows you to log metrics, parameters, media, and more during your model training and monitor your experiments through an aesthetically pleasing web interface. Comet ML helps data scientists iterate more rapidly, enhances transparency and reproducibility, and aids in the development of production models.
By combining Ultralytics YOLO11 with Comet ML, you unlock a range of benefits. These include simplified experiment management, real-time insights for quick adjustments, flexible and tailored logging options, and the ability to log experiments offline when internet access is limited. This integration empowers you to make data-driven decisions, analyze performance metrics, and achieve exceptional results.
To install the required packages, run:
!!! tip "Installation"
=== "CLI"
```bash
# Install the required packages for YOLO11 and Comet ML
pip install ultralytics comet_ml torch torchvision
```
After installing the required packages, you'll need to sign up, get a Comet API Key, and configure it.
!!! tip "Configuring Comet ML"
=== "CLI"
```bash
# Set your Comet Api Key
export COMET_API_KEY=YOUR_API_KEY
```
Then, you can initialize your Comet project. Comet will automatically detect the API key and proceed with the setup.
!!! example "Initialize Comet project"
=== "Python"
```python
import comet_ml
comet_ml.login(project_name="comet-example-yolo11-coco128")
```
If you are using a Google Colab notebook, the code above will prompt you to enter your API key for initialization.
Before diving into the usage instructions, be sure to check out the range of YOLO11 models offered by Ultralytics. This will help you choose the most appropriate model for your project requirements.
!!! example "Usage"
=== "Python"
```python
from ultralytics import YOLO
# Load a model
model = YOLO("yolo11n.pt")
# Train the model
results = model.train(
data="coco8.yaml",
project="comet-example-yolo11-coco128",
batch=32,
save_period=1,
save_json=True,
epochs=3,
)
```
After running the training code, Comet ML will create an experiment in your Comet workspace to track the run automatically. You will then be provided with a link to view the detailed logging of your YOLO11 model's training process.
Comet automatically logs the following data with no additional configuration: metrics such as mAP and loss, hyperparameters, model checkpoints, interactive confusion matrix, and image bounding box predictions.
Let's dive into what you'll see on the Comet ML dashboard once your YOLO11 model begins training. The dashboard is where all the action happens, presenting a range of automatically logged information through visuals and statistics. Here's a quick tour:
Experiment Panels
The experiment panels section of the Comet ML dashboard organize and present the different runs and their metrics, such as segment mask loss, class loss, precision, and mean average precision.
Metrics
In the metrics section, you have the option to examine the metrics in a tabular format as well, which is displayed in a dedicated pane as illustrated here.
Interactive Confusion Matrix
The confusion matrix, found in the Confusion Matrix tab, provides an interactive way to assess the model's classification accuracy. It details the correct and incorrect predictions, allowing you to understand the model's strengths and weaknesses.
System Metrics
Comet ML logs system metrics to help identify any bottlenecks in the training process. It includes metrics such as GPU utilization, GPU memory usage, CPU utilization, and RAM usage. These are essential for monitoring the efficiency of resource usage during model training.
Comet ML offers the flexibility to customize its logging behavior by setting environment variables. These configurations allow you to tailor Comet ML to your specific needs and preferences. Here are some helpful customization options:
You can control the number of image predictions that Comet ML logs during your experiments. By default, Comet ML logs 100 image predictions from the validation set. However, you can change this number to better suit your requirements. For example, to log 200 image predictions, use the following code:
import os
os.environ["COMET_MAX_IMAGE_PREDICTIONS"] = "200"
Comet ML allows you to specify how often batches of image predictions are logged. The COMET_EVAL_BATCH_LOGGING_INTERVAL
environment variable controls this frequency. The default setting is 1, which logs predictions from every validation batch. You can adjust this value to log predictions at a different interval. For instance, setting it to 4 will log predictions from every fourth batch.
import os
os.environ["COMET_EVAL_BATCH_LOGGING_INTERVAL"] = "4"
In some cases, you may not want to log the confusion matrix from your validation set after every epoch. You can disable this feature by setting the COMET_EVAL_LOG_CONFUSION_MATRIX
environment variable to "false." The confusion matrix will only be logged once, after the training is completed.
import os
os.environ["COMET_EVAL_LOG_CONFUSION_MATRIX"] = "false"
If you find yourself in a situation where internet access is limited, Comet ML provides an offline logging option. You can set the COMET_MODE
environment variable to "offline" to enable this feature. Your experiment data will be saved locally in a directory that you can later upload to Comet ML when internet connectivity is available.
import os
os.environ["COMET_MODE"] = "offline"
This guide has walked you through integrating Comet ML with Ultralytics' YOLO11. From installation to customization, you've learned to streamline experiment management, gain real-time insights, and adapt logging to your project's needs.
Explore Comet ML's official documentation for more insights on integrating with YOLO11.
Furthermore, if you're looking to dive deeper into the practical applications of YOLO11, specifically for image segmentation tasks, this detailed guide on fine-tuning YOLO11 with Comet ML offers valuable insights and step-by-step instructions to enhance your model's performance.
Additionally, to explore other exciting integrations with Ultralytics, check out the integration guide page, which offers a wealth of resources and information.
To integrate Comet ML with Ultralytics YOLO11, follow these steps:
Install the required packages:
pip install ultralytics comet_ml torch torchvision
Set up your Comet API Key:
export COMET_API_KEY=YOUR_API_KEY
Initialize your Comet project in your Python code:
import comet_ml
comet_ml.login(project_name="comet-example-yolo11-coco128")
Train your YOLO11 model and log metrics:
from ultralytics import YOLO
model = YOLO("yolo11n.pt")
results = model.train(
data="coco8.yaml",
project="comet-example-yolo11-coco128",
batch=32,
save_period=1,
save_json=True,
epochs=3,
)
For more detailed instructions, refer to the Comet ML configuration section.
By integrating Ultralytics YOLO11 with Comet ML, you can:
By leveraging these features, you can optimize your machine learning workflows for better performance and reproducibility. For more information, visit the Comet ML integration guide.
Comet ML allows for extensive customization of its logging behavior using environment variables:
Change the number of image predictions logged:
import os
os.environ["COMET_MAX_IMAGE_PREDICTIONS"] = "200"
Adjust batch logging interval:
import os
os.environ["COMET_EVAL_BATCH_LOGGING_INTERVAL"] = "4"
Disable confusion matrix logging:
import os
os.environ["COMET_EVAL_LOG_CONFUSION_MATRIX"] = "false"
Refer to the Customizing Comet ML Logging section for more customization options.
Once your YOLO11 model starts training, you can access a wide range of metrics and visualizations on the Comet ML dashboard. Key features include:
For a detailed overview of these features, visit the Understanding Your Model's Performance with Comet ML Visualizations section.
Yes, you can enable offline logging in Comet ML by setting the COMET_MODE
environment variable to "offline":
import os
os.environ["COMET_MODE"] = "offline"
This feature allows you to log your experiment data locally, which can later be uploaded to Comet ML when internet connectivity is available. This is particularly useful when working in environments with limited internet access. For more details, refer to the Offline Logging section.
Press p or to see the previous file or, n or to see the next file
Are you sure you want to delete this access key?
Are you sure you want to delete this access key?
Are you sure you want to delete this access key?
Are you sure you want to delete this access key?