peal.training.loggers.log_images_to_writer¶
- peal.training.loggers.log_images_to_writer(dataloader, writer, tag='train')[source]¶
Write up to three sample batches of a dataloader to TensorBoard.
For a
DataloaderMixerthat does not concatenate batches, batches are drawn from its first (and, for the third grid, second) underlying loader. Images are mapped to[0, 1]with the dataset’sproject_to_pytorch_defaultwhen available; if the dataset offersdiffusion_augmentationthe augmented batch is written as a second grid. The tag encodes the batch index and, for 1-D labels, the label list. The mixer is reset before and after so training starts from fresh iterators.- Parameters:
dataloader (
torch.utils.data.DataLoaderorDataloaderMixer) – Source of the batches;dataloader.datasetmust be reachable.writer (
torch.utils.tensorboard.SummaryWriter) – Destination of the image grids.tag (
str) – Prefix of the image tags, e.g."train"or"val".