Uploading data as a Training Run artifact
1. Filepath
If a string is provided then this argument will be treated like a filesystem path and the image will be opened and uploaded. The image type will be inferred from the file extension. To follow the code snippet please fetch sigopt_logo.png.
2. PIL.Image.Image
If a PIL Image is provided then it will be converted to PNG and uploaded.
This snippet will change the white pixels in the image to purple, save the data to the PIL Image frame, and upload it to the run context.
3. numpy.ndarray
If a numpy array is provided, the values will be clamped to the range [0, 255] and then cast to unsigned 8-bit integers. The resulting array will be converted to PNG and then uploaded.
In this snippet we reuse the PIL Image frame to log a grayscale, 2D numpy array.
4. matplotlib.figure.Figure
If a matplotlib Figure is provided then it will be converted to SVG and uploaded.
Here we log a matplotlib Figure by counting the number of white pixels in each column of the 2D numpy array and plotting the value on the y axis vs the column position.
Last updated