Code

Banana Detection Dataset Demonstration Code Implementation

To verify the data loading process for an object detection dataset, it is beneficial to programmatically visualize a sample of the images overlaid with their ground-truth bounding boxes. For instance, after loading a minibatch from the banana detection dataset, the images can be plotted alongside bounding boxes extracted from the label tensor. The following code demonstrates this visualization:

imgs = (batch[0][:10].permute(0, 2, 3, 1)) / 255 axes = d2l.show_images(imgs, 2, 5, scale=2) for ax, label in zip(axes, batch[1][:10]): d2l.show_bboxes(ax, [label[0][1:5] * edge_size], colors=['w'])

0

1

Updated 2026-05-20

Contributors are:

Who are from:

Tags

D2L

Dive into Deep Learning @ D2L