diff --git a/server/visualdl/lib.py b/server/visualdl/lib.py index 3764b58fb1bfd05d3dfe7eaf2849070f41de21d9..4aae5b5129f1620babe501f1013b525387db77f0 100644 --- a/server/visualdl/lib.py +++ b/server/visualdl/lib.py @@ -118,10 +118,12 @@ def get_invididual_image(storage, mode, tag, step_index, max_size=80): image = reader.image(tag) record = image.record(step_index, offset) + shape = record.shape() + data = np.array(record.data(), dtype='uint8').reshape(record.shape()) tempfile = NamedTemporaryFile(mode='w+b', suffix='.png') with Image.fromarray(data) as im: - size = max(record.shape[0], record.shape[1]) + size = max(shape[0], shape[1]) if size > max_size: scale = max_size * 1. / size im = im.resize(shape[:2])