import utils from config import add_eval_args from data import PartNetDataset, Tree sys.setrecursionlimit(5000) # this code uses recursion a lot for code simplicity parser = ArgumentParser() parser = add_eval_args(parser) eval_conf = parser.parse_args() # load train config conf = torch.load(os.path.join(eval_conf.model_path, eval_conf.exp_name, 'conf.pth')) eval_conf.data_path = conf.data_path # load object category information Tree.load_category_info(conf.category) # merge training and evaluation configurations, giving evaluation parameters precendence conf.__dict__.update(eval_conf.__dict__) # load model models = utils.get_model_module(conf.model_version) # set up device device = torch.device(conf.device) print(f'Using device: {conf.device}') # check if eval results already exist. If so, delete it. if os.path.exists(os.path.join(conf.result_path, conf.exp_name)): response = input('Eval results for "%s" already exists, overwrite? (y/n) ' % (conf.exp_name)) if response != 'y':
parser.add_argument("--template_symmetric_type", type=str, help='[gen] template symmetric type', default='max') # shared parameters parser.add_argument("--feat_len", type=int, help='[gen/dis] feature length', default=256) parser.add_argument("--hidden_len", type=int, help='[gen/dis] hidden length', default=256) # parse parameters args = parser.parse_args() # generate other parameters args.data_dir = './data/%s_geo' % args.category args.pg_dir = './stats/part_trees/%s_all_no_other_less_than_10_parts-train' % args.category ### preparation # load category information Tree.load_category_info(args.category) # output directory if args.pg_idx is not None: out_dir = os.path.join('pretrained_ckpts', 'test-%s-%04d' % (args.category, args.pg_idx)) elif args.pg_json is not None: out_dir = os.path.join('pretrained_ckpts', 'test-%s-%s' % (args.category, args.pg_json.split('.')[0])) else: print('ERROR: you have to specify pg_idx or pg_json!') exit(1) if os.path.exists(out_dir): if not args.y: response = input('Output directory "%s" already exists, overwrite? (y/n) ' % out_dir) if response != 'y': exit(0)