Created
November 27, 2020 02:18
-
-
Save c0ldf1recsgo/2c0e1cb4fabd98c5494cccd68d18ce85 to your computer and use it in GitHub Desktop.
colab-github-demo.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"nbformat": 4, | |
"nbformat_minor": 0, | |
"metadata": { | |
"colab": { | |
"name": "colab-github-demo.ipynb", | |
"provenance": [], | |
"collapsed_sections": [], | |
"include_colab_link": true | |
}, | |
"kernelspec": { | |
"display_name": "Python 3", | |
"name": "python3" | |
} | |
}, | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "view-in-github", | |
"colab_type": "text" | |
}, | |
"source": [ | |
"<a href=\"https://colab.research.google.com/gist/c0ldf1recsgo/2c0e1cb4fabd98c5494cccd68d18ce85/colab-github-demo.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"colab": { | |
"base_uri": "https://localhost:8080/" | |
}, | |
"id": "Pv0dCqitKua3", | |
"outputId": "7f627294-9682-479b-b633-a38f40e001c3" | |
}, | |
"source": [ | |
"!git clone https://github.com/ruohoruotsi/LSTM-Music-Genre-Classification.git" | |
], | |
"execution_count": 1, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"text": [ | |
"Cloning into 'LSTM-Music-Genre-Classification'...\n", | |
"remote: Enumerating objects: 752, done.\u001b[K\n", | |
"remote: Total 752 (delta 0), reused 0 (delta 0), pack-reused 752\u001b[K\n", | |
"Receiving objects: 100% (752/752), 727.61 MiB | 33.27 MiB/s, done.\n", | |
"Resolving deltas: 100% (77/77), done.\n", | |
"Checking out files: 100% (624/624), done.\n" | |
], | |
"name": "stdout" | |
} | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"colab": { | |
"base_uri": "https://localhost:8080/" | |
}, | |
"id": "1npS93-_LRJj", | |
"outputId": "6bc92adf-3780-4ef4-8e8c-7f9413b0ef07" | |
}, | |
"source": [ | |
"!ls LSTM-Music-Genre-Classification" | |
], | |
"execution_count": 8, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"text": [ | |
"audio\t\t lstm_genre_classifier_keras.py requirements.txt\n", | |
"GenreFeatureData.py lstm_genre_classifier_pytorch.py weights\n", | |
"gtzan\t\t predict_example.py\n", | |
"LICENSE\t\t README.md\n" | |
], | |
"name": "stdout" | |
} | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "7bdgeSEMLuLS" | |
}, | |
"source": [ | |
"import librosa\n", | |
"import math\n", | |
"import os\n", | |
"import re\n", | |
"\n", | |
"import numpy as np\n", | |
"\n", | |
"\n", | |
"class GenreFeatureData:\n", | |
"\n", | |
" \"Music audio features for genre classification\"\n", | |
" hop_length = None\n", | |
" genre_list = [\n", | |
" \"classical\",\n", | |
" \"country\",\n", | |
" \"disco\",\n", | |
" \"hiphop\",\n", | |
" \"jazz\",\n", | |
" \"metal\",\n", | |
" \"pop\",\n", | |
" \"reggae\",\n", | |
" ]\n", | |
"\n", | |
" dir_trainfolder = \"./LSTM-Music-Genre-Classification/gtzan/_train\"\n", | |
" dir_devfolder = \"./LSTM-Music-Genre-Classification/gtzan/_validation\"\n", | |
" dir_testfolder = \"./LSTM-Music-Genre-Classification/gtzan/_test\"\n", | |
" dir_all_files = \"./LSTM-Music-Genre-Classification/gtzan\"\n", | |
"\n", | |
" train_X_preprocessed_data = \"./LSTM-Music-Genre-Classification/gtzan/data_train_input.npy\"\n", | |
" train_Y_preprocessed_data = \"./LSTM-Music-Genre-Classification/gtzan/data_train_target.npy\"\n", | |
" dev_X_preprocessed_data = \"./LSTM-Music-Genre-Classification/gtzan/data_validation_input.npy\"\n", | |
" dev_Y_preprocessed_data = \"./LSTM-Music-Genre-Classification/gtzan/data_validation_target.npy\"\n", | |
" test_X_preprocessed_data = \"./LSTM-Music-Genre-Classification/gtzan/data_test_input.npy\"\n", | |
" test_Y_preprocessed_data = \"./LSTM-Music-Genre-Classification/gtzan/data_test_target.npy\"\n", | |
"\n", | |
" train_X = train_Y = None\n", | |
" dev_X = dev_Y = None\n", | |
" test_X = test_Y = None\n", | |
"\n", | |
" def __init__(self):\n", | |
" self.hop_length = 512\n", | |
"\n", | |
" self.timeseries_length_list = []\n", | |
" self.trainfiles_list = self.path_to_audiofiles(self.dir_trainfolder)\n", | |
" self.devfiles_list = self.path_to_audiofiles(self.dir_devfolder)\n", | |
" self.testfiles_list = self.path_to_audiofiles(self.dir_testfolder)\n", | |
"\n", | |
" self.all_files_list = []\n", | |
" self.all_files_list.extend(self.trainfiles_list)\n", | |
" self.all_files_list.extend(self.devfiles_list)\n", | |
" self.all_files_list.extend(self.testfiles_list)\n", | |
"\n", | |
" # compute minimum timeseries length, slow to compute, caching pre-computed value of 1290\n", | |
" # self.precompute_min_timeseries_len()\n", | |
" # print(\"min(self.timeseries_length_list) ==\" + str(min(self.timeseries_length_list)))\n", | |
" # self.timeseries_length = min(self.timeseries_length_list)\n", | |
"\n", | |
" self.timeseries_length = (\n", | |
" 128\n", | |
" ) # sequence length == 128, default fftsize == 2048 & hop == 512 @ SR of 22050\n", | |
" # equals 128 overlapped windows that cover approx ~3.065 seconds of audio, which is a bit small!\n", | |
"\n", | |
" def load_preprocess_data(self):\n", | |
" print(\"[DEBUG] total number of files: \" + str(len(self.timeseries_length_list)))\n", | |
"\n", | |
" # Training set\n", | |
" self.train_X, self.train_Y = self.extract_audio_features(self.trainfiles_list)\n", | |
" with open(self.train_X_preprocessed_data, \"wb\") as f:\n", | |
" np.save(f, self.train_X)\n", | |
" with open(self.train_Y_preprocessed_data, \"wb\") as f:\n", | |
" self.train_Y = self.one_hot(self.train_Y)\n", | |
" np.save(f, self.train_Y)\n", | |
"\n", | |
" # Validation set\n", | |
" self.dev_X, self.dev_Y = self.extract_audio_features(self.devfiles_list)\n", | |
" with open(self.dev_X_preprocessed_data, \"wb\") as f:\n", | |
" np.save(f, self.dev_X)\n", | |
" with open(self.dev_Y_preprocessed_data, \"wb\") as f:\n", | |
" self.dev_Y = self.one_hot(self.dev_Y)\n", | |
" np.save(f, self.dev_Y)\n", | |
"\n", | |
" # Test set\n", | |
" self.test_X, self.test_Y = self.extract_audio_features(self.testfiles_list)\n", | |
" with open(self.test_X_preprocessed_data, \"wb\") as f:\n", | |
" np.save(f, self.test_X)\n", | |
" with open(self.test_Y_preprocessed_data, \"wb\") as f:\n", | |
" self.test_Y = self.one_hot(self.test_Y)\n", | |
" np.save(f, self.test_Y)\n", | |
"\n", | |
" def load_deserialize_data(self):\n", | |
"\n", | |
" self.train_X = np.load(self.train_X_preprocessed_data)\n", | |
" self.train_Y = np.load(self.train_Y_preprocessed_data)\n", | |
"\n", | |
" self.dev_X = np.load(self.dev_X_preprocessed_data)\n", | |
" self.dev_Y = np.load(self.dev_Y_preprocessed_data)\n", | |
"\n", | |
" self.test_X = np.load(self.test_X_preprocessed_data)\n", | |
" self.test_Y = np.load(self.test_Y_preprocessed_data)\n", | |
"\n", | |
" def precompute_min_timeseries_len(self):\n", | |
" for file in self.all_files_list:\n", | |
" print(\"Loading \" + str(file))\n", | |
" y, sr = librosa.load(file)\n", | |
" self.timeseries_length_list.append(math.ceil(len(y) / self.hop_length))\n", | |
"\n", | |
" def extract_audio_features(self, list_of_audiofiles):\n", | |
"\n", | |
" data = np.zeros(\n", | |
" (len(list_of_audiofiles), self.timeseries_length, 33), dtype=np.float64\n", | |
" )\n", | |
" target = []\n", | |
"\n", | |
" for i, file in enumerate(list_of_audiofiles):\n", | |
" y, sr = librosa.load(file)\n", | |
" mfcc = librosa.feature.mfcc(\n", | |
" y=y, sr=sr, hop_length=self.hop_length, n_mfcc=13\n", | |
" )\n", | |
" spectral_center = librosa.feature.spectral_centroid(\n", | |
" y=y, sr=sr, hop_length=self.hop_length\n", | |
" )\n", | |
" chroma = librosa.feature.chroma_stft(y=y, sr=sr, hop_length=self.hop_length)\n", | |
" spectral_contrast = librosa.feature.spectral_contrast(\n", | |
" y=y, sr=sr, hop_length=self.hop_length\n", | |
" )\n", | |
"\n", | |
" splits = re.split(\"[ .]\", file)\n", | |
" genre = re.split(\"[ /]\", splits[1])[3]\n", | |
" target.append(genre)\n", | |
"\n", | |
" data[i, :, 0:13] = mfcc.T[0:self.timeseries_length, :]\n", | |
" data[i, :, 13:14] = spectral_center.T[0:self.timeseries_length, :]\n", | |
" data[i, :, 14:26] = chroma.T[0:self.timeseries_length, :]\n", | |
" data[i, :, 26:33] = spectral_contrast.T[0:self.timeseries_length, :]\n", | |
"\n", | |
" print(\n", | |
" \"Extracted features audio track %i of %i.\"\n", | |
" % (i + 1, len(list_of_audiofiles))\n", | |
" )\n", | |
"\n", | |
" return data, np.expand_dims(np.asarray(target), axis=1)\n", | |
"\n", | |
" def one_hot(self, Y_genre_strings):\n", | |
" y_one_hot = np.zeros((Y_genre_strings.shape[0], len(self.genre_list)))\n", | |
" for i, genre_string in enumerate(Y_genre_strings):\n", | |
" index = self.genre_list.index(genre_string)\n", | |
" y_one_hot[i, index] = 1\n", | |
" return y_one_hot\n", | |
"\n", | |
" @staticmethod\n", | |
" def path_to_audiofiles(dir_folder):\n", | |
" list_of_audio = []\n", | |
" for file in os.listdir(dir_folder):\n", | |
" if file.endswith(\".au\"):\n", | |
" directory = \"%s/%s\" % (dir_folder, file)\n", | |
" list_of_audio.append(directory)\n", | |
" return list_of_audio" | |
], | |
"execution_count": 9, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"colab": { | |
"base_uri": "https://localhost:8080/" | |
}, | |
"id": "VCXg6JS1MWJx", | |
"outputId": "a263784e-42f4-4d96-d5e5-7be82cd3739a" | |
}, | |
"source": [ | |
"import logging\n", | |
"import os\n", | |
"from keras.models import Sequential\n", | |
"#from keras.layers.recurrent import LSTM\n", | |
"from keras.layers import LSTM\n", | |
"from keras.layers import Dense\n", | |
"from keras.optimizers import Adam\n", | |
"from keras.layers import Bidirectional\n", | |
"\n", | |
"#from GenreFeatureData import (\n", | |
"# GenreFeatureData,\n", | |
"#) # local python class with Audio feature extraction (librosa)\n", | |
"\n", | |
"# set logging level\n", | |
"logging.getLogger(\"tensorflow\").setLevel(logging.ERROR)\n", | |
"\n", | |
"genre_features = GenreFeatureData()\n", | |
"\n", | |
"# if all of the preprocessed files do not exist, regenerate them all for self-consistency\n", | |
"if (\n", | |
" os.path.isfile(genre_features.train_X_preprocessed_data)\n", | |
" and os.path.isfile(genre_features.train_Y_preprocessed_data)\n", | |
" and os.path.isfile(genre_features.dev_X_preprocessed_data)\n", | |
" and os.path.isfile(genre_features.dev_Y_preprocessed_data)\n", | |
" and os.path.isfile(genre_features.test_X_preprocessed_data)\n", | |
" and os.path.isfile(genre_features.test_Y_preprocessed_data)\n", | |
"):\n", | |
" print(\"Preprocessed files exist, deserializing npy files\")\n", | |
" genre_features.load_deserialize_data()\n", | |
"else:\n", | |
" print(\"Preprocessing raw audio files\")\n", | |
" genre_features.load_preprocess_data()\n", | |
"\n", | |
"print(\"Training X shape: \" + str(genre_features.train_X.shape))\n", | |
"print(\"Training Y shape: \" + str(genre_features.train_Y.shape))\n", | |
"print(\"Dev X shape: \" + str(genre_features.dev_X.shape))\n", | |
"print(\"Dev Y shape: \" + str(genre_features.dev_Y.shape))\n", | |
"print(\"Test X shape: \" + str(genre_features.test_X.shape))\n", | |
"print(\"Test Y shape: \" + str(genre_features.test_Y.shape))\n", | |
"\n", | |
"input_shape = (genre_features.train_X.shape[1], genre_features.train_X.shape[2])\n", | |
"print(\"Build LSTM RNN model ...\")\n", | |
"model = Sequential()\n", | |
"\n", | |
"#forward_layer = LSTM(units=128, dropout=0.05, recurrent_dropout=0.35, return_sequences=True)\n", | |
"#backward_layer = LSTM(units=32, dropout=0.05, return_sequences=True, go_backwards=True)\n", | |
"#model.add(Bidirectional(forward_layer, backward_layer=backward_layer, input_shape=input_shape))\n", | |
"\n", | |
"model.add(Bidirectional(LSTM(units=128, dropout=0.05, recurrent_dropout=0.35, return_sequences=True, go_backwards=True), input_shape=input_shape))\n", | |
"model.add(Bidirectional(LSTM(units=32, dropout=0.05, recurrent_dropout=0.35, return_sequences=False, go_backwards=True)))\n", | |
"model.add(Dense(units=genre_features.train_Y.shape[1], activation=\"sigmoid\"))\n", | |
"\n", | |
"#model.add(LSTM(units=128, dropout=0.05, recurrent_dropout=0.35, return_sequences=True, input_shape=input_shape))\n", | |
"#model.add(LSTM(units=32, dropout=0.05, recurrent_dropout=0.35, return_sequences=False))\n", | |
"#model.add(Dense(units=genre_features.train_Y.shape[1], activation=\"softmax\"))\n", | |
"\n", | |
"print(\"Compiling ...\")\n", | |
"# Keras optimizer defaults:\n", | |
"# Adam : lr=0.001, beta_1=0.9, beta_2=0.999, epsilon=1e-8, decay=0.\n", | |
"# RMSprop: lr=0.001, rho=0.9, epsilon=1e-8, decay=0.\n", | |
"# SGD : lr=0.01, momentum=0., decay=0.\n", | |
"opt = Adam()\n", | |
"#model.compile(loss=\"categorical_crossentropy\", optimizer=opt, metrics=[\"accuracy\"])\n", | |
"model.compile(loss=\"binary_crossentropy\", optimizer=opt, metrics=[\"accuracy\"])\n", | |
"model.summary()\n", | |
"\n", | |
"print(\"Training ...\")\n", | |
"batch_size = 35 # num of training examples per minibatch\n", | |
"num_epochs = 400\n", | |
"model.fit(\n", | |
" genre_features.train_X,\n", | |
" genre_features.train_Y,\n", | |
" batch_size=batch_size,\n", | |
" epochs=num_epochs,\n", | |
")\n", | |
"\n", | |
"print(\"\\nValidating ...\")\n", | |
"score, accuracy = model.evaluate(\n", | |
" genre_features.dev_X, genre_features.dev_Y, batch_size=batch_size, verbose=1\n", | |
")\n", | |
"print(\"Dev loss: \", score)\n", | |
"print(\"Dev accuracy: \", accuracy)\n", | |
"\n", | |
"\n", | |
"print(\"\\nTesting ...\")\n", | |
"score, accuracy = model.evaluate(\n", | |
" genre_features.test_X, genre_features.test_Y, batch_size=batch_size, verbose=1\n", | |
")\n", | |
"print(\"Test loss: \", score)\n", | |
"print(\"Test accuracy: \", accuracy)\n", | |
"\n", | |
"# serialize model to JSON\n", | |
"json_filename = \"model.json\"\n", | |
"print(\"\\nSaving model to JSON: \" + json_filename)\n", | |
"model_json = model.to_json()\n", | |
"with open(json_filename, \"w\") as json_file:\n", | |
" json_file.write(model_json)\n", | |
"\n", | |
"# Creates a HDF5 file 'lstm_genre_classifier.h5'\n", | |
"model_filename = \"lstm_genre_classifier_lstm.h5\"\n", | |
"print(\"\\nSaving model: \" + model_filename)\n", | |
"model.save(model_filename)" | |
], | |
"execution_count": 15, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"text": [ | |
"Preprocessed files exist, deserializing npy files\n", | |
"Training X shape: (420, 128, 33)\n", | |
"Training Y shape: (420, 8)\n", | |
"Dev X shape: (120, 128, 33)\n", | |
"Dev Y shape: (120, 8)\n", | |
"Test X shape: (60, 128, 33)\n", | |
"Test Y shape: (60, 8)\n", | |
"Build LSTM RNN model ...\n", | |
"Compiling ...\n", | |
"Model: \"sequential_1\"\n", | |
"_________________________________________________________________\n", | |
"Layer (type) Output Shape Param # \n", | |
"=================================================================\n", | |
"bidirectional_2 (Bidirection (None, 128, 256) 165888 \n", | |
"_________________________________________________________________\n", | |
"bidirectional_3 (Bidirection (None, 64) 73984 \n", | |
"_________________________________________________________________\n", | |
"dense_1 (Dense) (None, 8) 520 \n", | |
"=================================================================\n", | |
"Total params: 240,392\n", | |
"Trainable params: 240,392\n", | |
"Non-trainable params: 0\n", | |
"_________________________________________________________________\n", | |
"Training ...\n", | |
"Epoch 1/400\n", | |
"12/12 [==============================] - 9s 769ms/step - loss: 0.4737 - accuracy: 0.1524\n", | |
"Epoch 2/400\n", | |
"12/12 [==============================] - 9s 763ms/step - loss: 0.3457 - accuracy: 0.2405\n", | |
"Epoch 3/400\n", | |
"12/12 [==============================] - 9s 761ms/step - loss: 0.3232 - accuracy: 0.3857\n", | |
"Epoch 4/400\n", | |
"12/12 [==============================] - 9s 765ms/step - loss: 0.3014 - accuracy: 0.4500\n", | |
"Epoch 5/400\n", | |
"12/12 [==============================] - 9s 776ms/step - loss: 0.2846 - accuracy: 0.5000\n", | |
"Epoch 6/400\n", | |
"12/12 [==============================] - 10s 792ms/step - loss: 0.2727 - accuracy: 0.5048\n", | |
"Epoch 7/400\n", | |
"12/12 [==============================] - 9s 777ms/step - loss: 0.2687 - accuracy: 0.5405\n", | |
"Epoch 8/400\n", | |
"12/12 [==============================] - 9s 759ms/step - loss: 0.2600 - accuracy: 0.5333\n", | |
"Epoch 9/400\n", | |
"12/12 [==============================] - 9s 768ms/step - loss: 0.2447 - accuracy: 0.5524\n", | |
"Epoch 10/400\n", | |
"12/12 [==============================] - 9s 763ms/step - loss: 0.2347 - accuracy: 0.5810\n", | |
"Epoch 11/400\n", | |
"12/12 [==============================] - 9s 764ms/step - loss: 0.2262 - accuracy: 0.6143\n", | |
"Epoch 12/400\n", | |
"12/12 [==============================] - 9s 763ms/step - loss: 0.2202 - accuracy: 0.6024\n", | |
"Epoch 13/400\n", | |
"12/12 [==============================] - 9s 763ms/step - loss: 0.2251 - accuracy: 0.6071\n", | |
"Epoch 14/400\n", | |
"12/12 [==============================] - 9s 761ms/step - loss: 0.2157 - accuracy: 0.6143\n", | |
"Epoch 15/400\n", | |
"12/12 [==============================] - 9s 773ms/step - loss: 0.2121 - accuracy: 0.6143\n", | |
"Epoch 16/400\n", | |
"12/12 [==============================] - 9s 774ms/step - loss: 0.2093 - accuracy: 0.6429\n", | |
"Epoch 17/400\n", | |
"12/12 [==============================] - 12s 1s/step - loss: 0.2063 - accuracy: 0.6429\n", | |
"Epoch 18/400\n", | |
"12/12 [==============================] - 9s 777ms/step - loss: 0.2019 - accuracy: 0.6452\n", | |
"Epoch 19/400\n", | |
"12/12 [==============================] - 9s 775ms/step - loss: 0.2036 - accuracy: 0.6452\n", | |
"Epoch 20/400\n", | |
"12/12 [==============================] - 9s 770ms/step - loss: 0.1890 - accuracy: 0.6738\n", | |
"Epoch 21/400\n", | |
"12/12 [==============================] - 9s 775ms/step - loss: 0.1929 - accuracy: 0.6643\n", | |
"Epoch 22/400\n", | |
"12/12 [==============================] - 9s 769ms/step - loss: 0.1941 - accuracy: 0.6476\n", | |
"Epoch 23/400\n", | |
"12/12 [==============================] - 9s 773ms/step - loss: 0.1880 - accuracy: 0.6881\n", | |
"Epoch 24/400\n", | |
"12/12 [==============================] - 9s 774ms/step - loss: 0.1966 - accuracy: 0.6214\n", | |
"Epoch 25/400\n", | |
"12/12 [==============================] - 9s 773ms/step - loss: 0.1846 - accuracy: 0.6976\n", | |
"Epoch 26/400\n", | |
"12/12 [==============================] - 9s 772ms/step - loss: 0.1901 - accuracy: 0.6548\n", | |
"Epoch 27/400\n", | |
"12/12 [==============================] - 9s 768ms/step - loss: 0.1860 - accuracy: 0.6881\n", | |
"Epoch 28/400\n", | |
"12/12 [==============================] - 9s 766ms/step - loss: 0.1792 - accuracy: 0.7048\n", | |
"Epoch 29/400\n", | |
"12/12 [==============================] - 9s 766ms/step - loss: 0.1823 - accuracy: 0.6881\n", | |
"Epoch 30/400\n", | |
"12/12 [==============================] - 9s 768ms/step - loss: 0.1738 - accuracy: 0.7095\n", | |
"Epoch 31/400\n", | |
"12/12 [==============================] - 9s 764ms/step - loss: 0.1790 - accuracy: 0.7024\n", | |
"Epoch 32/400\n", | |
"12/12 [==============================] - 9s 764ms/step - loss: 0.1730 - accuracy: 0.7167\n", | |
"Epoch 33/400\n", | |
"12/12 [==============================] - 9s 762ms/step - loss: 0.1711 - accuracy: 0.7143\n", | |
"Epoch 34/400\n", | |
"12/12 [==============================] - 9s 762ms/step - loss: 0.1660 - accuracy: 0.7500\n", | |
"Epoch 35/400\n", | |
"12/12 [==============================] - 9s 769ms/step - loss: 0.1658 - accuracy: 0.7262\n", | |
"Epoch 36/400\n", | |
"12/12 [==============================] - 9s 773ms/step - loss: 0.1612 - accuracy: 0.7381\n", | |
"Epoch 37/400\n", | |
"12/12 [==============================] - 9s 779ms/step - loss: 0.1705 - accuracy: 0.7143\n", | |
"Epoch 38/400\n", | |
"12/12 [==============================] - 9s 770ms/step - loss: 0.1664 - accuracy: 0.7190\n", | |
"Epoch 39/400\n", | |
"12/12 [==============================] - 9s 764ms/step - loss: 0.1579 - accuracy: 0.7524\n", | |
"Epoch 40/400\n", | |
"12/12 [==============================] - 9s 771ms/step - loss: 0.1557 - accuracy: 0.7643\n", | |
"Epoch 41/400\n", | |
"12/12 [==============================] - 9s 765ms/step - loss: 0.1446 - accuracy: 0.7976\n", | |
"Epoch 42/400\n", | |
"12/12 [==============================] - 9s 760ms/step - loss: 0.1526 - accuracy: 0.7548\n", | |
"Epoch 43/400\n", | |
"12/12 [==============================] - 9s 763ms/step - loss: 0.1528 - accuracy: 0.7548\n", | |
"Epoch 44/400\n", | |
"12/12 [==============================] - 9s 760ms/step - loss: 0.1456 - accuracy: 0.7738\n", | |
"Epoch 45/400\n", | |
"12/12 [==============================] - 9s 768ms/step - loss: 0.1435 - accuracy: 0.7667\n", | |
"Epoch 46/400\n", | |
"12/12 [==============================] - 9s 770ms/step - loss: 0.1420 - accuracy: 0.7762\n", | |
"Epoch 47/400\n", | |
"12/12 [==============================] - 9s 770ms/step - loss: 0.1440 - accuracy: 0.7690\n", | |
"Epoch 48/400\n", | |
"12/12 [==============================] - 9s 766ms/step - loss: 0.1395 - accuracy: 0.8000\n", | |
"Epoch 49/400\n", | |
"12/12 [==============================] - 9s 769ms/step - loss: 0.1481 - accuracy: 0.7619\n", | |
"Epoch 50/400\n", | |
"12/12 [==============================] - 9s 774ms/step - loss: 0.1386 - accuracy: 0.8119\n", | |
"Epoch 51/400\n", | |
"12/12 [==============================] - 9s 783ms/step - loss: 0.1390 - accuracy: 0.7810\n", | |
"Epoch 52/400\n", | |
"12/12 [==============================] - 9s 780ms/step - loss: 0.1370 - accuracy: 0.7833\n", | |
"Epoch 53/400\n", | |
"12/12 [==============================] - 9s 777ms/step - loss: 0.1448 - accuracy: 0.7690\n", | |
"Epoch 54/400\n", | |
"12/12 [==============================] - 9s 784ms/step - loss: 0.1418 - accuracy: 0.7690\n", | |
"Epoch 55/400\n", | |
"12/12 [==============================] - 9s 779ms/step - loss: 0.1235 - accuracy: 0.8095\n", | |
"Epoch 56/400\n", | |
"12/12 [==============================] - 9s 767ms/step - loss: 0.1198 - accuracy: 0.8167\n", | |
"Epoch 57/400\n", | |
"12/12 [==============================] - 9s 771ms/step - loss: 0.1235 - accuracy: 0.7952\n", | |
"Epoch 58/400\n", | |
"12/12 [==============================] - 9s 778ms/step - loss: 0.1186 - accuracy: 0.8238\n", | |
"Epoch 59/400\n", | |
"12/12 [==============================] - 9s 772ms/step - loss: 0.1151 - accuracy: 0.8071\n", | |
"Epoch 60/400\n", | |
"12/12 [==============================] - 9s 765ms/step - loss: 0.1329 - accuracy: 0.7929\n", | |
"Epoch 61/400\n", | |
"12/12 [==============================] - 9s 764ms/step - loss: 0.1405 - accuracy: 0.7905\n", | |
"Epoch 62/400\n", | |
"12/12 [==============================] - 9s 764ms/step - loss: 0.1646 - accuracy: 0.7381\n", | |
"Epoch 63/400\n", | |
"12/12 [==============================] - 9s 760ms/step - loss: 0.1655 - accuracy: 0.7286\n", | |
"Epoch 64/400\n", | |
"12/12 [==============================] - 9s 773ms/step - loss: 0.1608 - accuracy: 0.7310\n", | |
"Epoch 65/400\n", | |
"12/12 [==============================] - 9s 787ms/step - loss: 0.1432 - accuracy: 0.7738\n", | |
"Epoch 66/400\n", | |
"12/12 [==============================] - 10s 794ms/step - loss: 0.1398 - accuracy: 0.7786\n", | |
"Epoch 67/400\n", | |
"12/12 [==============================] - 9s 789ms/step - loss: 0.1290 - accuracy: 0.7952\n", | |
"Epoch 68/400\n", | |
"12/12 [==============================] - 10s 830ms/step - loss: 0.1219 - accuracy: 0.8214\n", | |
"Epoch 69/400\n", | |
"12/12 [==============================] - 9s 777ms/step - loss: 0.1142 - accuracy: 0.8262\n", | |
"Epoch 70/400\n", | |
"12/12 [==============================] - 10s 830ms/step - loss: 0.1126 - accuracy: 0.8357\n", | |
"Epoch 71/400\n", | |
"12/12 [==============================] - 9s 770ms/step - loss: 0.1118 - accuracy: 0.8333\n", | |
"Epoch 72/400\n", | |
"12/12 [==============================] - 9s 770ms/step - loss: 0.1114 - accuracy: 0.8333\n", | |
"Epoch 73/400\n", | |
"12/12 [==============================] - 9s 770ms/step - loss: 0.1125 - accuracy: 0.8310\n", | |
"Epoch 74/400\n", | |
"12/12 [==============================] - 9s 772ms/step - loss: 0.1096 - accuracy: 0.8452\n", | |
"Epoch 75/400\n", | |
"12/12 [==============================] - 9s 769ms/step - loss: 0.1134 - accuracy: 0.8286\n", | |
"Epoch 76/400\n", | |
"12/12 [==============================] - 9s 777ms/step - loss: 0.1024 - accuracy: 0.8405\n", | |
"Epoch 77/400\n", | |
"12/12 [==============================] - 12s 1s/step - loss: 0.0995 - accuracy: 0.8667\n", | |
"Epoch 78/400\n", | |
"12/12 [==============================] - 9s 780ms/step - loss: 0.0975 - accuracy: 0.8524\n", | |
"Epoch 79/400\n", | |
"12/12 [==============================] - 9s 763ms/step - loss: 0.1149 - accuracy: 0.8071\n", | |
"Epoch 80/400\n", | |
"12/12 [==============================] - 9s 762ms/step - loss: 0.1072 - accuracy: 0.8238\n", | |
"Epoch 81/400\n", | |
"12/12 [==============================] - 9s 763ms/step - loss: 0.0987 - accuracy: 0.8500\n", | |
"Epoch 82/400\n", | |
"12/12 [==============================] - 9s 768ms/step - loss: 0.0935 - accuracy: 0.8738\n", | |
"Epoch 83/400\n", | |
"12/12 [==============================] - 9s 777ms/step - loss: 0.0875 - accuracy: 0.8786\n", | |
"Epoch 84/400\n", | |
"12/12 [==============================] - 9s 771ms/step - loss: 0.0951 - accuracy: 0.8738\n", | |
"Epoch 85/400\n", | |
"12/12 [==============================] - 9s 767ms/step - loss: 0.0913 - accuracy: 0.8762\n", | |
"Epoch 86/400\n", | |
"12/12 [==============================] - 9s 776ms/step - loss: 0.1038 - accuracy: 0.8333\n", | |
"Epoch 87/400\n", | |
"12/12 [==============================] - 9s 772ms/step - loss: 0.0989 - accuracy: 0.8429\n", | |
"Epoch 88/400\n", | |
"12/12 [==============================] - 9s 774ms/step - loss: 0.1012 - accuracy: 0.8452\n", | |
"Epoch 89/400\n", | |
"12/12 [==============================] - 9s 776ms/step - loss: 0.1001 - accuracy: 0.8262\n", | |
"Epoch 90/400\n", | |
"12/12 [==============================] - 9s 772ms/step - loss: 0.0925 - accuracy: 0.8595\n", | |
"Epoch 91/400\n", | |
"12/12 [==============================] - 9s 769ms/step - loss: 0.0948 - accuracy: 0.8619\n", | |
"Epoch 92/400\n", | |
"12/12 [==============================] - 9s 765ms/step - loss: 0.0935 - accuracy: 0.8643\n", | |
"Epoch 93/400\n", | |
"12/12 [==============================] - 9s 773ms/step - loss: 0.0894 - accuracy: 0.8643\n", | |
"Epoch 94/400\n", | |
"12/12 [==============================] - 9s 772ms/step - loss: 0.0888 - accuracy: 0.8690\n", | |
"Epoch 95/400\n", | |
"12/12 [==============================] - 9s 772ms/step - loss: 0.0884 - accuracy: 0.8714\n", | |
"Epoch 96/400\n", | |
"12/12 [==============================] - 9s 774ms/step - loss: 0.0880 - accuracy: 0.8690\n", | |
"Epoch 97/400\n", | |
"12/12 [==============================] - 9s 771ms/step - loss: 0.0840 - accuracy: 0.8786\n", | |
"Epoch 98/400\n", | |
"12/12 [==============================] - 9s 786ms/step - loss: 0.0836 - accuracy: 0.8762\n", | |
"Epoch 99/400\n", | |
"12/12 [==============================] - 9s 788ms/step - loss: 0.0906 - accuracy: 0.8571\n", | |
"Epoch 100/400\n", | |
"12/12 [==============================] - 10s 830ms/step - loss: 0.0841 - accuracy: 0.8762\n", | |
"Epoch 101/400\n", | |
"12/12 [==============================] - 9s 768ms/step - loss: 0.0823 - accuracy: 0.8833\n", | |
"Epoch 102/400\n", | |
"12/12 [==============================] - 9s 763ms/step - loss: 0.0863 - accuracy: 0.8643\n", | |
"Epoch 103/400\n", | |
"12/12 [==============================] - 9s 761ms/step - loss: 0.0962 - accuracy: 0.8452\n", | |
"Epoch 104/400\n", | |
"12/12 [==============================] - 9s 759ms/step - loss: 0.0878 - accuracy: 0.8548\n", | |
"Epoch 105/400\n", | |
"12/12 [==============================] - 9s 769ms/step - loss: 0.1000 - accuracy: 0.8381\n", | |
"Epoch 106/400\n", | |
"12/12 [==============================] - 9s 764ms/step - loss: 0.0963 - accuracy: 0.8643\n", | |
"Epoch 107/400\n", | |
"12/12 [==============================] - 9s 757ms/step - loss: 0.0934 - accuracy: 0.8595\n", | |
"Epoch 108/400\n", | |
"12/12 [==============================] - 9s 761ms/step - loss: 0.0833 - accuracy: 0.8786\n", | |
"Epoch 109/400\n", | |
"12/12 [==============================] - 9s 759ms/step - loss: 0.0899 - accuracy: 0.8619\n", | |
"Epoch 110/400\n", | |
"12/12 [==============================] - 9s 767ms/step - loss: 0.0825 - accuracy: 0.8667\n", | |
"Epoch 111/400\n", | |
"12/12 [==============================] - 9s 767ms/step - loss: 0.0817 - accuracy: 0.8881\n", | |
"Epoch 112/400\n", | |
"12/12 [==============================] - 9s 761ms/step - loss: 0.0739 - accuracy: 0.8786\n", | |
"Epoch 113/400\n", | |
"12/12 [==============================] - 9s 771ms/step - loss: 0.0864 - accuracy: 0.8714\n", | |
"Epoch 114/400\n", | |
"12/12 [==============================] - 9s 762ms/step - loss: 0.0813 - accuracy: 0.8643\n", | |
"Epoch 115/400\n", | |
"12/12 [==============================] - 9s 759ms/step - loss: 0.0760 - accuracy: 0.8738\n", | |
"Epoch 116/400\n", | |
"12/12 [==============================] - 9s 761ms/step - loss: 0.0742 - accuracy: 0.8929\n", | |
"Epoch 117/400\n", | |
"12/12 [==============================] - 9s 761ms/step - loss: 0.0880 - accuracy: 0.8690\n", | |
"Epoch 118/400\n", | |
"12/12 [==============================] - 9s 757ms/step - loss: 0.0828 - accuracy: 0.8833\n", | |
"Epoch 119/400\n", | |
"12/12 [==============================] - 9s 764ms/step - loss: 0.0715 - accuracy: 0.9024\n", | |
"Epoch 120/400\n", | |
"12/12 [==============================] - 9s 764ms/step - loss: 0.0740 - accuracy: 0.8881\n", | |
"Epoch 121/400\n", | |
"12/12 [==============================] - 9s 771ms/step - loss: 0.0663 - accuracy: 0.9024\n", | |
"Epoch 122/400\n", | |
"12/12 [==============================] - 9s 778ms/step - loss: 0.0709 - accuracy: 0.9048\n", | |
"Epoch 123/400\n", | |
"12/12 [==============================] - 9s 782ms/step - loss: 0.0733 - accuracy: 0.9024\n", | |
"Epoch 124/400\n", | |
"12/12 [==============================] - 9s 772ms/step - loss: 0.0736 - accuracy: 0.8881\n", | |
"Epoch 125/400\n", | |
"12/12 [==============================] - 9s 773ms/step - loss: 0.0722 - accuracy: 0.8976\n", | |
"Epoch 126/400\n", | |
"12/12 [==============================] - 9s 768ms/step - loss: 0.0751 - accuracy: 0.8976\n", | |
"Epoch 127/400\n", | |
"12/12 [==============================] - 9s 767ms/step - loss: 0.0827 - accuracy: 0.8714\n", | |
"Epoch 128/400\n", | |
"12/12 [==============================] - 9s 768ms/step - loss: 0.0675 - accuracy: 0.9048\n", | |
"Epoch 129/400\n", | |
"12/12 [==============================] - 9s 773ms/step - loss: 0.0623 - accuracy: 0.9095\n", | |
"Epoch 130/400\n", | |
"12/12 [==============================] - 10s 802ms/step - loss: 0.0632 - accuracy: 0.9048\n", | |
"Epoch 131/400\n", | |
"12/12 [==============================] - 10s 866ms/step - loss: 0.0635 - accuracy: 0.9119\n", | |
"Epoch 132/400\n", | |
"12/12 [==============================] - 9s 775ms/step - loss: 0.0759 - accuracy: 0.8833\n", | |
"Epoch 133/400\n", | |
"12/12 [==============================] - 9s 762ms/step - loss: 0.0688 - accuracy: 0.8976\n", | |
"Epoch 134/400\n", | |
"12/12 [==============================] - 9s 762ms/step - loss: 0.0660 - accuracy: 0.8976\n", | |
"Epoch 135/400\n", | |
"12/12 [==============================] - 9s 770ms/step - loss: 0.0696 - accuracy: 0.9000\n", | |
"Epoch 136/400\n", | |
"12/12 [==============================] - 9s 771ms/step - loss: 0.0679 - accuracy: 0.8929\n", | |
"Epoch 137/400\n", | |
"12/12 [==============================] - 12s 1s/step - loss: 0.0662 - accuracy: 0.9048\n", | |
"Epoch 138/400\n", | |
"12/12 [==============================] - 9s 763ms/step - loss: 0.0712 - accuracy: 0.8881\n", | |
"Epoch 139/400\n", | |
"12/12 [==============================] - 9s 763ms/step - loss: 0.0705 - accuracy: 0.9000\n", | |
"Epoch 140/400\n", | |
"12/12 [==============================] - 9s 765ms/step - loss: 0.0708 - accuracy: 0.8976\n", | |
"Epoch 141/400\n", | |
"12/12 [==============================] - 9s 781ms/step - loss: 0.0849 - accuracy: 0.8643\n", | |
"Epoch 142/400\n", | |
"12/12 [==============================] - 9s 773ms/step - loss: 0.0713 - accuracy: 0.8881\n", | |
"Epoch 143/400\n", | |
"12/12 [==============================] - 9s 765ms/step - loss: 0.0662 - accuracy: 0.9048\n", | |
"Epoch 144/400\n", | |
"12/12 [==============================] - 9s 765ms/step - loss: 0.0715 - accuracy: 0.8905\n", | |
"Epoch 145/400\n", | |
"12/12 [==============================] - 9s 765ms/step - loss: 0.0668 - accuracy: 0.9024\n", | |
"Epoch 146/400\n", | |
"12/12 [==============================] - 9s 767ms/step - loss: 0.0665 - accuracy: 0.9119\n", | |
"Epoch 147/400\n", | |
"12/12 [==============================] - 9s 765ms/step - loss: 0.0579 - accuracy: 0.9333\n", | |
"Epoch 148/400\n", | |
"12/12 [==============================] - 9s 768ms/step - loss: 0.0586 - accuracy: 0.9024\n", | |
"Epoch 149/400\n", | |
"12/12 [==============================] - 9s 765ms/step - loss: 0.0599 - accuracy: 0.9071\n", | |
"Epoch 150/400\n", | |
"12/12 [==============================] - 9s 761ms/step - loss: 0.0584 - accuracy: 0.9095\n", | |
"Epoch 151/400\n", | |
"12/12 [==============================] - 9s 762ms/step - loss: 0.0510 - accuracy: 0.9381\n", | |
"Epoch 152/400\n", | |
"12/12 [==============================] - 9s 760ms/step - loss: 0.0570 - accuracy: 0.9214\n", | |
"Epoch 153/400\n", | |
"12/12 [==============================] - 9s 761ms/step - loss: 0.0562 - accuracy: 0.9190\n", | |
"Epoch 154/400\n", | |
"12/12 [==============================] - 9s 763ms/step - loss: 0.0497 - accuracy: 0.9286\n", | |
"Epoch 155/400\n", | |
"12/12 [==============================] - 9s 760ms/step - loss: 0.0551 - accuracy: 0.9119\n", | |
"Epoch 156/400\n", | |
"12/12 [==============================] - 9s 765ms/step - loss: 0.0627 - accuracy: 0.9024\n", | |
"Epoch 157/400\n", | |
"12/12 [==============================] - 9s 774ms/step - loss: 0.0540 - accuracy: 0.9238\n", | |
"Epoch 158/400\n", | |
"12/12 [==============================] - 9s 769ms/step - loss: 0.0488 - accuracy: 0.9405\n", | |
"Epoch 159/400\n", | |
"12/12 [==============================] - 9s 767ms/step - loss: 0.0456 - accuracy: 0.9405\n", | |
"Epoch 160/400\n", | |
"12/12 [==============================] - 9s 767ms/step - loss: 0.0490 - accuracy: 0.9357\n", | |
"Epoch 161/400\n", | |
"12/12 [==============================] - 9s 785ms/step - loss: 0.0496 - accuracy: 0.9429\n", | |
"Epoch 162/400\n", | |
"12/12 [==============================] - 9s 782ms/step - loss: 0.0526 - accuracy: 0.9238\n", | |
"Epoch 163/400\n", | |
"12/12 [==============================] - 9s 781ms/step - loss: 0.0616 - accuracy: 0.9167\n", | |
"Epoch 164/400\n", | |
"12/12 [==============================] - 9s 765ms/step - loss: 0.0659 - accuracy: 0.8976\n", | |
"Epoch 165/400\n", | |
"12/12 [==============================] - 9s 767ms/step - loss: 0.0669 - accuracy: 0.9000\n", | |
"Epoch 166/400\n", | |
"12/12 [==============================] - 9s 765ms/step - loss: 0.0599 - accuracy: 0.9024\n", | |
"Epoch 167/400\n", | |
"12/12 [==============================] - 9s 760ms/step - loss: 0.0529 - accuracy: 0.9238\n", | |
"Epoch 168/400\n", | |
"12/12 [==============================] - 9s 764ms/step - loss: 0.0535 - accuracy: 0.9214\n", | |
"Epoch 169/400\n", | |
"12/12 [==============================] - 9s 765ms/step - loss: 0.0574 - accuracy: 0.9167\n", | |
"Epoch 170/400\n", | |
"12/12 [==============================] - 9s 767ms/step - loss: 0.0551 - accuracy: 0.9143\n", | |
"Epoch 171/400\n", | |
"12/12 [==============================] - 9s 768ms/step - loss: 0.0587 - accuracy: 0.9095\n", | |
"Epoch 172/400\n", | |
"12/12 [==============================] - 9s 774ms/step - loss: 0.0532 - accuracy: 0.9405\n", | |
"Epoch 173/400\n", | |
"12/12 [==============================] - 9s 772ms/step - loss: 0.0627 - accuracy: 0.9048\n", | |
"Epoch 174/400\n", | |
"12/12 [==============================] - 9s 767ms/step - loss: 0.0539 - accuracy: 0.9214\n", | |
"Epoch 175/400\n", | |
"12/12 [==============================] - 9s 764ms/step - loss: 0.0501 - accuracy: 0.9405\n", | |
"Epoch 176/400\n", | |
"12/12 [==============================] - 9s 766ms/step - loss: 0.0538 - accuracy: 0.9143\n", | |
"Epoch 177/400\n", | |
"12/12 [==============================] - 9s 763ms/step - loss: 0.0680 - accuracy: 0.9048\n", | |
"Epoch 178/400\n", | |
"12/12 [==============================] - 9s 762ms/step - loss: 0.0480 - accuracy: 0.9310\n", | |
"Epoch 179/400\n", | |
"12/12 [==============================] - 9s 763ms/step - loss: 0.0473 - accuracy: 0.9405\n", | |
"Epoch 180/400\n", | |
"12/12 [==============================] - 9s 763ms/step - loss: 0.0489 - accuracy: 0.9310\n", | |
"Epoch 181/400\n", | |
"12/12 [==============================] - 9s 759ms/step - loss: 0.0450 - accuracy: 0.9429\n", | |
"Epoch 182/400\n", | |
"12/12 [==============================] - 9s 760ms/step - loss: 0.0487 - accuracy: 0.9333\n", | |
"Epoch 183/400\n", | |
"12/12 [==============================] - 9s 771ms/step - loss: 0.0434 - accuracy: 0.9452\n", | |
"Epoch 184/400\n", | |
"12/12 [==============================] - 9s 768ms/step - loss: 0.0504 - accuracy: 0.9262\n", | |
"Epoch 185/400\n", | |
"12/12 [==============================] - 9s 763ms/step - loss: 0.0422 - accuracy: 0.9452\n", | |
"Epoch 186/400\n", | |
"12/12 [==============================] - 9s 757ms/step - loss: 0.0472 - accuracy: 0.9286\n", | |
"Epoch 187/400\n", | |
"12/12 [==============================] - 9s 760ms/step - loss: 0.0607 - accuracy: 0.8976\n", | |
"Epoch 188/400\n", | |
"12/12 [==============================] - 9s 760ms/step - loss: 0.0489 - accuracy: 0.9357\n", | |
"Epoch 189/400\n", | |
"12/12 [==============================] - 9s 758ms/step - loss: 0.0509 - accuracy: 0.9286\n", | |
"Epoch 190/400\n", | |
"12/12 [==============================] - 9s 762ms/step - loss: 0.0584 - accuracy: 0.9167\n", | |
"Epoch 191/400\n", | |
"12/12 [==============================] - 9s 764ms/step - loss: 0.0459 - accuracy: 0.9429\n", | |
"Epoch 192/400\n", | |
"12/12 [==============================] - 9s 767ms/step - loss: 0.0493 - accuracy: 0.9333\n", | |
"Epoch 193/400\n", | |
"12/12 [==============================] - 9s 786ms/step - loss: 0.0453 - accuracy: 0.9286\n", | |
"Epoch 194/400\n", | |
"12/12 [==============================] - 9s 774ms/step - loss: 0.0445 - accuracy: 0.9429\n", | |
"Epoch 195/400\n", | |
"12/12 [==============================] - 9s 761ms/step - loss: 0.0421 - accuracy: 0.9405\n", | |
"Epoch 196/400\n", | |
"12/12 [==============================] - 9s 763ms/step - loss: 0.0476 - accuracy: 0.9262\n", | |
"Epoch 197/400\n", | |
"12/12 [==============================] - 12s 1s/step - loss: 0.0427 - accuracy: 0.9500\n", | |
"Epoch 198/400\n", | |
"12/12 [==============================] - 9s 760ms/step - loss: 0.0447 - accuracy: 0.9310\n", | |
"Epoch 199/400\n", | |
"12/12 [==============================] - 9s 760ms/step - loss: 0.0452 - accuracy: 0.9333\n", | |
"Epoch 200/400\n", | |
"12/12 [==============================] - 9s 771ms/step - loss: 0.0426 - accuracy: 0.9476\n", | |
"Epoch 201/400\n", | |
"12/12 [==============================] - 9s 770ms/step - loss: 0.0440 - accuracy: 0.9500\n", | |
"Epoch 202/400\n", | |
"12/12 [==============================] - 9s 771ms/step - loss: 0.0539 - accuracy: 0.9190\n", | |
"Epoch 203/400\n", | |
"12/12 [==============================] - 9s 765ms/step - loss: 0.0565 - accuracy: 0.9119\n", | |
"Epoch 204/400\n", | |
"12/12 [==============================] - 9s 769ms/step - loss: 0.0490 - accuracy: 0.9381\n", | |
"Epoch 205/400\n", | |
"12/12 [==============================] - 9s 764ms/step - loss: 0.0500 - accuracy: 0.9262\n", | |
"Epoch 206/400\n", | |
"12/12 [==============================] - 9s 769ms/step - loss: 0.0440 - accuracy: 0.9310\n", | |
"Epoch 207/400\n", | |
"12/12 [==============================] - 9s 775ms/step - loss: 0.0388 - accuracy: 0.9500\n", | |
"Epoch 208/400\n", | |
"12/12 [==============================] - 9s 769ms/step - loss: 0.0329 - accuracy: 0.9548\n", | |
"Epoch 209/400\n", | |
"12/12 [==============================] - 9s 773ms/step - loss: 0.0289 - accuracy: 0.9643\n", | |
"Epoch 210/400\n", | |
"12/12 [==============================] - 9s 767ms/step - loss: 0.0432 - accuracy: 0.9381\n", | |
"Epoch 211/400\n", | |
"12/12 [==============================] - 9s 766ms/step - loss: 0.0424 - accuracy: 0.9357\n", | |
"Epoch 212/400\n", | |
"12/12 [==============================] - 9s 769ms/step - loss: 0.0496 - accuracy: 0.9214\n", | |
"Epoch 213/400\n", | |
"12/12 [==============================] - 9s 768ms/step - loss: 0.0459 - accuracy: 0.9310\n", | |
"Epoch 214/400\n", | |
"12/12 [==============================] - 9s 767ms/step - loss: 0.0353 - accuracy: 0.9524\n", | |
"Epoch 215/400\n", | |
"12/12 [==============================] - 9s 767ms/step - loss: 0.0382 - accuracy: 0.9452\n", | |
"Epoch 216/400\n", | |
"12/12 [==============================] - 9s 767ms/step - loss: 0.0383 - accuracy: 0.9476\n", | |
"Epoch 217/400\n", | |
"12/12 [==============================] - 9s 761ms/step - loss: 0.0384 - accuracy: 0.9452\n", | |
"Epoch 218/400\n", | |
"12/12 [==============================] - 9s 767ms/step - loss: 0.0343 - accuracy: 0.9619\n", | |
"Epoch 219/400\n", | |
"12/12 [==============================] - 9s 767ms/step - loss: 0.0289 - accuracy: 0.9619\n", | |
"Epoch 220/400\n", | |
"12/12 [==============================] - 9s 764ms/step - loss: 0.0293 - accuracy: 0.9619\n", | |
"Epoch 221/400\n", | |
"12/12 [==============================] - 9s 768ms/step - loss: 0.0271 - accuracy: 0.9667\n", | |
"Epoch 222/400\n", | |
"12/12 [==============================] - 10s 801ms/step - loss: 0.0334 - accuracy: 0.9571\n", | |
"Epoch 223/400\n", | |
"12/12 [==============================] - 9s 770ms/step - loss: 0.0329 - accuracy: 0.9548\n", | |
"Epoch 224/400\n", | |
"12/12 [==============================] - 10s 795ms/step - loss: 0.0322 - accuracy: 0.9595\n", | |
"Epoch 225/400\n", | |
"12/12 [==============================] - 10s 805ms/step - loss: 0.0260 - accuracy: 0.9690\n", | |
"Epoch 226/400\n", | |
"12/12 [==============================] - 9s 765ms/step - loss: 0.0380 - accuracy: 0.9548\n", | |
"Epoch 227/400\n", | |
"12/12 [==============================] - 9s 763ms/step - loss: 0.0628 - accuracy: 0.9071\n", | |
"Epoch 228/400\n", | |
"12/12 [==============================] - 9s 762ms/step - loss: 0.0455 - accuracy: 0.9310\n", | |
"Epoch 229/400\n", | |
"12/12 [==============================] - 9s 764ms/step - loss: 0.0322 - accuracy: 0.9643\n", | |
"Epoch 230/400\n", | |
"12/12 [==============================] - 9s 774ms/step - loss: 0.0323 - accuracy: 0.9667\n", | |
"Epoch 231/400\n", | |
"12/12 [==============================] - 9s 772ms/step - loss: 0.0358 - accuracy: 0.9548\n", | |
"Epoch 232/400\n", | |
"12/12 [==============================] - 9s 772ms/step - loss: 0.0327 - accuracy: 0.9524\n", | |
"Epoch 233/400\n", | |
"12/12 [==============================] - 9s 765ms/step - loss: 0.0345 - accuracy: 0.9524\n", | |
"Epoch 234/400\n", | |
"12/12 [==============================] - 9s 775ms/step - loss: 0.0270 - accuracy: 0.9619\n", | |
"Epoch 235/400\n", | |
"12/12 [==============================] - 9s 766ms/step - loss: 0.0355 - accuracy: 0.9571\n", | |
"Epoch 236/400\n", | |
"12/12 [==============================] - 9s 766ms/step - loss: 0.0350 - accuracy: 0.9500\n", | |
"Epoch 237/400\n", | |
"12/12 [==============================] - 9s 772ms/step - loss: 0.0390 - accuracy: 0.9405\n", | |
"Epoch 238/400\n", | |
"12/12 [==============================] - 9s 764ms/step - loss: 0.0402 - accuracy: 0.9548\n", | |
"Epoch 239/400\n", | |
"12/12 [==============================] - 9s 766ms/step - loss: 0.0351 - accuracy: 0.9548\n", | |
"Epoch 240/400\n", | |
"12/12 [==============================] - 9s 767ms/step - loss: 0.0331 - accuracy: 0.9524\n", | |
"Epoch 241/400\n", | |
"12/12 [==============================] - 9s 769ms/step - loss: 0.0337 - accuracy: 0.9548\n", | |
"Epoch 242/400\n", | |
"12/12 [==============================] - 9s 761ms/step - loss: 0.0369 - accuracy: 0.9524\n", | |
"Epoch 243/400\n", | |
"12/12 [==============================] - 9s 779ms/step - loss: 0.0550 - accuracy: 0.9214\n", | |
"Epoch 244/400\n", | |
"12/12 [==============================] - 9s 769ms/step - loss: 0.0461 - accuracy: 0.9405\n", | |
"Epoch 245/400\n", | |
"12/12 [==============================] - 9s 767ms/step - loss: 0.0395 - accuracy: 0.9524\n", | |
"Epoch 246/400\n", | |
"12/12 [==============================] - 9s 756ms/step - loss: 0.0381 - accuracy: 0.9476\n", | |
"Epoch 247/400\n", | |
"12/12 [==============================] - 9s 762ms/step - loss: 0.0640 - accuracy: 0.9048\n", | |
"Epoch 248/400\n", | |
"12/12 [==============================] - 9s 760ms/step - loss: 0.0383 - accuracy: 0.9524\n", | |
"Epoch 249/400\n", | |
"12/12 [==============================] - 9s 767ms/step - loss: 0.0473 - accuracy: 0.9357\n", | |
"Epoch 250/400\n", | |
"12/12 [==============================] - 9s 763ms/step - loss: 0.0431 - accuracy: 0.9381\n", | |
"Epoch 251/400\n", | |
"12/12 [==============================] - 9s 763ms/step - loss: 0.0331 - accuracy: 0.9690\n", | |
"Epoch 252/400\n", | |
"12/12 [==============================] - 9s 773ms/step - loss: 0.0279 - accuracy: 0.9643\n", | |
"Epoch 253/400\n", | |
"12/12 [==============================] - 9s 769ms/step - loss: 0.0292 - accuracy: 0.9595\n", | |
"Epoch 254/400\n", | |
"12/12 [==============================] - 9s 763ms/step - loss: 0.0272 - accuracy: 0.9690\n", | |
"Epoch 255/400\n", | |
"12/12 [==============================] - 9s 769ms/step - loss: 0.0318 - accuracy: 0.9595\n", | |
"Epoch 256/400\n", | |
"12/12 [==============================] - 9s 789ms/step - loss: 0.0273 - accuracy: 0.9643\n", | |
"Epoch 257/400\n", | |
"12/12 [==============================] - 12s 997ms/step - loss: 0.0266 - accuracy: 0.9643\n", | |
"Epoch 258/400\n", | |
"12/12 [==============================] - 10s 852ms/step - loss: 0.0308 - accuracy: 0.9714\n", | |
"Epoch 259/400\n", | |
"12/12 [==============================] - 9s 775ms/step - loss: 0.0383 - accuracy: 0.9476\n", | |
"Epoch 260/400\n", | |
"12/12 [==============================] - 9s 780ms/step - loss: 0.0328 - accuracy: 0.9452\n", | |
"Epoch 261/400\n", | |
"12/12 [==============================] - 9s 776ms/step - loss: 0.0458 - accuracy: 0.9405\n", | |
"Epoch 262/400\n", | |
"12/12 [==============================] - 9s 777ms/step - loss: 0.0350 - accuracy: 0.9619\n", | |
"Epoch 263/400\n", | |
"12/12 [==============================] - 9s 777ms/step - loss: 0.0392 - accuracy: 0.9500\n", | |
"Epoch 264/400\n", | |
"12/12 [==============================] - 9s 775ms/step - loss: 0.0265 - accuracy: 0.9643\n", | |
"Epoch 265/400\n", | |
"12/12 [==============================] - 9s 774ms/step - loss: 0.0277 - accuracy: 0.9690\n", | |
"Epoch 266/400\n", | |
"12/12 [==============================] - 9s 773ms/step - loss: 0.0293 - accuracy: 0.9667\n", | |
"Epoch 267/400\n", | |
"12/12 [==============================] - 9s 772ms/step - loss: 0.0253 - accuracy: 0.9667\n", | |
"Epoch 268/400\n", | |
"12/12 [==============================] - 9s 773ms/step - loss: 0.0269 - accuracy: 0.9643\n", | |
"Epoch 269/400\n", | |
"12/12 [==============================] - 9s 773ms/step - loss: 0.0275 - accuracy: 0.9548\n", | |
"Epoch 270/400\n", | |
"12/12 [==============================] - 9s 772ms/step - loss: 0.0214 - accuracy: 0.9786\n", | |
"Epoch 271/400\n", | |
"12/12 [==============================] - 9s 777ms/step - loss: 0.0240 - accuracy: 0.9667\n", | |
"Epoch 272/400\n", | |
"12/12 [==============================] - 9s 783ms/step - loss: 0.0383 - accuracy: 0.9476\n", | |
"Epoch 273/400\n", | |
"12/12 [==============================] - 9s 770ms/step - loss: 0.0252 - accuracy: 0.9667\n", | |
"Epoch 274/400\n", | |
"12/12 [==============================] - 9s 769ms/step - loss: 0.0300 - accuracy: 0.9619\n", | |
"Epoch 275/400\n", | |
"12/12 [==============================] - 9s 770ms/step - loss: 0.0469 - accuracy: 0.9452\n", | |
"Epoch 276/400\n", | |
"12/12 [==============================] - 9s 768ms/step - loss: 0.0543 - accuracy: 0.9310\n", | |
"Epoch 277/400\n", | |
"12/12 [==============================] - 9s 773ms/step - loss: 0.0485 - accuracy: 0.9167\n", | |
"Epoch 278/400\n", | |
"12/12 [==============================] - 9s 776ms/step - loss: 0.0320 - accuracy: 0.9643\n", | |
"Epoch 279/400\n", | |
"12/12 [==============================] - 9s 774ms/step - loss: 0.0282 - accuracy: 0.9643\n", | |
"Epoch 280/400\n", | |
"12/12 [==============================] - 9s 773ms/step - loss: 0.0246 - accuracy: 0.9667\n", | |
"Epoch 281/400\n", | |
"12/12 [==============================] - 9s 768ms/step - loss: 0.0277 - accuracy: 0.9595\n", | |
"Epoch 282/400\n", | |
"12/12 [==============================] - 9s 787ms/step - loss: 0.0335 - accuracy: 0.9524\n", | |
"Epoch 283/400\n", | |
"12/12 [==============================] - 9s 772ms/step - loss: 0.0254 - accuracy: 0.9643\n", | |
"Epoch 284/400\n", | |
"12/12 [==============================] - 9s 769ms/step - loss: 0.0252 - accuracy: 0.9667\n", | |
"Epoch 285/400\n", | |
"12/12 [==============================] - 9s 770ms/step - loss: 0.0289 - accuracy: 0.9690\n", | |
"Epoch 286/400\n", | |
"12/12 [==============================] - 9s 769ms/step - loss: 0.0253 - accuracy: 0.9738\n", | |
"Epoch 287/400\n", | |
"12/12 [==============================] - 9s 784ms/step - loss: 0.0266 - accuracy: 0.9667\n", | |
"Epoch 288/400\n", | |
"12/12 [==============================] - 9s 775ms/step - loss: 0.0292 - accuracy: 0.9643\n", | |
"Epoch 289/400\n", | |
"12/12 [==============================] - 9s 773ms/step - loss: 0.0273 - accuracy: 0.9762\n", | |
"Epoch 290/400\n", | |
"12/12 [==============================] - 9s 767ms/step - loss: 0.0276 - accuracy: 0.9690\n", | |
"Epoch 291/400\n", | |
"12/12 [==============================] - 9s 773ms/step - loss: 0.0272 - accuracy: 0.9619\n", | |
"Epoch 292/400\n", | |
"12/12 [==============================] - 9s 770ms/step - loss: 0.0382 - accuracy: 0.9500\n", | |
"Epoch 293/400\n", | |
"12/12 [==============================] - 9s 770ms/step - loss: 0.0354 - accuracy: 0.9524\n", | |
"Epoch 294/400\n", | |
"12/12 [==============================] - 9s 768ms/step - loss: 0.0294 - accuracy: 0.9548\n", | |
"Epoch 295/400\n", | |
"12/12 [==============================] - 9s 772ms/step - loss: 0.0235 - accuracy: 0.9714\n", | |
"Epoch 296/400\n", | |
"12/12 [==============================] - 9s 771ms/step - loss: 0.0233 - accuracy: 0.9667\n", | |
"Epoch 297/400\n", | |
"12/12 [==============================] - 9s 767ms/step - loss: 0.0226 - accuracy: 0.9690\n", | |
"Epoch 298/400\n", | |
"12/12 [==============================] - 9s 768ms/step - loss: 0.0238 - accuracy: 0.9738\n", | |
"Epoch 299/400\n", | |
"12/12 [==============================] - 9s 771ms/step - loss: 0.0203 - accuracy: 0.9762\n", | |
"Epoch 300/400\n", | |
"12/12 [==============================] - 9s 767ms/step - loss: 0.0162 - accuracy: 0.9786\n", | |
"Epoch 301/400\n", | |
"12/12 [==============================] - 9s 768ms/step - loss: 0.0193 - accuracy: 0.9762\n", | |
"Epoch 302/400\n", | |
"12/12 [==============================] - 9s 777ms/step - loss: 0.0211 - accuracy: 0.9690\n", | |
"Epoch 303/400\n", | |
"12/12 [==============================] - 9s 772ms/step - loss: 0.0204 - accuracy: 0.9786\n", | |
"Epoch 304/400\n", | |
"12/12 [==============================] - 9s 767ms/step - loss: 0.0209 - accuracy: 0.9690\n", | |
"Epoch 305/400\n", | |
"12/12 [==============================] - 9s 768ms/step - loss: 0.0281 - accuracy: 0.9667\n", | |
"Epoch 306/400\n", | |
"12/12 [==============================] - 9s 768ms/step - loss: 0.0215 - accuracy: 0.9786\n", | |
"Epoch 307/400\n", | |
"12/12 [==============================] - 9s 770ms/step - loss: 0.0195 - accuracy: 0.9762\n", | |
"Epoch 308/400\n", | |
"12/12 [==============================] - 9s 771ms/step - loss: 0.0182 - accuracy: 0.9857\n", | |
"Epoch 309/400\n", | |
"12/12 [==============================] - 9s 771ms/step - loss: 0.0197 - accuracy: 0.9738\n", | |
"Epoch 310/400\n", | |
"12/12 [==============================] - 9s 765ms/step - loss: 0.0163 - accuracy: 0.9810\n", | |
"Epoch 311/400\n", | |
"12/12 [==============================] - 9s 770ms/step - loss: 0.0199 - accuracy: 0.9738\n", | |
"Epoch 312/400\n", | |
"12/12 [==============================] - 9s 771ms/step - loss: 0.0284 - accuracy: 0.9619\n", | |
"Epoch 313/400\n", | |
"12/12 [==============================] - 9s 781ms/step - loss: 0.0651 - accuracy: 0.8833\n", | |
"Epoch 314/400\n", | |
"12/12 [==============================] - 9s 766ms/step - loss: 0.0402 - accuracy: 0.9452\n", | |
"Epoch 315/400\n", | |
"12/12 [==============================] - 9s 764ms/step - loss: 0.0388 - accuracy: 0.9524\n", | |
"Epoch 316/400\n", | |
"12/12 [==============================] - 9s 761ms/step - loss: 0.0333 - accuracy: 0.9524\n", | |
"Epoch 317/400\n", | |
"12/12 [==============================] - 12s 1s/step - loss: 0.0235 - accuracy: 0.9738\n", | |
"Epoch 318/400\n", | |
"12/12 [==============================] - 10s 799ms/step - loss: 0.0181 - accuracy: 0.9929\n", | |
"Epoch 319/400\n", | |
"12/12 [==============================] - 9s 773ms/step - loss: 0.0309 - accuracy: 0.9690\n", | |
"Epoch 320/400\n", | |
"12/12 [==============================] - 9s 771ms/step - loss: 0.0268 - accuracy: 0.9619\n", | |
"Epoch 321/400\n", | |
"12/12 [==============================] - 9s 771ms/step - loss: 0.0282 - accuracy: 0.9643\n", | |
"Epoch 322/400\n", | |
"12/12 [==============================] - 9s 764ms/step - loss: 0.0251 - accuracy: 0.9667\n", | |
"Epoch 323/400\n", | |
"12/12 [==============================] - 9s 764ms/step - loss: 0.0256 - accuracy: 0.9643\n", | |
"Epoch 324/400\n", | |
"12/12 [==============================] - 9s 770ms/step - loss: 0.0174 - accuracy: 0.9810\n", | |
"Epoch 325/400\n", | |
"12/12 [==============================] - 9s 778ms/step - loss: 0.0216 - accuracy: 0.9762\n", | |
"Epoch 326/400\n", | |
"12/12 [==============================] - 10s 869ms/step - loss: 0.0262 - accuracy: 0.9786\n", | |
"Epoch 327/400\n", | |
"12/12 [==============================] - 9s 766ms/step - loss: 0.0229 - accuracy: 0.9738\n", | |
"Epoch 328/400\n", | |
"12/12 [==============================] - 9s 762ms/step - loss: 0.0228 - accuracy: 0.9810\n", | |
"Epoch 329/400\n", | |
"12/12 [==============================] - 9s 767ms/step - loss: 0.0209 - accuracy: 0.9714\n", | |
"Epoch 330/400\n", | |
"12/12 [==============================] - 9s 775ms/step - loss: 0.0204 - accuracy: 0.9762\n", | |
"Epoch 331/400\n", | |
"12/12 [==============================] - 9s 764ms/step - loss: 0.0169 - accuracy: 0.9833\n", | |
"Epoch 332/400\n", | |
"12/12 [==============================] - 9s 767ms/step - loss: 0.0174 - accuracy: 0.9833\n", | |
"Epoch 333/400\n", | |
"12/12 [==============================] - 9s 765ms/step - loss: 0.0234 - accuracy: 0.9714\n", | |
"Epoch 334/400\n", | |
"12/12 [==============================] - 9s 768ms/step - loss: 0.0272 - accuracy: 0.9714\n", | |
"Epoch 335/400\n", | |
"12/12 [==============================] - 9s 765ms/step - loss: 0.0222 - accuracy: 0.9714\n", | |
"Epoch 336/400\n", | |
"12/12 [==============================] - 9s 768ms/step - loss: 0.0216 - accuracy: 0.9762\n", | |
"Epoch 337/400\n", | |
"12/12 [==============================] - 9s 770ms/step - loss: 0.0203 - accuracy: 0.9714\n", | |
"Epoch 338/400\n", | |
"12/12 [==============================] - 9s 768ms/step - loss: 0.0159 - accuracy: 0.9833\n", | |
"Epoch 339/400\n", | |
"12/12 [==============================] - 9s 769ms/step - loss: 0.0161 - accuracy: 0.9833\n", | |
"Epoch 340/400\n", | |
"12/12 [==============================] - 9s 770ms/step - loss: 0.0172 - accuracy: 0.9786\n", | |
"Epoch 341/400\n", | |
"12/12 [==============================] - 9s 767ms/step - loss: 0.0189 - accuracy: 0.9738\n", | |
"Epoch 342/400\n", | |
"12/12 [==============================] - 9s 762ms/step - loss: 0.0190 - accuracy: 0.9833\n", | |
"Epoch 343/400\n", | |
"12/12 [==============================] - 9s 789ms/step - loss: 0.0177 - accuracy: 0.9762\n", | |
"Epoch 344/400\n", | |
"12/12 [==============================] - 9s 762ms/step - loss: 0.0230 - accuracy: 0.9667\n", | |
"Epoch 345/400\n", | |
"12/12 [==============================] - 9s 771ms/step - loss: 0.0186 - accuracy: 0.9714\n", | |
"Epoch 346/400\n", | |
"12/12 [==============================] - 9s 767ms/step - loss: 0.0161 - accuracy: 0.9786\n", | |
"Epoch 347/400\n", | |
"12/12 [==============================] - 9s 758ms/step - loss: 0.0159 - accuracy: 0.9786\n", | |
"Epoch 348/400\n", | |
"12/12 [==============================] - 9s 775ms/step - loss: 0.0173 - accuracy: 0.9762\n", | |
"Epoch 349/400\n", | |
"12/12 [==============================] - 9s 792ms/step - loss: 0.0245 - accuracy: 0.9690\n", | |
"Epoch 350/400\n", | |
"12/12 [==============================] - 9s 779ms/step - loss: 0.0186 - accuracy: 0.9786\n", | |
"Epoch 351/400\n", | |
"12/12 [==============================] - 9s 767ms/step - loss: 0.0216 - accuracy: 0.9738\n", | |
"Epoch 352/400\n", | |
"12/12 [==============================] - 9s 766ms/step - loss: 0.0205 - accuracy: 0.9786\n", | |
"Epoch 353/400\n", | |
"12/12 [==============================] - 9s 764ms/step - loss: 0.0217 - accuracy: 0.9762\n", | |
"Epoch 354/400\n", | |
"12/12 [==============================] - 9s 772ms/step - loss: 0.0203 - accuracy: 0.9762\n", | |
"Epoch 355/400\n", | |
"12/12 [==============================] - 9s 774ms/step - loss: 0.0153 - accuracy: 0.9833\n", | |
"Epoch 356/400\n", | |
"12/12 [==============================] - 9s 766ms/step - loss: 0.0179 - accuracy: 0.9786\n", | |
"Epoch 357/400\n", | |
"12/12 [==============================] - 9s 765ms/step - loss: 0.0150 - accuracy: 0.9786\n", | |
"Epoch 358/400\n", | |
"12/12 [==============================] - 9s 761ms/step - loss: 0.0230 - accuracy: 0.9690\n", | |
"Epoch 359/400\n", | |
"12/12 [==============================] - 9s 763ms/step - loss: 0.0173 - accuracy: 0.9762\n", | |
"Epoch 360/400\n", | |
"12/12 [==============================] - 9s 765ms/step - loss: 0.0282 - accuracy: 0.9595\n", | |
"Epoch 361/400\n", | |
"12/12 [==============================] - 9s 769ms/step - loss: 0.0226 - accuracy: 0.9786\n", | |
"Epoch 362/400\n", | |
"12/12 [==============================] - 9s 774ms/step - loss: 0.0205 - accuracy: 0.9762\n", | |
"Epoch 363/400\n", | |
"12/12 [==============================] - 9s 775ms/step - loss: 0.0161 - accuracy: 0.9786\n", | |
"Epoch 364/400\n", | |
"12/12 [==============================] - 9s 775ms/step - loss: 0.0204 - accuracy: 0.9738\n", | |
"Epoch 365/400\n", | |
"12/12 [==============================] - 9s 780ms/step - loss: 0.0149 - accuracy: 0.9857\n", | |
"Epoch 366/400\n", | |
"12/12 [==============================] - 9s 779ms/step - loss: 0.0176 - accuracy: 0.9762\n", | |
"Epoch 367/400\n", | |
"12/12 [==============================] - 9s 777ms/step - loss: 0.0337 - accuracy: 0.9619\n", | |
"Epoch 368/400\n", | |
"12/12 [==============================] - 9s 777ms/step - loss: 0.0452 - accuracy: 0.9405\n", | |
"Epoch 369/400\n", | |
"12/12 [==============================] - 9s 779ms/step - loss: 0.0597 - accuracy: 0.9048\n", | |
"Epoch 370/400\n", | |
"12/12 [==============================] - 9s 783ms/step - loss: 0.0492 - accuracy: 0.9310\n", | |
"Epoch 371/400\n", | |
"12/12 [==============================] - 10s 793ms/step - loss: 0.0415 - accuracy: 0.9429\n", | |
"Epoch 372/400\n", | |
"12/12 [==============================] - 9s 778ms/step - loss: 0.0243 - accuracy: 0.9619\n", | |
"Epoch 373/400\n", | |
"12/12 [==============================] - 10s 842ms/step - loss: 0.0148 - accuracy: 0.9881\n", | |
"Epoch 374/400\n", | |
"12/12 [==============================] - 9s 777ms/step - loss: 0.0185 - accuracy: 0.9833\n", | |
"Epoch 375/400\n", | |
"12/12 [==============================] - 9s 769ms/step - loss: 0.0228 - accuracy: 0.9643\n", | |
"Epoch 376/400\n", | |
"12/12 [==============================] - 9s 778ms/step - loss: 0.0186 - accuracy: 0.9762\n", | |
"Epoch 377/400\n", | |
"12/12 [==============================] - 14s 1s/step - loss: 0.0246 - accuracy: 0.9667\n", | |
"Epoch 378/400\n", | |
"12/12 [==============================] - 9s 779ms/step - loss: 0.0220 - accuracy: 0.9762\n", | |
"Epoch 379/400\n", | |
"12/12 [==============================] - 9s 774ms/step - loss: 0.0206 - accuracy: 0.9738\n", | |
"Epoch 380/400\n", | |
"12/12 [==============================] - 10s 822ms/step - loss: 0.0145 - accuracy: 0.9905\n", | |
"Epoch 381/400\n", | |
"12/12 [==============================] - 10s 844ms/step - loss: 0.0188 - accuracy: 0.9786\n", | |
"Epoch 382/400\n", | |
"12/12 [==============================] - 9s 775ms/step - loss: 0.0191 - accuracy: 0.9738\n", | |
"Epoch 383/400\n", | |
"12/12 [==============================] - 9s 779ms/step - loss: 0.0210 - accuracy: 0.9786\n", | |
"Epoch 384/400\n", | |
"12/12 [==============================] - 9s 777ms/step - loss: 0.0193 - accuracy: 0.9714\n", | |
"Epoch 385/400\n", | |
"12/12 [==============================] - 9s 773ms/step - loss: 0.0182 - accuracy: 0.9833\n", | |
"Epoch 386/400\n", | |
"12/12 [==============================] - 9s 774ms/step - loss: 0.0167 - accuracy: 0.9738\n", | |
"Epoch 387/400\n", | |
"12/12 [==============================] - 9s 781ms/step - loss: 0.0150 - accuracy: 0.9810\n", | |
"Epoch 388/400\n", | |
"12/12 [==============================] - 9s 774ms/step - loss: 0.0182 - accuracy: 0.9738\n", | |
"Epoch 389/400\n", | |
"12/12 [==============================] - 9s 777ms/step - loss: 0.0140 - accuracy: 0.9786\n", | |
"Epoch 390/400\n", | |
"12/12 [==============================] - 9s 777ms/step - loss: 0.0141 - accuracy: 0.9881\n", | |
"Epoch 391/400\n", | |
"12/12 [==============================] - 9s 775ms/step - loss: 0.0195 - accuracy: 0.9762\n", | |
"Epoch 392/400\n", | |
"12/12 [==============================] - 9s 772ms/step - loss: 0.0179 - accuracy: 0.9786\n", | |
"Epoch 393/400\n", | |
"12/12 [==============================] - 9s 773ms/step - loss: 0.0165 - accuracy: 0.9786\n", | |
"Epoch 394/400\n", | |
"12/12 [==============================] - 9s 769ms/step - loss: 0.0135 - accuracy: 0.9881\n", | |
"Epoch 395/400\n", | |
"12/12 [==============================] - 9s 772ms/step - loss: 0.0178 - accuracy: 0.9738\n", | |
"Epoch 396/400\n", | |
"12/12 [==============================] - 9s 771ms/step - loss: 0.0151 - accuracy: 0.9929\n", | |
"Epoch 397/400\n", | |
"12/12 [==============================] - 9s 774ms/step - loss: 0.0142 - accuracy: 0.9857\n", | |
"Epoch 398/400\n", | |
"12/12 [==============================] - 9s 772ms/step - loss: 0.0147 - accuracy: 0.9833\n", | |
"Epoch 399/400\n", | |
"12/12 [==============================] - 9s 776ms/step - loss: 0.0194 - accuracy: 0.9810\n", | |
"Epoch 400/400\n", | |
"12/12 [==============================] - 9s 777ms/step - loss: 0.0208 - accuracy: 0.9786\n", | |
"\n", | |
"Validating ...\n", | |
"4/4 [==============================] - 0s 77ms/step - loss: 0.2979 - accuracy: 0.6667\n", | |
"Dev loss: 0.2978794276714325\n", | |
"Dev accuracy: 0.6666666865348816\n", | |
"\n", | |
"Testing ...\n", | |
"2/2 [==============================] - 0s 49ms/step - loss: 0.3714 - accuracy: 0.6000\n", | |
"Test loss: 0.37135106325149536\n", | |
"Test accuracy: 0.6000000238418579\n", | |
"\n", | |
"Saving model to JSON: model.json\n", | |
"\n", | |
"Saving model: lstm_genre_classifier_lstm.h5\n" | |
], | |
"name": "stdout" | |
} | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"colab": { | |
"base_uri": "https://localhost:8080/" | |
}, | |
"id": "_IRUgFR4eioe", | |
"outputId": "00aec362-a5e7-438f-a892-0984b1daf2b9" | |
}, | |
"source": [ | |
"!ls" | |
], | |
"execution_count": 16, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"text": [ | |
"lstm_genre_classifier_lstm.h5\t model.json\n", | |
"LSTM-Music-Genre-Classification sample_data\n" | |
], | |
"name": "stdout" | |
} | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"colab": { | |
"base_uri": "https://localhost:8080/" | |
}, | |
"id": "ObxYdoIqejWM", | |
"outputId": "691de971-3f77-4af8-cf7b-591f6d1c88fc" | |
}, | |
"source": [ | |
"\"An example of predicting a music genre from a custom audio file\"\n", | |
"import librosa\n", | |
"import logging\n", | |
"import sys\n", | |
"import numpy as np\n", | |
"\n", | |
"from keras.models import model_from_json\n", | |
"#from GenreFeatureData import (\n", | |
"# GenreFeatureData,\n", | |
"#) # local python class with Audio feature extraction and genre list\n", | |
"\n", | |
"# set logging level\n", | |
"logging.getLogger(\"tensorflow\").setLevel(logging.ERROR)\n", | |
"\n", | |
"\n", | |
"def load_model(model_path, weights_path):\n", | |
" \"Load the trained LSTM model from directory for genre classification\"\n", | |
" with open(model_path, \"r\") as model_file:\n", | |
" trained_model = model_from_json(model_file.read())\n", | |
" trained_model.load_weights(weights_path)\n", | |
" trained_model.compile(\n", | |
" loss=\"categorical_crossentropy\", optimizer=\"adam\", metrics=[\"accuracy\"]\n", | |
" )\n", | |
" return trained_model\n", | |
"\n", | |
"\n", | |
"def extract_audio_features(file):\n", | |
" \"Extract audio features from an audio file for genre classification\"\n", | |
" timeseries_length = 128\n", | |
" features = np.zeros((1, timeseries_length, 33), dtype=np.float64)\n", | |
"\n", | |
" y, sr = librosa.load(file)\n", | |
" mfcc = librosa.feature.mfcc(y=y, sr=sr, hop_length=512, n_mfcc=13)\n", | |
" spectral_center = librosa.feature.spectral_centroid(y=y, sr=sr, hop_length=512)\n", | |
" chroma = librosa.feature.chroma_stft(y=y, sr=sr, hop_length=512)\n", | |
" spectral_contrast = librosa.feature.spectral_contrast(y=y, sr=sr, hop_length=512)\n", | |
"\n", | |
" features[0, :, 0:13] = mfcc.T[0:timeseries_length, :]\n", | |
" features[0, :, 13:14] = spectral_center.T[0:timeseries_length, :]\n", | |
" features[0, :, 14:26] = chroma.T[0:timeseries_length, :]\n", | |
" features[0, :, 26:33] = spectral_contrast.T[0:timeseries_length, :]\n", | |
" return features\n", | |
"\n", | |
"\n", | |
"def get_genre(model, music_path):\n", | |
" \"Predict genre of music using a trained model\"\n", | |
" prediction = model.predict(extract_audio_features(music_path))\n", | |
" predict_genre = GenreFeatureData().genre_list[np.argmax(prediction)]\n", | |
" return predict_genre\n", | |
"\n", | |
"\n", | |
"if __name__ == \"__main__\":\n", | |
" PATH = \"./LSTM-Music-Genre-Classification/audio/country_music.mp3\"\n", | |
" #MODEL = load_model(\"./model.json\", \"./weights/model_weights.h5\")\n", | |
" M_PATH = \"./model.json\"\n", | |
" W_PATH = \"./lstm_genre_classifier_lstm.h5\"\n", | |
" MODEL = load_model(M_PATH, W_PATH)\n", | |
" GENRE = get_genre(MODEL, PATH)\n", | |
" print(\"Model predict: {}\".format(GENRE))" | |
], | |
"execution_count": 21, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"text": [ | |
"Model predict: metal\n" | |
], | |
"name": "stdout" | |
} | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "A9UlGJtNfdlG" | |
}, | |
"source": [ | |
"" | |
], | |
"execution_count": null, | |
"outputs": [] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment