{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# 오토인코더" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "Using TensorFlow backend.\n" ] } ], "source": [ "import os\n", "\n", "from utils.loaders import load_mnist\n", "from models.AE import Autoencoder" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 매개변수 설정" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "# 실행 매개변수\n", "SECTION = 'vae'\n", "RUN_ID = '0001'\n", "DATA_NAME = 'digits'\n", "RUN_FOLDER = 'run/{}/'.format(SECTION)\n", "RUN_FOLDER += '_'.join([RUN_ID, DATA_NAME])\n", "\n", "if not os.path.exists(RUN_FOLDER):\n", " os.mkdir(RUN_FOLDER)\n", " os.mkdir(os.path.join(RUN_FOLDER, 'viz'))\n", " os.mkdir(os.path.join(RUN_FOLDER, 'images'))\n", " os.mkdir(os.path.join(RUN_FOLDER, 'weights'))\n", "\n", "MODE = 'build' #'load' #" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 데이터 적재" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Downloading data from https://s3.amazonaws.com/img-datasets/mnist.npz\n", "11493376/11490434 [==============================] - 1s 0us/step\n" ] } ], "source": [ "(x_train, y_train), (x_test, y_test) = load_mnist()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 신경망 구조 정의" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "WARNING:tensorflow:From /home/jupyter/GDL_code/env/lib/python3.5/site-packages/tensorflow/python/framework/op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.\n", "Instructions for updating:\n", "Colocations handled automatically by placer.\n" ] } ], "source": [ "AE = Autoencoder(\n", " input_dim = (28,28,1)\n", " , encoder_conv_filters = [32,64,64, 64]\n", " , encoder_conv_kernel_size = [3,3,3,3]\n", " , encoder_conv_strides = [1,2,2,1]\n", " , decoder_conv_t_filters = [64,64,32,1]\n", " , decoder_conv_t_kernel_size = [3,3,3,3]\n", " , decoder_conv_t_strides = [1,2,2,1]\n", " , z_dim = 2\n", ")\n", "\n", "if MODE == 'build':\n", " AE.save(RUN_FOLDER)\n", "else:\n", " AE.load_weights(os.path.join(RUN_FOLDER, 'weights/weights.h5'))" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "_________________________________________________________________\n", "Layer (type) Output Shape Param # \n", "=================================================================\n", "encoder_input (InputLayer) (None, 28, 28, 1) 0 \n", "_________________________________________________________________\n", "encoder_conv_0 (Conv2D) (None, 28, 28, 32) 320 \n", "_________________________________________________________________\n", "leaky_re_lu_1 (LeakyReLU) (None, 28, 28, 32) 0 \n", "_________________________________________________________________\n", "encoder_conv_1 (Conv2D) (None, 14, 14, 64) 18496 \n", "_________________________________________________________________\n", "leaky_re_lu_2 (LeakyReLU) (None, 14, 14, 64) 0 \n", "_________________________________________________________________\n", "encoder_conv_2 (Conv2D) (None, 7, 7, 64) 36928 \n", "_________________________________________________________________\n", "leaky_re_lu_3 (LeakyReLU) (None, 7, 7, 64) 0 \n", "_________________________________________________________________\n", "encoder_conv_3 (Conv2D) (None, 7, 7, 64) 36928 \n", "_________________________________________________________________\n", "leaky_re_lu_4 (LeakyReLU) (None, 7, 7, 64) 0 \n", "_________________________________________________________________\n", "flatten_1 (Flatten) (None, 3136) 0 \n", "_________________________________________________________________\n", "encoder_output (Dense) (None, 2) 6274 \n", "=================================================================\n", "Total params: 98,946\n", "Trainable params: 98,946\n", "Non-trainable params: 0\n", "_________________________________________________________________\n" ] } ], "source": [ "AE.encoder.summary()" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "_________________________________________________________________\n", "Layer (type) Output Shape Param # \n", "=================================================================\n", "decoder_input (InputLayer) (None, 2) 0 \n", "_________________________________________________________________\n", "dense_1 (Dense) (None, 3136) 9408 \n", "_________________________________________________________________\n", "reshape_1 (Reshape) (None, 7, 7, 64) 0 \n", "_________________________________________________________________\n", "decoder_conv_t_0 (Conv2DTran (None, 7, 7, 64) 36928 \n", "_________________________________________________________________\n", "leaky_re_lu_5 (LeakyReLU) (None, 7, 7, 64) 0 \n", "_________________________________________________________________\n", "decoder_conv_t_1 (Conv2DTran (None, 14, 14, 64) 36928 \n", "_________________________________________________________________\n", "leaky_re_lu_6 (LeakyReLU) (None, 14, 14, 64) 0 \n", "_________________________________________________________________\n", "decoder_conv_t_2 (Conv2DTran (None, 28, 28, 32) 18464 \n", "_________________________________________________________________\n", "leaky_re_lu_7 (LeakyReLU) (None, 28, 28, 32) 0 \n", "_________________________________________________________________\n", "decoder_conv_t_3 (Conv2DTran (None, 28, 28, 1) 289 \n", "_________________________________________________________________\n", "activation_1 (Activation) (None, 28, 28, 1) 0 \n", "=================================================================\n", "Total params: 102,017\n", "Trainable params: 102,017\n", "Non-trainable params: 0\n", "_________________________________________________________________\n" ] } ], "source": [ "AE.decoder.summary()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 오토인코더 훈련" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "LEARNING_RATE = 0.0005\n", "BATCH_SIZE = 32\n", "INITIAL_EPOCH = 0" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [], "source": [ "AE.compile(LEARNING_RATE)" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "WARNING:tensorflow:From /home/jupyter/GDL_code/env/lib/python3.5/site-packages/tensorflow/python/ops/math_ops.py:3066: to_int32 (from tensorflow.python.ops.math_ops) is deprecated and will be removed in a future version.\n", "Instructions for updating:\n", "Use tf.cast instead.\n", "Epoch 1/200\n", " 832/1000 [=======================>......] - ETA: 4s - loss: 0.2010 " ] }, { "name": "stderr", "output_type": "stream", "text": [ "/home/jupyter/GDL_code/env/lib/python3.5/site-packages/keras/callbacks.py:122: UserWarning: Method on_batch_end() is slow compared to the batch update (0.145966). Check your callbacks.\n", " % delta_t_median)\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "1000/1000 [==============================] - 24s 24ms/step - loss: 0.1859\n", "\n", "Epoch 00001: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 2/200\n", "1000/1000 [==============================] - 0s 261us/step - loss: 0.0854\n", "\n", "Epoch 00002: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 3/200\n", "1000/1000 [==============================] - 0s 262us/step - loss: 0.0676\n", "\n", "Epoch 00003: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 4/200\n", "1000/1000 [==============================] - 0s 267us/step - loss: 0.0638\n", "\n", "Epoch 00004: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 5/200\n", "1000/1000 [==============================] - 0s 256us/step - loss: 0.0602\n", "\n", "Epoch 00005: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 6/200\n", "1000/1000 [==============================] - 0s 249us/step - loss: 0.0581\n", "\n", "Epoch 00006: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 7/200\n", "1000/1000 [==============================] - 0s 247us/step - loss: 0.0566\n", "\n", "Epoch 00007: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 8/200\n", "1000/1000 [==============================] - 0s 252us/step - loss: 0.0555\n", "\n", "Epoch 00008: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 9/200\n", "1000/1000 [==============================] - 0s 238us/step - loss: 0.0549\n", "\n", "Epoch 00009: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 10/200\n", "1000/1000 [==============================] - 0s 240us/step - loss: 0.0539\n", "\n", "Epoch 00010: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 11/200\n", "1000/1000 [==============================] - 0s 244us/step - loss: 0.0533\n", "\n", "Epoch 00011: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 12/200\n", "1000/1000 [==============================] - 0s 236us/step - loss: 0.0529\n", "\n", "Epoch 00012: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 13/200\n", "1000/1000 [==============================] - 0s 239us/step - loss: 0.0521\n", "\n", "Epoch 00013: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 14/200\n", "1000/1000 [==============================] - 0s 238us/step - loss: 0.0517\n", "\n", "Epoch 00014: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 15/200\n", "1000/1000 [==============================] - 0s 238us/step - loss: 0.0512\n", "\n", "Epoch 00015: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 16/200\n", "1000/1000 [==============================] - 0s 236us/step - loss: 0.0510\n", "\n", "Epoch 00016: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 17/200\n", "1000/1000 [==============================] - 0s 239us/step - loss: 0.0508\n", "\n", "Epoch 00017: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 18/200\n", "1000/1000 [==============================] - 0s 233us/step - loss: 0.0502\n", "\n", "Epoch 00018: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 19/200\n", "1000/1000 [==============================] - 0s 243us/step - loss: 0.0499\n", "\n", "Epoch 00019: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 20/200\n", "1000/1000 [==============================] - 0s 235us/step - loss: 0.0497\n", "\n", "Epoch 00020: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 21/200\n", "1000/1000 [==============================] - 0s 245us/step - loss: 0.0495\n", "\n", "Epoch 00021: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 22/200\n", "1000/1000 [==============================] - 0s 239us/step - loss: 0.0492\n", "\n", "Epoch 00022: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 23/200\n", "1000/1000 [==============================] - 0s 239us/step - loss: 0.0488\n", "\n", "Epoch 00023: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 24/200\n", "1000/1000 [==============================] - 0s 237us/step - loss: 0.0487\n", "\n", "Epoch 00024: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 25/200\n", "1000/1000 [==============================] - 0s 234us/step - loss: 0.0483\n", "\n", "Epoch 00025: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 26/200\n", "1000/1000 [==============================] - 0s 237us/step - loss: 0.0480\n", "\n", "Epoch 00026: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 27/200\n", "1000/1000 [==============================] - 0s 242us/step - loss: 0.0477\n", "\n", "Epoch 00027: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 28/200\n", "1000/1000 [==============================] - 0s 239us/step - loss: 0.0475\n", "\n", "Epoch 00028: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 29/200\n", "1000/1000 [==============================] - 0s 236us/step - loss: 0.0474\n", "\n", "Epoch 00029: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 30/200\n", "1000/1000 [==============================] - 0s 239us/step - loss: 0.0470\n", "\n", "Epoch 00030: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 31/200\n", "1000/1000 [==============================] - 0s 243us/step - loss: 0.0469\n", "\n", "Epoch 00031: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 32/200\n", "1000/1000 [==============================] - 0s 254us/step - loss: 0.0468\n", "\n", "Epoch 00032: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 33/200\n", "1000/1000 [==============================] - 0s 241us/step - loss: 0.0464\n", "\n", "Epoch 00033: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 34/200\n", "1000/1000 [==============================] - 0s 241us/step - loss: 0.0464\n", "\n", "Epoch 00034: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 35/200\n", "1000/1000 [==============================] - 0s 239us/step - loss: 0.0462\n", "\n", "Epoch 00035: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 36/200\n", "1000/1000 [==============================] - 0s 239us/step - loss: 0.0460\n", "\n", "Epoch 00036: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 37/200\n", "1000/1000 [==============================] - 0s 239us/step - loss: 0.0457\n", "\n", "Epoch 00037: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 38/200\n", "1000/1000 [==============================] - 0s 238us/step - loss: 0.0457\n", "\n", "Epoch 00038: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 39/200\n", "1000/1000 [==============================] - 0s 233us/step - loss: 0.0452\n", "\n", "Epoch 00039: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 40/200\n", "1000/1000 [==============================] - 0s 229us/step - loss: 0.0451\n", "\n", "Epoch 00040: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 41/200\n", "1000/1000 [==============================] - 0s 234us/step - loss: 0.0451\n", "\n", "Epoch 00041: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 42/200\n", "1000/1000 [==============================] - 0s 240us/step - loss: 0.0449\n", "\n", "Epoch 00042: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 43/200\n", "1000/1000 [==============================] - 0s 242us/step - loss: 0.0449\n", "\n", "Epoch 00043: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 44/200\n", "1000/1000 [==============================] - 0s 234us/step - loss: 0.0444\n", "\n", "Epoch 00044: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 45/200\n", "1000/1000 [==============================] - 0s 242us/step - loss: 0.0442\n", "\n", "Epoch 00045: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 46/200\n", "1000/1000 [==============================] - 0s 243us/step - loss: 0.0438\n", "\n", "Epoch 00046: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 47/200\n", "1000/1000 [==============================] - 0s 242us/step - loss: 0.0440\n", "\n", "Epoch 00047: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 48/200\n", "1000/1000 [==============================] - 0s 247us/step - loss: 0.0435\n", "\n", "Epoch 00048: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 49/200\n", "1000/1000 [==============================] - 0s 244us/step - loss: 0.0437\n", "\n", "Epoch 00049: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 50/200\n", "1000/1000 [==============================] - 0s 248us/step - loss: 0.0434\n", "\n", "Epoch 00050: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 51/200\n", "1000/1000 [==============================] - 0s 246us/step - loss: 0.0435\n", "\n", "Epoch 00051: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 52/200\n", "1000/1000 [==============================] - 0s 241us/step - loss: 0.0430\n", "\n", "Epoch 00052: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 53/200\n", "1000/1000 [==============================] - 0s 245us/step - loss: 0.0429\n", "\n", "Epoch 00053: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 54/200\n", "1000/1000 [==============================] - 0s 240us/step - loss: 0.0427\n", "\n", "Epoch 00054: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 55/200\n", "1000/1000 [==============================] - 0s 227us/step - loss: 0.0427\n", "\n", "Epoch 00055: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 56/200\n", "1000/1000 [==============================] - 0s 236us/step - loss: 0.0427\n", "\n", "Epoch 00056: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 57/200\n", "1000/1000 [==============================] - 0s 230us/step - loss: 0.0425\n", "\n", "Epoch 00057: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 58/200\n", "1000/1000 [==============================] - 0s 233us/step - loss: 0.0422\n", "\n", "Epoch 00058: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 59/200\n", "1000/1000 [==============================] - 0s 228us/step - loss: 0.0423\n", "\n", "Epoch 00059: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 60/200\n", "1000/1000 [==============================] - 0s 232us/step - loss: 0.0418\n", "\n", "Epoch 00060: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 61/200\n", "1000/1000 [==============================] - 0s 237us/step - loss: 0.0417\n", "\n", "Epoch 00061: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 62/200\n", "1000/1000 [==============================] - 0s 239us/step - loss: 0.0417\n", "\n", "Epoch 00062: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 63/200\n", "1000/1000 [==============================] - 0s 245us/step - loss: 0.0416\n", "\n", "Epoch 00063: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 64/200\n", "1000/1000 [==============================] - 0s 251us/step - loss: 0.0411\n", "\n", "Epoch 00064: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 65/200\n", "1000/1000 [==============================] - 0s 246us/step - loss: 0.0413\n", "\n", "Epoch 00065: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 66/200\n", "1000/1000 [==============================] - 0s 246us/step - loss: 0.0413\n", "\n", "Epoch 00066: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 67/200\n", "1000/1000 [==============================] - 0s 245us/step - loss: 0.0413\n", "\n", "Epoch 00067: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 68/200\n", "1000/1000 [==============================] - 0s 245us/step - loss: 0.0413\n", "\n", "Epoch 00068: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 69/200\n", "1000/1000 [==============================] - 0s 247us/step - loss: 0.0410\n", "\n", "Epoch 00069: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 70/200\n", "1000/1000 [==============================] - 0s 246us/step - loss: 0.0408\n", "\n", "Epoch 00070: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 71/200\n", "1000/1000 [==============================] - 0s 247us/step - loss: 0.0407\n", "\n", "Epoch 00071: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 72/200\n", "1000/1000 [==============================] - 0s 252us/step - loss: 0.0408\n", "\n", "Epoch 00072: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 73/200\n", "1000/1000 [==============================] - 0s 242us/step - loss: 0.0405\n", "\n", "Epoch 00073: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 74/200\n", "1000/1000 [==============================] - 0s 240us/step - loss: 0.0404\n", "\n", "Epoch 00074: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 75/200\n", "1000/1000 [==============================] - 0s 240us/step - loss: 0.0403\n", "\n", "Epoch 00075: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 76/200\n", "1000/1000 [==============================] - 0s 237us/step - loss: 0.0399\n", "\n", "Epoch 00076: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 77/200\n", "1000/1000 [==============================] - 0s 235us/step - loss: 0.0398\n", "\n", "Epoch 00077: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 78/200\n", "1000/1000 [==============================] - 0s 245us/step - loss: 0.0398\n", "\n", "Epoch 00078: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 79/200\n", "1000/1000 [==============================] - 0s 243us/step - loss: 0.0399\n", "\n", "Epoch 00079: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 80/200\n", "1000/1000 [==============================] - 0s 241us/step - loss: 0.0399\n", "\n", "Epoch 00080: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 81/200\n", "1000/1000 [==============================] - 0s 240us/step - loss: 0.0399\n", "\n", "Epoch 00081: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 82/200\n", "1000/1000 [==============================] - 0s 246us/step - loss: 0.0395\n", "\n", "Epoch 00082: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 83/200\n", "1000/1000 [==============================] - 0s 240us/step - loss: 0.0395\n", "\n", "Epoch 00083: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 84/200\n", "1000/1000 [==============================] - 0s 242us/step - loss: 0.0395\n", "\n", "Epoch 00084: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 85/200\n", "1000/1000 [==============================] - 0s 243us/step - loss: 0.0397\n", "\n", "Epoch 00085: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 86/200\n", "1000/1000 [==============================] - 0s 253us/step - loss: 0.0397\n", "\n", "Epoch 00086: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 87/200\n", "1000/1000 [==============================] - 0s 249us/step - loss: 0.0394\n", "\n", "Epoch 00087: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 88/200\n", "1000/1000 [==============================] - 0s 246us/step - loss: 0.0390\n", "\n", "Epoch 00088: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 89/200\n", "1000/1000 [==============================] - 0s 247us/step - loss: 0.0388\n", "\n", "Epoch 00089: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 90/200\n", "1000/1000 [==============================] - 0s 240us/step - loss: 0.0390\n", "\n", "Epoch 00090: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 91/200\n", "1000/1000 [==============================] - 0s 237us/step - loss: 0.0390\n", "\n", "Epoch 00091: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 92/200\n", "1000/1000 [==============================] - 0s 237us/step - loss: 0.0390\n", "\n", "Epoch 00092: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 93/200\n", "1000/1000 [==============================] - 0s 241us/step - loss: 0.0398\n", "\n", "Epoch 00093: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 94/200\n", "1000/1000 [==============================] - 0s 239us/step - loss: 0.0393\n", "\n", "Epoch 00094: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 95/200\n", "1000/1000 [==============================] - 0s 236us/step - loss: 0.0385\n", "\n", "Epoch 00095: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 96/200\n", "1000/1000 [==============================] - 0s 238us/step - loss: 0.0383\n", "\n", "Epoch 00096: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 97/200\n", "1000/1000 [==============================] - 0s 241us/step - loss: 0.0384\n", "\n", "Epoch 00097: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 98/200\n", "1000/1000 [==============================] - 0s 238us/step - loss: 0.0385\n", "\n", "Epoch 00098: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 99/200\n", "1000/1000 [==============================] - 0s 238us/step - loss: 0.0382\n", "\n", "Epoch 00099: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 100/200\n", "1000/1000 [==============================] - 0s 244us/step - loss: 0.0380\n", "\n", "Epoch 00100: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 101/200\n", "1000/1000 [==============================] - 0s 244us/step - loss: 0.0383\n", "\n", "Epoch 00101: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 102/200\n", "1000/1000 [==============================] - 0s 241us/step - loss: 0.0382\n", "\n", "Epoch 00102: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 103/200\n", "1000/1000 [==============================] - 0s 239us/step - loss: 0.0379\n", "\n", "Epoch 00103: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 104/200\n", "1000/1000 [==============================] - 0s 239us/step - loss: 0.0381\n", "\n", "Epoch 00104: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 105/200\n", "1000/1000 [==============================] - 0s 250us/step - loss: 0.0380\n", "\n", "Epoch 00105: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 106/200\n", "1000/1000 [==============================] - 0s 251us/step - loss: 0.0376\n", "\n", "Epoch 00106: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 107/200\n", "1000/1000 [==============================] - 0s 254us/step - loss: 0.0377\n", "\n", "Epoch 00107: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 108/200\n", "1000/1000 [==============================] - 0s 248us/step - loss: 0.0382\n", "\n", "Epoch 00108: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 109/200\n", "1000/1000 [==============================] - 0s 253us/step - loss: 0.0383\n", "\n", "Epoch 00109: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 110/200\n", "1000/1000 [==============================] - 0s 251us/step - loss: 0.0383\n", "\n", "Epoch 00110: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 111/200\n", "1000/1000 [==============================] - 0s 251us/step - loss: 0.0380\n", "\n", "Epoch 00111: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 112/200\n", "1000/1000 [==============================] - 0s 249us/step - loss: 0.0380\n", "\n", "Epoch 00112: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 113/200\n", "1000/1000 [==============================] - 0s 249us/step - loss: 0.0379\n", "\n", "Epoch 00113: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 114/200\n", "1000/1000 [==============================] - 0s 249us/step - loss: 0.0376\n", "\n", "Epoch 00114: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 115/200\n", "1000/1000 [==============================] - 0s 240us/step - loss: 0.0372\n", "\n", "Epoch 00115: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 116/200\n", "1000/1000 [==============================] - 0s 235us/step - loss: 0.0373\n", "\n", "Epoch 00116: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 117/200\n", "1000/1000 [==============================] - 0s 240us/step - loss: 0.0370\n", "\n", "Epoch 00117: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 118/200\n", "1000/1000 [==============================] - 0s 237us/step - loss: 0.0372\n", "\n", "Epoch 00118: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 119/200\n", "1000/1000 [==============================] - 0s 236us/step - loss: 0.0375\n", "\n", "Epoch 00119: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 120/200\n", "1000/1000 [==============================] - 0s 250us/step - loss: 0.0372\n", "\n", "Epoch 00120: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 121/200\n", "1000/1000 [==============================] - 0s 248us/step - loss: 0.0373\n", "\n", "Epoch 00121: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 122/200\n", "1000/1000 [==============================] - 0s 245us/step - loss: 0.0371\n", "\n", "Epoch 00122: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 123/200\n", "1000/1000 [==============================] - 0s 243us/step - loss: 0.0371\n", "\n", "Epoch 00123: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 124/200\n", "1000/1000 [==============================] - 0s 235us/step - loss: 0.0373\n", "\n", "Epoch 00124: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 125/200\n", "1000/1000 [==============================] - 0s 238us/step - loss: 0.0373\n", "\n", "Epoch 00125: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 126/200\n", "1000/1000 [==============================] - 0s 237us/step - loss: 0.0376\n", "\n", "Epoch 00126: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 127/200\n", "1000/1000 [==============================] - 0s 236us/step - loss: 0.0372\n", "\n", "Epoch 00127: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 128/200\n", "1000/1000 [==============================] - 0s 238us/step - loss: 0.0369\n", "\n", "Epoch 00128: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 129/200\n", "1000/1000 [==============================] - 0s 239us/step - loss: 0.0367\n", "\n", "Epoch 00129: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 130/200\n", "1000/1000 [==============================] - 0s 239us/step - loss: 0.0369\n", "\n", "Epoch 00130: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 131/200\n", "1000/1000 [==============================] - 0s 236us/step - loss: 0.0367\n", "\n", "Epoch 00131: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 132/200\n", "1000/1000 [==============================] - 0s 238us/step - loss: 0.0368\n", "\n", "Epoch 00132: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 133/200\n", "1000/1000 [==============================] - 0s 237us/step - loss: 0.0368\n", "\n", "Epoch 00133: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 134/200\n", "1000/1000 [==============================] - 0s 236us/step - loss: 0.0366\n", "\n", "Epoch 00134: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 135/200\n", "1000/1000 [==============================] - 0s 238us/step - loss: 0.0367\n", "\n", "Epoch 00135: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 136/200\n", "1000/1000 [==============================] - 0s 234us/step - loss: 0.0363\n", "\n", "Epoch 00136: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 137/200\n", "1000/1000 [==============================] - 0s 233us/step - loss: 0.0366\n", "\n", "Epoch 00137: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 138/200\n", "1000/1000 [==============================] - 0s 238us/step - loss: 0.0363\n", "\n", "Epoch 00138: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 139/200\n", "1000/1000 [==============================] - 0s 237us/step - loss: 0.0361\n", "\n", "Epoch 00139: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 140/200\n", "1000/1000 [==============================] - 0s 234us/step - loss: 0.0362\n", "\n", "Epoch 00140: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 141/200\n", "1000/1000 [==============================] - 0s 237us/step - loss: 0.0359\n", "\n", "Epoch 00141: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 142/200\n", "1000/1000 [==============================] - 0s 237us/step - loss: 0.0366\n", "\n", "Epoch 00142: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 143/200\n", "1000/1000 [==============================] - 0s 236us/step - loss: 0.0364\n", "\n", "Epoch 00143: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 144/200\n", "1000/1000 [==============================] - 0s 236us/step - loss: 0.0368\n", "\n", "Epoch 00144: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 145/200\n", "1000/1000 [==============================] - 0s 238us/step - loss: 0.0368\n", "\n", "Epoch 00145: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 146/200\n", "1000/1000 [==============================] - 0s 235us/step - loss: 0.0364\n", "\n", "Epoch 00146: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 147/200\n", "1000/1000 [==============================] - 0s 236us/step - loss: 0.0360\n", "\n", "Epoch 00147: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 148/200\n", "1000/1000 [==============================] - 0s 235us/step - loss: 0.0363\n", "\n", "Epoch 00148: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 149/200\n", "1000/1000 [==============================] - 0s 235us/step - loss: 0.0362\n", "\n", "Epoch 00149: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 150/200\n", "1000/1000 [==============================] - 0s 239us/step - loss: 0.0360\n", "\n", "Epoch 00150: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 151/200\n", "1000/1000 [==============================] - 0s 236us/step - loss: 0.0367\n", "\n", "Epoch 00151: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 152/200\n", "1000/1000 [==============================] - 0s 234us/step - loss: 0.0359\n", "\n", "Epoch 00152: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 153/200\n", "1000/1000 [==============================] - 0s 238us/step - loss: 0.0359\n", "\n", "Epoch 00153: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 154/200\n", "1000/1000 [==============================] - 0s 235us/step - loss: 0.0359\n", "\n", "Epoch 00154: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 155/200\n", "1000/1000 [==============================] - 0s 235us/step - loss: 0.0357\n", "\n", "Epoch 00155: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 156/200\n", "1000/1000 [==============================] - 0s 232us/step - loss: 0.0361\n", "\n", "Epoch 00156: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 157/200\n", "1000/1000 [==============================] - 0s 239us/step - loss: 0.0358\n", "\n", "Epoch 00157: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 158/200\n", "1000/1000 [==============================] - 0s 239us/step - loss: 0.0362\n", "\n", "Epoch 00158: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 159/200\n", "1000/1000 [==============================] - 0s 231us/step - loss: 0.0362\n", "\n", "Epoch 00159: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 160/200\n", "1000/1000 [==============================] - 0s 237us/step - loss: 0.0357\n", "\n", "Epoch 00160: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 161/200\n", "1000/1000 [==============================] - 0s 239us/step - loss: 0.0360\n", "\n", "Epoch 00161: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 162/200\n", "1000/1000 [==============================] - 0s 235us/step - loss: 0.0362\n", "\n", "Epoch 00162: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 163/200\n", "1000/1000 [==============================] - 0s 239us/step - loss: 0.0357\n", "\n", "Epoch 00163: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 164/200\n", "1000/1000 [==============================] - 0s 241us/step - loss: 0.0355\n", "\n", "Epoch 00164: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 165/200\n", "1000/1000 [==============================] - 0s 243us/step - loss: 0.0353\n", "\n", "Epoch 00165: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 166/200\n", "1000/1000 [==============================] - 0s 241us/step - loss: 0.0353\n", "\n", "Epoch 00166: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 167/200\n", "1000/1000 [==============================] - 0s 238us/step - loss: 0.0352\n", "\n", "Epoch 00167: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 168/200\n", "1000/1000 [==============================] - 0s 234us/step - loss: 0.0355\n", "\n", "Epoch 00168: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 169/200\n", "1000/1000 [==============================] - 0s 236us/step - loss: 0.0355\n", "\n", "Epoch 00169: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 170/200\n", "1000/1000 [==============================] - 0s 235us/step - loss: 0.0355\n", "\n", "Epoch 00170: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 171/200\n", "1000/1000 [==============================] - 0s 231us/step - loss: 0.0355\n", "\n", "Epoch 00171: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 172/200\n", "1000/1000 [==============================] - 0s 241us/step - loss: 0.0353\n", "\n", "Epoch 00172: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 173/200\n", "1000/1000 [==============================] - 0s 241us/step - loss: 0.0353\n", "\n", "Epoch 00173: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 174/200\n", "1000/1000 [==============================] - 0s 248us/step - loss: 0.0353\n", "\n", "Epoch 00174: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 175/200\n", "1000/1000 [==============================] - 0s 244us/step - loss: 0.0350\n", "\n", "Epoch 00175: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 176/200\n", "1000/1000 [==============================] - 0s 249us/step - loss: 0.0350\n", "\n", "Epoch 00176: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 177/200\n", "1000/1000 [==============================] - 0s 252us/step - loss: 0.0355\n", "\n", "Epoch 00177: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 178/200\n", "1000/1000 [==============================] - 0s 248us/step - loss: 0.0350\n", "\n", "Epoch 00178: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 179/200\n", "1000/1000 [==============================] - 0s 259us/step - loss: 0.0351\n", "\n", "Epoch 00179: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 180/200\n", "1000/1000 [==============================] - 0s 258us/step - loss: 0.0350\n", "\n", "Epoch 00180: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 181/200\n", "1000/1000 [==============================] - 0s 241us/step - loss: 0.0353\n", "\n", "Epoch 00181: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 182/200\n", "1000/1000 [==============================] - 0s 241us/step - loss: 0.0352\n", "\n", "Epoch 00182: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 183/200\n", "1000/1000 [==============================] - 0s 241us/step - loss: 0.0353\n", "\n", "Epoch 00183: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 184/200\n", "1000/1000 [==============================] - 0s 238us/step - loss: 0.0352\n", "\n", "Epoch 00184: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 185/200\n", "1000/1000 [==============================] - 0s 252us/step - loss: 0.0350\n", "\n", "Epoch 00185: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 186/200\n", "1000/1000 [==============================] - 0s 270us/step - loss: 0.0351\n", "\n", "Epoch 00186: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 187/200\n", "1000/1000 [==============================] - 0s 247us/step - loss: 0.0351\n", "\n", "Epoch 00187: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 188/200\n", "1000/1000 [==============================] - 0s 241us/step - loss: 0.0352\n", "\n", "Epoch 00188: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 189/200\n", "1000/1000 [==============================] - 0s 257us/step - loss: 0.0352\n", "\n", "Epoch 00189: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 190/200\n", "1000/1000 [==============================] - 0s 257us/step - loss: 0.0349\n", "\n", "Epoch 00190: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 191/200\n", "1000/1000 [==============================] - 0s 246us/step - loss: 0.0348\n", "\n", "Epoch 00191: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 192/200\n", "1000/1000 [==============================] - 0s 248us/step - loss: 0.0350\n", "\n", "Epoch 00192: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 193/200\n", "1000/1000 [==============================] - 0s 248us/step - loss: 0.0352\n", "\n", "Epoch 00193: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 194/200\n", "1000/1000 [==============================] - 0s 241us/step - loss: 0.0350\n", "\n", "Epoch 00194: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 195/200\n", "1000/1000 [==============================] - 0s 243us/step - loss: 0.0350\n", "\n", "Epoch 00195: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 196/200\n", "1000/1000 [==============================] - 0s 242us/step - loss: 0.0347\n", "\n", "Epoch 00196: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 197/200\n", "1000/1000 [==============================] - 0s 236us/step - loss: 0.0347\n", "\n", "Epoch 00197: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 198/200\n", "1000/1000 [==============================] - 0s 242us/step - loss: 0.0354\n", "\n", "Epoch 00198: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 199/200\n", "1000/1000 [==============================] - 0s 234us/step - loss: 0.0353\n", "\n", "Epoch 00199: saving model to run/vae/0001_digits/weights/weights.h5\n", "Epoch 200/200\n", "1000/1000 [==============================] - 0s 235us/step - loss: 0.0345\n", "\n", "Epoch 00200: saving model to run/vae/0001_digits/weights/weights.h5\n" ] } ], "source": [ "AE.train( \n", " x_train[:1000]\n", " , batch_size = BATCH_SIZE\n", " , epochs = 200\n", " , run_folder = RUN_FOLDER\n", " , initial_epoch = INITIAL_EPOCH\n", ")" ] } ], "metadata": { "kernelspec": { "display_name": "gdl", "language": "python", "name": "gdl" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.5.3" } }, "nbformat": 4, "nbformat_minor": 2 }