for i, file in enumerate(weights_files): print(str(i) + " : " + file) print("---------------------------------------") file_number_weights = int( input('Type in the number in front of the file you want to choose:')) weights_file = weights_files[file_number_weights] weights_path = '%s%s' % (weights_dir, weights_file) print("loading model...") model = model_from_json(open(model_path).read()) print("loading weights...") model.load_weights(weights_path) print("Compiling model...") model.compile(loss='binary_crossentropy', optimizer='adam') print("Compose2...") net_output = [] net_roll = [] for i, song in enumerate(test_data): net_output.append(model.predict(song)) net_roll.append( data_utils_compose.NetOutToPianoRoll(net_output[i], threshold=thresh)) data_utils_compose.createMidiFromPianoRoll(net_roll[i], mel_lowest_note, composition_dir, composition_files[i], thresh) orig = glob.glob('data/test/*.mid') composed = glob.glob('data/split/test_left/*.mid') for i, j in zip(orig, composed): data_utils_compose.merge_left_right(i, j)
model = model_from_json(open(model_path).read()) print() print("loading weights...") model.load_weights(weights_path) print() print("Compiling model...") model.compile(loss='binary_crossentropy', optimizer='adam', class_mode=class_mode) print() print("Compose...") for i, song in enumerate(test_data): net_output = model.predict(song) #print("net_output:", net_output) net_roll = data_utils_compose.NetOutToPianoRoll(net_output, threshold=thresh) #print("net_roll:", net_roll) #print("net_roll.shape", net_roll.shape) data_utils_compose.createMidiFromPianoRoll(net_roll, mel_lowest_note, composition_dir, composition_files[i], thresh, res_factor=resolution_factor) print("Finished composing song %d." % (i + 1)) print() print("Dope!")
weights_path = '%s%s' %(weights_dir, weights_file) print() print("loading model...") model = model_from_json(open(model_path).read()) print() print("loading weights...") model.load_weights(weights_path) print() print("Compiling model...") model.compile(loss='binary_crossentropy', optimizer='adam', class_mode=class_mode) print() print("Compose...") for i, song in enumerate(test_data): net_output = model.predict(song) #print("net_output:", net_output) net_roll = data_utils_compose.NetOutToPianoRoll(net_output, threshold=thresh) #print("net_roll:", net_roll) #print("net_roll.shape", net_roll.shape) data_utils_compose.createMidiFromPianoRoll(net_roll, mel_lowest_note, composition_dir, composition_files[i], thresh, res_factor=resolution_factor) print("Finished composing song %d." %(i+1)) print() print("Dope!")