In [1]:
from collections import defaultdict
import datetime
from keras.callbacks import EarlyStopping, ModelCheckpoint
from keras.layers import Activation, Concatenate, Conv2D, Dense, Dropout, Flatten, MaxPooling2D
from keras.models import Input, Model, load_model, model_from_json
from librosa import cqt
import numpy as np
import os
import pickle
import shutil
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.metrics import accuracy_score, classification_report, f1_score, precision_score, recall_score
from sklearn.model_selection import KFold, StratifiedKFold
from sklearn.preprocessing import StandardScaler
import sys
from warnings import warn
from zipfile import ZipFile

module_path = os.path.abspath('..')
if module_path not in sys.path:
    sys.path.append(module_path)
from music_transcription.pitch_detection.cnn_cqt_pitch_detection import CnnCqtFeatureExtractor
from music_transcription.pitch_detection.read_data import get_wav_and_truth_files, read_data_y


Using Theano backend.
WARNING (theano.sandbox.cuda): The cuda backend is deprecated and will be removed in the next release (v0.10).  Please switch to the gpuarray backend. You can get more information about how to switch at this URL:
 https://github.com/Theano/Theano/wiki/Converting-to-the-new-gpu-back-end%28gpuarray%29

Using gpu device 0: GeForce GTX 980M (CNMeM is enabled with initial size: 80.0% of memory, cuDNN 5005)
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-8c21291ec85a> in <module>()
     21     sys.path.append(module_path)
     22 from music_transcription.pitch_detection.cnn_cqt_pitch_detection import CnnCqtFeatureExtractor
---> 23 from music_transcription.pitch_detection.read_data import get_wav_and_truth_files, read_data_y

ImportError: cannot import name 'get_wav_and_truth_files'

In [2]:
DATASETS_CV = {1, 2}
DATASETS_ADDITIONAL = {3, 9, 10, 11}

sample_rate = 44100
subsampling_step = 1
min_pitch = 40
max_pitch = 88
onset_group_threshold_seconds = 0.05

image_data_format = 'channels_first'
cqt_configs = [
    {
        'hop_length': 512,
        'fmin': 55.0,
        'n_bins': 180,
        'bins_per_octave': 36,
        'scale': False,
    },
]
n_frames_before = 15
n_frames_after = 20

LOSS = 'binary_crossentropy'
OPTIMIZER = 'adam'
METRICS = None
BATCH_SIZE = 256

In [3]:
wav_file_paths_cv, truth_dataset_format_tuples_cv = get_wav_and_truth_files(DATASETS_CV)
wav_file_paths_additional, truth_dataset_format_tuples_additional = get_wav_and_truth_files(DATASETS_ADDITIONAL)


C:\Users\Michel\FH\IP6\git\music_transcription\onset_detection\read_data.py:133: UserWarning: Skipping AR_Lick11_FN.wav, no truth found.
  warn('Skipping ' + wav_file + ', no truth found.')
C:\Users\Michel\FH\IP6\git\music_transcription\onset_detection\read_data.py:133: UserWarning: Skipping AR_Lick11_KN.wav, no truth found.
  warn('Skipping ' + wav_file + ', no truth found.')
C:\Users\Michel\FH\IP6\git\music_transcription\onset_detection\read_data.py:133: UserWarning: Skipping AR_Lick11_MN.wav, no truth found.
  warn('Skipping ' + wav_file + ', no truth found.')
C:\Users\Michel\FH\IP6\git\music_transcription\onset_detection\read_data.py:135: UserWarning: Skipping ..\data\IDMT-SMT-GUITAR_V2\dataset2\audio\desktop.ini, not a .wav file.
  warn('Skipping ' + path_to_wav + ', not a .wav file.')
C:\Users\Michel\FH\IP6\git\music_transcription\onset_detection\read_data.py:133: UserWarning: Skipping FS_Lick11_FN.wav, no truth found.
  warn('Skipping ' + wav_file + ', no truth found.')
C:\Users\Michel\FH\IP6\git\music_transcription\onset_detection\read_data.py:133: UserWarning: Skipping FS_Lick11_KN.wav, no truth found.
  warn('Skipping ' + wav_file + ', no truth found.')
C:\Users\Michel\FH\IP6\git\music_transcription\onset_detection\read_data.py:133: UserWarning: Skipping FS_Lick11_MN.wav, no truth found.
  warn('Skipping ' + wav_file + ', no truth found.')
C:\Users\Michel\FH\IP6\git\music_transcription\onset_detection\read_data.py:133: UserWarning: Skipping LP_Lick11_FN.wav, no truth found.
  warn('Skipping ' + wav_file + ', no truth found.')
C:\Users\Michel\FH\IP6\git\music_transcription\onset_detection\read_data.py:133: UserWarning: Skipping LP_Lick11_KN.wav, no truth found.
  warn('Skipping ' + wav_file + ', no truth found.')
C:\Users\Michel\FH\IP6\git\music_transcription\onset_detection\read_data.py:133: UserWarning: Skipping LP_Lick11_MN.wav, no truth found.
  warn('Skipping ' + wav_file + ', no truth found.')
C:\Users\Michel\FH\IP6\git\music_transcription\onset_detection\read_data.py:133: UserWarning: Skipping G63-44104-1111-20675.wav, no truth found.
  warn('Skipping ' + wav_file + ', no truth found.')
C:\Users\Michel\FH\IP6\git\music_transcription\onset_detection\read_data.py:133: UserWarning: Skipping G71-40100-1111-20749.wav, no truth found.
  warn('Skipping ' + wav_file + ', no truth found.')
C:\Users\Michel\FH\IP6\git\music_transcription\onset_detection\read_data.py:133: UserWarning: Skipping G83-45105-1111-20988.wav, no truth found.
  warn('Skipping ' + wav_file + ', no truth found.')
C:\Users\Michel\FH\IP6\git\music_transcription\onset_detection\read_data.py:133: UserWarning: Skipping G91-43103-1111-21064.wav, no truth found.
  warn('Skipping ' + wav_file + ', no truth found.')
C:\Users\Michel\FH\IP6\git\music_transcription\onset_detection\read_data.py:133: UserWarning: Skipping G93-46106-1111-21145.wav, no truth found.
  warn('Skipping ' + wav_file + ', no truth found.')
C:\Users\Michel\FH\IP6\git\music_transcription\onset_detection\read_data.py:133: UserWarning: Skipping P94-43120-1111-41410.wav, no truth found.
  warn('Skipping ' + wav_file + ', no truth found.')
C:\Users\Michel\FH\IP6\git\music_transcription\onset_detection\read_data.py:133: UserWarning: Skipping P94-44110-1111-41396.wav, no truth found.
  warn('Skipping ' + wav_file + ', no truth found.')

In [4]:
folds = []
k_fold = KFold(n_splits=10, shuffle=True, random_state=42)
for k, (train_indices, test_indices) in enumerate(k_fold.split(wav_file_paths_cv)):
    # if k > 0:
    #     print('Skipping split {}'.format(k))
    #     continue
    
    wav_file_paths_train = [wav_file_paths_cv[i] for i in train_indices] + wav_file_paths_additional
    truth_dataset_format_tuples_train = [truth_dataset_format_tuples_cv[i] for i in train_indices] + truth_dataset_format_tuples_additional
    wav_file_paths_test = [wav_file_paths_cv[i] for i in test_indices]
    truth_dataset_format_tuples_test = [truth_dataset_format_tuples_cv[i] for i in test_indices]
    
    data_train, y_train, wav_file_paths_train_valid, truth_dataset_format_tuples_train_valid = read_data_y(
        wav_file_paths_train, truth_dataset_format_tuples_train,
        sample_rate, subsampling_step,
        min_pitch, max_pitch,
        onset_group_threshold_seconds=onset_group_threshold_seconds
    )
    
    feature_extractor = CnnCqtFeatureExtractor(image_data_format, sample_rate, cqt_configs, n_frames_before, n_frames_after)
    list_of_X_train, sample_file_indexes_train = feature_extractor.fit_transform(data_train)

    data_test, y_test, wav_file_paths_test_valid, truth_dataset_format_tuples_test_valid = read_data_y(
        wav_file_paths_test, truth_dataset_format_tuples_test,
        sample_rate, subsampling_step,
        min_pitch, max_pitch,
        onset_group_threshold_seconds=onset_group_threshold_seconds
    )
    list_of_X_test, sample_file_indexes_test = feature_extractor.transform(data_test, verbose=True)

    folds.append((list_of_X_train, y_train, list_of_X_test, y_test))


C:\Users\Michel\FH\IP6\git\music_transcription\pitch_detection\read_data.py:90: UserWarning: Skipping ..\data\IDMT-SMT-GUITAR_V2\dataset2\annotation\AR_NH_IV.xml, pitch 92 is out of range.
  warn('Skipping {}, pitch {} is out of range.'.format(path_to_xml, pitch))
C:\Users\Michel\FH\IP6\git\music_transcription\pitch_detection\read_data.py:90: UserWarning: Skipping ..\data\IDMT-SMT-GUITAR_V2\dataset2\annotation\AR_NH_IX.xml, pitch 92 is out of range.
  warn('Skipping {}, pitch {} is out of range.'.format(path_to_xml, pitch))
C:\Users\Michel\FH\IP6\git\music_transcription\pitch_detection\read_data.py:90: UserWarning: Skipping ..\data\IDMT-SMT-GUITAR_V2\dataset2\annotation\FS_NH_IV.xml, pitch 92 is out of range.
  warn('Skipping {}, pitch {} is out of range.'.format(path_to_xml, pitch))
C:\Users\Michel\FH\IP6\git\music_transcription\pitch_detection\read_data.py:90: UserWarning: Skipping ..\data\IDMT-SMT-GUITAR_V2\dataset2\annotation\FS_NH_IX.xml, pitch 92 is out of range.
  warn('Skipping {}, pitch {} is out of range.'.format(path_to_xml, pitch))
C:\Users\Michel\FH\IP6\git\music_transcription\pitch_detection\read_data.py:90: UserWarning: Skipping ..\data\IDMT-SMT-GUITAR_V2\dataset2\annotation\LP_NH_IV.xml, pitch 92 is out of range.
  warn('Skipping {}, pitch {} is out of range.'.format(path_to_xml, pitch))
C:\Users\Michel\FH\IP6\git\music_transcription\pitch_detection\read_data.py:56: UserWarning: Skipping ..\data\IDMT-SMT-GUITAR_V2\dataset3\audio\pathetique_poly.wav, cannot handle stereo signal.
  warn('Skipping ' + path_to_wav + ', cannot handle stereo signal.')
C:\Users\Michel\FH\IP6\git\music_transcription\pitch_detection\read_data.py:90: UserWarning: Skipping ..\data\IDMT-SMT-GUITAR_V2\dataset3\annotation\pathetique_poly.xml, pitch 30 is out of range.
  warn('Skipping {}, pitch {} is out of range.'.format(path_to_xml, pitch))
Creating spectrograms
Fitting standard scalers for each spectrogram and bin
(547471, 180)
3.68417139688
22.4409437959
Standardizing for each spectrogram and bin
-3.88643841832e-17
1.0
(4761, 36, 180)
Reshaping data
(4761, 1, 36, 180)
Creating spectrograms
C:\Users\Michel\FH\IP6\git\music_transcription\pitch_detection\read_data.py:90: UserWarning: Skipping ..\data\IDMT-SMT-GUITAR_V2\dataset2\annotation\LP_NH_IX.xml, pitch 92 is out of range.
  warn('Skipping {}, pitch {} is out of range.'.format(path_to_xml, pitch))
(41682, 180)
5.5261683425
27.6109156022
Standardizing for each spectrogram and bin
0.0992231932843
1.17145313113
(338, 36, 180)
Reshaping data
(338, 1, 36, 180)
Creating spectrograms
Fitting standard scalers for each spectrogram and bin
(557431, 180)
3.77812439059
22.559128891
Standardizing for each spectrogram and bin
2.89740737771e-16
1.0
(4803, 36, 180)
Reshaping data
(4803, 1, 36, 180)
Creating spectrograms
(31722, 180)
4.45353667809
27.4566022803
Standardizing for each spectrogram and bin
0.0455604395835
1.17690111469
(296, 36, 180)
Reshaping data
(296, 1, 36, 180)
Creating spectrograms
Fitting standard scalers for each spectrogram and bin
(559395, 180)
3.75710636671
22.61410081
Standardizing for each spectrogram and bin
4.20576863807e-17
1.0
(4767, 36, 180)
Reshaping data
(4767, 1, 36, 180)
Creating spectrograms
(29758, 180)
4.89321297359
26.880949377
Standardizing for each spectrogram and bin
0.0621791682988
1.0733988344
(332, 36, 180)
Reshaping data
(332, 1, 36, 180)
Creating spectrograms
Fitting standard scalers for each spectrogram and bin
(556974, 180)
3.63754869258
21.9965888058
Standardizing for each spectrogram and bin
6.65823655409e-17
1.0
(4737, 36, 180)
Reshaping data
(4737, 1, 36, 180)
Creating spectrograms
(32179, 180)
6.87711557752
34.274186994
Standardizing for each spectrogram and bin
0.210222831141
1.62356280392
(362, 36, 180)
Reshaping data
(362, 1, 36, 180)
Creating spectrograms
Fitting standard scalers for each spectrogram and bin
(542586, 180)
3.78675598189
22.8839449078
Standardizing for each spectrogram and bin
8.51488869374e-17
1.0
(4603, 36, 180)
Reshaping data
(4603, 1, 36, 180)
Creating spectrograms
(46567, 180)
4.13765040662
22.4493064178
Standardizing for each spectrogram and bin
0.0417222486204
1.09157125672
(496, 36, 180)
Reshaping data
(496, 1, 36, 180)
Creating spectrograms
Fitting standard scalers for each spectrogram and bin
(550650, 180)
3.7222577838
22.7690619315
Standardizing for each spectrogram and bin
2.6772615421e-17
1.0
(4663, 36, 180)
Reshaping data
(4663, 1, 36, 180)
Creating spectrograms
(38503, 180)
5.13356099583
23.9400911247
Standardizing for each spectrogram and bin
0.0956528900972
1.09562946274
(436, 36, 180)
Reshaping data
(436, 1, 36, 180)
Creating spectrograms
Fitting standard scalers for each spectrogram and bin
(550023, 180)
3.54871810804
21.4946910409
Standardizing for each spectrogram and bin
-2.79807205513e-16
1.0
(4655, 36, 180)
Reshaping data
(4655, 1, 36, 180)
Creating spectrograms
(39130, 180)
7.55027262293
36.7699369113
Standardizing for each spectrogram and bin
0.237526563363
1.60852737891
(444, 36, 180)
Reshaping data
(444, 1, 36, 180)
Creating spectrograms
Fitting standard scalers for each spectrogram and bin
(549340, 180)
3.72704241974
22.8013246258
Standardizing for each spectrogram and bin
-5.63828363922e-18
1.0
(4680, 36, 180)
Reshaping data
(4680, 1, 36, 180)
Creating spectrograms
(39813, 180)
5.02110528754
23.4793731659
Standardizing for each spectrogram and bin
0.0918758541996
1.16153140936
(419, 36, 180)
Reshaping data
(419, 1, 36, 180)
Creating spectrograms
Fitting standard scalers for each spectrogram and bin
(549535, 180)
3.73972168469
22.7048423588
Standardizing for each spectrogram and bin
2.53931555529e-16
1.0
(4712, 36, 180)
Reshaping data
(4712, 1, 36, 180)
Creating spectrograms
(39618, 180)
4.85160259673
24.7538250401
Standardizing for each spectrogram and bin
0.0476650781506
0.975952865211
(387, 36, 180)
Reshaping data
(387, 1, 36, 180)
Creating spectrograms
Fitting standard scalers for each spectrogram and bin
(554407, 180)
3.74771519453
22.7236712645
Standardizing for each spectrogram and bin
-1.15941065044e-16
1.0
(4774, 36, 180)
Reshaping data
(4774, 1, 36, 180)
Creating spectrograms
(34746, 180)
4.87996344379
24.7557484228
Standardizing for each spectrogram and bin
0.058774128495
1.04742662618
(325, 36, 180)
Reshaping data
(325, 1, 36, 180)

In [ ]:
counts = defaultdict(int)
for ds in [t[1] for t in truth_dataset_format_tuples_cv]:
    counts[ds] += 1
print(counts)

for k, (train_indices, test_indices) in enumerate(k_fold.split(wav_file_paths_cv)):
    print(k)
    counts_test_k = defaultdict(int)
    for ds in [t[1] for t in [truth_dataset_format_tuples_cv[i] for i in test_indices]]:
        counts_test_k[ds] += 1
    print(counts_test_k)

In [5]:
def predict(model, proba_threshold, list_of_X, y, epsilon=1e-7):
    proba_matrix = model.predict(list_of_X)
    y = proba_matrix > proba_threshold
    y = y.astype(np.int8)

    # Make sure at least one pitch is returned.
    for probas, labels in zip(proba_matrix, y):
        if labels.sum() == 0:
            max_proba = max(probas)
            max_index = np.where(np.logical_and(probas > max_proba - epsilon, probas < max_proba + epsilon))[0][0]
            labels[max_index] = 1

    return y

def print_metrics(y, y_predicted):
    print('Accuracy: {}'.format(round(accuracy_score(y, y_predicted), 4)))
    print(classification_report(y, y_predicted, digits=3,
                                target_names=[str(pitch) for pitch in range(min_pitch, max_pitch + 1)]))

