Default tensorboard=False for speed (#20213)

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
This commit is contained in:
Glenn Jocher 2025-04-18 00:43:42 +02:00 committed by GitHub
parent 1bdc601e4c
commit 39e03c4247
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 53 additions and 36 deletions

View File

@ -21,9 +21,9 @@
},
"source": [
"<div align=\"center\">\n",
"\n",
" <a href=\"https://ultralytics.com/yolo\" target=\"_blank\">\n",
" <img width=\"1024\", src=\"https://raw.githubusercontent.com/ultralytics/assets/main/yolov8/banner-yolov8.png\"></a>\n",
" <img width=\"1024\" src=\"https://raw.githubusercontent.com/ultralytics/assets/main/yolov8/banner-yolov8.png\">\n",
" </a>\n",
"\n",
" [中文](https://docs.ultralytics.com/zh/) | [한국어](https://docs.ultralytics.com/ko/) | [日本語](https://docs.ultralytics.com/ja/) | [Русский](https://docs.ultralytics.com/ru/) | [Deutsch](https://docs.ultralytics.com/de/) | [Français](https://docs.ultralytics.com/fr/) | [Español](https://docs.ultralytics.com/es/) | [Português](https://docs.ultralytics.com/pt/) | [Türkçe](https://docs.ultralytics.com/tr/) | [Tiếng Việt](https://docs.ultralytics.com/vi/) | [العربية](https://docs.ultralytics.com/ar/)\n",
"\n",
@ -35,20 +35,27 @@
" <a href=\"https://ultralytics.com/discord\"><img alt=\"Discord\" src=\"https://img.shields.io/discord/1089800235347353640?logo=discord&logoColor=white&label=Discord&color=blue\"></a>\n",
" <a href=\"https://community.ultralytics.com\"><img alt=\"Ultralytics Forums\" src=\"https://img.shields.io/discourse/users?server=https%3A%2F%2Fcommunity.ultralytics.com&logo=discourse&label=Forums&color=blue\"></a>\n",
" <a href=\"https://reddit.com/r/ultralytics\"><img alt=\"Ultralytics Reddit\" src=\"https://img.shields.io/reddit/subreddit-subscribers/ultralytics?style=flat&logo=reddit&logoColor=white&label=Reddit&color=blue\"></a>\n",
"</div>\n",
"\n",
"Welcome to the Ultralytics YOLO11 🚀 notebook! <a href=\"https://github.com/ultralytics/ultralytics\">YOLO11</a> is the latest version of the YOLO (You Only Look Once) AI models developed by <a href=\"https://ultralytics.com\">Ultralytics</a>. This notebook serves as the starting point for exploring the various resources available to help you get started with YOLO11 and understand its features and capabilities.\n",
"This **Ultralytics Colab Notebook** is the easiest way to get started with [YOLO models](https://www.ultralytics.com/yolo)—no installation needed. Built by [Ultralytics](https://www.ultralytics.com/), the creators of YOLO, this notebook walks you through running **state-of-the-art** models directly in your browser.\n",
"\n",
"YOLO11 models are fast, accurate, and easy to use, making them ideal for various object detection and image segmentation tasks. They can be trained on large datasets and run on diverse hardware platforms, from CPUs to GPUs.\n",
"Ultralytics models are constantly updated for performance and flexibility. They're **fast**, **accurate**, and **easy to use**, and they excel at [object detection](https://docs.ultralytics.com/tasks/detect/), [tracking](https://docs.ultralytics.com/modes/track/), [instance segmentation](https://docs.ultralytics.com/tasks/segment/), [image classification](https://docs.ultralytics.com/tasks/classify/), and [pose estimation](https://docs.ultralytics.com/tasks/pose/).\n",
"\n",
"We hope that the resources in this notebook will help you get the most out of YOLO11. Please browse the YOLO11 <a href=\"https://docs.ultralytics.com/\">Docs</a> for details, raise an issue on <a href=\"https://github.com/ultralytics/ultralytics\">GitHub</a> for support, and join our <a href=\"https://ultralytics.com/discord\">Discord</a> community for questions and discussions!\n",
"Find detailed documentation in the [Ultralytics Docs](https://docs.ultralytics.com/). Get support via [GitHub Issues](https://github.com/ultralytics/ultralytics/issues/new/choose). Join discussions on [Discord](https://discord.com/invite/ultralytics), [Reddit](https://www.reddit.com/r/ultralytics/), and the [Ultralytics Community Forums](https://community.ultralytics.com/)!\n",
"\n",
"Request an Enterprise License for commercial use at [Ultralytics Licensing](https://www.ultralytics.com/license).\n",
"\n",
"<br>\n",
"<div>\n",
" <a href=\"https://www.youtube.com/watch?v=ZN3nRZT7b24\" target=\"_blank\">\n",
" <img src=\"https://img.youtube.com/vi/ZN3nRZT7b24/maxresdefault.jpg\" alt=\"Ultralytics Video\" width=\"720\" style=\"border-radius: 10px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);\"></a>\n",
" \n",
" <img src=\"https://img.youtube.com/vi/ZN3nRZT7b24/maxresdefault.jpg\" alt=\"Ultralytics Video\" width=\"640\" style=\"border-radius: 10px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);\">\n",
" </a>\n",
"\n",
" <p style=\"font-size: 16px; font-family: Arial, sans-serif; color: #555;\">\n",
" <strong>Watch: </strong> How to Train\n",
" <a href=\"https://github.com/ultralytics/ultralytics\">Ultralytics</a>\n",
" <a href=\"https://docs.ultralytics.com/models/yolo11/\">YOLO11</a> Model on Custom Dataset using Google Colab Notebook 🚀</p>\n",
" <a href=\"https://github.com/ultralytics/ultralytics\">Ultralytics</a>\n",
" <a href=\"https://docs.ultralytics.com/models/yolo11/\">YOLO11</a> Model on Custom Dataset using Google Colab Notebook 🚀\n",
" </p>\n",
"</div>"
]
},
@ -79,7 +86,7 @@
"import ultralytics\n",
"ultralytics.checks()"
],
"execution_count": 1,
"execution_count": null,
"outputs": [
{
"output_type": "stream",
@ -115,7 +122,7 @@
"# Run inference on an image with YOLO11n\n",
"!yolo predict model=yolo11n.pt source='https://ultralytics.com/images/zidane.jpg'"
],
"execution_count": 2,
"execution_count": null,
"outputs": [
{
"output_type": "stream",
@ -183,7 +190,7 @@
"# Validate YOLO11n on COCO8 val\n",
"!yolo val model=yolo11n.pt data=coco8.yaml"
],
"execution_count": 3,
"execution_count": null,
"outputs": [
{
"output_type": "stream",
@ -234,14 +241,14 @@
"cell_type": "code",
"source": [
"#@title Select YOLO11 🚀 logger {run: 'auto'}\n",
"logger = 'Comet' #@param ['Comet', 'TensorBoard']\n",
"logger = 'TensorBoard' #@param ['TensorBoard', 'Weights & Biases']\n",
"\n",
"if logger == 'Comet':\n",
" %pip install -q comet_ml\n",
" import comet_ml; comet_ml.init()\n",
"elif logger == 'TensorBoard':\n",
"if logger == 'TensorBoard':\n",
" !yolo settings tensorboard=True\n",
" %load_ext tensorboard\n",
" %tensorboard --logdir ."
" %tensorboard --logdir .\n",
"elif logger == 'Weights & Biases':\n",
" !yolo settings wandb=True"
],
"metadata": {
"id": "ktegpM42AooT"
@ -262,7 +269,7 @@
"# Train YOLO11n on COCO8 for 3 epochs\n",
"!yolo train model=yolo11n.pt data=coco8.yaml epochs=3 imgsz=640"
],
"execution_count": 4,
"execution_count": null,
"outputs": [
{
"output_type": "stream",
@ -401,7 +408,7 @@
"id": "CYIjW4igCjqD",
"outputId": "54c9a0c0-7b49-4b4b-a990-c1f898d10093"
},
"execution_count": 5,
"execution_count": null,
"outputs": [
{
"output_type": "stream",
@ -631,7 +638,7 @@
{
"cell_type": "code",
"source": [
"# Git clone and run tests on updates branch\n",
"# Git clone and run tests on 'main' branch\n",
"!git clone https://github.com/ultralytics/ultralytics -b main\n",
"%pip install -qe ultralytics"
],

View File

@ -14,6 +14,14 @@ from ultralytics.utils import DATASETS_DIR, SETTINGS
from ultralytics.utils.checks import check_requirements
@pytest.mark.slow
def test_tensorboard():
"""Test training with MLflow tracking enabled (see https://mlflow.org/ for details)."""
SETTINGS["tensorboard"] = True
YOLO("yolo11n-cls.yaml").train(data="imagenet10", imgsz=32, epochs=3, plots=False, device="cpu")
SETTINGS["tensorboard"] = False
@pytest.mark.skipif(not check_requirements("ray", install=False), reason="ray[tune] not installed")
def test_model_ray_tune():
"""Tune YOLO model using Ray for hyperparameter optimization."""

View File

@ -1796,6 +1796,9 @@ class Albumentations:
prefix = colorstr("albumentations: ")
try:
import os
os.environ["NO_ALBUMENTATIONS_UPDATE"] = "1" # suppress Albumentations upgrade message
import albumentations as A
check_version(A.__version__, "1.0.3", hard=True) # version requirement

View File

@ -110,14 +110,14 @@ class AutoBackend(nn.Module):
Initialize the AutoBackend for inference.
Args:
weights (str | torch.nn.Module): Path to the model weights file or a module instance. Defaults to 'yolo11n.pt'.
device (torch.device): Device to run the model on. Defaults to CPU.
dnn (bool): Use OpenCV DNN module for ONNX inference. Defaults to False.
weights (str | List[str] | torch.nn.Module): Path to the model weights file or a module instance.
device (torch.device): Device to run the model on.
dnn (bool): Use OpenCV DNN module for ONNX inference.
data (str | Path | optional): Path to the additional data.yaml file containing class names.
fp16 (bool): Enable half-precision inference. Supported only on specific backends. Defaults to False.
fp16 (bool): Enable half-precision inference. Supported only on specific backends.
batch (int): Batch-size to assume for inference.
fuse (bool): Fuse Conv2D + BatchNorm layers for optimization. Defaults to True.
verbose (bool): Enable verbose logging. Defaults to True.
fuse (bool): Fuse Conv2D + BatchNorm layers for optimization.
verbose (bool): Enable verbose logging.
"""
super().__init__()
w = str(weights[0] if isinstance(weights, list) else weights)
@ -288,8 +288,8 @@ class AutoBackend(nn.Module):
# fix error: `np.bool` was a deprecated alias for the builtin `bool` for JetPack 4 with Python <= 3.8.0
check_requirements("numpy==1.23.5")
try:
import tensorrt as trt # noqa https://developer.nvidia.com/nvidia-tensorrt-download
try: # https://developer.nvidia.com/nvidia-tensorrt-download
import tensorrt as trt # noqa
except ImportError:
if LINUX:
check_requirements("tensorrt>7.0.0,!=10.1.0")
@ -562,9 +562,9 @@ class AutoBackend(nn.Module):
Args:
im (torch.Tensor): The image tensor to perform inference on.
augment (bool): Whether to perform data augmentation during inference. Defaults to False.
visualize (bool): Whether to visualize the output predictions. Defaults to False.
embed (list, optional): A list of feature vectors/embeddings to return.
augment (bool): Whether to perform data augmentation during inference.
visualize (bool): Whether to visualize the output predictions.
embed (list | None): A list of feature vectors/embeddings to return.
**kwargs (Any): Additional keyword arguments for model configuration.
Returns:
@ -799,11 +799,10 @@ class AutoBackend(nn.Module):
@staticmethod
def _model_type(p="path/to/model.pt"):
"""
Takes a path to a model file and returns the model type. Possibles types are pt, jit, onnx, xml, engine, coreml,
saved_model, pb, tflite, edgetpu, tfjs, ncnn, mnn, imx or paddle.
Takes a path to a model file and returns the model type.
Args:
p (str): Path to the model file. Defaults to path/to/model.pt
p (str): Path to the model file.
Returns:
(List[bool]): List of booleans indicating the model type.

View File

@ -1243,7 +1243,7 @@ class SettingsManager(JSONDict):
"mlflow": True, # MLflow integration
"neptune": True, # Neptune integration
"raytune": True, # Ray Tune integration
"tensorboard": True, # TensorBoard logging
"tensorboard": False, # TensorBoard logging
"wandb": False, # Weights & Biases logging
"vscode_msg": True, # VSCode messaging
}