Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

mnist

import tflearn
from tflearn.layers.conv import conv_2d, max_pool_2d
from tflearn.layers.core import input_data, dropout, fully_connected
from tflearn.layers.estimator import regression
import tflearn.datasets.mnist as mnist

X, Y, test_x, test_y = mnist.load_data(one_hot=True)

X = X.reshape([-1, 28, 28, 1])
test_x = test_x.reshape([-1, 28, 28, 1])

convnet = input_data(shape=[None, 28, 28, 1], name='input')

convnet = conv_2d(convnet, 32, 2, activation='relu')
convnet = max_pool_2d(convnet, 2)

convnet = conv_2d(convnet, 64, 2, activation='relu')
convnet = max_pool_2d(convnet, 2)

convnet = fully_connected(convnet, 1024, activation='relu')
convnet = dropout(convnet, 0.8)

convnet = fully_connected(convnet, 10, activation='softmax')
convnet = regression(convnet, optimizer='adam', learning_rate=0.01, loss='categorical_crossentropy', name='targets')

model = tflearn.DNN(convnet)
model.fit({'input': X}, {'targets': Y}, n_epoch=10, validation_set=({'input': test_x}, {'targets': test_y}), 
    snapshot_step=500, show_metric=True, run_id='mnist')
Comment

PREVIOUS NEXT
Code Example
Python :: how to list gym envirolments 
Python :: megre pandas in dictionary 
Python :: create time array whith np.datetime64 
Python :: mosaicplot pandas 
Python :: pickle.load from gpu device to cpu 
Python :: resize qpushbutton pyqt 
Python :: element not interactable headless chrome 
Python :: python build a string using reduce and concatenate 
Python :: how to get maximum value of number in python 
Python :: fetch last record from django model 
Python :: python change version 
Python :: python - remove exta space in column 
Python :: append two dfs 
Python :: godot get scenes from folder 
Python :: how to get module path in python 
Python :: python append list to list 
Python :: python generalised eigenvalue problem 
Python :: call python from bash shell 
Python :: python ternary statement 
Python :: python switch 
Python :: store in a variable the ocntent of a file python 
Python :: use rclone on colab 
Python :: leer fichero de texto con columnas como diccionario python 
Python :: DJANGO model instance get by variable 
Python :: find the median of input number in a list and print 
Python :: python using os module file name from file path 
Python :: how to skip number in while loop python 
Python :: python time a task 
Python :: explode multiple columns pandas 
Python :: encrypt and decrypt sha256 python 
ADD CONTENT
Topic
Content
Source link
Name
7+4 =