##### get model version and data version exp_name = cfg.config.split('/')[-1][:-5] model_name = exp_name.split('_')[0] data_name = exp_name.split('_')[-1] ##### model logger.info('=> creating model ...') logger.info('Classes: {}'.format(cfg.classes)) if model_name == 'pointgroup': from model.pointgroup.pointgroup import PointGroup as Network from model.pointgroup.pointgroup import model_fn_decorator 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(
exp_name = cfg.config.split('/')[-1][:-5] model_name = exp_name.split('_')[0] data_name = exp_name.split('_')[-1] cfg.dataset='train_weakly' ##### model #logger.info('=> creating model ...') ##logger.info('Classes: {}'.format(cfg.classes)) if model_name == 'pointgroup': from model.pointgroup.pointgroup import PointGroup as Network from model.pointgroup.pointgroup import model_fn_decorator 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
##### get model version and data version exp_name = cfg.config.split('/')[-1][:-5] model_name = exp_name.split('_')[0] data_name = exp_name.split('_')[-1] ##### model logger.info('=> creating model ...') logger.info('Classes: {}'.format(cfg.classes)) if model_name == 'pointgroup': from model.pointgroup.pointgroup import PointGroup as Network from model.pointgroup.pointgroup import model_fn_decorator 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
##### get model version and data version exp_name = cfg.config.split('/')[-1][:-5] model_name = exp_name.split('_')[0] data_name = exp_name.split('_')[-1] ##### model logger.info('=> creating model ...') if model_name == 'pointgroup': from model.pointgroup.pointgroup import PointGroup as Network from model.pointgroup.pointgroup import model_fn_decorator else: print("Error: no model - " + 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: {}'.format(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)