Ultralytics Integration
Weights & Biases integration with Ultralytics.
WandBUltralyticsCallback
Stateful callback for logging model checkpoints, predictions, and
ground-truth annotations with interactive overlays for bounding boxes
to Weights & Biases Tables during training, validation and prediction
for a ultratytics
workflow.
Warning
This callback has been deprecated in favor of the feature-complete
integration with Ultralytics
which was shipped with Weights & Biases Release v0.15.10.
Instead of using from wandb_addons.ultralytics import add_wandb_callback
please use from wandb.integration.ultralytics import add_wandb_callback
.
Example
Usage:
from ultralytics.yolo.engine.model import YOLO
import wandb
from wandb_addons.ultralytics import add_wandb_callback
# initialize wandb run
wandb.init(project="YOLOv8")
# initialize YOLO model
model = YOLO("yolov8n.pt")
# add wandb callback
add_wandb_callback(model, max_validation_batches=2, enable_model_checkpointing=True)
# train
model.train(data="coco128.yaml", epochs=5, imgsz=640)
# validate
model.val()
# perform inference
model(['img1.jpeg', 'img2.jpeg'])
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model |
YOLO
|
YOLO Model. |
required |
max_validation_batches |
int
|
maximum number of validation batches to log to a table per epoch. |
1
|
enable_model_checkpointing |
bool
|
enable logging model checkpoints as artifacts
at the end of eveny epoch if set to |
False
|
Source code in wandb_addons/ultralytics/callback.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
|
callbacks: Dict[str, Callable]
property
Property contains all the relevant callbacks to add to the YOLO model for the Weights & Biases logging.
add_wandb_callback(model, enable_model_checkpointing=False, enable_train_validation_logging=True, enable_validation_logging=True, enable_prediction_logging=True, max_validation_batches=1)
Function to add the WandBUltralyticsCallback
callback to the YOLO
model.
Warning
This callback has been deprecated in favor of the feature-complete
integration with Ultralytics
which was shipped with Weights & Biases Release v0.15.10.
Instead of using from wandb_addons.ultralytics import add_wandb_callback
please use from wandb.integration.ultralytics import add_wandb_callback
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model |
YOLO
|
YOLO Model. |
required |
enable_model_checkpointing |
bool
|
enable logging model checkpoints as artifacts
at the end of eveny epoch if set to |
False
|
enable_train_validation_logging |
bool
|
enable logging the predictions and
ground-truths as interactive image overlays on the images from the validation
dataloader to a |
True
|
enable_validation_logging |
bool
|
enable logging the predictions and
ground-truths as interactive image overlays on the images from the validation
dataloader to a |
True
|
enable_prediction_logging |
bool
|
enable logging the predictions and
ground-truths as interactive image overlays on the images from the validation
dataloader to a |
True
|
max_validation_batches |
int
|
maximum number of validation batches to log to a table per epoch. |
1
|