VESSL Docs
Search…
vessl.Image
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.
Parameter
Description
data
Supported types - PIL Image: the Image module of Pillow
- torch.Tensor: a PyTorch tensor
- numpy.ndarray: a NumPy array
- str: the image path
caption
Label of the given image

PIL Image

1
import vessl
2
from PIL import Image
3
4
my_PIL_image = Image.open('my-image.png')
5
vessl.Image(
6
data=my_PIL_image,
7
caption='my-caption',
8
)
Copied!

torch.Tensor

1
import vessl
2
import torch
3
4
vessl.Image()
5
test_loader = torch.utils.data.DataLoader(
6
test_dataset, batch_size=10, shuffle=True)
7
for data, target in test_loader:
8
vessl.Image(
9
data=data[0],
10
caption=f'Target:{target[0]}',
11
)
Copied!

numpy.ndarray

1
import vessl
2
import numpy as np
3
4
my_np_image = np.array([[0,1,1,0],[1,0,0,1],[0,1,1,0]])
5
vessl.Image(
6
data= my_np_image,
7
caption='my-caption',
8
)
Copied!

str

1
import vessl
2
3
my_image_path = 'my-image.png'
4
vessl.Image(
5
data=my_image_path,
6
caption='my-caption',
7
)
8
Copied!
Last modified 5d ago