Exemplo n.º 1
0
print("- Test-set:\t\t{}".format(len(data.test.labels)))

model = Network(img_shape=(50, 50, 1))
model.add_flat_layer()
model.add_fc_layer(size=50 * 50, use_relu=True)
model.add_fc_layer(size=16, use_relu=True)
model.add_fc_layer(size=2, use_relu=False)
model.finish_setup()
model.set_data(data)

model_path = os.path.join(cwd, 'results', 'models', 'crater_model_nn.ckpt')
#model.restore(model_path)

model.print_test_accuracy()

model.optimize(epochs=20)

model.save(model_path)

model.print_test_accuracy()

model.print_test_accuracy(show_example_errors=True)

model.print_test_accuracy(show_example_errors=True, show_confusion_matrix=True)

image1 = data.test.images[7]
plot_image(image1)

image2 = data.test.images[14]
plot_image(image2)
Exemplo n.º 2
0
model = Network(img_shape=(50, 50, 1))
model.add_convolutional_layer(5, 16)
model.add_convolutional_layer(5, 36)
model.add_flat_layer()
model.add_fc_layer(size=64, use_relu=True)
model.add_fc_layer(size=16, use_relu=True)
model.add_fc_layer(size=2, use_relu=False)
model.finish_setup()
model.set_data(data)

model_path = os.path.join(cwd, 'models', 'cnn', 'crater_model_cnn_mask.ckpt') # the models with _th indicate that they use positive samples extracted form theresholding images. 
#model.restore(model_path)

model.print_test_accuracy()

model.optimize(epochs=100)

model.save(model_path)

model.print_test_accuracy()

model.print_test_accuracy(show_example_errors=True)

model.print_test_accuracy(show_example_errors=True,
                          show_confusion_matrix=True)

image1 = data.test.images[7]
plot_image(image1)

image2 = data.test.images[14]
plot_image(image2)