%run './../interface/hyperspectral_image.ipynb'
This model is based on this: https://www.tensorflow.org/versions/r0.9/tutorials/tflearn/index.html#tf-contrib-learn-quickstart
%run './../interface/tensorflow_defaults.ipynb'
%run './../interface/tensorflow_functions.ipynb'
# Build 3 layer DNN with 10, 20, 10 units respectively.
classifier = tf.contrib.learn.DNNClassifier(hidden_units=[10], n_classes=len(hyimage.labelClasses))
# Fit model
classifier.fit(x=hyimage.splitPixels(stratified=True, trainProportion=0.1).XTrain,
y=hyimage.splitPixels(stratified=True, trainProportion=0.1).YTrain.astype(np.int32), steps=1000000);
%run './../interface/model_evaluation_functions.ipynb'
classifier.evaluate(x=hyimage.splitPixels(stratified=True, trainProportion=0.1).XTrain,
y=hyimage.splitPixels(stratified=True, trainProportion=0.1).YTrain.astype(np.int32))["accuracy"]
classifier.evaluate(x=hyimage.splitPixels(stratified=True, trainProportion=0.1).XTest,
y=hyimage.splitPixels(stratified=True, trainProportion=0.1).YTest.astype(np.int32))["accuracy"]
compareLabels(originalLabels=hyimage.splitPixels(stratified=True).YTest,
predictedLabels=classifier.predict(x=hyimage.splitPixels(stratified=True).XTest).reshape(-1,1))
hyImageCompare(hyimage, classifier.predict(x=hyimage.pixelsScaled).reshape(hyimage.labels.shape))