else: print("Error: no model version " + model_name) exit(0) model = Network(cfg) use_cuda = torch.cuda.is_available() logger.info('cuda available: {}'.format(use_cuda)) assert use_cuda model = model.cuda() # logger.info(model) logger.info('#classifier parameters (model): {}'.format( sum([x.nelement() for x in model.parameters()]))) ##### model_fn (criterion) model_fn = model_fn_decorator(test=True) ##### load model utils.checkpoint_restore( model, cfg.exp_path, cfg.config.split('/')[-1][:-5], use_cuda, cfg.test_epoch, dist=False, f=cfg.pretrain ) # resume from the latest epoch, or specify the epoch to restore ##### evaluate test(model, model_fn, data_name, cfg.test_epoch)
sum([x.nelement() for x in model.parameters()]))) ##### optimizer if cfg.optim == 'Adam': optimizer = optim.Adam(filter(lambda p: p.requires_grad, model.parameters()), lr=cfg.lr) elif cfg.optim == 'SGD': optimizer = optim.SGD(filter(lambda p: p.requires_grad, model.parameters()), lr=cfg.lr, momentum=cfg.momentum, weight_decay=cfg.weight_decay) ##### model_fn (criterion) model_fn = model_fn_decorator() import data.scannetv2_inst dataset = data.scannetv2_inst.Dataset() dataset.trainLoader() dataset.valLoader() ##### dataset '''if cfg.dataset == 'scannetv2': if data_name == 'scannet': else: print("Error: no data loader - " + data_name) exit(0)''' ##### resume start_epoch = utils.checkpoint_restore(