In [6]:
def create_model_1(list_of_X, n_output_units):
    inputs = []
    conv_blocks = []
    for X in list_of_X:
        spectrogram = Input(shape=X.shape[1:])
        inputs.append(spectrogram)

        conv = Conv2D(20, (7, 3), padding='valid')(spectrogram)
        conv = Activation('relu')(conv)
        conv = MaxPooling2D(pool_size=(1, 3))(conv)
        conv = Conv2D(20, (3, 3), padding='valid')(conv)
        conv = Activation('relu')(conv)
        conv = MaxPooling2D(pool_size=(1, 3))(conv)
        conv = Dropout(0.25)(conv)
        conv = Flatten()(conv)
        conv_blocks.append(conv)

    z = Concatenate()(conv_blocks) if len(conv_blocks) > 1 else conv_blocks[0]
    z = Dense(256)(z)
    z = Activation('relu')(z)
    z = Dropout(0.5)(z)
    output = Dense(n_output_units, activation='sigmoid')(z)

    model = Model(inputs, output)
    model.compile(loss=LOSS, optimizer=OPTIMIZER, metrics=METRICS)
    model.summary()

    return model

def create_model_2(list_of_X, n_output_units, dropout_conv=0.25, dropout_dense=0.5):
    inputs = []
    conv_blocks = []
    for X in list_of_X:
        spectrogram = Input(shape=X.shape[1:])
        inputs.append(spectrogram)

        conv = Conv2D(10, (7, 3), padding='valid')(spectrogram)
        conv = Activation('relu')(conv)
        conv = MaxPooling2D(pool_size=(1, 3))(conv)
        conv = Conv2D(20, (3, 3), padding='valid')(conv)
        conv = Activation('relu')(conv)
        conv = MaxPooling2D(pool_size=(1, 3))(conv)
        conv = Dropout(dropout_conv)(conv)
        conv = Flatten()(conv)
        conv_blocks.append(conv)

    z = Concatenate()(conv_blocks) if len(conv_blocks) > 1 else conv_blocks[0]
    z = Dense(256)(z)
    z = Activation('relu')(z)
    z = Dropout(dropout_dense)(z)
    output = Dense(n_output_units, activation='sigmoid')(z)

    model = Model(inputs, output)
    model.compile(loss=LOSS, optimizer=OPTIMIZER, metrics=METRICS)
    model.summary()

    return model

def create_model_3(list_of_X, n_output_units):
    inputs = []
    conv_blocks = []
    for X in list_of_X:
        spectrogram = Input(shape=X.shape[1:])
        inputs.append(spectrogram)

        conv = Conv2D(49, (16, 6), padding='valid')(spectrogram)
        conv = Activation('relu')(conv)
        conv = MaxPooling2D(pool_size=(1, 29))(conv)
        conv = Dropout(0.25)(conv)
        conv = Flatten()(conv)
        conv_blocks.append(conv)

    z = Concatenate()(conv_blocks) if len(conv_blocks) > 1 else conv_blocks[0]
    z = Dense(32)(z)
    z = Activation('relu')(z)
    z = Dropout(0.5)(z)
    output = Dense(n_output_units, activation='sigmoid')(z)

    model = Model(inputs, output)
    model.compile(loss=LOSS, optimizer=OPTIMIZER, metrics=METRICS)
    model.summary()

    return model

def create_model_4(list_of_X, n_output_units, dropout_conv=0.25, dropout_dense=0.5):
    inputs = []
    conv_blocks = []
    for X in list_of_X:
        spectrogram = Input(shape=X.shape[1:])
        inputs.append(spectrogram)

        conv = Conv2D(10, (7, 3), padding='valid')(spectrogram)
        conv = Activation('relu')(conv)
        conv = MaxPooling2D(pool_size=(1, 3))(conv)
        conv = Dropout(dropout_conv)(conv)
        conv = Flatten()(conv)
        conv_blocks.append(conv)

    z = Concatenate()(conv_blocks) if len(conv_blocks) > 1 else conv_blocks[0]
    z = Dense(256)(z)
    z = Activation('relu')(z)
    z = Dropout(dropout_dense)(z)
    output = Dense(n_output_units, activation='sigmoid')(z)

    model = Model(inputs, output)
    model.compile(loss=LOSS, optimizer=OPTIMIZER, metrics=METRICS)
    # model.summary()

    return model

def create_model_5(list_of_X, n_output_units,
                   dropout_conv, dropout_dense,
                   n_filters, filter_size, pool_size):
    inputs = []
    conv_blocks = []
    for X in list_of_X:
        spectrogram = Input(shape=X.shape[1:])
        inputs.append(spectrogram)

        conv = Conv2D(n_filters, filter_size, padding='valid')(spectrogram)
        conv = Activation('relu')(conv)
        conv = MaxPooling2D(pool_size=pool_size)(conv)
        conv = Dropout(dropout_conv)(conv)
        conv = Flatten()(conv)
        conv_blocks.append(conv)

    z = Concatenate()(conv_blocks) if len(conv_blocks) > 1 else conv_blocks[0]
    z = Dense(256)(z)
    z = Activation('relu')(z)
    z = Dropout(dropout_dense)(z)
    output = Dense(n_output_units, activation='sigmoid')(z)

    model = Model(inputs, output)
    model.compile(loss=LOSS, optimizer=OPTIMIZER, metrics=METRICS)
    model.summary()

    return model

def create_model_6(list_of_X, n_output_units):
    inputs = []
    conv_blocks = []
    for X in list_of_X:
        spectrogram = Input(shape=X.shape[1:])
        inputs.append(spectrogram)

        conv = Conv2D(10, (15, 6), padding='valid')(spectrogram)
        conv = Activation('relu')(conv)
        conv = MaxPooling2D(pool_size=(1, 3))(conv)
        conv = Flatten()(conv)
        conv_blocks.append(conv)

    z = Concatenate()(conv_blocks) if len(conv_blocks) > 1 else conv_blocks[0]
    z = Dense(256)(z)
    z = Activation('relu')(z)
    output = Dense(n_output_units, activation='sigmoid')(z)

    model = Model(inputs, output)
    model.compile(loss=LOSS, optimizer=OPTIMIZER, metrics=METRICS)
    model.summary()

    return model

def create_model_7(list_of_X, n_output_units, dropout_conv=0.1, dropout_dense=0.2):
    inputs = []
    conv_blocks = []
    for X in list_of_X:
        spectrogram = Input(shape=X.shape[1:])
        inputs.append(spectrogram)

        conv = Conv2D(10, (15, 6), padding='valid')(spectrogram)
        conv = Activation('relu')(conv)
        conv = Conv2D(20, (5, 2), padding='valid')(conv)
        conv = Activation('relu')(conv)
        conv = MaxPooling2D(pool_size=(1, 3))(conv)
        conv = Dropout(dropout_conv)(conv)
        conv = Flatten()(conv)
        conv_blocks.append(conv)

    z = Concatenate()(conv_blocks) if len(conv_blocks) > 1 else conv_blocks[0]
    z = Dense(256)(z)
    z = Activation('relu')(z)
    z = Dropout(dropout_dense)(z)
    output = Dense(n_output_units, activation='sigmoid')(z)

    model = Model(inputs, output)
    model.compile(loss=LOSS, optimizer=OPTIMIZER, metrics=METRICS)
    # model.summary()

    return model

def create_model_8(list_of_X, n_output_units,
                   dropout_conv, dropout_dense,
                   n_filters, filter_size, pool_size=None):
    inputs = []
    conv_blocks = []
    for X in list_of_X:
        spectrogram = Input(shape=X.shape[1:])
        inputs.append(spectrogram)

        conv = Conv2D(n_filters, filter_size, strides=(5, 1), padding='valid')(spectrogram)
        conv = Activation('relu')(conv)
        conv = Dropout(dropout_conv)(conv)
        conv = Flatten()(conv)
        conv_blocks.append(conv)

    z = Concatenate()(conv_blocks) if len(conv_blocks) > 1 else conv_blocks[0]
    z = Dense(128)(z)
    z = Activation('relu')(z)
    z = Dropout(dropout_dense)(z)
    output = Dense(n_output_units, activation='sigmoid')(z)

    model = Model(inputs, output)
    model.compile(loss=LOSS, optimizer=OPTIMIZER, metrics=METRICS)
    model.summary()

    return model

def create_model_9(list_of_X, n_output_units,
                   dropout_conv, dropout_dense,
                   n_filters, filter_size, pool_size):
    inputs = []
    conv_blocks = []
    for X in list_of_X:
        spectrogram = Input(shape=X.shape[1:])
        inputs.append(spectrogram)

        conv = Conv2D(n_filters, filter_size, padding='valid')(spectrogram)
        conv = Activation('relu')(conv)
        conv = MaxPooling2D(pool_size=pool_size)(conv)
        conv = Dropout(dropout_conv)(conv)
        conv = Flatten()(conv)
        conv_blocks.append(conv)

    z = Concatenate()(conv_blocks) if len(conv_blocks) > 1 else conv_blocks[0]
    z = Dense(64)(z)
    z = Activation('relu')(z)
    z = Dropout(dropout_dense)(z)
    output = Dense(n_output_units, activation='sigmoid')(z)

    model = Model(inputs, output)
    model.compile(loss=LOSS, optimizer=OPTIMIZER, metrics=METRICS)
    model.summary()

    return model

def create_model_10(list_of_X, n_output_units,
                    dropout_conv=None, dropout_dense=None,
                    n_filters=None, filter_size=None, pool_size=None):
    inputs = []
    conv_blocks = []
    for X in list_of_X:
        spectrogram = Input(shape=X.shape[1:])
        inputs.append(spectrogram)

        conv = Conv2D(10, (10, 3), padding='valid')(spectrogram)
        conv = Activation('relu')(conv)
        conv = MaxPooling2D(pool_size=(6, 3))(conv)
        conv = Dropout(0.15)(conv)
        conv = Flatten()(conv)
        conv_blocks.append(conv)

    z = Concatenate()(conv_blocks) if len(conv_blocks) > 1 else conv_blocks[0]
    z = Dense(256)(z)
    z = Activation('relu')(z)
    z = Dropout(0.3)(z)
    output = Dense(n_output_units, activation='sigmoid')(z)

    model = Model(inputs, output)
    model.compile(loss=LOSS, optimizer=OPTIMIZER, metrics=METRICS)
    model.summary()

    return model

def create_model_11(list_of_X, n_output_units,
                    dropout_conv=None, dropout_dense=None,
                    n_filters=None, filter_size=None, pool_size=None):
    inputs = []
    conv_blocks = []
    for X in list_of_X:
        spectrogram = Input(shape=X.shape[1:])
        inputs.append(spectrogram)

        conv = Conv2D(10, (10, 3), padding='valid')(spectrogram)
        conv = Activation('relu')(conv)
        conv = MaxPooling2D(pool_size=(6, 3))(conv)
        conv = Dropout(0.15)(conv)
        conv = Flatten()(conv)
        conv_blocks.append(conv)

        conv = Conv2D(512, (10, 180), strides=(5, 1), padding='valid')(spectrogram)
        conv = Activation('relu')(conv)
        conv = MaxPooling2D(pool_size=(2, 1))(conv)
        conv = Dropout(0.25)(conv)
        conv = Flatten()(conv)
        conv_blocks.append(conv)

    z = Concatenate()(conv_blocks)
    z = Dense(256)(z)
    z = Activation('relu')(z)
    z = Dropout(0.3)(z)
    output = Dense(n_output_units, activation='sigmoid')(z)

    model = Model(inputs, output)
    model.compile(loss=LOSS, optimizer=OPTIMIZER, metrics=METRICS)
    model.summary()

    return model

In [7]:
def train_and_evaluate(folds, create_model,
                       dropout_conv=None, dropout_dense=None, proba_threshold=0.5,
                       n_filters=None, filter_size=None, pool_size=None,
                       verbose=False):
    y_test_all_folds = None
    y_test_predicted_all_folds = None
    for i, (list_of_X_train, y_train, list_of_X_test, y_test) in enumerate(folds):
        if verbose:
            fit_verbose = 2
            validation_data = (list_of_X_test, y_test)
        else:
            fit_verbose = 0
            validation_data = None
        
        # model_dir = datetime.datetime.now().strftime('%Y%m%d-%H%M%S')
        # os.mkdir(model_dir)

        model = create_model(
            list_of_X_train, max_pitch - min_pitch + 1,
            dropout_conv, dropout_dense,
            n_filters, filter_size, pool_size
        )
        model.fit(list_of_X_train, y_train,
                  epochs=1000,
                  batch_size=BATCH_SIZE,
                  sample_weight=None,
                  class_weight=None,
                  callbacks=[EarlyStopping(monitor='loss', patience=6),
                             # ModelCheckpoint(os.path.join(model_dir, 'model.' + str(i) + '.{epoch:02d}-{val_loss:.4f}.hdf5'),
                             #                 monitor='val_loss', save_best_only=True)
                            ],
                  verbose=fit_verbose,
                  validation_data=validation_data,
                 )

        # Load model with lowest val_loss
        # path_to_model = max([os.path.join(model_dir, file)
        #                      for file in os.listdir(model_dir)
        #                      if file.startswith('model.' + str(i) + '.')])
        # print(path_to_model)
        # model = load_model(path_to_model)

        y_test_predicted = predict(model, proba_threshold, list_of_X_test, y_test)
        if verbose:
            print_metrics(y_test, y_test_predicted)

        if y_test_all_folds is None:
            y_test_all_folds = y_test
        else:
            y_test_all_folds = np.concatenate((y_test_all_folds, y_test))

        if y_test_predicted_all_folds is None:
            y_test_predicted_all_folds = y_test_predicted
        else:
            y_test_predicted_all_folds = np.concatenate((y_test_predicted_all_folds, y_test_predicted))

    print_metrics(y_test_all_folds, y_test_predicted_all_folds)

# print('dropout_conv={}, dropout_dense={}, proba_threshold={}, n_filters={}, filter_size={}, pool_size={}'.format(
#     dropout_conv, dropout_dense, proba_threshold, n_filters, filter_size, pool_size
# ))

print('model_11')
train_and_evaluate(folds, create_model_11, proba_threshold=0.3, verbose=True)

# print('model_8')
# train_and_evaluate(folds, create_model_8,
#                    dropout_conv=0.25, dropout_dense=0.2, proba_threshold=0.5,
#                    n_filters=512, filter_size=(36, 180),
#                    verbose=True)


