Open rraminen opened 4 years ago
In cyclegan.ipynb and cyclegan_ws.ipynb, show_best(fnames, losses, gen, n):
Would this be the right fix:
def show_best(fnames, losses, gen, n=8): sort_idx = losses.argsort().cpu() _,axs = plt.subplots(n//2, 4, figsize=(12,2*n)) xb = get_batch(fnames[sort_idx][:n], tfms, size=128) with torch.no_grad(): fakes = gen(xb) xb,fakes = (1+xb.cpu())/2,(1+fakes.cpu())/2 for i in range(n): axs.flatten()[2*i].imshow(xb[i].permute(1,2,0)) axs.flatten()[2*i].axis('off') axs.flatten()[2*i+1].imshow(fakes[i].permute(1,2,0)) axs.flatten()[2*i+1].set_title(losses[sort_idx][i].item()) axs.flatten()[2*i+1].axis('off')
In cyclegan.ipynb and cyclegan_ws.ipynb, show_best(fnames, losses, gen, n):
Would this be the right fix: