For research at university I am examining the oxford 17 flowers alexnet example. The example uses the API tflearn based on tensorflow. Training is working very well on my GPU, reaching an accuracy of ~ 97% after a while.
Unfortunately evaluating single images isn't working yet in tflearn, I would have to use model.predict(...) to predict all my data per batch, and loop over all my test set and calculate accuracy by myself.
My training code so far:
...
import image_loader
X, Y = image_loader.load_data(one_hot=True, shuffle=False)
X = X.reshape(244,244)
# Build network
network = input_data(shape=[None, 224, 224, 3])
network = conv_2d(network, 96, 11, strides=4, activation='relu')
network = max_pool_2d(network, 3, strides=2)
network = local_response_normalization(network)
network = conv_2d(network, 256, 5, activation='relu')
network = max_pool_2d(network, 3, strides=2)
network = local_response_normalization(network)
network = conv_2d(network, 384, 3, activation='relu')
network = conv_2d(network, 384, 3, activation='relu')
network = conv_2d(network, 256, 3, activation='relu')
network = max_pool_2d(network, 3, strides=2)
network = local_response_normalization(network)
network = fully_connected(network, 4096, activation='tanh')
network = dropout(network, 0.5)
network = fully_connected(network, 4096, activation='tanh')
network = dropout(network, 0.5)
network = fully_connected(network, 17, activation='softmax')
network = regression(network, optimizer='momentum',
loss='categorical_crossentropy',
learning_rate=0.01)
# Training
model = tflearn.DNN(network, checkpoint_path='model_ba',
max_checkpoints=1, tensorboard_verbose=0)
model.fit(X, Y, n_epoch=3, validation_set=0.1, shuffle=True,
show_metric=True, batch_size=32, snapshot_step=400,
snapshot_epoch=False, run_id='ba_soccer_network')
The code is saving a checkpoint "model_ba" and also the network in form of a .meta-file. Is there a possibility of loading that saved checkpoint and evaluate a single image with tensorflow?
Thanks in advance, Arno