def load_meta_data(datasets): meta_data_train_all = [] meta_data_eval_all = [] for dataset in datasets: name = dataset['name'] root_path = dataset['path'] meta_file_train = dataset['meta_file_train'] meta_file_val = dataset['meta_file_val'] preprocessor = get_preprocessor_by_name(name) meta_data_train = preprocessor(root_path, meta_file_train) if meta_file_val is None: meta_data_eval, meta_data_train = split_dataset(meta_data_train) else: meta_data_eval = preprocessor(root_path, meta_file_val) meta_data_train_all += meta_data_train meta_data_eval_all += meta_data_eval return meta_data_train_all, meta_data_eval_all
def load_meta_data(datasets): meta_data_train_all = [] meta_data_eval_all = [] for dataset in datasets: name = dataset['name'] root_path = dataset['path'] meta_file_train = dataset['meta_file_train'] meta_file_val = dataset['meta_file_val'] preprocessor = get_preprocessor_by_name(name) meta_data_train = preprocessor(root_path, meta_file_train) print( f" | > Found {len(meta_data_train)} files in {Path(root_path).resolve()}" ) if meta_file_val is None: meta_data_eval, meta_data_train = split_dataset(meta_data_train) else: meta_data_eval = preprocessor(root_path, meta_file_val) meta_data_train_all += meta_data_train meta_data_eval_all += meta_data_eval return meta_data_train_all, meta_data_eval_all
def load_meta_data(datasets, eval_split=True): meta_data_train_all = [] meta_data_eval_all = [] if eval_split else None for dataset in datasets: name = dataset['name'] root_path = dataset['path'] meta_file_train = dataset['meta_file_train'] meta_file_val = dataset['meta_file_val'] # setup the right data processor preprocessor = get_preprocessor_by_name(name) # load train set meta_data_train = preprocessor(root_path, meta_file_train) print( f" | > Found {len(meta_data_train)} files in {Path(root_path).resolve()}" ) # load evaluation split if set if eval_split: if meta_file_val is None: meta_data_eval, meta_data_train = split_dataset( meta_data_train) else: meta_data_eval = preprocessor(root_path, meta_file_val) meta_data_eval_all += meta_data_eval meta_data_train_all += meta_data_train # load attention masks for duration predictor training if 'meta_file_attn_mask' in dataset and dataset[ 'meta_file_attn_mask'] is not None: meta_data = dict( load_attention_mask_meta_data(dataset['meta_file_attn_mask'])) for idx, ins in enumerate(meta_data_train_all): attn_file = meta_data[ins[1]].strip() meta_data_train_all[idx].append(attn_file) if meta_data_eval_all is not None: for idx, ins in enumerate(meta_data_eval_all): attn_file = meta_data[ins[1]].strip() meta_data_eval_all[idx].append(attn_file) return meta_data_train_all, meta_data_eval_all