type=int, default=0, help='index of the image to visualize activations for') parser.add_argument('--vis-alayer', type=int, default=0, help='index of the layer to visualize (0-23)') args = parser.parse_args() args.cuda = not args.no_cuda and torch.cuda.is_available() torch.manual_seed(args.seed) if args.cuda: torch.cuda.manual_seed(args.seed) val_ds = CarvanaDataset() val_ds.initialize(args, phase='val') kwargs = {'num_workers': 1, 'pin_memory': True} if args.cuda else {} val_loader = DataLoader(val_ds, batch_size=args.batch_size, drop_last=True, **kwargs) model = CarvanaFvbNet() print(model) print('\nloading model params') model.load_state_dict( torch.load('./checkpoints/latest_{}.pth'.format(args.which_epoch))) if args.cuda: model.cuda() print('\nload complete!')
help='SGD momentum (default: 0.5)') parser.add_argument('--no-cuda', action='store_true', default=False, help='disables CUDA training') parser.add_argument('--seed', type=int, default=1, metavar='S', help='random seed (default: 1)') parser.add_argument('--log-interval', type=int, default=10, metavar='N', help='how many batches to wait before logging training status') args = parser.parse_args() args.cuda = not args.no_cuda and torch.cuda.is_available() torch.manual_seed(args.seed) if args.cuda: torch.cuda.manual_seed(args.seed) test_ds = CarvanaDataset() test_ds.initialize(args, phase='test') kwargs = {'num_workers': 1, 'pin_memory': True} if args.cuda else {} test_loader = DataLoader(test_ds, batch_size=args.batch_size, drop_last=True, **kwargs) model = CarvanaFvbNet() model.load_state_dict(torch.load('./checkpoints/latest_{}.pth'.format(args.which_epoch))) if args.cuda: model.cuda() def test(): model.eval() print(model) test_loss = 0 correct = 0 for data, target, dsidx in test_loader: if args.cuda:
help='random seed (default: 1)') parser.add_argument( '--log-interval', type=int, default=10, metavar='N', help='how many batches to wait before logging training status') args = parser.parse_args() args.cuda = not args.no_cuda and torch.cuda.is_available() torch.manual_seed(args.seed) if args.cuda: torch.cuda.manual_seed(args.seed) train_ds = CarvanaDataset() train_ds.initialize(args, phase='train') test_ds = CarvanaDataset() test_ds.initialize(args, phase='test') kwargs = {'num_workers': 1, 'pin_memory': True} if args.cuda else {} train_loader = DataLoader(train_ds, batch_size=args.batch_size, drop_last=True, shuffle=True, **kwargs) test_loader = DataLoader(test_ds, batch_size=args.batch_size, drop_last=True, **kwargs) model = CarvanaFvbNet() if args.cuda: