print('Checkpoint {} saved !'.format(epoch + 1)) logger.image_summary( 'train_images', [vis_image.cpu().numpy() for vis_image in vis_images], step=tot_step_count) if __name__ == '__main__': if net_name == 'unet': model = UNet(n_channels=3, n_classes=2) else: model = HNNNet(pretrained=True, class_number=2) if config.D_MULTIPLY: dnet = DNet(input_dim=3, output_dim=1, input_size=config.PATCH_SIZE) else: dnet = DNet(input_dim=4, output_dim=1, input_size=config.PATCH_SIZE) g_optimizer = optim.SGD(model.parameters(), lr=config.G_LEARNING_RATE, momentum=0.9, weight_decay=0.0005) d_optimizer = optim.SGD(dnet.parameters(), lr=config.D_LEARNING_RATE, momentum=0.9, weight_decay=0.0005) resume = config.RESUME_MODEL if resume: if os.path.isfile(resume): print("=> loading checkpoint '{}'".format(resume))
'train_images', [vis_image.cpu().numpy() for vis_image in vis_images], step=tot_step_count) if __name__ == '__main__': if net_name == 'unet': model = UNet(n_channels=3, n_classes=2) else: model = HNNNet(pretrained=True, class_number=2) if config.USE_DNET: if config.D_MULTIPLY: dnet = DNet(input_dim=3, output_dim=1, input_size=config.PATCH_SIZE) else: dnet = DNet(input_dim=4, output_dim=1, input_size=config.PATCH_SIZE) else: dnet = None resume = config.RESUME_MODEL if resume: if os.path.isfile(resume): print("=> loading checkpoint '{}'".format(resume)) checkpoint = torch.load(resume) start_epoch = checkpoint['epoch'] + 1 start_step = checkpoint['step']