model_11
____________________________________________________________________________________________________
Layer (type)                     Output Shape          Param #     Connected to                     
====================================================================================================
input_1 (InputLayer)             (None, 1, 36, 180)    0                                            
____________________________________________________________________________________________________
conv2d_1 (Conv2D)                (None, 10, 27, 178)   310                                          
____________________________________________________________________________________________________
conv2d_2 (Conv2D)                (None, 512, 6, 1)     922112                                       
____________________________________________________________________________________________________
activation_1 (Activation)        (None, 10, 27, 178)   0                                            
____________________________________________________________________________________________________
activation_2 (Activation)        (None, 512, 6, 1)     0                                            
____________________________________________________________________________________________________
max_pooling2d_1 (MaxPooling2D)   (None, 10, 4, 59)     0                                            
____________________________________________________________________________________________________
max_pooling2d_2 (MaxPooling2D)   (None, 512, 3, 1)     0                                            
____________________________________________________________________________________________________
dropout_1 (Dropout)              (None, 10, 4, 59)     0                                            
____________________________________________________________________________________________________
dropout_2 (Dropout)              (None, 512, 3, 1)     0                                            
____________________________________________________________________________________________________
flatten_1 (Flatten)              (None, 2360)          0                                            
____________________________________________________________________________________________________
flatten_2 (Flatten)              (None, 1536)          0                                            
____________________________________________________________________________________________________
concatenate_1 (Concatenate)      (None, 3896)          0                                            
____________________________________________________________________________________________________
dense_1 (Dense)                  (None, 256)           997632                                       
____________________________________________________________________________________________________
activation_3 (Activation)        (None, 256)           0                                            
____________________________________________________________________________________________________
dropout_3 (Dropout)              (None, 256)           0                                            
____________________________________________________________________________________________________
dense_2 (Dense)                  (None, 49)            12593                                        
====================================================================================================
Total params: 1,932,647.0
Trainable params: 1,932,647.0
Non-trainable params: 0.0
____________________________________________________________________________________________________
Train on 4761 samples, validate on 338 samples
Epoch 1/1000
1s - loss: 0.2146 - val_loss: 0.0540
Epoch 2/1000
1s - loss: 0.0648 - val_loss: 0.0259
Epoch 3/1000
1s - loss: 0.0385 - val_loss: 0.0180
Epoch 4/1000
1s - loss: 0.0276 - val_loss: 0.0143
Epoch 5/1000
1s - loss: 0.0229 - val_loss: 0.0138
Epoch 6/1000
1s - loss: 0.0191 - val_loss: 0.0105
Epoch 7/1000
1s - loss: 0.0168 - val_loss: 0.0100
Epoch 8/1000
1s - loss: 0.0141 - val_loss: 0.0109
Epoch 9/1000
1s - loss: 0.0131 - val_loss: 0.0092
Epoch 10/1000
1s - loss: 0.0117 - val_loss: 0.0092
Epoch 11/1000
1s - loss: 0.0103 - val_loss: 0.0082
Epoch 12/1000
1s - loss: 0.0098 - val_loss: 0.0090
Epoch 13/1000
1s - loss: 0.0093 - val_loss: 0.0100
Epoch 14/1000
1s - loss: 0.0083 - val_loss: 0.0081
Epoch 15/1000
1s - loss: 0.0075 - val_loss: 0.0087
Epoch 16/1000
1s - loss: 0.0076 - val_loss: 0.0075
Epoch 17/1000
1s - loss: 0.0072 - val_loss: 0.0082
Epoch 18/1000
1s - loss: 0.0066 - val_loss: 0.0076
Epoch 19/1000
1s - loss: 0.0059 - val_loss: 0.0082
Epoch 20/1000
1s - loss: 0.0059 - val_loss: 0.0086
Epoch 21/1000
1s - loss: 0.0063 - val_loss: 0.0078
Epoch 22/1000
1s - loss: 0.0055 - val_loss: 0.0078
Epoch 23/1000
1s - loss: 0.0055 - val_loss: 0.0069
Epoch 24/1000
1s - loss: 0.0052 - val_loss: 0.0106
Epoch 25/1000
1s - loss: 0.0050 - val_loss: 0.0093
Epoch 26/1000
1s - loss: 0.0046 - val_loss: 0.0091
Epoch 27/1000
1s - loss: 0.0045 - val_loss: 0.0078
Epoch 28/1000
1s - loss: 0.0041 - val_loss: 0.0094
Epoch 29/1000
1s - loss: 0.0044 - val_loss: 0.0084
Epoch 30/1000
1s - loss: 0.0041 - val_loss: 0.0091
Epoch 31/1000
1s - loss: 0.0046 - val_loss: 0.0084
Epoch 32/1000
1s - loss: 0.0041 - val_loss: 0.0079
Epoch 33/1000
1s - loss: 0.0039 - val_loss: 0.0085
Epoch 34/1000
1s - loss: 0.0034 - val_loss: 0.0088
Epoch 35/1000
1s - loss: 0.0037 - val_loss: 0.0090
Epoch 36/1000
1s - loss: 0.0035 - val_loss: 0.0090
Epoch 37/1000
1s - loss: 0.0034 - val_loss: 0.0090
Epoch 38/1000
1s - loss: 0.0036 - val_loss: 0.0093
Epoch 39/1000
1s - loss: 0.0038 - val_loss: 0.0092
Epoch 40/1000
1s - loss: 0.0033 - val_loss: 0.0089
Epoch 41/1000
1s - loss: 0.0031 - val_loss: 0.0098
Epoch 42/1000
1s - loss: 0.0032 - val_loss: 0.0090
Epoch 43/1000
1s - loss: 0.0034 - val_loss: 0.0089
Epoch 44/1000
1s - loss: 0.0030 - val_loss: 0.0087
Epoch 45/1000
1s - loss: 0.0032 - val_loss: 0.0102
Epoch 46/1000
1s - loss: 0.0031 - val_loss: 0.0091
Epoch 47/1000
1s - loss: 0.0030 - val_loss: 0.0098
Epoch 48/1000
1s - loss: 0.0029 - val_loss: 0.0098
Epoch 49/1000
1s - loss: 0.0029 - val_loss: 0.0104
Epoch 50/1000
1s - loss: 0.0028 - val_loss: 0.0095
Epoch 51/1000
1s - loss: 0.0030 - val_loss: 0.0130
Epoch 52/1000
1s - loss: 0.0029 - val_loss: 0.0112
Epoch 53/1000
1s - loss: 0.0026 - val_loss: 0.0102
Epoch 54/1000
1s - loss: 0.0029 - val_loss: 0.0098
Epoch 55/1000
1s - loss: 0.0022 - val_loss: 0.0093
Epoch 56/1000
1s - loss: 0.0025 - val_loss: 0.0096
Epoch 57/1000
1s - loss: 0.0027 - val_loss: 0.0079
Epoch 58/1000
1s - loss: 0.0027 - val_loss: 0.0092
Epoch 59/1000
1s - loss: 0.0025 - val_loss: 0.0081
Epoch 60/1000
1s - loss: 0.0025 - val_loss: 0.0092
Epoch 61/1000
1s - loss: 0.0021 - val_loss: 0.0111
Epoch 62/1000
1s - loss: 0.0023 - val_loss: 0.0106
Epoch 63/1000
1s - loss: 0.0023 - val_loss: 0.0100
Epoch 64/1000
1s - loss: 0.0020 - val_loss: 0.0135
Epoch 65/1000
1s - loss: 0.0023 - val_loss: 0.0111
Epoch 66/1000
1s - loss: 0.0024 - val_loss: 0.0136
Epoch 67/1000
1s - loss: 0.0024 - val_loss: 0.0095
Epoch 68/1000
1s - loss: 0.0023 - val_loss: 0.0124
Epoch 69/1000
1s - loss: 0.0021 - val_loss: 0.0111
Epoch 70/1000
1s - loss: 0.0021 - val_loss: 0.0130
Epoch 71/1000
1s - loss: 0.0020 - val_loss: 0.0132
Epoch 72/1000
1s - loss: 0.0020 - val_loss: 0.0128
Epoch 73/1000
1s - loss: 0.0020 - val_loss: 0.0142
Epoch 74/1000
1s - loss: 0.0022 - val_loss: 0.0127
Epoch 75/1000
1s - loss: 0.0021 - val_loss: 0.0126
Epoch 76/1000
1s - loss: 0.0022 - val_loss: 0.0113
Epoch 77/1000
1s - loss: 0.0019 - val_loss: 0.0117
Epoch 78/1000
1s - loss: 0.0019 - val_loss: 0.0119
Epoch 79/1000
1s - loss: 0.0020 - val_loss: 0.0120
Epoch 80/1000
1s - loss: 0.0021 - val_loss: 0.0111
Epoch 81/1000
1s - loss: 0.0021 - val_loss: 0.0131
Epoch 82/1000
1s - loss: 0.0020 - val_loss: 0.0109
Epoch 83/1000
1s - loss: 0.0021 - val_loss: 0.0110
Epoch 84/1000
1s - loss: 0.0021 - val_loss: 0.0157
Accuracy: 0.9349
             precision    recall  f1-score   support

         40      1.000     1.000     1.000        13
         41      1.000     1.000     1.000         3
         42      1.000     1.000     1.000         1
         43      0.714     1.000     0.833         5
         44      1.000     1.000     1.000         2
         45      1.000     1.000     1.000        21
         46      1.000     1.000     1.000         3
         47      1.000     1.000     1.000        17
         48      1.000     1.000     1.000        41
         49      1.000     1.000     1.000         8
         50      1.000     1.000     1.000        29
         51      1.000     1.000     1.000         3
         52      1.000     1.000     1.000        38
         53      1.000     1.000     1.000        11
         54      1.000     0.867     0.929        15
         55      0.971     0.971     0.971        35
         56      1.000     1.000     1.000        22
         57      0.933     0.966     0.949        29
         58      1.000     0.750     0.857         4
         59      1.000     0.918     0.957        49
         60      1.000     0.926     0.962        27
         61      1.000     0.885     0.939        26
         62      0.840     0.875     0.857        24
         63      1.000     1.000     1.000         3
         64      1.000     0.944     0.971        36
         65      1.000     1.000     1.000         6
         66      1.000     1.000     1.000         4
         67      0.600     0.500     0.545         6
         68      1.000     1.000     1.000         2
         69      1.000     1.000     1.000        15
         70      0.500     1.000     0.667         1
         71      1.000     0.500     0.667         2
         72      1.000     1.000     1.000         1
         73      0.000     0.000     0.000         1
         74      1.000     1.000     1.000         4
         75      1.000     1.000     1.000         2
         76      1.000     1.000     1.000         1
         77      0.000     0.000     0.000         0
         78      0.000     0.000     0.000         0
         79      1.000     1.000     1.000         1
         80      0.000     0.000     0.000         0
         81      0.000     0.000     0.000         0
         82      0.000     0.000     0.000         0
         83      1.000     1.000     1.000         1
         84      0.000     0.000     0.000         0
         85      0.000     0.000     0.000         0
         86      0.000     0.000     0.000         0
         87      0.000     0.000     0.000         0
         88      1.000     1.000     1.000         1

avg / total      0.976     0.953     0.963       513

D:\ProgramFiles\Anaconda3_64\lib\site-packages\sklearn\metrics\classification.py:1113: UndefinedMetricWarning: Precision and F-score are ill-defined and being set to 0.0 in labels with no predicted samples.
  'precision', 'predicted', average, warn_for)
D:\ProgramFiles\Anaconda3_64\lib\site-packages\sklearn\metrics\classification.py:1115: UndefinedMetricWarning: Recall and F-score are ill-defined and being set to 0.0 in labels with no true samples.
  'recall', 'true', average, warn_for)
____________________________________________________________________________________________________
Layer (type)                     Output Shape          Param #     Connected to                     
====================================================================================================
input_2 (InputLayer)             (None, 1, 36, 180)    0                                            
____________________________________________________________________________________________________
conv2d_3 (Conv2D)                (None, 10, 27, 178)   310                                          
____________________________________________________________________________________________________
conv2d_4 (Conv2D)                (None, 512, 6, 1)     922112                                       
____________________________________________________________________________________________________
activation_4 (Activation)        (None, 10, 27, 178)   0                                            
____________________________________________________________________________________________________
activation_5 (Activation)        (None, 512, 6, 1)     0                                            
____________________________________________________________________________________________________
max_pooling2d_3 (MaxPooling2D)   (None, 10, 4, 59)     0                                            
____________________________________________________________________________________________________
max_pooling2d_4 (MaxPooling2D)   (None, 512, 3, 1)     0                                            
____________________________________________________________________________________________________
dropout_4 (Dropout)              (None, 10, 4, 59)     0                                            
____________________________________________________________________________________________________
dropout_5 (Dropout)              (None, 512, 3, 1)     0                                            
____________________________________________________________________________________________________
flatten_3 (Flatten)              (None, 2360)          0                                            
____________________________________________________________________________________________________
flatten_4 (Flatten)              (None, 1536)          0                                            
____________________________________________________________________________________________________
concatenate_2 (Concatenate)      (None, 3896)          0                                            
____________________________________________________________________________________________________
dense_3 (Dense)                  (None, 256)           997632                                       
____________________________________________________________________________________________________
activation_6 (Activation)        (None, 256)           0                                            
____________________________________________________________________________________________________
dropout_6 (Dropout)              (None, 256)           0                                            
____________________________________________________________________________________________________
dense_4 (Dense)                  (None, 49)            12593                                        
====================================================================================================
Total params: 1,932,647.0
Trainable params: 1,932,647.0
Non-trainable params: 0.0
____________________________________________________________________________________________________
Train on 4803 samples, validate on 296 samples
Epoch 1/1000
1s - loss: 0.2273 - val_loss: 0.0494
Epoch 2/1000
1s - loss: 0.0672 - val_loss: 0.0255
Epoch 3/1000
1s - loss: 0.0388 - val_loss: 0.0192
Epoch 4/1000
1s - loss: 0.0278 - val_loss: 0.0142
Epoch 5/1000
1s - loss: 0.0223 - val_loss: 0.0136
Epoch 6/1000
1s - loss: 0.0185 - val_loss: 0.0134
Epoch 7/1000
1s - loss: 0.0155 - val_loss: 0.0098
Epoch 8/1000
1s - loss: 0.0138 - val_loss: 0.0100
Epoch 9/1000
1s - loss: 0.0131 - val_loss: 0.0104
Epoch 10/1000
1s - loss: 0.0114 - val_loss: 0.0100
Epoch 11/1000
1s - loss: 0.0104 - val_loss: 0.0106
Epoch 12/1000
1s - loss: 0.0093 - val_loss: 0.0086
Epoch 13/1000
1s - loss: 0.0088 - val_loss: 0.0097
Epoch 14/1000
1s - loss: 0.0078 - val_loss: 0.0081
Epoch 15/1000
1s - loss: 0.0077 - val_loss: 0.0096
Epoch 16/1000
1s - loss: 0.0069 - val_loss: 0.0074
Epoch 17/1000
1s - loss: 0.0074 - val_loss: 0.0088
Epoch 18/1000
1s - loss: 0.0065 - val_loss: 0.0102
Epoch 19/1000
1s - loss: 0.0060 - val_loss: 0.0088
Epoch 20/1000
1s - loss: 0.0054 - val_loss: 0.0096
Epoch 21/1000
1s - loss: 0.0052 - val_loss: 0.0102
Epoch 22/1000
1s - loss: 0.0051 - val_loss: 0.0085
Epoch 23/1000
1s - loss: 0.0049 - val_loss: 0.0100
Epoch 24/1000
1s - loss: 0.0048 - val_loss: 0.0105
Epoch 25/1000
1s - loss: 0.0046 - val_loss: 0.0106
Epoch 26/1000
1s - loss: 0.0043 - val_loss: 0.0100
Epoch 27/1000
1s - loss: 0.0044 - val_loss: 0.0090
Epoch 28/1000
1s - loss: 0.0043 - val_loss: 0.0098
Epoch 29/1000
1s - loss: 0.0042 - val_loss: 0.0119
Epoch 30/1000
1s - loss: 0.0036 - val_loss: 0.0094
Epoch 31/1000
1s - loss: 0.0038 - val_loss: 0.0087
Epoch 32/1000
1s - loss: 0.0037 - val_loss: 0.0098
Epoch 33/1000
1s - loss: 0.0035 - val_loss: 0.0114
Epoch 34/1000
1s - loss: 0.0035 - val_loss: 0.0091
Epoch 35/1000
1s - loss: 0.0035 - val_loss: 0.0074
Epoch 36/1000
1s - loss: 0.0033 - val_loss: 0.0079
Epoch 37/1000
1s - loss: 0.0032 - val_loss: 0.0099
Epoch 38/1000
1s - loss: 0.0030 - val_loss: 0.0139
Epoch 39/1000
1s - loss: 0.0036 - val_loss: 0.0128
Epoch 40/1000
1s - loss: 0.0032 - val_loss: 0.0108
Epoch 41/1000
1s - loss: 0.0030 - val_loss: 0.0093
Epoch 42/1000
1s - loss: 0.0031 - val_loss: 0.0109
Epoch 43/1000
1s - loss: 0.0031 - val_loss: 0.0124
Epoch 44/1000
1s - loss: 0.0030 - val_loss: 0.0102
Epoch 45/1000
1s - loss: 0.0026 - val_loss: 0.0098
Epoch 46/1000
1s - loss: 0.0027 - val_loss: 0.0107
Epoch 47/1000
1s - loss: 0.0025 - val_loss: 0.0112
Epoch 48/1000
1s - loss: 0.0026 - val_loss: 0.0110
Epoch 49/1000
1s - loss: 0.0026 - val_loss: 0.0123
Epoch 50/1000
1s - loss: 0.0026 - val_loss: 0.0103
Epoch 51/1000
1s - loss: 0.0023 - val_loss: 0.0098
Epoch 52/1000
1s - loss: 0.0022 - val_loss: 0.0117
Epoch 53/1000
1s - loss: 0.0024 - val_loss: 0.0137
Epoch 54/1000
1s - loss: 0.0025 - val_loss: 0.0133
Epoch 55/1000
1s - loss: 0.0022 - val_loss: 0.0132
Epoch 56/1000
1s - loss: 0.0023 - val_loss: 0.0140
Epoch 57/1000
1s - loss: 0.0024 - val_loss: 0.0112
Epoch 58/1000
1s - loss: 0.0024 - val_loss: 0.0111
Epoch 59/1000
1s - loss: 0.0026 - val_loss: 0.0113
Accuracy: 0.9595
             precision    recall  f1-score   support

         40      0.000     0.000     0.000         0
         41      0.000     0.000     0.000         0
         42      1.000     1.000     1.000         1
         43      0.000     0.000     0.000         0
         44      1.000     1.000     1.000         2
         45      1.000     1.000     1.000         8
         46      0.000     0.000     0.000         0
         47      1.000     1.000     1.000         4
         48      1.000     1.000     1.000        18
         49      1.000     1.000     1.000         7
         50      1.000     1.000     1.000        14
         51      1.000     0.667     0.800         3
         52      1.000     1.000     1.000        14
         53      0.889     1.000     0.941         8
         54      1.000     1.000     1.000        17
         55      1.000     1.000     1.000        11
         56      1.000     0.938     0.968        16
         57      1.000     1.000     1.000        16
         58      1.000     1.000     1.000         1
         59      1.000     1.000     1.000        24
         60      0.917     0.917     0.917        12
         61      1.000     1.000     1.000        20
         62      1.000     1.000     1.000        21
         63      1.000     0.600     0.750         5
         64      0.963     0.963     0.963        27
         65      0.889     0.889     0.889         9
         66      1.000     0.900     0.947        10
         67      1.000     0.917     0.957        12
         68      1.000     0.500     0.667         6
         69      0.958     0.958     0.958        24
         70      1.000     0.800     0.889         5
         71      1.000     0.667     0.800         3
         72      1.000     0.667     0.800         9
         73      1.000     0.667     0.800         3
         74      1.000     0.875     0.933         8
         75      1.000     1.000     1.000         1
         76      1.000     1.000     1.000         3
         77      1.000     1.000     1.000         1
         78      1.000     1.000     1.000         2
         79      1.000     1.000     1.000         2
         80      0.000     0.000     0.000         0
         81      0.000     0.000     0.000         0
         82      0.000     0.000     0.000         0
         83      1.000     1.000     1.000         2
         84      0.000     0.000     0.000         0
         85      0.000     0.000     0.000         0
         86      0.000     0.000     0.000         0
         87      0.000     0.000     0.000         0
         88      1.000     1.000     1.000         1

avg / total      0.986     0.943     0.960       350

D:\ProgramFiles\Anaconda3_64\lib\site-packages\sklearn\metrics\classification.py:1113: UndefinedMetricWarning: Precision and F-score are ill-defined and being set to 0.0 in labels with no predicted samples.
  'precision', 'predicted', average, warn_for)
D:\ProgramFiles\Anaconda3_64\lib\site-packages\sklearn\metrics\classification.py:1115: UndefinedMetricWarning: Recall and F-score are ill-defined and being set to 0.0 in labels with no true samples.
  'recall', 'true', average, warn_for)
