Ultralytics YOLO27: Join the waitlist.
Get Started

Elevating YOLO26 Training: Simplify Your Logging Process with Comet

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 for Ultralytics YOLO Model Training Logs and Metrics 🚀

Ultralytics YOLO26 integrates with Comet (formerly Comet ML) to capture the training process of your YOLO26 object detection models. This guide covers installation, Comet setup, real-time insights, custom logging, and offline usage, so that your YOLO26 training runs are documented and reproducible.

Comet#

Comet ML experiment tracking dashboard

Comet 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 a web interface. Comet helps data scientists iterate more rapidly, enhances transparency and reproducibility, and aids in the development of production models.

Harnessing the Power of YOLO26 and Comet#

Combining Ultralytics YOLO26 with Comet offers several benefits, including simplified experiment tracking, 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 helps you make data-driven decisions and analyze performance metrics.

Installation#

To install the required packages, run:

Installation
# Install YOLO26 and Comet
pip install ultralytics comet_ml

Configuring Comet#

After installing the required packages, you'll need to sign up, get a Comet API Key, and configure it.

Configuring Comet
# Set your Comet API Key
export COMET_API_KEY=YOUR_API_KEY

Then, authenticate with Comet. The Ultralytics callback creates the experiment and uses the YOLO project training argument as the Comet project name.

Initialize Comet project
import comet_ml

comet_ml.login()

If you are using a Google Colab notebook, the code above will prompt you to enter your API key for initialization.

Usage#

Usage
from ultralytics import YOLO

# Load a model
model = YOLO("yolo26n.pt")

# Train the model
results = model.train(
    data="coco8.yaml",
    project="comet-example-yolo26-coco128",
    batch=32,
    save_period=1,
    save_json=True,
    epochs=3,
)

After running the training code, Comet 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 YOLO26 model's training process.

Once Comet is installed and configured, its callback is enabled by default and logs metrics such as mAP and loss, hyperparameters, model checkpoints, and an interactive confusion matrix. Image bounding box predictions from the validation set are logged for detect and segment training with save_json=True. Run yolo settings comet=False to disable the integration.

Understanding Your Model's Performance with Comet Visualizations#

Once your YOLO26 model begins training, the Comet dashboard presents automatically logged information through visuals and statistics:

Experiment Panels

The experiment panels section of the Comet dashboard organizes and presents the different runs and their metrics, such as segment mask loss, class loss, precision, and mean average precision.

Comet experiment panels comparing YOLO26 training runs and metrics

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.

Comet metrics pane listing YOLO26 training metrics in a table

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.

Comet interactive confusion matrix for YOLO26 validation results

System Metrics

Comet 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 system metrics showing GPU and CPU utilization during training

Customizing Comet Logging#

Comet offers the flexibility to customize its logging behavior by setting environment variables. These configurations allow you to tailor Comet to your specific needs and preferences. The Ultralytics callback reads the following environment variables (set them before training starts):

