def evluation_single(self, image):

        boxes_list = get_discrete_sliding_window_boxes(
            img_size=(image.shape[0], image.shape[1]),
            bbox_size=(self.box_size, self.box_size),
            stride=(self.box_size / 2, self.box_size / 2))

        nb_windows = len(boxes_list)
        #print "the number of windows", nb_windows
        nb_row = 0

        for i in range(nb_windows):
            if boxes_list[i][0] == 0:
                nb_row += 1
        nb_col = nb_windows / nb_row

        offset = 0
        for j in range(nb_col):

            for i in range(nb_row):
                img = crop_image(image=image,
                                 crop_size=(self.box_size, self.box_size),
                                 offset=(boxes_list[i + offset][0],
                                         boxes_list[i + offset][1]))

                if self.mean == None:
                    img_norm = normalize_image_channelwise(img)

                else:
                    img_norm = img - self.mean
                    img_norm = img_norm / 255.

                img_norm = np.expand_dims(img_norm, axis=0)
                prediction = self.model.predict(img_norm)
                prediction = compress_as_label(prediction)
                prediction = np.reshape(prediction,
                                        (self.box_size, self.box_size))
                crop_prediction = crop_image(image=prediction,
                                             crop_size=(self.box_size / 2,
                                                        self.box_size / 2),
                                             offset=(self.box_size / 4,
                                                     self.box_size / 4))
                crop_prediction = np.squeeze(crop_prediction, axis=2)

                if i == 0:
                    row_image = crop_prediction
                else:
                    row_image = np.concatenate((row_image, crop_prediction),
                                               axis=1)
            offset += nb_row
            if j == 0:
                whole_image = row_image
            else:
                whole_image = np.concatenate((whole_image, row_image), axis=0)

        return whole_image
    def prediction(self):

        if self.mean == None:
            normal_image = normalize_image_channelwise(self.image)

        else:
            normal_image = self.image - self.mean
            normal_image = normal_image / 255.

        prediction = predict_complete(self.model, normal_image)
        prediction = compress_as_label(prediction)

        return prediction
    def evl_complete(self):

        prediction = predict_complete(self.model, self.image)
        #print "the prediction shape after complete predict", prediction.shape
        prediction = compress_as_label(prediction)
        #print "the final prediction shape", prediction.shape

        fig = plt.figure()
        fig.add_subplot(1, 2, 1)
        plt.imshow(self.image)

        fig.add_subplot(1, 2, 2)
        plt.imshow(prediction)

        plt.show()
    def evluation_single(self, image, label):

        if self.mean == None:
            normal_image = normalize_image_channelwise(image)

        else:
            normal_image = image - self.mean
            normal_image = normal_image / 255.

        prediction = predict_complete(self.model, normal_image)
        prediction = compress_as_label(prediction)

        label = label.flatten()
        prediction = prediction.flatten()

        cm = confusion_matrix(y_true=label,
                              y_pred=prediction,
                              labels=range(self.nb_classes))

        return cm