____________________________________________________________________________________________________
Layer (type)                     Output Shape          Param #     Connected to                     
====================================================================================================
input_3 (InputLayer)             (None, 1, 36, 180)    0                                            
____________________________________________________________________________________________________
conv2d_5 (Conv2D)                (None, 10, 27, 178)   310                                          
____________________________________________________________________________________________________
conv2d_6 (Conv2D)                (None, 512, 6, 1)     922112                                       
____________________________________________________________________________________________________
activation_7 (Activation)        (None, 10, 27, 178)   0                                            
____________________________________________________________________________________________________
activation_8 (Activation)        (None, 512, 6, 1)     0                                            
____________________________________________________________________________________________________
max_pooling2d_5 (MaxPooling2D)   (None, 10, 4, 59)     0                                            
____________________________________________________________________________________________________
max_pooling2d_6 (MaxPooling2D)   (None, 512, 3, 1)     0                                            
____________________________________________________________________________________________________
dropout_7 (Dropout)              (None, 10, 4, 59)     0                                            
____________________________________________________________________________________________________
dropout_8 (Dropout)              (None, 512, 3, 1)     0                                            
____________________________________________________________________________________________________
flatten_5 (Flatten)              (None, 2360)          0                                            
____________________________________________________________________________________________________
flatten_6 (Flatten)              (None, 1536)          0                                            
____________________________________________________________________________________________________
concatenate_3 (Concatenate)      (None, 3896)          0                                            
____________________________________________________________________________________________________
dense_5 (Dense)                  (None, 256)           997632                                       
____________________________________________________________________________________________________
activation_9 (Activation)        (None, 256)           0                                            
____________________________________________________________________________________________________
dropout_9 (Dropout)              (None, 256)           0                                            
____________________________________________________________________________________________________
dense_6 (Dense)                  (None, 49)            12593                                        
====================================================================================================
Total params: 1,932,647.0
Trainable params: 1,932,647.0
Non-trainable params: 0.0
____________________________________________________________________________________________________
Train on 4767 samples, validate on 332 samples
Epoch 1/1000
1s - loss: 0.2185 - val_loss: 0.0463
Epoch 2/1000
1s - loss: 0.0676 - val_loss: 0.0218
Epoch 3/1000
1s - loss: 0.0382 - val_loss: 0.0141
Epoch 4/1000
1s - loss: 0.0283 - val_loss: 0.0106
Epoch 5/1000
1s - loss: 0.0220 - val_loss: 0.0083
Epoch 6/1000
1s - loss: 0.0186 - val_loss: 0.0085
Epoch 7/1000
1s - loss: 0.0151 - val_loss: 0.0082
Epoch 8/1000
1s - loss: 0.0135 - val_loss: 0.0070
Epoch 9/1000
1s - loss: 0.0122 - val_loss: 0.0064
Epoch 10/1000
1s - loss: 0.0109 - val_loss: 0.0073
Epoch 11/1000
1s - loss: 0.0102 - val_loss: 0.0067
Epoch 12/1000
1s - loss: 0.0090 - val_loss: 0.0068
Epoch 13/1000
1s - loss: 0.0089 - val_loss: 0.0071
Epoch 14/1000
1s - loss: 0.0080 - val_loss: 0.0059
Epoch 15/1000
1s - loss: 0.0075 - val_loss: 0.0055
Epoch 16/1000
1s - loss: 0.0072 - val_loss: 0.0070
Epoch 17/1000
1s - loss: 0.0069 - val_loss: 0.0056
Epoch 18/1000
1s - loss: 0.0060 - val_loss: 0.0076
Epoch 19/1000
1s - loss: 0.0058 - val_loss: 0.0087
Epoch 20/1000
1s - loss: 0.0054 - val_loss: 0.0061
Epoch 21/1000
1s - loss: 0.0053 - val_loss: 0.0056
Epoch 22/1000
1s - loss: 0.0047 - val_loss: 0.0066
Epoch 23/1000
1s - loss: 0.0046 - val_loss: 0.0073
Epoch 24/1000
1s - loss: 0.0047 - val_loss: 0.0061
Epoch 25/1000
1s - loss: 0.0046 - val_loss: 0.0070
Epoch 26/1000
1s - loss: 0.0046 - val_loss: 0.0068
Epoch 27/1000
1s - loss: 0.0043 - val_loss: 0.0064
Epoch 28/1000
1s - loss: 0.0039 - val_loss: 0.0062
Epoch 29/1000
1s - loss: 0.0040 - val_loss: 0.0069
Epoch 30/1000
1s - loss: 0.0037 - val_loss: 0.0083
Epoch 31/1000
1s - loss: 0.0037 - val_loss: 0.0071
Epoch 32/1000
1s - loss: 0.0038 - val_loss: 0.0072
Epoch 33/1000
1s - loss: 0.0034 - val_loss: 0.0078
Epoch 34/1000
1s - loss: 0.0036 - val_loss: 0.0070
Epoch 35/1000
1s - loss: 0.0033 - val_loss: 0.0057
Epoch 36/1000
1s - loss: 0.0034 - val_loss: 0.0077
Epoch 37/1000
1s - loss: 0.0032 - val_loss: 0.0068
Epoch 38/1000
1s - loss: 0.0031 - val_loss: 0.0085
Epoch 39/1000
1s - loss: 0.0032 - val_loss: 0.0078
Epoch 40/1000
1s - loss: 0.0032 - val_loss: 0.0086
Epoch 41/1000
1s - loss: 0.0029 - val_loss: 0.0072
Epoch 42/1000
1s - loss: 0.0030 - val_loss: 0.0080
Epoch 43/1000
1s - loss: 0.0029 - val_loss: 0.0075
Epoch 44/1000
1s - loss: 0.0029 - val_loss: 0.0086
Epoch 45/1000
1s - loss: 0.0029 - val_loss: 0.0080
Epoch 46/1000
1s - loss: 0.0027 - val_loss: 0.0079
Epoch 47/1000
1s - loss: 0.0028 - val_loss: 0.0086
Epoch 48/1000
1s - loss: 0.0030 - val_loss: 0.0068
Epoch 49/1000
1s - loss: 0.0027 - val_loss: 0.0077
Epoch 50/1000
1s - loss: 0.0028 - val_loss: 0.0079
Epoch 51/1000
1s - loss: 0.0027 - val_loss: 0.0091
Epoch 52/1000
1s - loss: 0.0025 - val_loss: 0.0075
Epoch 53/1000
1s - loss: 0.0025 - val_loss: 0.0070
Epoch 54/1000
1s - loss: 0.0021 - val_loss: 0.0084
Epoch 55/1000
1s - loss: 0.0022 - val_loss: 0.0068
Epoch 56/1000
1s - loss: 0.0018 - val_loss: 0.0075
Epoch 57/1000
1s - loss: 0.0022 - val_loss: 0.0067
Epoch 58/1000
1s - loss: 0.0022 - val_loss: 0.0093
Epoch 59/1000
1s - loss: 0.0021 - val_loss: 0.0075
Epoch 60/1000
1s - loss: 0.0019 - val_loss: 0.0075
Epoch 61/1000
1s - loss: 0.0021 - val_loss: 0.0071
Epoch 62/1000
1s - loss: 0.0018 - val_loss: 0.0084
Epoch 63/1000
1s - loss: 0.0019 - val_loss: 0.0071
Accuracy: 0.9578
             precision    recall  f1-score   support

         40      1.000     1.000     1.000         6
         41      1.000     1.000     1.000         2
         42      0.000     0.000     0.000         0
         43      1.000     1.000     1.000         3
         44      0.000     0.000     0.000         0
         45      1.000     1.000     1.000        17
         46      1.000     1.000     1.000         1
         47      1.000     1.000     1.000         7
         48      0.939     1.000     0.969        31
         49      1.000     1.000     1.000         8
         50      1.000     1.000     1.000        27
         51      1.000     1.000     1.000         2
         52      1.000     1.000     1.000        25
         53      1.000     1.000     1.000        10
         54      1.000     1.000     1.000        19
         55      0.842     1.000     0.914        16
         56      1.000     1.000     1.000        16
         57      1.000     0.952     0.976        21
         58      1.000     1.000     1.000         1
         59      0.967     1.000     0.983        29
         60      0.885     1.000     0.939        23
         61      1.000     1.000     1.000        21
         62      1.000     1.000     1.000        26
         63      0.500     1.000     0.667         2
         64      0.960     0.960     0.960        25
         65      1.000     0.800     0.889        10
         66      1.000     1.000     1.000         5
         67      0.824     1.000     0.903        14
         68      1.000     0.667     0.800         3
         69      1.000     0.909     0.952        22
         70      0.000     0.000     0.000         0
         71      1.000     1.000     1.000         1
         72      0.875     1.000     0.933         7
         73      0.500     1.000     0.667         1
         74      0.857     1.000     0.923         6
         75      0.000     0.000     0.000         0
         76      1.000     1.000     1.000         2
         77      0.000     0.000     0.000         0
         78      0.000     0.000     0.000         0
         79      0.000     0.000     0.000         0
         80      0.000     0.000     0.000         0
         81      0.000     0.000     0.000         0
         82      0.000     0.000     0.000         0
         83      0.000     0.000     0.000         0
         84      0.000     0.000     0.000         0
         85      0.000     0.000     0.000         0
         86      0.000     0.000     0.000         0
         87      0.000     0.000     0.000         0
         88      0.000     0.000     0.000         0

avg / total      0.964     0.983     0.971       409

____________________________________________________________________________________________________
Layer (type)                     Output Shape          Param #     Connected to                     
====================================================================================================
input_4 (InputLayer)             (None, 1, 36, 180)    0                                            
____________________________________________________________________________________________________
conv2d_7 (Conv2D)                (None, 10, 27, 178)   310                                          
____________________________________________________________________________________________________
conv2d_8 (Conv2D)                (None, 512, 6, 1)     922112                                       
____________________________________________________________________________________________________
activation_10 (Activation)       (None, 10, 27, 178)   0                                            
____________________________________________________________________________________________________
activation_11 (Activation)       (None, 512, 6, 1)     0                                            
____________________________________________________________________________________________________
max_pooling2d_7 (MaxPooling2D)   (None, 10, 4, 59)     0                                            
____________________________________________________________________________________________________
max_pooling2d_8 (MaxPooling2D)   (None, 512, 3, 1)     0                                            
____________________________________________________________________________________________________
dropout_10 (Dropout)             (None, 10, 4, 59)     0                                            
____________________________________________________________________________________________________
dropout_11 (Dropout)             (None, 512, 3, 1)     0                                            
____________________________________________________________________________________________________
flatten_7 (Flatten)              (None, 2360)          0                                            
____________________________________________________________________________________________________
flatten_8 (Flatten)              (None, 1536)          0                                            
____________________________________________________________________________________________________
concatenate_4 (Concatenate)      (None, 3896)          0                                            
____________________________________________________________________________________________________
dense_7 (Dense)                  (None, 256)           997632                                       
____________________________________________________________________________________________________
activation_12 (Activation)       (None, 256)           0                                            
____________________________________________________________________________________________________
dropout_12 (Dropout)             (None, 256)           0                                            
____________________________________________________________________________________________________
dense_8 (Dense)                  (None, 49)            12593                                        
====================================================================================================
Total params: 1,932,647.0
Trainable params: 1,932,647.0
Non-trainable params: 0.0
____________________________________________________________________________________________________
Train on 4737 samples, validate on 362 samples
Epoch 1/1000
1s - loss: 0.2227 - val_loss: 0.0609
Epoch 2/1000
1s - loss: 0.0644 - val_loss: 0.0289
Epoch 3/1000
1s - loss: 0.0381 - val_loss: 0.0176
Epoch 4/1000
1s - loss: 0.0274 - val_loss: 0.0143
Epoch 5/1000
1s - loss: 0.0216 - val_loss: 0.0138
Epoch 6/1000
1s - loss: 0.0182 - val_loss: 0.0105
Epoch 7/1000
1s - loss: 0.0156 - val_loss: 0.0111
Epoch 8/1000
1s - loss: 0.0135 - val_loss: 0.0094
Epoch 9/1000
1s - loss: 0.0120 - val_loss: 0.0099
Epoch 10/1000
1s - loss: 0.0111 - val_loss: 0.0089
Epoch 11/1000
1s - loss: 0.0099 - val_loss: 0.0089
Epoch 12/1000
1s - loss: 0.0089 - val_loss: 0.0086
Epoch 13/1000
1s - loss: 0.0082 - val_loss: 0.0084
Epoch 14/1000
1s - loss: 0.0079 - val_loss: 0.0083
Epoch 15/1000
1s - loss: 0.0073 - val_loss: 0.0101
Epoch 16/1000
1s - loss: 0.0070 - val_loss: 0.0089
Epoch 17/1000
1s - loss: 0.0068 - val_loss: 0.0087
Epoch 18/1000
1s - loss: 0.0065 - val_loss: 0.0083
Epoch 19/1000
1s - loss: 0.0058 - val_loss: 0.0091
Epoch 20/1000
1s - loss: 0.0058 - val_loss: 0.0087
Epoch 21/1000
1s - loss: 0.0055 - val_loss: 0.0077
Epoch 22/1000
1s - loss: 0.0054 - val_loss: 0.0082
Epoch 23/1000
1s - loss: 0.0049 - val_loss: 0.0089
Epoch 24/1000
1s - loss: 0.0047 - val_loss: 0.0080
Epoch 25/1000
1s - loss: 0.0049 - val_loss: 0.0096
Epoch 26/1000
1s - loss: 0.0047 - val_loss: 0.0081
Epoch 27/1000
1s - loss: 0.0043 - val_loss: 0.0077
Epoch 28/1000
1s - loss: 0.0042 - val_loss: 0.0087
Epoch 29/1000
1s - loss: 0.0042 - val_loss: 0.0079
Epoch 30/1000
1s - loss: 0.0039 - val_loss: 0.0074
Epoch 31/1000
1s - loss: 0.0037 - val_loss: 0.0076
Epoch 32/1000
1s - loss: 0.0038 - val_loss: 0.0080
Epoch 33/1000
1s - loss: 0.0037 - val_loss: 0.0085
Epoch 34/1000
1s - loss: 0.0035 - val_loss: 0.0082
Epoch 35/1000
1s - loss: 0.0036 - val_loss: 0.0086
Epoch 36/1000
1s - loss: 0.0036 - val_loss: 0.0089
Epoch 37/1000
1s - loss: 0.0031 - val_loss: 0.0073
Epoch 38/1000
1s - loss: 0.0033 - val_loss: 0.0088
Epoch 39/1000
1s - loss: 0.0035 - val_loss: 0.0082
Epoch 40/1000
1s - loss: 0.0032 - val_loss: 0.0082
Epoch 41/1000
1s - loss: 0.0034 - val_loss: 0.0089
Epoch 42/1000
1s - loss: 0.0031 - val_loss: 0.0078
Epoch 43/1000
1s - loss: 0.0034 - val_loss: 0.0092
Epoch 44/1000
1s - loss: 0.0030 - val_loss: 0.0096
Epoch 45/1000
1s - loss: 0.0029 - val_loss: 0.0088
Epoch 46/1000
1s - loss: 0.0029 - val_loss: 0.0096
Epoch 47/1000
1s - loss: 0.0030 - val_loss: 0.0086
Epoch 48/1000
1s - loss: 0.0028 - val_loss: 0.0087
Epoch 49/1000
1s - loss: 0.0029 - val_loss: 0.0087
Epoch 50/1000
1s - loss: 0.0026 - val_loss: 0.0087
Epoch 51/1000
1s - loss: 0.0025 - val_loss: 0.0087
Epoch 52/1000
1s - loss: 0.0026 - val_loss: 0.0103
Epoch 53/1000
1s - loss: 0.0025 - val_loss: 0.0107
Epoch 54/1000
1s - loss: 0.0027 - val_loss: 0.0102
Epoch 55/1000
1s - loss: 0.0026 - val_loss: 0.0081
Epoch 56/1000
1s - loss: 0.0024 - val_loss: 0.0086
Epoch 57/1000
1s - loss: 0.0024 - val_loss: 0.0071
Epoch 58/1000
1s - loss: 0.0027 - val_loss: 0.0087
Epoch 59/1000
1s - loss: 0.0025 - val_loss: 0.0100
Epoch 60/1000
1s - loss: 0.0026 - val_loss: 0.0101
Epoch 61/1000
1s - loss: 0.0024 - val_loss: 0.0099
Epoch 62/1000
1s - loss: 0.0025 - val_loss: 0.0090
Epoch 63/1000
1s - loss: 0.0021 - val_loss: 0.0100
Epoch 64/1000
1s - loss: 0.0021 - val_loss: 0.0093
Epoch 65/1000
1s - loss: 0.0021 - val_loss: 0.0093
Epoch 66/1000
1s - loss: 0.0022 - val_loss: 0.0101
Epoch 67/1000
1s - loss: 0.0022 - val_loss: 0.0090
Epoch 68/1000
1s - loss: 0.0019 - val_loss: 0.0082
Epoch 69/1000
1s - loss: 0.0021 - val_loss: 0.0089
Epoch 70/1000
1s - loss: 0.0022 - val_loss: 0.0083
Epoch 71/1000
1s - loss: 0.0020 - val_loss: 0.0090
Epoch 72/1000
1s - loss: 0.0024 - val_loss: 0.0107
Epoch 73/1000
1s - loss: 0.0027 - val_loss: 0.0088
Epoch 74/1000
1s - loss: 0.0021 - val_loss: 0.0088
Epoch 75/1000
1s - loss: 0.0023 - val_loss: 0.0081
Accuracy: 0.9475
             precision    recall  f1-score   support

         40      1.000     1.000     1.000         8
         41      1.000     1.000     1.000         3
         42      1.000     1.000     1.000         1
         43      1.000     1.000     1.000         8
         44      1.000     1.000     1.000         2
         45      1.000     1.000     1.000        16
         46      1.000     1.000     1.000         2
         47      1.000     1.000     1.000        12
         48      1.000     1.000     1.000        27
         49      1.000     1.000     1.000         5
         50      1.000     1.000     1.000        32
         51      0.857     1.000     0.923         6
         52      1.000     1.000     1.000        37
         53      1.000     1.000     1.000         6
         54      0.958     1.000     0.979        23
         55      0.926     1.000     0.962        25
         56      1.000     1.000     1.000        20
         57      1.000     0.943     0.971        35
         58      0.900     1.000     0.947         9
         59      0.955     1.000     0.977        42
         60      1.000     0.944     0.971        18
         61      0.903     1.000     0.949        28
         62      0.921     0.921     0.921        38
         63      0.800     1.000     0.889         4
         64      0.970     1.000     0.985        32
         65      1.000     1.000     1.000         8
         66      0.882     1.000     0.938        15
         67      0.938     1.000     0.968        15
         68      1.000     1.000     1.000         3
         69      1.000     0.952     0.976        21
         70      0.800     0.800     0.800         5
         71      1.000     1.000     1.000         4
         72      1.000     1.000     1.000         2
         73      0.800     1.000     0.889         4
         74      0.889     1.000     0.941         8
         75      1.000     1.000     1.000         2
         76      0.000     0.000     0.000         0
         77      0.000     0.000     0.000         0
         78      0.000     0.000     0.000         0
         79      0.000     0.000     0.000         0
         80      0.000     0.000     0.000         0
         81      0.000     0.000     0.000         0
         82      0.000     0.000     0.000         0
         83      0.000     0.000     0.000         0
         84      0.000     0.000     0.000         0
         85      0.000     0.000     0.000         0
         86      0.000     0.000     0.000         0
         87      0.000     0.000     0.000         0
         88      0.000     0.000     0.000         0

