#Create Piano Roll Representation of the MIDI files. Return: 3-dimensional array or shape (num_midi_files, maximum num of ticks, note range) chord_roll = data_utils_train.fromMidiCreatePianoRoll(chord_train_files, chord_ticks, chord_lowest_note, chord_highest_note, res_factor=resolution_factor) mel_roll = data_utils_train.fromMidiCreatePianoRoll(mel_train_files, mel_ticks, mel_lowest_note, mel_highest_note, res_factor=resolution_factor) #Double each chord_roll and mel_roll. Preprocessing to create Input and Target Vector for Network double_chord_roll = data_utils_train.doubleRoll(chord_roll) double_mel_roll = data_utils_train.doubleRoll(mel_roll) #Create Network Inputs: #Input_data Shape: (num of training samples, num of timesteps=sequence length, note range) #Target_data Shape: (num of training samples, note range) input_data, target_data = data_utils_train.createNetInputs(double_chord_roll, double_mel_roll, seq_length=chord_ticks) input_data = input_data.astype(np.bool) target_data = target_data.astype(np.bool) input_dim = input_data.shape[2] output_dim = target_data.shape[1] print() print("For how many epochs do you wanna train?") num_epochs = int(input('Num of Epochs:')) print() print() print("Choose a batch size:")
res_factor=resolution_factor) mel_roll = data_utils_train.fromMidiCreatePianoRoll( mel_train_files, mel_ticks, mel_lowest_note, mel_highest_note, res_factor=resolution_factor) #Double each chord_roll and mel_roll. Preprocessing to create Input and Target Vector for Network double_chord_roll = data_utils_train.doubleRoll(chord_roll) double_mel_roll = data_utils_train.doubleRoll(mel_roll) #Create Network Inputs: #Input_data Shape: (num of training samples, num of timesteps=sequence length, note range) #Target_data Shape: (num of training samples, note range) input_data, target_data = data_utils_train.createNetInputs( double_chord_roll, double_mel_roll, seq_length=chord_ticks) input_data = input_data.astype(np.bool) target_data = target_data.astype(np.bool) input_dim = input_data.shape[2] output_dim = target_data.shape[1] print() print("For how many epochs do you wanna train?") num_epochs = int(input('Num of Epochs:')) print() print() print("Choose a batch size:") print( "(Batch size determines how many training samples per gradient-update are used. --> Number of gradient-updates per epoch: Num of samples / batch size)"
import data_utils_train import numpy as np import time from keras.models import Sequential from keras.layers.recurrent import LSTM from keras.layers import Bidirectional, Dropout from keras.utils import plot_model import Attention train = True mel_roll, chord_roll = roll(train) double_chord_roll = data_utils_train.doubleRoll(chord_roll) double_mel_roll = data_utils_train.doubleRoll(mel_roll) input_data, target_data = data_utils_train.createNetInputs( double_mel_roll, double_chord_roll, 8) input_data = input_data.astype(np.bool) target_data = target_data.astype(np.bool) del double_chord_roll, double_mel_roll, mel_roll, chord_roll input_dim = input_data.shape[2] output_dim = target_data.shape[1] print("For how many epochs do you wanna train?") num_epochs = int(input('Num of Epochs:')) print("Choose a batch size:") print( "(Batch size determines how many training samples per gradient-update are used. --> Number of gradient-updates per epoch: Num of samples / batch size)" )