Use the vessl.Image class to log image data. This takes the image data and saves it as a local PNG file in the vessl-media/image directory with randomly generated names.

ParameterDescription
data

Supported types - PIL Image: the Image module of Pillow

- torch.Tensor: a PyTorch tensor

- numpy.ndarray: a NumPy array

- str: the image path

captionLabel of the given image

PIL Image

import vessl
from PIL import Image

my_PIL_image = Image.open('my-image.png')
vessl.Image(
    data=my_PIL_image,
    caption='my-caption',
)

torch.Tensor

import vessl
import torch

vessl.Image()
test_loader = torch.utils.data.DataLoader(
                test_dataset, batch_size=10, shuffle=True)
for data, target in test_loader:
    vessl.Image(
        data=data[0], 
        caption=f'Target:{target[0]}',
    )

numpy.ndarray

import vessl
import numpy as np

my_np_image = np.array([[0,1,1,0],[1,0,0,1],[0,1,1,0]]) 
vessl.Image(
    data= my_np_image,
    caption='my-caption',
)

str

import vessl

my_image_path = 'my-image.png'
vessl.Image(
    data=my_image_path,
    caption='my-caption',
)