avg / total      0.963     0.985     0.973       526

____________________________________________________________________________________________________
Layer (type)                     Output Shape          Param #     Connected to                     
====================================================================================================
input_5 (InputLayer)             (None, 1, 36, 180)    0                                            
____________________________________________________________________________________________________
conv2d_9 (Conv2D)                (None, 10, 27, 178)   310                                          
____________________________________________________________________________________________________
conv2d_10 (Conv2D)               (None, 512, 6, 1)     922112                                       
____________________________________________________________________________________________________
activation_13 (Activation)       (None, 10, 27, 178)   0                                            
____________________________________________________________________________________________________
activation_14 (Activation)       (None, 512, 6, 1)     0                                            
____________________________________________________________________________________________________
max_pooling2d_9 (MaxPooling2D)   (None, 10, 4, 59)     0                                            
____________________________________________________________________________________________________
max_pooling2d_10 (MaxPooling2D)  (None, 512, 3, 1)     0                                            
____________________________________________________________________________________________________
dropout_13 (Dropout)             (None, 10, 4, 59)     0                                            
____________________________________________________________________________________________________
dropout_14 (Dropout)             (None, 512, 3, 1)     0                                            
____________________________________________________________________________________________________
flatten_9 (Flatten)              (None, 2360)          0                                            
____________________________________________________________________________________________________
flatten_10 (Flatten)             (None, 1536)          0                                            
____________________________________________________________________________________________________
concatenate_5 (Concatenate)      (None, 3896)          0                                            
____________________________________________________________________________________________________
dense_9 (Dense)                  (None, 256)           997632                                       
____________________________________________________________________________________________________
activation_15 (Activation)       (None, 256)           0                                            
____________________________________________________________________________________________________
dropout_15 (Dropout)             (None, 256)           0                                            
____________________________________________________________________________________________________
dense_10 (Dense)                 (None, 49)            12593                                        
====================================================================================================
Total params: 1,932,647.0
Trainable params: 1,932,647.0
Non-trainable params: 0.0
____________________________________________________________________________________________________
Train on 4603 samples, validate on 496 samples
Epoch 1/1000
1s - loss: 0.2264 - val_loss: 0.0620
Epoch 2/1000
1s - loss: 0.0674 - val_loss: 0.0390
Epoch 3/1000
1s - loss: 0.0385 - val_loss: 0.0303
Epoch 4/1000
1s - loss: 0.0283 - val_loss: 0.0259
Epoch 5/1000
1s - loss: 0.0229 - val_loss: 0.0238
Epoch 6/1000
1s - loss: 0.0185 - val_loss: 0.0234
Epoch 7/1000
1s - loss: 0.0164 - val_loss: 0.0201
Epoch 8/1000
1s - loss: 0.0144 - val_loss: 0.0185
Epoch 9/1000
1s - loss: 0.0134 - val_loss: 0.0194
Epoch 10/1000
1s - loss: 0.0118 - val_loss: 0.0173
Epoch 11/1000
1s - loss: 0.0110 - val_loss: 0.0163
Epoch 12/1000
1s - loss: 0.0100 - val_loss: 0.0163
Epoch 13/1000
1s - loss: 0.0089 - val_loss: 0.0161
Epoch 14/1000
1s - loss: 0.0087 - val_loss: 0.0162
Epoch 15/1000
1s - loss: 0.0081 - val_loss: 0.0178
Epoch 16/1000
1s - loss: 0.0077 - val_loss: 0.0166
Epoch 17/1000
1s - loss: 0.0066 - val_loss: 0.0161
Epoch 18/1000
1s - loss: 0.0072 - val_loss: 0.0174
Epoch 19/1000
1s - loss: 0.0065 - val_loss: 0.0147
Epoch 20/1000
1s - loss: 0.0060 - val_loss: 0.0181
Epoch 21/1000
1s - loss: 0.0057 - val_loss: 0.0153
Epoch 22/1000
1s - loss: 0.0054 - val_loss: 0.0139
Epoch 23/1000
1s - loss: 0.0050 - val_loss: 0.0162
Epoch 24/1000
1s - loss: 0.0050 - val_loss: 0.0145
Epoch 25/1000
1s - loss: 0.0049 - val_loss: 0.0147
Epoch 26/1000
1s - loss: 0.0048 - val_loss: 0.0135
Epoch 27/1000
1s - loss: 0.0049 - val_loss: 0.0148
Epoch 28/1000
1s - loss: 0.0045 - val_loss: 0.0158
Epoch 29/1000
1s - loss: 0.0042 - val_loss: 0.0146
Epoch 30/1000
1s - loss: 0.0042 - val_loss: 0.0171
Epoch 31/1000
1s - loss: 0.0038 - val_loss: 0.0145
Epoch 32/1000
1s - loss: 0.0039 - val_loss: 0.0154
Epoch 33/1000
1s - loss: 0.0034 - val_loss: 0.0160
Epoch 34/1000
1s - loss: 0.0035 - val_loss: 0.0152
Epoch 35/1000
1s - loss: 0.0035 - val_loss: 0.0139
Epoch 36/1000
1s - loss: 0.0038 - val_loss: 0.0160
Epoch 37/1000
1s - loss: 0.0035 - val_loss: 0.0166
Epoch 38/1000
1s - loss: 0.0032 - val_loss: 0.0140
Epoch 39/1000
1s - loss: 0.0033 - val_loss: 0.0157
Epoch 40/1000
1s - loss: 0.0038 - val_loss: 0.0190
Epoch 41/1000
1s - loss: 0.0031 - val_loss: 0.0164
Epoch 42/1000
1s - loss: 0.0032 - val_loss: 0.0170
Epoch 43/1000
1s - loss: 0.0031 - val_loss: 0.0174
Epoch 44/1000
1s - loss: 0.0032 - val_loss: 0.0164
Epoch 45/1000
1s - loss: 0.0029 - val_loss: 0.0162
Epoch 46/1000
1s - loss: 0.0032 - val_loss: 0.0162
Epoch 47/1000
1s - loss: 0.0028 - val_loss: 0.0162
Epoch 48/1000
1s - loss: 0.0024 - val_loss: 0.0173
Epoch 49/1000
1s - loss: 0.0026 - val_loss: 0.0165
Epoch 50/1000
1s - loss: 0.0027 - val_loss: 0.0195
Epoch 51/1000
1s - loss: 0.0026 - val_loss: 0.0163
Epoch 52/1000
1s - loss: 0.0026 - val_loss: 0.0199
Epoch 53/1000
1s - loss: 0.0028 - val_loss: 0.0160
Epoch 54/1000
1s - loss: 0.0022 - val_loss: 0.0155
Epoch 55/1000
1s - loss: 0.0027 - val_loss: 0.0183
Epoch 56/1000
1s - loss: 0.0025 - val_loss: 0.0158
Epoch 57/1000
1s - loss: 0.0024 - val_loss: 0.0195
Epoch 58/1000
1s - loss: 0.0025 - val_loss: 0.0189
Epoch 59/1000
1s - loss: 0.0024 - val_loss: 0.0205
Epoch 60/1000
1s - loss: 0.0023 - val_loss: 0.0162
Epoch 61/1000
1s - loss: 0.0025 - val_loss: 0.0172
Accuracy: 0.8629
             precision    recall  f1-score   support

         40      0.900     0.900     0.900        10
         41      1.000     1.000     1.000         3
         42      1.000     1.000     1.000         1
         43      1.000     0.462     0.632        13
         44      1.000     1.000     1.000         2
         45      1.000     0.944     0.971        18
         46      1.000     1.000     1.000         1
         47      1.000     1.000     1.000        10
         48      1.000     0.875     0.933        40
         49      1.000     1.000     1.000         4
         50      1.000     0.944     0.971        18
         51      1.000     1.000     1.000         3
         52      0.614     1.000     0.761        27
         53      0.917     0.478     0.629        23
         54      0.920     0.920     0.920        25
         55      1.000     1.000     1.000        16
         56      1.000     0.923     0.960        13
         57      0.852     1.000     0.920        23
         58      0.917     0.647     0.759        17
         59      0.833     0.930     0.879        43
         60      1.000     0.957     0.978        23
         61      0.889     1.000     0.941        24
         62      0.854     1.000     0.921        35
         63      1.000     0.273     0.429        11
         64      0.887     0.922     0.904        51
         65      1.000     1.000     1.000         7
         66      1.000     1.000     1.000        10
         67      0.966     0.933     0.949        30
         68      1.000     0.750     0.857         4
         69      0.943     1.000     0.971        33
         70      1.000     1.000     1.000         2
         71      0.750     0.750     0.750         4
         72      0.684     1.000     0.813        13
         73      1.000     0.600     0.750        10
         74      0.583     1.000     0.737         7
         75      1.000     1.000     1.000         2
         76      1.000     1.000     1.000         2
         77      1.000     1.000     1.000         2
         78      1.000     1.000     1.000        10
         79      1.000     1.000     1.000         2
         80      1.000     1.000     1.000         1
         81      1.000     1.000     1.000         1
         82      1.000     1.000     1.000         1
         83      1.000     1.000     1.000         1
         84      1.000     1.000     1.000         1
         85      0.000     0.000     0.000         0
         86      0.000     0.000     0.000         0
         87      0.000     0.000     0.000         0
         88      0.000     0.000     0.000         0

avg / total      0.913     0.899     0.891       597

____________________________________________________________________________________________________
Layer (type)                     Output Shape          Param #     Connected to                     
====================================================================================================
input_6 (InputLayer)             (None, 1, 36, 180)    0                                            
____________________________________________________________________________________________________
conv2d_11 (Conv2D)               (None, 10, 27, 178)   310                                          
____________________________________________________________________________________________________
conv2d_12 (Conv2D)               (None, 512, 6, 1)     922112                                       
____________________________________________________________________________________________________
activation_16 (Activation)       (None, 10, 27, 178)   0                                            
____________________________________________________________________________________________________
activation_17 (Activation)       (None, 512, 6, 1)     0                                            
____________________________________________________________________________________________________
max_pooling2d_11 (MaxPooling2D)  (None, 10, 4, 59)     0                                            
____________________________________________________________________________________________________
max_pooling2d_12 (MaxPooling2D)  (None, 512, 3, 1)     0                                            
____________________________________________________________________________________________________
dropout_16 (Dropout)             (None, 10, 4, 59)     0                                            
____________________________________________________________________________________________________
dropout_17 (Dropout)             (None, 512, 3, 1)     0                                            
____________________________________________________________________________________________________
flatten_11 (Flatten)             (None, 2360)          0                                            
____________________________________________________________________________________________________
flatten_12 (Flatten)             (None, 1536)          0                                            
____________________________________________________________________________________________________
concatenate_6 (Concatenate)      (None, 3896)          0                                            
____________________________________________________________________________________________________
dense_11 (Dense)                 (None, 256)           997632                                       
____________________________________________________________________________________________________
activation_18 (Activation)       (None, 256)           0                                            
____________________________________________________________________________________________________
dropout_18 (Dropout)             (None, 256)           0                                            
____________________________________________________________________________________________________
dense_12 (Dense)                 (None, 49)            12593                                        
====================================================================================================
Total params: 1,932,647.0
Trainable params: 1,932,647.0
Non-trainable params: 0.0
____________________________________________________________________________________________________
Train on 4663 samples, validate on 436 samples
Epoch 1/1000
1s - loss: 0.2269 - val_loss: 0.0482
Epoch 2/1000
1s - loss: 0.0677 - val_loss: 0.0298
Epoch 3/1000
1s - loss: 0.0397 - val_loss: 0.0209
Epoch 4/1000
1s - loss: 0.0284 - val_loss: 0.0176
Epoch 5/1000
1s - loss: 0.0225 - val_loss: 0.0157
Epoch 6/1000
1s - loss: 0.0196 - val_loss: 0.0147
Epoch 7/1000
1s - loss: 0.0170 - val_loss: 0.0129
Epoch 8/1000
1s - loss: 0.0153 - val_loss: 0.0125
Epoch 9/1000
1s - loss: 0.0137 - val_loss: 0.0110
Epoch 10/1000
1s - loss: 0.0128 - val_loss: 0.0103
Epoch 11/1000
1s - loss: 0.0109 - val_loss: 0.0105
Epoch 12/1000
1s - loss: 0.0105 - val_loss: 0.0103
Epoch 13/1000
1s - loss: 0.0089 - val_loss: 0.0107
Epoch 14/1000
1s - loss: 0.0093 - val_loss: 0.0099
Epoch 15/1000
1s - loss: 0.0083 - val_loss: 0.0114
Epoch 16/1000
1s - loss: 0.0078 - val_loss: 0.0097
Epoch 17/1000
1s - loss: 0.0074 - val_loss: 0.0097
Epoch 18/1000
1s - loss: 0.0070 - val_loss: 0.0092
Epoch 19/1000
1s - loss: 0.0065 - val_loss: 0.0103
Epoch 20/1000
1s - loss: 0.0058 - val_loss: 0.0099
Epoch 21/1000
1s - loss: 0.0059 - val_loss: 0.0086
Epoch 22/1000
1s - loss: 0.0058 - val_loss: 0.0098
Epoch 23/1000
1s - loss: 0.0056 - val_loss: 0.0087
Epoch 24/1000
1s - loss: 0.0053 - val_loss: 0.0090
Epoch 25/1000
1s - loss: 0.0048 - val_loss: 0.0096
Epoch 26/1000
1s - loss: 0.0050 - val_loss: 0.0098
Epoch 27/1000
1s - loss: 0.0046 - val_loss: 0.0101
Epoch 28/1000
1s - loss: 0.0044 - val_loss: 0.0096
Epoch 29/1000
1s - loss: 0.0041 - val_loss: 0.0092
Epoch 30/1000
1s - loss: 0.0038 - val_loss: 0.0104
Epoch 31/1000
1s - loss: 0.0039 - val_loss: 0.0103
Epoch 32/1000
1s - loss: 0.0040 - val_loss: 0.0084
Epoch 33/1000
1s - loss: 0.0039 - val_loss: 0.0089
Epoch 34/1000
1s - loss: 0.0034 - val_loss: 0.0090
Epoch 35/1000
1s - loss: 0.0038 - val_loss: 0.0083
Epoch 36/1000
1s - loss: 0.0038 - val_loss: 0.0097
Epoch 37/1000
1s - loss: 0.0038 - val_loss: 0.0101
Epoch 38/1000
1s - loss: 0.0036 - val_loss: 0.0093
Epoch 39/1000
1s - loss: 0.0038 - val_loss: 0.0097
Epoch 40/1000
1s - loss: 0.0034 - val_loss: 0.0096
Epoch 41/1000
1s - loss: 0.0038 - val_loss: 0.0094
Epoch 42/1000
1s - loss: 0.0036 - val_loss: 0.0083
Epoch 43/1000
1s - loss: 0.0032 - val_loss: 0.0091
Epoch 44/1000
1s - loss: 0.0030 - val_loss: 0.0090
Epoch 45/1000
1s - loss: 0.0032 - val_loss: 0.0085
Epoch 46/1000
1s - loss: 0.0033 - val_loss: 0.0079
Epoch 47/1000
1s - loss: 0.0033 - val_loss: 0.0100
Epoch 48/1000
1s - loss: 0.0029 - val_loss: 0.0104
Epoch 49/1000
1s - loss: 0.0030 - val_loss: 0.0090
Epoch 50/1000
1s - loss: 0.0028 - val_loss: 0.0112
Epoch 51/1000
1s - loss: 0.0025 - val_loss: 0.0096
Epoch 52/1000
1s - loss: 0.0036 - val_loss: 0.0105
Epoch 53/1000
1s - loss: 0.0031 - val_loss: 0.0086
Epoch 54/1000
1s - loss: 0.0034 - val_loss: 0.0106
Epoch 55/1000
1s - loss: 0.0028 - val_loss: 0.0124
Epoch 56/1000
1s - loss: 0.0028 - val_loss: 0.0093
Epoch 57/1000
1s - loss: 0.0029 - val_loss: 0.0104
Epoch 58/1000
1s - loss: 0.0028 - val_loss: 0.0122
Accuracy: 0.9014
             precision    recall  f1-score   support

         40      0.000     0.000     0.000         0
         41      0.000     0.000     0.000         0
         42      0.000     0.000     0.000         0
         43      1.000     1.000     1.000         5
         44      0.000     0.000     0.000         0
         45      1.000     1.000     1.000        20
         46      0.000     0.000     0.000         0
         47      1.000     0.933     0.966        15
         48      1.000     1.000     1.000        44
         49      0.941     1.000     0.970        16
         50      1.000     1.000     1.000        20
         51      1.000     1.000     1.000         2
         52      0.972     1.000     0.986        35
         53      1.000     0.500     0.667        12
         54      0.868     0.943     0.904        35
         55      0.933     1.000     0.966        28
         56      0.947     1.000     0.973        18
         57      1.000     0.880     0.936        25
         58      1.000     0.857     0.923        14
         59      1.000     0.854     0.921        41
         60      1.000     1.000     1.000        13
         61      0.867     0.929     0.897        42
         62      0.871     0.900     0.885        30
         63      1.000     0.333     0.500         6
         64      1.000     0.864     0.927        22
         65      0.833     1.000     0.909         5
         66      0.769     1.000     0.870        10
         67      1.000     0.870     0.930        23
         68      0.833     0.833     0.833         6
         69      0.960     1.000     0.980        24
         70      1.000     1.000     1.000         1
         71      1.000     0.889     0.941         9
         72      1.000     0.857     0.923         7
         73      1.000     1.000     1.000         5
         74      0.556     0.833     0.667         6
         75      0.000     0.000     0.000         0
         76      1.000     1.000     1.000         1
         77      0.000     0.000     0.000         0
         78      1.000     1.000     1.000         4
         79      0.000     0.000     0.000         0
         80      0.000     0.000     0.000         0
         81      0.000     0.000     0.000         0
         82      0.000     0.000     0.000         0
         83      0.000     0.000     0.000         0
         84      0.000     0.000     0.000         0
         85      0.000     0.000     0.000         0
         86      0.000     0.000     0.000         0
         87      0.000     0.000     0.000         0
         88      0.000     0.000     0.000         0

