def plot_step(sample): # reshape [C, H, W] -> [W, H, C] # sample = sample.permute(2, 1, 0) # sample = sample.contiguous().view(1024, 3) # sample = sample.cpu().data.numpy() # plot for i in range(1024): img = sample[:i + 1, :] filepath = sample_path + '/step_{:04d}.png'.format(i) Plotter.plot_pc_color(img, filepath) print(i)
def plot_samples(samples, epoch, name, nsamples=1, color=False): # reshape [N, C, H, W] -> [N, W, H, C] samples = samples.permute(0, 3, 2, 1) samples = samples.contiguous().view(samples.shape[0], 1024, 3) samples = samples.cpu().data.numpy() # plot for i in range(nsamples): img = samples[i, :, :] filepath = sample_path + '/{}_{}_{}.png'.format(name, epoch, i) if color: Plotter.plot_pc_color(img, filepath) else: Plotter.plot_pc(img, filepath)