KerasCV Object Detection Integrations
Utilities and callbacks integrating Weights & Biases with the object detection systems present in KerasCV.
WandBDetectionVisualizationCallback
Bases: Callback
Callback for visualizing ground-truth and predicted bounding boxes in an
epoch-wise manner for an object-detection task for
KerasCV. The callback logs a
wandb.Table
with columns for the epoch,
the images overlayed with an interactive bounding box overlay corresponding to the
ground-truth and predicted boudning boxes, the number of ground-truth bounding
boxes and the predicted mean-confidence for each class.
Examples:
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dataset |
Dataset
|
A batched dataset consisting of Ragged Tensors.
This can be obtained by applying |
required |
class_mapping |
Dict[int, str]
|
A dictionary that maps the index of the classes to the corresponding class names. |
required |
max_batches_to_visualize |
Optional[int]
|
Maximum number of batches from the dataset to be visualized. |
1
|
iou_threshold |
float
|
IoU threshold for non-max suppression during prediction. |
0.01
|
confidence_threshold |
float
|
Confidence threshold for non-max suppression during prediction. |
0.01
|
source_bounding_box_format |
str
|
Format of the source bounding box, one of
|
'xywh'
|
title |
str
|
Title under which the table will be logged to the Weights & Biases workspace. |
'Evaluation-Table'
|
Source code in wandb_addons/keras/detection/callback.py
13 14 15 16 17 18 19 20 21 22 23 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 173 174 175 176 177 178 179 180 181 |
|
log_predictions_to_wandb(image_batch, prediction_batch, class_mapping, source_bbox_format='xywh')
Function to log inference results to a wandb.Table with images overlayed with an interactive bounding box overlay corresponding to the predicted boxes.
Example notebooks:
Parameters:
Name | Type | Description | Default |
---|---|---|---|
image_batch |
Union[KerasTensor, array]
|
The batch of resized and batched images that is also passed to the model. |
required |
prediction_batch |
Union[KerasTensor, array]
|
The prediction batch that is the output of the detection model. |
required |
class_mapping |
Dict[int, str]
|
A dictionary that maps the index of the classes to the corresponding class names. |
required |
source_bbox_format |
str
|
Format of the source bounding box, one of |
'xywh'
|
Source code in wandb_addons/keras/detection/inference.py
visualize_dataset(dataset, class_mapping, title, max_batches_to_visualize=1, source_bbox_format='xywh')
Function to visualize a dataset using a wandb.Table with 2 columns, one with the images overlayed with an interactive bounding box overlay corresponding to the predicted boxes and another showing the number of bounding boxes corresponding to that image.
Example notebooks:
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dataset |
Dataset
|
A batched dataset consisting of Ragged Tensors.
This can be obtained by applying |
required |
class_mapping |
Dict[int, str]
|
A dictionary that maps the index of the classes to the corresponding class names. |
required |
title |
str
|
Title under which the table will be logged to the Weights & Biases workspace. |
required |
max_batches_to_visualize |
Optional[int]
|
Maximum number of batches from the dataset to be visualized. |
1
|
source_bbox_format |
str
|
Format of the source bounding box, one of |
'xywh'
|