avg / total      0.951     0.926     0.933       544

____________________________________________________________________________________________________
Layer (type)                     Output Shape          Param #     Connected to                     
====================================================================================================
input_7 (InputLayer)             (None, 1, 36, 180)    0                                            
____________________________________________________________________________________________________
conv2d_13 (Conv2D)               (None, 10, 27, 178)   310                                          
____________________________________________________________________________________________________
conv2d_14 (Conv2D)               (None, 512, 6, 1)     922112                                       
____________________________________________________________________________________________________
activation_19 (Activation)       (None, 10, 27, 178)   0                                            
____________________________________________________________________________________________________
activation_20 (Activation)       (None, 512, 6, 1)     0                                            
____________________________________________________________________________________________________
max_pooling2d_13 (MaxPooling2D)  (None, 10, 4, 59)     0                                            
____________________________________________________________________________________________________
max_pooling2d_14 (MaxPooling2D)  (None, 512, 3, 1)     0                                            
____________________________________________________________________________________________________
dropout_19 (Dropout)             (None, 10, 4, 59)     0                                            
____________________________________________________________________________________________________
dropout_20 (Dropout)             (None, 512, 3, 1)     0                                            
____________________________________________________________________________________________________
flatten_13 (Flatten)             (None, 2360)          0                                            
____________________________________________________________________________________________________
flatten_14 (Flatten)             (None, 1536)          0                                            
____________________________________________________________________________________________________
concatenate_7 (Concatenate)      (None, 3896)          0                                            
____________________________________________________________________________________________________
dense_13 (Dense)                 (None, 256)           997632                                       
____________________________________________________________________________________________________
activation_21 (Activation)       (None, 256)           0                                            
____________________________________________________________________________________________________
dropout_21 (Dropout)             (None, 256)           0                                            
____________________________________________________________________________________________________
dense_14 (Dense)                 (None, 49)            12593                                        
====================================================================================================
Total params: 1,932,647.0
Trainable params: 1,932,647.0
Non-trainable params: 0.0
____________________________________________________________________________________________________
Train on 4655 samples, validate on 444 samples
Epoch 1/1000
1s - loss: 0.2130 - val_loss: 0.0472
Epoch 2/1000
1s - loss: 0.0623 - val_loss: 0.0180
Epoch 3/1000
1s - loss: 0.0354 - val_loss: 0.0113
Epoch 4/1000
1s - loss: 0.0259 - val_loss: 0.0084
Epoch 5/1000
1s - loss: 0.0199 - val_loss: 0.0072
Epoch 6/1000
1s - loss: 0.0171 - val_loss: 0.0056
Epoch 7/1000
1s - loss: 0.0152 - val_loss: 0.0059
Epoch 8/1000
1s - loss: 0.0127 - val_loss: 0.0047
Epoch 9/1000
1s - loss: 0.0116 - val_loss: 0.0041
Epoch 10/1000
1s - loss: 0.0110 - val_loss: 0.0047
Epoch 11/1000
1s - loss: 0.0096 - val_loss: 0.0059
Epoch 12/1000
1s - loss: 0.0086 - val_loss: 0.0038
Epoch 13/1000
1s - loss: 0.0082 - val_loss: 0.0041
Epoch 14/1000
1s - loss: 0.0080 - val_loss: 0.0043
Epoch 15/1000
1s - loss: 0.0074 - val_loss: 0.0037
Epoch 16/1000
1s - loss: 0.0066 - val_loss: 0.0031
Epoch 17/1000
1s - loss: 0.0061 - val_loss: 0.0029
Epoch 18/1000
1s - loss: 0.0059 - val_loss: 0.0027
Epoch 19/1000
1s - loss: 0.0057 - val_loss: 0.0041
Epoch 20/1000
1s - loss: 0.0053 - val_loss: 0.0030
Epoch 21/1000
1s - loss: 0.0049 - val_loss: 0.0032
Epoch 22/1000
1s - loss: 0.0054 - val_loss: 0.0034
Epoch 23/1000
1s - loss: 0.0046 - val_loss: 0.0040
Epoch 24/1000
1s - loss: 0.0045 - val_loss: 0.0039
Epoch 25/1000
1s - loss: 0.0045 - val_loss: 0.0024
Epoch 26/1000
1s - loss: 0.0045 - val_loss: 0.0030
Epoch 27/1000
1s - loss: 0.0038 - val_loss: 0.0028
Epoch 28/1000
1s - loss: 0.0038 - val_loss: 0.0020
Epoch 29/1000
1s - loss: 0.0037 - val_loss: 0.0028
Epoch 30/1000
1s - loss: 0.0039 - val_loss: 0.0025
Epoch 31/1000
1s - loss: 0.0041 - val_loss: 0.0030
Epoch 32/1000
1s - loss: 0.0035 - val_loss: 0.0042
Epoch 33/1000
1s - loss: 0.0032 - val_loss: 0.0027
Epoch 34/1000
1s - loss: 0.0033 - val_loss: 0.0043
Epoch 35/1000
1s - loss: 0.0033 - val_loss: 0.0028
Epoch 36/1000
1s - loss: 0.0031 - val_loss: 0.0027
Epoch 37/1000
1s - loss: 0.0031 - val_loss: 0.0031
Epoch 38/1000
1s - loss: 0.0034 - val_loss: 0.0023
Epoch 39/1000
1s - loss: 0.0031 - val_loss: 0.0032
Epoch 40/1000
1s - loss: 0.0028 - val_loss: 0.0023
Epoch 41/1000
1s - loss: 0.0025 - val_loss: 0.0036
Epoch 42/1000
1s - loss: 0.0031 - val_loss: 0.0023
Epoch 43/1000
1s - loss: 0.0032 - val_loss: 0.0036
Epoch 44/1000
1s - loss: 0.0029 - val_loss: 0.0027
Epoch 45/1000
1s - loss: 0.0029 - val_loss: 0.0032
Epoch 46/1000
1s - loss: 0.0031 - val_loss: 0.0026
Epoch 47/1000
1s - loss: 0.0031 - val_loss: 0.0031
Epoch 48/1000
1s - loss: 0.0031 - val_loss: 0.0017
Accuracy: 0.9842
             precision    recall  f1-score   support

         40      1.000     1.000     1.000        13
         41      1.000     1.000     1.000         6
         42      1.000     1.000     1.000         5
         43      1.000     1.000     1.000         9
         44      1.000     1.000     1.000         2
         45      1.000     1.000     1.000        28
         46      1.000     1.000     1.000         4
         47      1.000     1.000     1.000        17
         48      1.000     1.000     1.000        45
         49      1.000     1.000     1.000        10
         50      1.000     0.973     0.986        37
         51      1.000     1.000     1.000         5
         52      1.000     1.000     1.000        44
         53      1.000     1.000     1.000        14
         54      1.000     1.000     1.000        24
         55      1.000     1.000     1.000        37
         56      1.000     1.000     1.000        15
         57      1.000     1.000     1.000        35
         58      1.000     1.000     1.000         8
         59      0.958     1.000     0.979        46
         60      1.000     1.000     1.000        14
         61      1.000     1.000     1.000        26
         62      1.000     0.967     0.983        30
         63      1.000     1.000     1.000         3
         64      0.960     1.000     0.980        48
         65      1.000     1.000     1.000         2
         66      1.000     0.929     0.963        14
         67      1.000     0.923     0.960        13
         68      1.000     1.000     1.000         1
         69      0.929     1.000     0.963        13
         70      1.000     1.000     1.000         2
         71      1.000     1.000     1.000         3
         72      1.000     0.500     0.667         2
         73      1.000     1.000     1.000         1
         74      1.000     1.000     1.000         4
         75      1.000     1.000     1.000         2
         76      1.000     1.000     1.000         1
         77      1.000     1.000     1.000         1
         78      1.000     1.000     1.000         1
         79      1.000     1.000     1.000         1
         80      1.000     1.000     1.000         1
         81      1.000     1.000     1.000         1
         82      1.000     1.000     1.000         1
         83      1.000     1.000     1.000         1
         84      1.000     1.000     1.000         1
         85      0.000     0.000     0.000         0
         86      0.000     0.000     0.000         0
         87      0.000     0.000     0.000         0
         88      0.000     0.000     0.000         0

avg / total      0.992     0.992     0.991       591

____________________________________________________________________________________________________
Layer (type)                     Output Shape          Param #     Connected to                     
====================================================================================================
input_8 (InputLayer)             (None, 1, 36, 180)    0                                            
____________________________________________________________________________________________________
conv2d_15 (Conv2D)               (None, 10, 27, 178)   310                                          
____________________________________________________________________________________________________
conv2d_16 (Conv2D)               (None, 512, 6, 1)     922112                                       
____________________________________________________________________________________________________
activation_22 (Activation)       (None, 10, 27, 178)   0                                            
____________________________________________________________________________________________________
activation_23 (Activation)       (None, 512, 6, 1)     0                                            
____________________________________________________________________________________________________
max_pooling2d_15 (MaxPooling2D)  (None, 10, 4, 59)     0                                            
____________________________________________________________________________________________________
max_pooling2d_16 (MaxPooling2D)  (None, 512, 3, 1)     0                                            
____________________________________________________________________________________________________
dropout_22 (Dropout)             (None, 10, 4, 59)     0                                            
____________________________________________________________________________________________________
dropout_23 (Dropout)             (None, 512, 3, 1)     0                                            
____________________________________________________________________________________________________
flatten_15 (Flatten)             (None, 2360)          0                                            
____________________________________________________________________________________________________
flatten_16 (Flatten)             (None, 1536)          0                                            
____________________________________________________________________________________________________
concatenate_8 (Concatenate)      (None, 3896)          0                                            
____________________________________________________________________________________________________
dense_15 (Dense)                 (None, 256)           997632                                       
____________________________________________________________________________________________________
activation_24 (Activation)       (None, 256)           0                                            
____________________________________________________________________________________________________
dropout_24 (Dropout)             (None, 256)           0                                            
____________________________________________________________________________________________________
dense_16 (Dense)                 (None, 49)            12593                                        
====================================================================================================
Total params: 1,932,647.0
Trainable params: 1,932,647.0
Non-trainable params: 0.0
____________________________________________________________________________________________________
Train on 4680 samples, validate on 419 samples
Epoch 1/1000
1s - loss: 0.2091 - val_loss: 0.0470
Epoch 2/1000
1s - loss: 0.0643 - val_loss: 0.0190
Epoch 3/1000
1s - loss: 0.0379 - val_loss: 0.0133
Epoch 4/1000
1s - loss: 0.0270 - val_loss: 0.0109
Epoch 5/1000
1s - loss: 0.0215 - val_loss: 0.0100
Epoch 6/1000
1s - loss: 0.0177 - val_loss: 0.0089
Epoch 7/1000
1s - loss: 0.0155 - val_loss: 0.0088
Epoch 8/1000
1s - loss: 0.0138 - val_loss: 0.0078
Epoch 9/1000
1s - loss: 0.0116 - val_loss: 0.0086
Epoch 10/1000
1s - loss: 0.0107 - val_loss: 0.0076
Epoch 11/1000
1s - loss: 0.0097 - val_loss: 0.0070
Epoch 12/1000
1s - loss: 0.0091 - val_loss: 0.0065
Epoch 13/1000
1s - loss: 0.0086 - val_loss: 0.0069
Epoch 14/1000
1s - loss: 0.0077 - val_loss: 0.0070
Epoch 15/1000
1s - loss: 0.0072 - val_loss: 0.0075
Epoch 16/1000
1s - loss: 0.0067 - val_loss: 0.0074
Epoch 17/1000
1s - loss: 0.0061 - val_loss: 0.0065
Epoch 18/1000
1s - loss: 0.0060 - val_loss: 0.0068
Epoch 19/1000
1s - loss: 0.0057 - val_loss: 0.0069
Epoch 20/1000
1s - loss: 0.0061 - val_loss: 0.0064
Epoch 21/1000
1s - loss: 0.0057 - val_loss: 0.0071
Epoch 22/1000
1s - loss: 0.0052 - val_loss: 0.0069
Epoch 23/1000
1s - loss: 0.0046 - val_loss: 0.0063
Epoch 24/1000
1s - loss: 0.0046 - val_loss: 0.0074
Epoch 25/1000
1s - loss: 0.0044 - val_loss: 0.0076
Epoch 26/1000
1s - loss: 0.0045 - val_loss: 0.0068
Epoch 27/1000
1s - loss: 0.0042 - val_loss: 0.0072
Epoch 28/1000
1s - loss: 0.0042 - val_loss: 0.0075
Epoch 29/1000
1s - loss: 0.0037 - val_loss: 0.0077
Epoch 30/1000
1s - loss: 0.0037 - val_loss: 0.0074
Epoch 31/1000
1s - loss: 0.0039 - val_loss: 0.0085
Epoch 32/1000
1s - loss: 0.0035 - val_loss: 0.0079
Epoch 33/1000
1s - loss: 0.0033 - val_loss: 0.0081
Epoch 34/1000
1s - loss: 0.0033 - val_loss: 0.0078
Epoch 35/1000
1s - loss: 0.0029 - val_loss: 0.0076
Epoch 36/1000
1s - loss: 0.0032 - val_loss: 0.0082
Epoch 37/1000
1s - loss: 0.0029 - val_loss: 0.0074
Epoch 38/1000
1s - loss: 0.0030 - val_loss: 0.0063
Epoch 39/1000
1s - loss: 0.0030 - val_loss: 0.0069
Epoch 40/1000
1s - loss: 0.0027 - val_loss: 0.0071
Epoch 41/1000
1s - loss: 0.0026 - val_loss: 0.0070
Epoch 42/1000
1s - loss: 0.0027 - val_loss: 0.0074
Epoch 43/1000
1s - loss: 0.0034 - val_loss: 0.0062
Epoch 44/1000
1s - loss: 0.0035 - val_loss: 0.0073
Epoch 45/1000
1s - loss: 0.0032 - val_loss: 0.0086
Epoch 46/1000
1s - loss: 0.0029 - val_loss: 0.0088
Epoch 47/1000
1s - loss: 0.0028 - val_loss: 0.0078
Epoch 48/1000
1s - loss: 0.0024 - val_loss: 0.0082
Epoch 49/1000
1s - loss: 0.0022 - val_loss: 0.0086
Epoch 50/1000
1s - loss: 0.0024 - val_loss: 0.0090
Epoch 51/1000
1s - loss: 0.0023 - val_loss: 0.0084
Epoch 52/1000
1s - loss: 0.0026 - val_loss: 0.0077
Epoch 53/1000
1s - loss: 0.0023 - val_loss: 0.0088
Epoch 54/1000
1s - loss: 0.0024 - val_loss: 0.0088
Epoch 55/1000
1s - loss: 0.0024 - val_loss: 0.0080
Epoch 56/1000
1s - loss: 0.0023 - val_loss: 0.0073
Accuracy: 0.9547
             precision    recall  f1-score   support

         40      1.000     1.000     1.000         5
         41      1.000     1.000     1.000         1
         42      0.000     0.000     0.000         0
         43      1.000     1.000     1.000         3
         44      0.000     0.000     0.000         0
         45      1.000     1.000     1.000        21
         46      1.000     1.000     1.000         3
         47      0.938     0.938     0.938        16
         48      1.000     1.000     1.000        30
         49      1.000     0.941     0.970        17
         50      1.000     1.000     1.000        22
         51      1.000     1.000     1.000         1
         52      1.000     0.971     0.986        35
         53      0.889     1.000     0.941         8
         54      0.944     1.000     0.971        34
         55      1.000     1.000     1.000        26
         56      1.000     1.000     1.000        22
         57      0.912     0.969     0.939        32
         58      0.818     1.000     0.900         9
         59      1.000     0.925     0.961        40
         60      1.000     1.000     1.000        14
         61      0.978     1.000     0.989        44
         62      1.000     1.000     1.000        30
         63      1.000     1.000     1.000         7
         64      1.000     0.962     0.980        26
         65      1.000     1.000     1.000         9
         66      1.000     1.000     1.000        10
         67      1.000     1.000     1.000        19
         68      1.000     1.000     1.000         4
         69      0.955     1.000     0.977        21
         70      0.667     1.000     0.800         4
         71      0.833     0.833     0.833         6
         72      0.875     0.875     0.875         8
         73      1.000     0.750     0.857         4
         74      1.000     0.900     0.947        10
         75      1.000     1.000     1.000         3
         76      1.000     1.000     1.000         1
         77      1.000     1.000     1.000         1
         78      1.000     1.000     1.000         1
         79      1.000     1.000     1.000         1
         80      0.000     0.000     0.000         0
         81      0.000     0.000     0.000         0
         82      0.000     0.000     0.000         0
         83      0.000     0.000     0.000         0
         84      0.000     0.000     0.000         0
         85      0.000     0.000     0.000         0
         86      0.000     0.000     0.000         0
         87      0.000     0.000     0.000         0
         88      0.000     0.000     0.000         0

avg / total      0.975     0.978     0.976       548

