Ultralytics YOLO27: Join the waitlist.
Get Started

Creating a Minimum Reproducible Example for Bug Reports#

When submitting a bug report for Ultralytics YOLO repositories, it's essential to provide a Minimum Reproducible Example (MRE). An MRE is a small, self-contained piece of code that demonstrates the problem you're experiencing. Providing an MRE helps maintainers and contributors understand the issue and work on a fix more efficiently. This guide explains how to create an MRE when submitting bug reports to Ultralytics YOLO repositories.

1. Isolate the Problem#

The first step in creating an MRE is to isolate the problem. Remove any unnecessary code or dependencies that are not directly related to the issue. Focus on the specific part of the code that is causing the problem and eliminate any irrelevant sections.

2. Use Public Models and Datasets#

When creating an MRE, use publicly available models and datasets to reproduce the issue. For example, use the YOLO26n model (yolo26n.pt) and the COCO8 dataset (coco8.yaml). This ensures that the maintainers and contributors can easily run your example and investigate the problem without needing access to proprietary data or custom models.

3. Include All Necessary Dependencies#

Ensure all necessary dependencies are included in your MRE. If your code relies on external libraries, specify the required packages and their versions. Ideally, list the dependencies in your bug report using yolo checks if you have ultralytics installed or pip list for other tools.

4. Write a Clear Description of the Issue#

Provide a clear and concise description of the issue you're experiencing. Explain the expected behavior and the actual behavior you're encountering. If applicable, include any relevant error messages or logs.

5. Format Your Code Properly#