Environment VariableDefaultDescription
COMET_START_ONLINE1Run the experiment in online (1) or offline (0) mode.
COMET_PROJECT_NAMEargs.projectComet workspace project. Falls back to the YOLO project training argument when unset.
COMET_MODEL_NAMEUltralyticsName registered for the logged model artifact.
COMET_MAX_IMAGE_PREDICTIONS100Total number of validation image predictions to log per run.
COMET_EVAL_BATCH_LOGGING_INTERVAL1Log image predictions every Nth validation batch.
COMET_EVAL_LOG_IMAGE_PREDICTIONStrueToggle image prediction logging on (true) or off (false).
COMET_EVAL_LOG_CONFUSION_MATRIXfalseLog a confusion matrix at each save_period checkpoint. A final matrix is always logged after training.
COMET_MAX_CONFIDENCE_SCORE100.0Multiplier applied to detection confidence scores before logging (Comet's UI expects a percentage scale).
COMET_MODE (deprecated)onlineLegacy alias of COMET_START_ONLINE ("online" ↔ 1, "offline" ↔ 0). Emits a deprecation warning.

For the boolean toggles (COMET_EVAL_LOG_IMAGE_PREDICTIONS and COMET_EVAL_LOG_CONFUSION_MATRIX), the values 1, true, yes, on, y, and t are parsed as True (case-insensitive). Any other value is False.

Logging Image Predictions#

You can control the number of image predictions that Comet logs during your experiments. With save_json=True, Comet logs up to 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"

To disable annotated image prediction logging (for example, to reduce upload volume on slow connections), set COMET_EVAL_LOG_IMAGE_PREDICTIONS to "false":

import os

os.environ["COMET_EVAL_LOG_IMAGE_PREDICTIONS"] = "false"

The train_batch*.jpg and val_batch*.jpg plot images are still logged at the end of training.

Batch Logging Interval#

Comet 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"

Per-Epoch Confusion Matrix Logging#

By default, the confusion matrix from your validation set is logged once, after the training is completed. To also log it at every checkpoint saved by save_period (save_period=1 saves every epoch), set the COMET_EVAL_LOG_CONFUSION_MATRIX environment variable to "true."

import os

os.environ["COMET_EVAL_LOG_CONFUSION_MATRIX"] = "true"

Online and Offline Mode#

By default, Comet runs in online mode and streams experiment data to the Comet servers. If you need to train without internet access, set COMET_START_ONLINE=0 before training starts. Experiment data is saved locally and can be uploaded later with the comet upload CLI.

import os

os.environ["COMET_START_ONLINE"] = "0"  # 1 (default) = online, 0 = offline
`COMET_MODE` is deprecated

Earlier versions used COMET_MODE="offline" for this purpose. The variable is still honored for backward compatibility but emits a deprecation warning. Use COMET_START_ONLINE going forward.

Project Name#

By default, the Comet callback passes the YOLO project training argument to Comet (or None when the argument is unset, in which case Comet uses your workspace default). Override this with COMET_PROJECT_NAME to send all experiments to a specific Comet workspace project regardless of the YOLO training argument:

import os

os.environ["COMET_PROJECT_NAME"] = "my-yolo26-experiments"

Model Artifact Name#

COMET_MODEL_NAME sets the name Comet registers for the logged model artifact (defaults to Ultralytics). Use it to differentiate model variants in a shared workspace:

import os

os.environ["COMET_MODEL_NAME"] = "yolo26n-coco128"

Confidence Score Scaling#

Detection confidence scores are emitted in the [0, 1] range, but the Comet UI displays them on a percentage scale by default. The callback multiplies each score by COMET_MAX_CONFIDENCE_SCORE (default 100.0) before logging. Adjust this if you prefer raw probabilities or a different scale:

import os

os.environ["COMET_MAX_CONFIDENCE_SCORE"] = "1.0"  # log raw [0, 1] scores

Summary#

This guide has walked you through integrating Comet with Ultralytics YOLO26. 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's official YOLOv8 integration documentation, which also applies to YOLO26 projects.

FAQ#

  • To integrate Comet with Ultralytics YOLO26, follow these steps:

    1. Install the required packages:

      pip install ultralytics comet_ml
    2. Set up your Comet API Key:

      export COMET_API_KEY=YOUR_API_KEY
    3. Authenticate with Comet in your Python code:

      import comet_ml
      
      comet_ml.login()
    4. Train your YOLO26 model and log metrics:

      from ultralytics import YOLO
      
      model = YOLO("yolo26n.pt")
      results = model.train(
          data="coco8.yaml",
          project="comet-example-yolo26-coco128",
          batch=32,
          save_period=1,
          save_json=True,
          epochs=3,
      )

    For more detailed instructions, refer to the Comet configuration section.

  • By integrating Ultralytics YOLO26 with Comet, you can:

    • Monitor real-time insights: Get instant feedback on your training results, allowing for quick adjustments.
    • Log extensive metrics: Automatically capture essential metrics such as mAP, loss, hyperparameters, and model checkpoints.
    • Track experiments offline: Log your training runs locally when internet access is unavailable.
    • Compare different training runs: Use the interactive Comet dashboard to analyze and compare multiple experiments.

    With these features, you can optimize your machine learning workflows for better performance and reproducibility.

  • Comet 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"
    • Log the confusion matrix at every save_period checkpoint:

      import os
      
      os.environ["COMET_EVAL_LOG_CONFUSION_MATRIX"] = "true"
    • Set the Comet project name:

      import os
      
      os.environ["COMET_PROJECT_NAME"] = "my-yolo26-experiments"
    • Set the logged model artifact name:

      import os
      
      os.environ["COMET_MODEL_NAME"] = "yolo26n-coco128"

    See the Customizing Comet Logging section for the full list, including image prediction toggles, confidence score scaling, and online/offline mode.

  • Once your YOLO26 model starts training, you can access a wide range of metrics and visualizations on the Comet dashboard. Key features include:

    • Experiment Panels: View different runs and their metrics, including segment mask loss, class loss, and mean average precision.
    • Metrics: Examine metrics in tabular format for detailed analysis.
    • Interactive Confusion Matrix: Assess classification accuracy with an interactive confusion matrix.
    • System Metrics: Monitor GPU and CPU utilization, memory usage, and other system metrics.

    For a detailed overview of these features, visit the Understanding Your Model's Performance with Comet Visualizations section.

  • Yes. Set COMET_START_ONLINE=0 before training starts to log locally:

    import os
    
    os.environ["COMET_START_ONLINE"] = "0"

    Experiment data is saved on disk and can be uploaded to Comet later with the comet upload CLI when connectivity is available. The earlier COMET_MODE="offline" variable still works but emits a deprecation warning. For more details, see the Online and Offline Mode section.

Comments5

Ask a question, share your results, or help someone else.

  1. lauravchrobaklauravchrobakGitHub

    I am getting this warning when using the above workflow, 'comet_ml.init() is deprecated and will be removed soon. Please use comet_ml.login()' perhaps the above should be updated to use comet_ml.login() instead?

    1. Paula DerrengerPaula DerrengerUltralytics

      @lauravchrobak thank you for pointing that out. The warning indicates that comet_ml.init() is deprecated and should be replaced with comet_ml.login(). We will update the documentation accordingly. For now, please use comet_ml.login() to avoid the deprecation warning. If you encounter any further issues, ensure you are using the latest versions of the packages. For more details, you can visit the Comet ML integration guide.

      1
    2. Glenn JocherGlenn JocherUltralytics

      Thank you for your feedback! We've updated our documentation to use comet_ml.login() instead of the deprecated comet_ml.init(). This should resolve the warning you're encountering. If you have any other questions or need further assistance, feel free to ask. For more details, you can visit the Comet ML integration guide.