def load_yaml(): """load config from yaml""" yaml_name = util.CONFIG_DIR + util.TRAIN_YAML print('trainging network configuration file is {0}'.format(yaml_name)) util.check_file_exist(yaml_name) config = util.load_yaml_file(yaml_name) return config
def dataset_loading_3RScan(root:str, pth_selection:str,split:str,class_choice:list=None): pth_catfile = os.path.join(pth_selection, 'classes.txt') classNames = util.read_txt_to_list(pth_catfile) pth_relationship = os.path.join(pth_selection, 'relationships.txt') util.check_file_exist(pth_relationship) relationNames = util.read_relationships(pth_relationship) selected_scans=set() if split == 'train_scans' : selected_scans = selected_scans.union(util.read_txt_to_list(os.path.join(pth_selection,'train_scans.txt'))) elif split == 'validation_scans': selected_scans = selected_scans.union(util.read_txt_to_list(os.path.join(pth_selection,'validation_scans.txt'))) elif split == 'test_scans': selected_scans = selected_scans.union(util.read_txt_to_list(os.path.join(pth_selection,'test_scans.txt'))) else: raise RuntimeError('unknown split type.') with open(os.path.join(root, 'relationships_train.json'), "r") as read_file: data1 = json.load(read_file) with open(os.path.join(root, 'relationships_validation.json'), "r") as read_file: data2 = json.load(read_file) data = dict() data['scans'] = data1['scans'] + data2['scans'] if 'neighbors' in data1: data['neighbors'] = {**data1['neighbors'], **data2['neighbors']} return classNames, relationNames, data, selected_scans
def __init__(self, filename: str): check_file_exist(filename) self.filename = filename
def load_yaml(yaml_name): """load config from yaml""" print('training network configuration file is {0}'.format(yaml_name)) util.check_file_exist(yaml_name) config = util.load_yaml_file(yaml_name) return config