lo(number_images)
array[100, 64, 64, 3] n=1228800 xโ[0., 1.000] ฮผ=0.784 ฯ=0.171
# We need to form the images inro a rectangular area. For this, we might
# need to add some dummy images to the last row, whoch might be not be full.
n_extra_images = n_rows*n_cols - t.shape[0]
if n_extra_images:
extra_images = np.ones((n_extra_images, *t.shape[1:]))
# extra_images = torch.ones((n_extra_images, *t.shape[1:]))
t = np.concatenate([ t, extra_images ])
# This is where the fun begins! Imagine 't' is tensor[20, 128, 128, 3].
# and we want 5 rows, 4 columns each.
t = t.reshape(n_rows, n_cols, *t.shape[-3:])
# Now t is tensor[5, 4, 128, 128, 3]
t = t.transpose(0, 2, 1, 3, 4)
# now t is tensor[5, 128, 4, 128, 3]
# If we just squick dimensions 0,1 and 2,3 togerther, we get the image we want.
t = t.reshape(n_rows*xy_shape[0], n_cols*xy_shape[1], n_channels)
tile2d (t:numpy.ndarray, view_width=966)
Tile images in a grid.
Type | Default | Details | |
---|---|---|---|
t | ndarray | Array containing images, shape=(n,h,w,c) | |
view_width | int | 966 | Try to protuce an images at most this wide |
Combine with utils.pad.pad_frame_gutters
to make it look better
hypertile (t:numpy.ndarray, frame_px=1, gutter_px=3, view_width=966)
Recursively tile images on a 2d grid
Type | Default | Details | |
---|---|---|---|
t | ndarray | torch.Tensor, # input tensor, shape=([โฆ], B, H, W, C) | |
frame_px | int | 1 | Frame width for the innermost group |
gutter_px | int | 3 | Gutter width for the innermost group |
view_width | int | 966 | Try to protuce an images at most this wide |
array[2, 5, 10, 64, 64, 3] n=1228800 xโ[0., 1.000] ฮผ=0.784 ฯ=0.171