In [ ]:
import tflearn


c:\users\seo\appdata\local\programs\python\python35\lib\site-packages\h5py\__init__.py:34: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters
curses is not supported on this machine (please install/reinstall curses for an optimal experience)

In [ ]:
from tflearn.layers.core import input_data, dropout, fully_connected
from tflearn.layers.conv import conv_2d, max_pool_2d
from tflearn.layers.normalization import local_response_normalization
from tflearn.layers.estimator import regression
import tflearn.datasets.mnist as mnist

X,Y,X_test,Y_test = mnist.load_data(one_hot=True)
X = X.reshape([-1,28,28,1])
X_test = X_test.reshape([-1,28,28,1])

CNN = input_data(shape=[None,28,28,1],name='input')
CNN = conv_2d(CNN,32,5,activation='relu',regularizer='L2')
CNN = max_pool_2d(CNN,2)
CNN = local_response_normalization(CNN)
CNN = conv_2d(CNN,64,5,activation='relu',regularizer='L2')
CNN = max_pool_2d(CNN,2)
CNN = local_response_normalization(CNN)
CNN = fully_connected(CNN,1024,activation=None)
CNN = dropout(CNN,0.5)
CNN = fully_connected(CNN,10,activation='softmax')
CNN = regression(CNN,optimizer='adam',learning_rate=0.0001,loss='categorical_crossentropy',name='target')

model = tflearn.DNN(CNN,tensorboard_verbose=0,
                   checkpoint_path='/Check/')
model.fit({'input':X},{'target':Y},n_epoch=3,validation_set=({'input':X_test},{'target':Y_test}),
         snapshot_step = 1000,show_metric=True,run_id='convnet_mnist')


Training Step: 2342  | total loss: 0.05472 | time: 90.764s
| Adam | epoch: 003 | loss: 0.05472 - acc: 0.9835 -- iter: 39808/55000

In [ ]: