Example #1
0
if __name__ == '__main__':
    # Load in list of MSD entries
    msd_index = whoosh_search.get_whoosh_index(
        os.path.join(DATA_PATH, 'msd', 'index'))
    with msd_index.searcher() as searcher:
        msd_list = list(searcher.documents())

    # Load in list of MSD entries
    midi_index = whoosh_search.get_whoosh_index(
        os.path.join(DATA_PATH, 'clean_midi', 'index'))
    with midi_index.searcher() as searcher:
        midi_list = list(searcher.documents())

    # Load MSD embeddings
    msd_embedding_datas = experiment_utils.load_precomputed_data(
        msd_list, os.path.join(RESULTS_PATH, 'pse_msd_embeddings'))
    # Load in hash sequences (and metadata) for all MSD entries
    msd_sequence_datas = experiment_utils.load_precomputed_data(
        msd_list, os.path.join(RESULTS_PATH, 'dhs_msd_hash_sequences'))
    # Ignore entries with very short sequences
    msd_embedding_datas = [
        e for d, e in zip(msd_sequence_datas, msd_embedding_datas)
        if len(d['hash_sequence']) > MIN_SEQUENCE_LENGTH]
    msd_sequence_datas = [d for d in msd_sequence_datas
                          if len(d['hash_sequence']) > MIN_SEQUENCE_LENGTH]
    # Create a big matrix of the embeddings
    msd_embeddings = np.concatenate(
        [d['embedding'] for d in msd_embedding_datas], axis=0)
    # Construct paths to each feature file
    msd_feature_paths = [
        os.path.join(DATA_PATH, 'msd', 'h5', d['path']) + '.h5'
Example #2
0
if __name__ == '__main__':
    # Load in list of MSD entries
    msd_index = whoosh_search.get_whoosh_index(
        os.path.join(DATA_PATH, 'msd', 'index'))
    with msd_index.searcher() as searcher:
        msd_list = list(searcher.documents())

    # Load in list of MSD entries
    midi_index = whoosh_search.get_whoosh_index(
        os.path.join(DATA_PATH, 'clean_midi', 'index'))
    with midi_index.searcher() as searcher:
        midi_list = list(searcher.documents())

    # Load in hash sequences (and metadata) for all MSD entries
    msd_data = experiment_utils.load_precomputed_data(
        msd_list, os.path.join(RESULTS_PATH, 'tpaa_msd_hash_sequences'))
    # Ignore very short sequences
    msd_data = [d for d in msd_data
                if len(d['hash_sequence']) > MIN_SEQUENCE_LENGTH]

    # Get a list of valid MIDI-MSD match pairs
    midi_msd_mapping = experiment_utils.get_valid_matches(
        os.path.join(RESULTS_PATH, '{}_pairs.csv'.format(SPLIT)),
        SCORE_THRESHOLD,
        os.path.join(RESULTS_PATH, 'clean_midi_aligned', 'h5'))

    midi_datas, midi_index_mapping = experiment_utils.load_valid_midi_datas(
        midi_msd_mapping, msd_data, midi_list,
        os.path.join(RESULTS_PATH, 'tpaa_clean_midi_hash_sequences'))

    # Run match_one_midi for each MIDI data and MSD index list
Example #3
0
if __name__ == '__main__':
    # Load in list of MSD entries
    msd_index = whoosh_search.get_whoosh_index(
        os.path.join(DATA_PATH, 'msd', 'index'))
    with msd_index.searcher() as searcher:
        msd_list = list(searcher.documents())

    # Load in list of MSD entries
    midi_index = whoosh_search.get_whoosh_index(
        os.path.join(DATA_PATH, 'clean_midi', 'index'))
    with midi_index.searcher() as searcher:
        midi_list = list(searcher.documents())

    # Load in hash sequences (and metadata) for all MSD entries
    msd_data = experiment_utils.load_precomputed_data(
        msd_list, os.path.join(RESULTS_PATH, 'tdftm_msd_embeddings'))

    # Get a list of valid MIDI-MSD match pairs
    midi_msd_mapping = experiment_utils.get_valid_matches(
        os.path.join(RESULTS_PATH, '{}_pairs.csv'.format(SPLIT)),
        SCORE_THRESHOLD,
        os.path.join(RESULTS_PATH, 'clean_midi_aligned', 'h5'))

    midi_datas, midi_index_mapping = experiment_utils.load_valid_midi_datas(
        midi_msd_mapping, msd_data, midi_list,
        os.path.join(RESULTS_PATH, 'tdftm_clean_midi_embeddings'))

    # Run match_one_midi for each MIDI data and MSD index list
    results = [experiment_utils.match_embedding(
                   midi_datas[md5], msd_data, midi_index_mapping[md5])
               for md5 in midi_datas]
Example #4
0
    # Load in network parameter values
    lasagne.layers.set_all_param_values(
        layers[-1], network_params['X'])
    # Compile function for computing the output of the network
    hash_fn = theano.function(
        [layers[0].input_var],
        lasagne.layers.get_output(layers[-1], deterministic=True))

    # Load in list of MSD entries
    msd_index = whoosh_search.get_whoosh_index(
        os.path.join(DATA_PATH, 'msd', 'index'))
    with msd_index.searcher() as searcher:
        msd_list = list(searcher.documents())

    # Load MSD embeddings
    msd_embedding_datas = experiment_utils.load_precomputed_data(
        msd_list, os.path.join(RESULTS_PATH, 'pse_msd_embeddings'))
    # Load in hash sequences (and metadata) for all MSD entries
    msd_sequence_datas = experiment_utils.load_precomputed_data(
        msd_list, os.path.join(RESULTS_PATH, 'dhs_msd_hash_sequences'))
    # Ignore entries with very short sequences
    msd_embedding_datas = [
        e for d, e in zip(msd_sequence_datas, msd_embedding_datas)
        if len(d['hash_sequence']) > MIN_SEQUENCE_LENGTH]
    msd_sequence_datas = [d for d in msd_sequence_datas
                          if len(d['hash_sequence']) > MIN_SEQUENCE_LENGTH]
    # Create a big matrix of the embeddings
    msd_embeddings = np.concatenate(
        [d['embedding'] for d in msd_embedding_datas], axis=0)
    # Construct paths to each feature file
    msd_feature_paths = [
        os.path.join(DATA_PATH, 'msd', 'h5', d['path']) + '.h5'
Example #5
0
if __name__ == '__main__':
    # Load in list of MSD entries
    msd_index = whoosh_search.get_whoosh_index(
        os.path.join(DATA_PATH, 'msd', 'index'))
    with msd_index.searcher() as searcher:
        msd_list = list(searcher.documents())

    # Load in list of MSD entries
    midi_index = whoosh_search.get_whoosh_index(
        os.path.join(DATA_PATH, 'clean_midi', 'index'))
    with midi_index.searcher() as searcher:
        midi_list = list(searcher.documents())

    # Load in hash sequences (and metadata) for all MSD entries
    msd_data = experiment_utils.load_precomputed_data(
        msd_list, os.path.join(RESULTS_PATH, 'dhs_piano_msd_hash_sequences'))
    # Ignore very short sequences
    msd_data = [
        d for d in msd_data if len(d['hash_sequence']) > MIN_SEQUENCE_LENGTH
    ]

    # Get a list of valid MIDI-MSD match pairs
    midi_msd_mapping = experiment_utils.get_valid_matches(
        os.path.join(RESULTS_PATH,
                     '{}_pairs.csv'.format(SPLIT)), SCORE_THRESHOLD,
        os.path.join(RESULTS_PATH, 'clean_midi_aligned', 'h5'))

    midi_datas, midi_index_mapping = experiment_utils.load_valid_midi_datas(
        midi_msd_mapping, msd_data, midi_list,
        os.path.join(RESULTS_PATH, 'dhs_piano_clean_midi_hash_sequences'))
Example #6
0
if __name__ == '__main__':
    # Load in list of MSD entries
    msd_index = whoosh_search.get_whoosh_index(
        os.path.join(DATA_PATH, 'msd', 'index'))
    with msd_index.searcher() as searcher:
        msd_list = list(searcher.documents())

    # Load in list of MSD entries
    midi_index = whoosh_search.get_whoosh_index(
        os.path.join(DATA_PATH, 'clean_midi', 'index'))
    with midi_index.searcher() as searcher:
        midi_list = list(searcher.documents())

    # Load in hash sequences (and metadata) for all MSD entries
    msd_data = experiment_utils.load_precomputed_data(
        msd_list, os.path.join(RESULTS_PATH, 'stats_msd_embeddings'))

    # Get a list of valid MIDI-MSD match pairs
    midi_msd_mapping = experiment_utils.get_valid_matches(
        os.path.join(RESULTS_PATH, '{}_pairs.csv'.format(SPLIT)),
        SCORE_THRESHOLD,
        os.path.join(RESULTS_PATH, 'clean_midi_aligned', 'h5'))

    midi_datas, midi_index_mapping = experiment_utils.load_valid_midi_datas(
        midi_msd_mapping, msd_data, midi_list,
        os.path.join(RESULTS_PATH, 'stats_clean_midi_embeddings'))

    # Run match_one_midi for each MIDI data and MSD index list
    results = [
        experiment_utils.match_embedding(
            midi_datas[md5], msd_data, midi_index_mapping[md5])