____________________________________________________________________________________________________
Layer (type)                     Output Shape          Param #     Connected to                     
====================================================================================================
input_9 (InputLayer)             (None, 1, 36, 180)    0                                            
____________________________________________________________________________________________________
conv2d_17 (Conv2D)               (None, 10, 27, 178)   310                                          
____________________________________________________________________________________________________
conv2d_18 (Conv2D)               (None, 512, 6, 1)     922112                                       
____________________________________________________________________________________________________
activation_25 (Activation)       (None, 10, 27, 178)   0                                            
____________________________________________________________________________________________________
activation_26 (Activation)       (None, 512, 6, 1)     0                                            
____________________________________________________________________________________________________
max_pooling2d_17 (MaxPooling2D)  (None, 10, 4, 59)     0                                            
____________________________________________________________________________________________________
max_pooling2d_18 (MaxPooling2D)  (None, 512, 3, 1)     0                                            
____________________________________________________________________________________________________
dropout_25 (Dropout)             (None, 10, 4, 59)     0                                            
____________________________________________________________________________________________________
dropout_26 (Dropout)             (None, 512, 3, 1)     0                                            
____________________________________________________________________________________________________
flatten_17 (Flatten)             (None, 2360)          0                                            
____________________________________________________________________________________________________
flatten_18 (Flatten)             (None, 1536)          0                                            
____________________________________________________________________________________________________
concatenate_9 (Concatenate)      (None, 3896)          0                                            
____________________________________________________________________________________________________
dense_17 (Dense)                 (None, 256)           997632                                       
____________________________________________________________________________________________________
activation_27 (Activation)       (None, 256)           0                                            
____________________________________________________________________________________________________
dropout_27 (Dropout)             (None, 256)           0                                            
____________________________________________________________________________________________________
dense_18 (Dense)                 (None, 49)            12593                                        
====================================================================================================
Total params: 1,932,647.0
Trainable params: 1,932,647.0
Non-trainable params: 0.0
____________________________________________________________________________________________________
Train on 4712 samples, validate on 387 samples
Epoch 1/1000
1s - loss: 0.2221 - val_loss: 0.0456
Epoch 2/1000
1s - loss: 0.0659 - val_loss: 0.0270
Epoch 3/1000
1s - loss: 0.0382 - val_loss: 0.0194
Epoch 4/1000
1s - loss: 0.0279 - val_loss: 0.0166
Epoch 5/1000
1s - loss: 0.0230 - val_loss: 0.0159
Epoch 6/1000
1s - loss: 0.0182 - val_loss: 0.0140
Epoch 7/1000
1s - loss: 0.0157 - val_loss: 0.0130
Epoch 8/1000
1s - loss: 0.0139 - val_loss: 0.0127
Epoch 9/1000
1s - loss: 0.0125 - val_loss: 0.0125
Epoch 10/1000
1s - loss: 0.0112 - val_loss: 0.0113
Epoch 11/1000
1s - loss: 0.0104 - val_loss: 0.0128
Epoch 12/1000
1s - loss: 0.0091 - val_loss: 0.0122
Epoch 13/1000
1s - loss: 0.0087 - val_loss: 0.0122
Epoch 14/1000
1s - loss: 0.0084 - val_loss: 0.0111
Epoch 15/1000
1s - loss: 0.0074 - val_loss: 0.0116
Epoch 16/1000
1s - loss: 0.0073 - val_loss: 0.0119
Epoch 17/1000
1s - loss: 0.0068 - val_loss: 0.0128
Epoch 18/1000
1s - loss: 0.0067 - val_loss: 0.0129
Epoch 19/1000
1s - loss: 0.0063 - val_loss: 0.0107
Epoch 20/1000
1s - loss: 0.0059 - val_loss: 0.0111
Epoch 21/1000
1s - loss: 0.0056 - val_loss: 0.0110
Epoch 22/1000
1s - loss: 0.0051 - val_loss: 0.0111
Epoch 23/1000
1s - loss: 0.0054 - val_loss: 0.0112
Epoch 24/1000
1s - loss: 0.0047 - val_loss: 0.0125
Epoch 25/1000
1s - loss: 0.0043 - val_loss: 0.0119
Epoch 26/1000
1s - loss: 0.0044 - val_loss: 0.0119
Epoch 27/1000
1s - loss: 0.0046 - val_loss: 0.0120
Epoch 28/1000
1s - loss: 0.0046 - val_loss: 0.0113
Epoch 29/1000
1s - loss: 0.0041 - val_loss: 0.0098
Epoch 30/1000
1s - loss: 0.0040 - val_loss: 0.0107
Epoch 31/1000
1s - loss: 0.0038 - val_loss: 0.0105
Epoch 32/1000
1s - loss: 0.0037 - val_loss: 0.0132
Epoch 33/1000
1s - loss: 0.0038 - val_loss: 0.0115
Epoch 34/1000
1s - loss: 0.0034 - val_loss: 0.0126
Epoch 35/1000
1s - loss: 0.0036 - val_loss: 0.0135
Epoch 36/1000
1s - loss: 0.0036 - val_loss: 0.0130
Epoch 37/1000
1s - loss: 0.0031 - val_loss: 0.0124
Epoch 38/1000
1s - loss: 0.0035 - val_loss: 0.0122
Epoch 39/1000
1s - loss: 0.0028 - val_loss: 0.0123
Epoch 40/1000
1s - loss: 0.0029 - val_loss: 0.0117
Epoch 41/1000
1s - loss: 0.0029 - val_loss: 0.0136
Epoch 42/1000
1s - loss: 0.0028 - val_loss: 0.0129
Epoch 43/1000
1s - loss: 0.0030 - val_loss: 0.0134
Epoch 44/1000
1s - loss: 0.0027 - val_loss: 0.0113
Epoch 45/1000
1s - loss: 0.0029 - val_loss: 0.0131
Epoch 46/1000
1s - loss: 0.0032 - val_loss: 0.0124
Epoch 47/1000
1s - loss: 0.0029 - val_loss: 0.0111
Epoch 48/1000
1s - loss: 0.0027 - val_loss: 0.0128
Epoch 49/1000
1s - loss: 0.0028 - val_loss: 0.0128
Epoch 50/1000
1s - loss: 0.0025 - val_loss: 0.0141
Epoch 51/1000
1s - loss: 0.0026 - val_loss: 0.0124
Epoch 52/1000
1s - loss: 0.0022 - val_loss: 0.0131
Epoch 53/1000
1s - loss: 0.0022 - val_loss: 0.0134
Epoch 54/1000
1s - loss: 0.0024 - val_loss: 0.0122
Epoch 55/1000
1s - loss: 0.0022 - val_loss: 0.0134
Epoch 56/1000
1s - loss: 0.0026 - val_loss: 0.0117
Epoch 57/1000
1s - loss: 0.0024 - val_loss: 0.0126
Epoch 58/1000
1s - loss: 0.0026 - val_loss: 0.0123
Epoch 59/1000
1s - loss: 0.0024 - val_loss: 0.0124
Accuracy: 0.8992
             precision    recall  f1-score   support

         40      1.000     1.000     1.000         1
         41      0.000     0.000     0.000         1
         42      0.000     0.000     0.000         0
         43      1.000     1.000     1.000         2
         44      1.000     1.000     1.000         1
         45      1.000     0.952     0.976        21
         46      1.000     1.000     1.000         4
         47      1.000     1.000     1.000         6
         48      0.960     1.000     0.980        24
         49      1.000     1.000     1.000         7
         50      1.000     1.000     1.000        43
         51      1.000     1.000     1.000         1
         52      0.939     0.939     0.939        33
         53      0.909     1.000     0.952        10
         54      0.963     1.000     0.981        26
         55      1.000     0.960     0.980        25
         56      1.000     1.000     1.000        18
         57      0.872     1.000     0.932        34
         58      0.857     1.000     0.923         6
         59      0.946     0.921     0.933        38
         60      0.950     1.000     0.974        19
         61      0.969     0.912     0.939        34
         62      0.938     0.882     0.909        34
         63      0.800     1.000     0.889         4
         64      0.875     1.000     0.933        28
         65      0.900     1.000     0.947         9
         66      1.000     0.909     0.952        11
         67      1.000     0.933     0.966        15
         68      1.000     1.000     1.000         3
         69      0.969     0.969     0.969        32
         70      1.000     1.000     1.000         6
         71      0.833     1.000     0.909         5
         72      0.333     0.500     0.400         2
         73      1.000     0.500     0.667         2
         74      1.000     0.857     0.923         7
         75      0.000     0.000     0.000         0
         76      0.000     0.000     0.000         0
         77      0.000     0.000     0.000         0
         78      1.000     1.000     1.000         1
         79      0.000     0.000     0.000         0
         80      0.000     0.000     0.000         0
         81      0.000     0.000     0.000         0
         82      0.000     0.000     0.000         0
         83      1.000     1.000     1.000         1
         84      0.000     0.000     0.000         0
         85      0.000     0.000     0.000         0
         86      0.000     0.000     0.000         0
         87      0.000     0.000     0.000         0
         88      0.000     0.000     0.000         0

avg / total      0.950     0.959     0.953       514

____________________________________________________________________________________________________
Layer (type)                     Output Shape          Param #     Connected to                     
====================================================================================================
input_10 (InputLayer)            (None, 1, 36, 180)    0                                            
____________________________________________________________________________________________________
conv2d_19 (Conv2D)               (None, 10, 27, 178)   310                                          
____________________________________________________________________________________________________
conv2d_20 (Conv2D)               (None, 512, 6, 1)     922112                                       
____________________________________________________________________________________________________
activation_28 (Activation)       (None, 10, 27, 178)   0                                            
____________________________________________________________________________________________________
activation_29 (Activation)       (None, 512, 6, 1)     0                                            
____________________________________________________________________________________________________
max_pooling2d_19 (MaxPooling2D)  (None, 10, 4, 59)     0                                            
____________________________________________________________________________________________________
max_pooling2d_20 (MaxPooling2D)  (None, 512, 3, 1)     0                                            
____________________________________________________________________________________________________
dropout_28 (Dropout)             (None, 10, 4, 59)     0                                            
____________________________________________________________________________________________________
dropout_29 (Dropout)             (None, 512, 3, 1)     0                                            
____________________________________________________________________________________________________
flatten_19 (Flatten)             (None, 2360)          0                                            
____________________________________________________________________________________________________
flatten_20 (Flatten)             (None, 1536)          0                                            
____________________________________________________________________________________________________
concatenate_10 (Concatenate)     (None, 3896)          0                                            
____________________________________________________________________________________________________
dense_19 (Dense)                 (None, 256)           997632                                       
____________________________________________________________________________________________________
activation_30 (Activation)       (None, 256)           0                                            
____________________________________________________________________________________________________
dropout_30 (Dropout)             (None, 256)           0                                            
____________________________________________________________________________________________________
dense_20 (Dense)                 (None, 49)            12593                                        
====================================================================================================
Total params: 1,932,647.0
Trainable params: 1,932,647.0
Non-trainable params: 0.0
____________________________________________________________________________________________________
Train on 4774 samples, validate on 325 samples
Epoch 1/1000
1s - loss: 0.2259 - val_loss: 0.0494
Epoch 2/1000
1s - loss: 0.0659 - val_loss: 0.0296
Epoch 3/1000
1s - loss: 0.0392 - val_loss: 0.0228
Epoch 4/1000
1s - loss: 0.0288 - val_loss: 0.0218
Epoch 5/1000
1s - loss: 0.0232 - val_loss: 0.0190
Epoch 6/1000
1s - loss: 0.0193 - val_loss: 0.0194
Epoch 7/1000
1s - loss: 0.0166 - val_loss: 0.0179
Epoch 8/1000
1s - loss: 0.0152 - val_loss: 0.0168
Epoch 9/1000
1s - loss: 0.0131 - val_loss: 0.0156
Epoch 10/1000
1s - loss: 0.0117 - val_loss: 0.0152
Epoch 11/1000
1s - loss: 0.0112 - val_loss: 0.0150
Epoch 12/1000
1s - loss: 0.0099 - val_loss: 0.0141
Epoch 13/1000
1s - loss: 0.0091 - val_loss: 0.0152
Epoch 14/1000
1s - loss: 0.0087 - val_loss: 0.0153
Epoch 15/1000
1s - loss: 0.0079 - val_loss: 0.0156
Epoch 16/1000
1s - loss: 0.0075 - val_loss: 0.0139
Epoch 17/1000
1s - loss: 0.0071 - val_loss: 0.0146
Epoch 18/1000
1s - loss: 0.0066 - val_loss: 0.0154
Epoch 19/1000
1s - loss: 0.0065 - val_loss: 0.0149
Epoch 20/1000
1s - loss: 0.0061 - val_loss: 0.0145
Epoch 21/1000
1s - loss: 0.0062 - val_loss: 0.0151
Epoch 22/1000
1s - loss: 0.0056 - val_loss: 0.0131
Epoch 23/1000
1s - loss: 0.0051 - val_loss: 0.0134
Epoch 24/1000
1s - loss: 0.0053 - val_loss: 0.0167
Epoch 25/1000
1s - loss: 0.0054 - val_loss: 0.0151
Epoch 26/1000
1s - loss: 0.0050 - val_loss: 0.0145
Epoch 27/1000
1s - loss: 0.0045 - val_loss: 0.0136
Epoch 28/1000
1s - loss: 0.0045 - val_loss: 0.0146
Epoch 29/1000
1s - loss: 0.0045 - val_loss: 0.0140
Epoch 30/1000
1s - loss: 0.0043 - val_loss: 0.0130
Epoch 31/1000
1s - loss: 0.0044 - val_loss: 0.0159
Epoch 32/1000
1s - loss: 0.0041 - val_loss: 0.0159
Epoch 33/1000
1s - loss: 0.0035 - val_loss: 0.0158
Epoch 34/1000
1s - loss: 0.0036 - val_loss: 0.0159
Epoch 35/1000
1s - loss: 0.0039 - val_loss: 0.0187
Epoch 36/1000
1s - loss: 0.0040 - val_loss: 0.0155
Epoch 37/1000
1s - loss: 0.0035 - val_loss: 0.0147
Epoch 38/1000
1s - loss: 0.0035 - val_loss: 0.0166
Epoch 39/1000
1s - loss: 0.0033 - val_loss: 0.0155
Epoch 40/1000
1s - loss: 0.0036 - val_loss: 0.0177
Epoch 41/1000
1s - loss: 0.0033 - val_loss: 0.0151
Epoch 42/1000
1s - loss: 0.0031 - val_loss: 0.0180
Epoch 43/1000
1s - loss: 0.0034 - val_loss: 0.0200
Epoch 44/1000
1s - loss: 0.0031 - val_loss: 0.0163
Epoch 45/1000
1s - loss: 0.0032 - val_loss: 0.0161
Epoch 46/1000
1s - loss: 0.0028 - val_loss: 0.0167
Epoch 47/1000
1s - loss: 0.0032 - val_loss: 0.0182
Epoch 48/1000
1s - loss: 0.0028 - val_loss: 0.0199
Epoch 49/1000
1s - loss: 0.0027 - val_loss: 0.0181
Epoch 50/1000
1s - loss: 0.0024 - val_loss: 0.0175
Epoch 51/1000
1s - loss: 0.0026 - val_loss: 0.0160
Epoch 52/1000
1s - loss: 0.0028 - val_loss: 0.0167
Epoch 53/1000
1s - loss: 0.0024 - val_loss: 0.0189
Epoch 54/1000
1s - loss: 0.0027 - val_loss: 0.0186
Epoch 55/1000
1s - loss: 0.0024 - val_loss: 0.0189
Epoch 56/1000
1s - loss: 0.0028 - val_loss: 0.0187
Epoch 57/1000
1s - loss: 0.0026 - val_loss: 0.0182
Epoch 58/1000
1s - loss: 0.0024 - val_loss: 0.0197
Epoch 59/1000
1s - loss: 0.0025 - val_loss: 0.0195
Epoch 60/1000
1s - loss: 0.0023 - val_loss: 0.0198
Epoch 61/1000
1s - loss: 0.0018 - val_loss: 0.0213
Epoch 62/1000
1s - loss: 0.0021 - val_loss: 0.0207
Epoch 63/1000
1s - loss: 0.0022 - val_loss: 0.0214
Epoch 64/1000
1s - loss: 0.0024 - val_loss: 0.0191
Epoch 65/1000
1s - loss: 0.0023 - val_loss: 0.0207
Epoch 66/1000
1s - loss: 0.0022 - val_loss: 0.0207
Epoch 67/1000
1s - loss: 0.0025 - val_loss: 0.0171
Epoch 68/1000
1s - loss: 0.0023 - val_loss: 0.0198
Accuracy: 0.92
             precision    recall  f1-score   support

         40      0.000     0.000     0.000         0
         41      1.000     1.000     1.000         1
         42      1.000     1.000     1.000         2
         43      1.000     1.000     1.000         2
         44      0.000     0.000     0.000         0
         45      1.000     1.000     1.000        17
         46      1.000     1.000     1.000         4
         47      0.833     1.000     0.909        15
         48      1.000     0.969     0.984        32
         49      0.947     0.947     0.947        19
         50      1.000     0.960     0.980        25
         51      0.750     1.000     0.857         3
         52      1.000     1.000     1.000        34
         53      1.000     1.000     1.000         6
         54      0.871     0.964     0.915        28
         55      1.000     0.958     0.979        24
         56      1.000     1.000     1.000         9
         57      0.913     0.840     0.875        25
         58      0.818     1.000     0.900         9
         59      0.955     0.955     0.955        22
         60      0.923     1.000     0.960        12
         61      0.960     0.923     0.941        26
         62      0.955     0.913     0.933        23
         63      1.000     0.667     0.800         3
         64      1.000     0.929     0.963        14
         65      1.000     1.000     1.000         7
         66      0.875     0.875     0.875         8
         67      0.933     1.000     0.966        14
         68      1.000     1.000     1.000         4
         69      0.944     1.000     0.971        17
         70      0.800     0.667     0.727         6
         71      0.714     1.000     0.833         5
         72      1.000     0.667     0.800         3
         73      1.000     1.000     1.000         2
         74      1.000     0.778     0.875         9
         75      1.000     1.000     1.000         1
         76      1.000     1.000     1.000         2
         77      1.000     1.000     1.000         1
         78      1.000     1.000     1.000         2
         79      1.000     1.000     1.000         2
         80      1.000     1.000     1.000         1
         81      0.000     0.000     0.000         1
         82      1.000     1.000     1.000         1
         83      1.000     1.000     1.000         3
         84      1.000     1.000     1.000         1
         85      0.000     0.000     0.000         0
         86      0.000     0.000     0.000         0
         87      0.000     0.000     0.000         0
         88      1.000     1.000     1.000         1