Format your code properly using code blocks in the issue description. This makes it easier for others to read and understand your code. In GitHub, you can create a code block by wrapping your code with triple backticks (```) and specifying the language:

```python
# Your Python code goes here
```

6. Test Your MRE#

Before submitting your MRE, test it to ensure that it accurately reproduces the issue. Make sure that others can run your example without any issues or modifications.

Example of an MRE#

Here's an example of an MRE for a hypothetical bug report:

Bug description:

When running inference on a 0-channel image, I get an error related to the dimensions of the input tensor.

MRE:

import torch

from ultralytics import YOLO

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

# Load a 0-channel image
image = torch.rand(1, 0, 640, 640)

# Run the model
results = model(image)

Error message:

RuntimeError: Expected input[1, 0, 640, 640] to have 3 channels, but got 0 channels instead

Dependencies:

  • torch==2.8.0
  • ultralytics==8.4.142

In this example, the MRE demonstrates the issue with a minimal amount of code, uses a public model ("yolo26n.pt"), includes all necessary dependencies, and provides a clear description of the problem along with the error message.

By following these guidelines, you'll help the maintainers and contributors of Ultralytics YOLO repositories understand and resolve your issue more efficiently.

FAQ#

  • To create an effective Minimum Reproducible Example (MRE) for bug reports in Ultralytics YOLO repositories, follow these steps:

    1. Isolate the Problem: Remove any code or dependencies that are not directly related to the issue.
    2. Use Public Models and Datasets: Use public resources like yolo26n.pt and coco8.yaml for easier reproducibility.
    3. Include All Necessary Dependencies: Specify required packages and their versions. You can list dependencies using yolo checks if you have ultralytics installed or pip list.
    4. Write a Clear Description of the Issue: Explain the expected and actual behavior, including any error messages or logs.
    5. Format Your Code Properly: Use code blocks to format your code, making it easier to read.
    6. Test Your MRE: Ensure your MRE reproduces the issue without modifications.

    For a detailed guide, see Creating a Minimum Reproducible Example.

  • Using publicly available models and datasets in your MRE ensures that maintainers can easily run your example without needing access to proprietary data. This allows for quicker and more efficient issue resolution. For instance, using the yolo26n.pt model and coco8.yaml dataset helps standardize and simplify the debugging process. Learn more about public models and datasets in the Use Public Models and Datasets section.

  • A comprehensive bug report for Ultralytics YOLO should include:

    • Clear Description: Explain the issue, expected behavior, and actual behavior.
    • Error Messages: Include any relevant error messages or logs.
    • Dependencies: List required dependencies and their versions.
    • MRE: Provide a Minimum Reproducible Example.
    • Steps to Reproduce: Outline the steps needed to reproduce the issue.

    For a complete checklist, refer to the Write a Clear Description of the Issue section.

  • To format your code properly when submitting a bug report on GitHub:

    • Use triple backticks (```) to create code blocks.
    • Specify the programming language for syntax highlighting, e.g., ```python.
    • Ensure your code is indented correctly for readability.

    Example:

    ```python
    # Your Python code goes here
    ```

    For more tips on code formatting, see Format Your Code Properly.

  • Before submitting your MRE, make sure to:

    • Verify the issue is reproducible.
    • Ensure all dependencies are listed and correct.
    • Remove any unnecessary code.
    • Test the MRE to ensure it reproduces the issue without modifications.

    For a detailed checklist, visit the Test Your MRE section.

Comments5

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

  1. AVON257AVON257GitHub

    Thanks for this, I'll get back to you as soon as I can, although it was the lvis dataset that produced these errors.

    Does that make any difference?

    On Wed, 26 Feb 2025, 17:00 Glenn Jocher, @.***> wrote:

    @AVON257 https://github.com/AVON257 hi Tom, thanks for reporting this. To help us investigate, please create a Minimum Reproducible Example using the COCO8-OBB dataset and share your exact training/validation commands, dependency versions (yolo checks), and complete error logs. The validation logic is handled in the Val mode - you can review the source code in the Ultralytics repository.

    For potential contributions, we welcome PRs that follow our Contributing Guide including signed CLA and Google-style docstrings. The community will appreciate your improvements to YOLO compatibility across hardware platforms.

    — Reply to this email directly, view it on GitHub https://github.com/orgs/ultralytics/discussions/19445#discussioncomment-12328645, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMWQGN6XUAOONBP7JBOKO7L2RXXLTAVCNFSM6AAAAABX5TFNQWVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTEMZSHA3DINI . You are receiving this because you were mentioned.Message ID: @.*** com>

    1. Glenn JocherGlenn JocherUltralytics

      @AVON257 hi there! While the LVIS dataset context is helpful, we still need a Minimum Reproducible Example with the COCO8-OBB dataset (or another public dataset) to efficiently investigate this issue. Please share your exact training/validation commands, yolo checks output, and full error traceback when using a public dataset. This standardized approach helps us resolve issues faster for everyone. For MRE guidelines, see Creating a Minimum Reproducible Example. 😊

  2. AVON257AVON257GitHub

    Hi, I'd just like to mention that I have found a bug on the validation model (if it is a bug), where when I train a nano sized OBB model on YOLO 12 unfortunately it either produces Nan's during training or it won't validate on my RTX3090, even though it isn't showing that it's using too much memory when I try it with any batch size.

    Any ideas on this?

    Thanks,

    Tom T.

    P.S. I am actively working on combining this with quantum circuits but in order to do that, I need to be able to test it against the classical baseline, and curiously it seems okay on Colab when I tried it on an A100 but not on my RTX3090.

    P.P.S. I would very much like to submit a commit to you once I finish my current work on the latest version of Ultralytics if you don't mind, although I should tell you that it will only work with optimal performance on Nvidia hardware at the moment. It can work on other things too, it just won't work as fast that way.

    1. AVON257AVON257GitHub

      In fact I would debug it myself if I could figure out which part of ultralytics deals with validation, any ideas?

    2. Glenn JocherGlenn JocherUltralytics

      @AVON257 hi Tom, thanks for reporting this. To help us investigate, please create a Minimum Reproducible Example using the COCO8-OBB dataset and share your exact training/validation commands, dependency versions (yolo checks), and complete error logs. The validation logic is handled in the Val mode - you can review the source code in the Ultralytics repository.

      For potential contributions, we welcome PRs that follow our Contributing Guide including signed CLA and Google-style docstrings. The community will appreciate your improvements to YOLO compatibility across hardware platforms.