# load config parameters used in 'audio_representation.py', config_json = config_file.DATA_FOLDER + config[ 'audio_representation_folder'] + 'config.json' with open(config_json, "r") as f: params = json.load(f) config['audio_rep'] = params # set patch parameters config['xInput'] = config['n_frames'] config['yInput'] = config['audio_rep']['n_mels'] # load audio representation paths file_index = config_file.DATA_FOLDER + config[ 'audio_representation_folder'] + 'index.tsv' [audio_repr_paths, id2audio_repr_path] = shared.load_id2audioReprPath(file_index) # load training ground truth file_ground_truth_train = config_file.DATA_FOLDER + config['gt_train'] [all_ids_train, id2gt_train] = shared.load_id2gt(file_ground_truth_train) [_, id2label_train] = shared.load_id2label(file_ground_truth_train) label2ids_train = shared.load_label2ids(id2label_train) # load test ground truth file_ground_truth_test = config_file.DATA_FOLDER + config['gt_test'] [all_ids_test, id2gt_test] = shared.load_id2gt(file_ground_truth_test) [_, id2label_test] = shared.load_id2label(file_ground_truth_test) label2ids_test = shared.load_label2ids(id2label_test) # set output according to the experimental setup classes_vector = list(range(config['num_classes_dataset']))
# which experiment we want to evaluate? parser = argparse.ArgumentParser() parser.add_argument('experiment', help='Id of the configuration dictionary') args = parser.parse_args() experiment = args.experiment experiment_folder = config_file.DATA_FOLDER + 'experiments/' + str( experiment) + '/' config = json.load(open(experiment_folder + 'config.json')) print('Experiment: ' + str(experiment)) print('\n' + str(config)) # load all audio representation paths [audio_repr_paths, id2audio_repr_path] = shared.load_id2audioReprPath(FILE_INDEX) # load ground truth FILE_GROUND_TRUTH_TEST = config_file.DATA_FOLDER + 'index/' + DATASET + '/gt_' + DATASET + '_fold' + str( config['fold']) + '_test.tsv' [ids, id2gt] = shared.load_id2gt(FILE_GROUND_TRUTH_TEST) [_, id2label] = shared.load_id2label(FILE_GROUND_TRUTH_TEST) print(FILE_GROUND_TRUTH_TEST) # pescador: define (finite, batched & parallel) streamer pack = [config, 'overlap_sampling', 1] streams = [ pescador.Streamer(transfer_train.data_gen, id, id2audio_repr_path[id], id2gt[id], pack) for id in ids ] mux_stream = pescador.ChainMux(streams, mode='exhaustive')