avg / total      0.950     0.948     0.947       446

Accuracy: 0.9299
             precision    recall  f1-score   support

         40      0.982     0.982     0.982        56
         41      1.000     0.950     0.974        20
         42      1.000     1.000     1.000        11
         43      0.956     0.860     0.905        50
         44      1.000     1.000     1.000        11
         45      1.000     0.989     0.995       187
         46      1.000     1.000     1.000        22
         47      0.967     0.983     0.975       119
         48      0.991     0.982     0.986       332
         49      0.980     0.980     0.980       101
         50      1.000     0.989     0.994       267
         51      0.933     0.966     0.949        29
         52      0.941     0.991     0.965       322
         53      0.957     0.833     0.891       108
         54      0.941     0.972     0.956       246
         55      0.968     0.988     0.978       243
         56      0.994     0.988     0.991       169
         57      0.943     0.956     0.949       275
         58      0.908     0.885     0.896        78
         59      0.957     0.947     0.952       374
         60      0.966     0.971     0.969       175
         61      0.949     0.962     0.956       291
         62      0.932     0.945     0.939       291
         63      0.892     0.688     0.776        48
         64      0.952     0.958     0.955       309
         65      0.958     0.958     0.958        72
         66      0.939     0.959     0.949        97
         67      0.949     0.932     0.940       161
         68      0.968     0.833     0.896        36
         69      0.964     0.977     0.971       222
         70      0.848     0.875     0.862        32
         71      0.881     0.881     0.881        42
         72      0.821     0.852     0.836        54
         73      0.926     0.758     0.833        33
         74      0.851     0.913     0.881        69
         75      1.000     1.000     1.000        13
         76      1.000     1.000     1.000        13
         77      1.000     1.000     1.000         6
         78      1.000     1.000     1.000        21
         79      1.000     1.000     1.000         9
         80      1.000     1.000     1.000         3
         81      1.000     0.667     0.800         3
         82      1.000     1.000     1.000         3
         83      1.000     1.000     1.000         9
         84      1.000     1.000     1.000         3
         85      0.000     0.000     0.000         0
         86      0.000     0.000     0.000         0
         87      0.000     0.000     0.000         0
         88      1.000     1.000     1.000         3

avg / total      0.957     0.956     0.956      5038


In [72]:
list_of_X_train, y_train, list_of_X_test, y_test = folds[0]
fit_verbose = 2
validation_data = (list_of_X_test, y_test)

# model = create_model_8(list_of_X_train, max_pitch - min_pitch + 1,
#                        0.25, 0.2, 1024, (10, 180))
# model = create_model_10(list_of_X_train, max_pitch - min_pitch + 1)
model = create_model_11(list_of_X_train, max_pitch - min_pitch + 1)
model.fit(list_of_X_train, y_train,
          epochs=1000,
          batch_size=BATCH_SIZE,
          sample_weight=None,
          class_weight=None,
          callbacks=[EarlyStopping(monitor='loss', patience=6),
                     # ModelCheckpoint(os.path.join(model_dir, 'model.' + str(i) + '.{epoch:02d}-{val_loss:.4f}.hdf5'),
                     #                 monitor='val_loss', save_best_only=True)
                    ],
          verbose=fit_verbose,
          validation_data=validation_data,
         )

for proba_threshold in [0.3]:# [0.2, 0.3, 0.4, 0.5, 0.6]:
    print(proba_threshold)
    y_test_predicted = predict(model, proba_threshold, list_of_X_test, y_test)
    print_metrics(y_test, y_test_predicted)


____________________________________________________________________________________________________
Layer (type)                     Output Shape          Param #     Connected to                     
====================================================================================================
input_61 (InputLayer)            (None, 1, 36, 180)    0                                            
____________________________________________________________________________________________________
conv2d_83 (Conv2D)               (None, 10, 27, 178)   310                                          
____________________________________________________________________________________________________
conv2d_84 (Conv2D)               (None, 512, 6, 1)     922112                                       
____________________________________________________________________________________________________
activation_143 (Activation)      (None, 10, 27, 178)   0                                            
____________________________________________________________________________________________________
activation_144 (Activation)      (None, 512, 6, 1)     0                                            
____________________________________________________________________________________________________
max_pooling2d_53 (MaxPooling2D)  (None, 10, 4, 59)     0                                            
____________________________________________________________________________________________________
max_pooling2d_54 (MaxPooling2D)  (None, 512, 3, 1)     0                                            
____________________________________________________________________________________________________
dropout_143 (Dropout)            (None, 10, 4, 59)     0                                            
____________________________________________________________________________________________________
dropout_144 (Dropout)            (None, 512, 3, 1)     0                                            
____________________________________________________________________________________________________
flatten_83 (Flatten)             (None, 2360)          0                                            
____________________________________________________________________________________________________
flatten_84 (Flatten)             (None, 1536)          0                                            
____________________________________________________________________________________________________
concatenate_23 (Concatenate)     (None, 3896)          0                                            
____________________________________________________________________________________________________
dense_121 (Dense)                (None, 256)           997632                                       
____________________________________________________________________________________________________
activation_145 (Activation)      (None, 256)           0                                            
____________________________________________________________________________________________________
dropout_145 (Dropout)            (None, 256)           0                                            
____________________________________________________________________________________________________
dense_122 (Dense)                (None, 49)            12593                                        
====================================================================================================
Total params: 1,932,647.0
Trainable params: 1,932,647.0
Non-trainable params: 0.0
____________________________________________________________________________________________________
Train on 4466 samples, validate on 633 samples
Epoch 1/1000
1s - loss: 0.2243 - val_loss: 0.0488
Epoch 2/1000
1s - loss: 0.0693 - val_loss: 0.0264
Epoch 3/1000
1s - loss: 0.0404 - val_loss: 0.0185
Epoch 4/1000
1s - loss: 0.0291 - val_loss: 0.0156
Epoch 5/1000
1s - loss: 0.0233 - val_loss: 0.0140
Epoch 6/1000
1s - loss: 0.0190 - val_loss: 0.0114
Epoch 7/1000
1s - loss: 0.0166 - val_loss: 0.0101
Epoch 8/1000
1s - loss: 0.0150 - val_loss: 0.0105
Epoch 9/1000
1s - loss: 0.0133 - val_loss: 0.0099
Epoch 10/1000
1s - loss: 0.0119 - val_loss: 0.0095
Epoch 11/1000
1s - loss: 0.0109 - val_loss: 0.0083
Epoch 12/1000
1s - loss: 0.0099 - val_loss: 0.0084
Epoch 13/1000
1s - loss: 0.0091 - val_loss: 0.0086
Epoch 14/1000
1s - loss: 0.0084 - val_loss: 0.0081
Epoch 15/1000
1s - loss: 0.0072 - val_loss: 0.0093
Epoch 16/1000
1s - loss: 0.0071 - val_loss: 0.0074
Epoch 17/1000
1s - loss: 0.0069 - val_loss: 0.0072
Epoch 18/1000
1s - loss: 0.0065 - val_loss: 0.0094
Epoch 19/1000
1s - loss: 0.0067 - val_loss: 0.0073
Epoch 20/1000
1s - loss: 0.0059 - val_loss: 0.0078
Epoch 21/1000
1s - loss: 0.0057 - val_loss: 0.0080
Epoch 22/1000
1s - loss: 0.0056 - val_loss: 0.0099
Epoch 23/1000
1s - loss: 0.0058 - val_loss: 0.0080
Epoch 24/1000
1s - loss: 0.0049 - val_loss: 0.0097
Epoch 25/1000
1s - loss: 0.0050 - val_loss: 0.0071
Epoch 26/1000
1s - loss: 0.0043 - val_loss: 0.0083
Epoch 27/1000
1s - loss: 0.0047 - val_loss: 0.0080
Epoch 28/1000
1s - loss: 0.0046 - val_loss: 0.0080
Epoch 29/1000
1s - loss: 0.0041 - val_loss: 0.0080
Epoch 30/1000
1s - loss: 0.0039 - val_loss: 0.0096
Epoch 31/1000
1s - loss: 0.0039 - val_loss: 0.0096
Epoch 32/1000
1s - loss: 0.0045 - val_loss: 0.0099
Epoch 33/1000
1s - loss: 0.0038 - val_loss: 0.0116
Epoch 34/1000
1s - loss: 0.0041 - val_loss: 0.0105
Epoch 35/1000
1s - loss: 0.0038 - val_loss: 0.0088
Epoch 36/1000
1s - loss: 0.0036 - val_loss: 0.0091
Epoch 37/1000
1s - loss: 0.0035 - val_loss: 0.0092
Epoch 38/1000
1s - loss: 0.0034 - val_loss: 0.0096
Epoch 39/1000
1s - loss: 0.0037 - val_loss: 0.0104
Epoch 40/1000
1s - loss: 0.0031 - val_loss: 0.0083
Epoch 41/1000
1s - loss: 0.0030 - val_loss: 0.0093
Epoch 42/1000
1s - loss: 0.0030 - val_loss: 0.0089
Epoch 43/1000
1s - loss: 0.0034 - val_loss: 0.0084
Epoch 44/1000
1s - loss: 0.0032 - val_loss: 0.0091
Epoch 45/1000
1s - loss: 0.0028 - val_loss: 0.0089
Epoch 46/1000
1s - loss: 0.0028 - val_loss: 0.0100
Epoch 47/1000
1s - loss: 0.0029 - val_loss: 0.0077
Epoch 48/1000
1s - loss: 0.0026 - val_loss: 0.0100
Epoch 49/1000
1s - loss: 0.0026 - val_loss: 0.0096
Epoch 50/1000
1s - loss: 0.0027 - val_loss: 0.0076
Epoch 51/1000
1s - loss: 0.0026 - val_loss: 0.0082
Epoch 52/1000
1s - loss: 0.0024 - val_loss: 0.0092
Epoch 53/1000
1s - loss: 0.0026 - val_loss: 0.0091
Epoch 54/1000
1s - loss: 0.0028 - val_loss: 0.0087
Epoch 55/1000
1s - loss: 0.0024 - val_loss: 0.0075
Epoch 56/1000
1s - loss: 0.0022 - val_loss: 0.0105
Epoch 57/1000
1s - loss: 0.0022 - val_loss: 0.0095
Epoch 58/1000
1s - loss: 0.0021 - val_loss: 0.0090
Epoch 59/1000
1s - loss: 0.0023 - val_loss: 0.0110
Epoch 60/1000
1s - loss: 0.0021 - val_loss: 0.0107
Epoch 61/1000
1s - loss: 0.0019 - val_loss: 0.0110
Epoch 62/1000
1s - loss: 0.0025 - val_loss: 0.0091
Epoch 63/1000
1s - loss: 0.0024 - val_loss: 0.0091
Epoch 64/1000
1s - loss: 0.0024 - val_loss: 0.0105
Epoch 65/1000
1s - loss: 0.0022 - val_loss: 0.0105
Epoch 66/1000
1s - loss: 0.0022 - val_loss: 0.0107
Epoch 67/1000
1s - loss: 0.0021 - val_loss: 0.0090
Epoch 68/1000
1s - loss: 0.0022 - val_loss: 0.0091
0.3
Accuracy: 0.9526
             precision    recall  f1-score   support

         40      1.000     1.000     1.000        13
         41      1.000     1.000     1.000         3
         42      1.000     1.000     1.000         2
         43      1.000     1.000     1.000         5
         44      1.000     1.000     1.000         4
         45      1.000     1.000     1.000        29
         46      1.000     1.000     1.000         3
         47      1.000     0.952     0.976        21
         48      1.000     1.000     1.000        59
         49      1.000     1.000     1.000        15
         50      1.000     1.000     1.000        43
         51      1.000     1.000     1.000         6
         52      1.000     1.000     1.000        52
         53      0.905     1.000     0.950        19
         54      1.000     0.938     0.968        32
         55      0.978     1.000     0.989        45
         56      1.000     0.947     0.973        38
         57      0.978     0.978     0.978        45
         58      1.000     0.800     0.889         5
         59      1.000     0.959     0.979        73
         60      0.974     0.974     0.974        39
         61      1.000     0.978     0.989        46
         62      0.933     0.933     0.933        45
         63      1.000     0.875     0.933         8
         64      0.968     0.968     0.968        63
         65      0.938     1.000     0.968        15
         66      1.000     1.000     1.000        14
         67      1.000     0.833     0.909        18
         68      1.000     0.625     0.769         8
         69      0.974     0.974     0.974        39
         70      0.714     0.833     0.769         6
         71      1.000     0.600     0.750         5
         72      1.000     0.800     0.889        10
         73      1.000     0.500     0.667         4
         74      1.000     0.917     0.957        12
         75      1.000     1.000     1.000         3
         76      1.000     1.000     1.000         4
         77      1.000     1.000     1.000         1
         78      1.000     1.000     1.000         2
         79      1.000     1.000     1.000         3
         80      0.000     0.000     0.000         0
         81      0.000     0.000     0.000         0
         82      0.000     0.000     0.000         0
         83      1.000     1.000     1.000         3
         84      0.000     0.000     0.000         0
         85      0.000     0.000     0.000         0
         86      0.000     0.000     0.000         0
         87      0.000     0.000     0.000         0
         88      1.000     1.000     1.000         2

avg / total      0.984     0.962     0.971       862

D:\ProgramFiles\Anaconda3_64\lib\site-packages\sklearn\metrics\classification.py:1113: UndefinedMetricWarning: Precision and F-score are ill-defined and being set to 0.0 in labels with no predicted samples.
  'precision', 'predicted', average, warn_for)
D:\ProgramFiles\Anaconda3_64\lib\site-packages\sklearn\metrics\classification.py:1115: UndefinedMetricWarning: Recall and F-score are ill-defined and being set to 0.0 in labels with no true samples.
  'recall', 'true', average, warn_for)

Visualization


In [2]:
from music_transcription.pitch_detection.cnn_cqt_pitch_detection import CnnCqtPitchDetector
pitch_detector = CnnCqtPitchDetector.from_zip('../models/pitch_detection/20170718_1224_cqt_ds12391011_100-perc_optimized-params_proba-thresh-0.3.zip')

In [3]:
model = pitch_detector.model

In [6]:
from matplotlib import pyplot as plt
%matplotlib inline

import matplotlib.cm as cm
from mpl_toolkits.axes_grid1 import make_axes_locatable
import numpy.ma as ma

def nice_imshow(ax, data, vmin=None, vmax=None, cmap=None):
    """Wrapper around pl.imshow"""
    if cmap is None:
        cmap = cm.jet
    if vmin is None:
        vmin = data.min()
    if vmax is None:
        vmax = data.max()
    divider = make_axes_locatable(ax)
    cax = divider.append_axes("right", size="5%", pad=0.05)
    im = ax.imshow(data, vmin=vmin, vmax=vmax, interpolation='nearest', cmap=cmap)
    plt.colorbar(im, cax=cax)

def make_mosaic(imgs, nrows, ncols, border=1):
    """
    Given a set of images with all the same shape, makes a
    mosaic with nrows and ncols
    """
    nimgs = imgs.shape[0]
    imshape = imgs.shape[1:]
    
    mosaic = ma.masked_all((nrows * imshape[0] + (nrows - 1) * border,
                            ncols * imshape[1] + (ncols - 1) * border),
                            dtype=np.float32)
    
    paddedh = imshape[0] + border
    paddedw = imshape[1] + border
    for i in range(nimgs):
        row = int(np.floor(i / ncols))
        col = i % ncols
        
        mosaic[row * paddedh:row * paddedh + imshape[0],
               col * paddedw:col * paddedw + imshape[1]] = imgs[i]
    return mosaic

def get_filters(model, layer_name):
    layer = model.get_layer(name=layer_name)
    W = layer.get_weights()[0]
    print(W.shape)
    # (7, 3, 1, 10) -> (10, 3, 7)
    W = np.squeeze(W).T
    # (10, 3, 7) -> (10, 7, 3)
    W_filters_transposed = np.empty((W.shape[0], W.shape[2], W.shape[1]))
    for i, array in enumerate(W):
        W_filters_transposed[i] = array.T
    print(W_filters_transposed.shape)
    return W_filters_transposed

CNN with 10 10x3 filters (10 frames x 3 frequency bins)


In [93]:
W_filters_transposed = get_filters(model, 'conv2d_1')


(10, 3, 1, 10)
(10, 10, 3)

In [94]:
plt.figure(figsize=(15, 15))
plt.title('conv1 weights')
nice_imshow(plt.gca(), make_mosaic(W_filters_transposed, 2, 5), cmap=cm.binary)


CNN with 512 10x180 filters


In [7]:
W_filters_transposed = get_filters(model, 'conv2d_2')


(10, 180, 1, 512)
(512, 10, 180)

In [11]:
from random import randrange
n_rows = 3
n_cols = 3
fig, axarr = plt.subplots(n_rows, n_cols, figsize=(15, 15))
_, n_frames, n_bins = W_filters_transposed.shape
aspect = n_bins / n_frames
for i in range(n_rows):
    for j in range(n_cols):
        _ = axarr[i, j].imshow(W_filters_transposed[randrange(W_filters_transposed.shape[0]), :, :].T, aspect=1/aspect)
        # _ = axarr[i, j].imshow(W_filters_transposed[i*n_cols + j, :, :].T, aspect=1/aspect)



In [10]:
fig.set_size_inches(n_cols*10, n_rows*10)
fig.savefig('test.png')