Exemple #1
0
    def store_prediction(self, sess, batch_x, batch_y, name):
        prediction = sess.run(self.net.predicter,
                              feed_dict={
                                  self.net.x: batch_x,
                                  self.net.y: batch_y,
                                  self.net.keep_prob: 1.,
                                  self.net.block_size: 1
                              })
        pred_shape = prediction.shape

        loss = sess.run(self.net.cost,
                        feed_dict={
                            self.net.x: batch_x,
                            self.net.y:
                            util.crop_to_shape(batch_y, pred_shape),
                            self.net.keep_prob: 1.,
                            self.net.block_size: 1
                        })

        logging.info("Verification error= {:.1f}%, loss= {:.4f}".format(
            error_rate(prediction,
                       util.crop_to_shape(batch_y, prediction.shape)), loss))

        img = util.combine_img_prediction(batch_x, batch_y, prediction)
        util.save_image(img, "%s/%s.jpg" % (self.prediction_path, name))

        return pred_shape
Exemple #2
0
import numpy as np

data_provider = image_util.ImageDataProvider("DRIVE700/test/*",
                                             data_suffix="_test.tif",
                                             mask_suffix='_manual1.png',
                                             n_class=2)

net = unet.Unet(layers=4, features_root=8, channels=3, n_class=2)
test_x, test_y = data_provider(1)

prediction = net.predict("mode/drive100_0.92_700/model.ckpt", test_x)
prediction = util.crop_to_shape(prediction, (20, 584, 565, 2))

AUC_ROC = metrics.roc_Auc(prediction,
                          util.crop_to_shape(test_y, prediction.shape))
print("auc", AUC_ROC)
acc = metrics.acc(prediction, util.crop_to_shape(test_y, prediction.shape))
print("acc:", acc)
precision = metrics.precision(prediction,
                              util.crop_to_shape(test_y, prediction.shape))
print("ppv:", precision)
sen = metrics.sen(prediction, util.crop_to_shape(test_y, prediction.shape))
print("TPR:", sen)
TNR = metrics.TNR(prediction, util.crop_to_shape(test_y, prediction.shape))
print("tnr:", TNR)
f1 = metrics.f1score2(prediction, util.crop_to_shape(test_y, prediction.shape))
print("f1:", f1)

img = util.combine_img_prediction(test_x, test_y, prediction)
util.save_image(img, "19.jpg")