I have come across this book while searching for some resources related to image processing. In the 12th Chapter of this book a paragraph (which describes how to set up the convolutional layers etc. ) has caught my eyes. I have thought that it contained the necessary code implementations for my project. Unfortunately, the written code was incomplete. Now if you would look at the attached code segment - You will see that for the training purpose of the face recognition system the writer has told us to create and fit the model. But nowhere do I see the creation or invocation statements for the model. Can anybody please fill in the gaps for me or am I missing something?
train_data = create_training_data()
x =-2
train = train_data[:x]
test = [x:]
X = np.array(i[0] for i in train).reshape(-1,200,200,1)
Y=[i[1] for i in train]
test_x = np.array[i[0] for i in test].reshape(-1,200,200,1)
test_y = [i[1] for i in test]
convnet = input_data(shape = [None,200,200,1], name ='input')
convnet =conv_2d(convnet,4,5,activation = 'relu')
convnet = max_pool_2d(convnet,5)
convnet = conv_2d(convnet,5,5,activation = 'relu')
convnet = max_pool_2d(convnet,5)
convnet = conv_2d(convnet,8,5,activation = 'relu')
convnet = max_pool_2d(convnet,5)
convnet = fully_connected(convnet,8,activation = 'relu')
convnet = dropout(convnet,0.2)
convnet = fully_connected(convnet, 2, activation = 'softmax')
convnet = regression(convnet,optimizer= 'adam', learning_rate = LR, loss = 'categorical_crossentropy', name = 'targets')
#Invocation Missing. I have read the previous chapters. The book does not indicate such statements.
model.fit({'input':X},{'targets':Y}, epoch = 1,validation_set = ({'input':test_x},{'targets':test_y}),snapshot_step= 500,show_metric = True,run_id = MODEL_NAME)
Name of the Book: Deep Learning Application with Python (Face detection, Recognition etc.) Author: Navin Kumar Manaswi Chapter: 12 Page No. 187 Publication Year: 2018
The model invocation statement which was missing- should be written as:
model = tflearn.DNN(convnet, tensorboard_dir='log')