from TensorflowToolbox.model_flow import model_func
import tensorflow as tf

if __name__ == "__main__":
    img = tf.constant(3, dtype=tf.float32, shape=[1, 227, 227, 3])
    atrous1 = model_func.atrous_convolution_layer(img, \
       [3,3, 3, 512], 4, "SAME", 0.01, "atrous1")
    print(atrous1)
Beispiel #2
0
    def _model_infer_cnn_single(self, input_ph, model_params):
        leaky_param = model_params["leaky_param"]
        wd = model_params["weight_decay"]

        hyper_list = list()

        print(input_ph)

        conv11 = mf.add_leaky_relu(
            mf.convolution_2d_layer(input_ph, [3, 3, 3, 64], [1, 1], "SAME",
                                    wd, "conv1_1"), leaky_param)

        conv12 = mf.add_leaky_relu(
            mf.convolution_2d_layer(conv11, [3, 3, 64, 64], [1, 1], "SAME", wd,
                                    "conv1_2"), leaky_param)

        conv12_maxpool = mf.maxpool_2d_layer(conv12, [3, 3], [2, 2],
                                             "maxpool1")

        print(conv12_maxpool)

        conv21 = mf.add_leaky_relu(
            mf.convolution_2d_layer(conv12_maxpool, [3, 3, 64, 128], [1, 1],
                                    "SAME", wd, "conv2_1"), leaky_param)

        conv22 = mf.add_leaky_relu(
            mf.convolution_2d_layer(conv21, [3, 3, 128, 128], [1, 1], "SAME",
                                    wd, "conv2_2"), leaky_param)

        conv22_maxpool = mf.maxpool_2d_layer(conv22, [3, 3], [2, 2],
                                             "maxpool2")

        print(conv22_maxpool)
        hyper_list.append(conv22_maxpool)

        conv31 = mf.add_leaky_relu(
            mf.convolution_2d_layer(conv22_maxpool, [3, 3, 128, 256], [1, 1],
                                    "SAME", wd, "conv3_1"), leaky_param)

        conv32 = mf.add_leaky_relu(
            mf.convolution_2d_layer(conv31, [3, 3, 256, 256], [1, 1], "SAME",
                                    wd, "conv3_2"), leaky_param)

        atrous3 = mf.add_leaky_relu(
            mf.atrous_convolution_layer(conv32, [3, 3, 256, 256], 2, "SAME",
                                        wd, "atrous3"), leaky_param)

        print(atrous3)
        hyper_list.append(atrous3)

        conv41 = mf.add_leaky_relu(
            mf.convolution_2d_layer(atrous3, [3, 3, 256, 512], [1, 1], "SAME",
                                    wd, "conv4_1"), leaky_param)

        conv42 = mf.add_leaky_relu(
            mf.convolution_2d_layer(conv41, [3, 3, 512, 512], [1, 1], "SAME",
                                    wd, "conv4_2"), leaky_param)

        atrous4 = mf.add_leaky_relu(
            mf.atrous_convolution_layer(conv42, [3, 3, 512, 512], 2, "SAME",
                                        wd, "atrous4"), leaky_param)

        print(atrous4)
        hyper_list.append(atrous4)

        atrous51 = mf.add_leaky_relu(
            mf.atrous_convolution_layer(atrous4, [3, 3, 512, 512], 2, "SAME",
                                        wd, "atrous5_1"), leaky_param)

        atrous52 = mf.add_leaky_relu(
            mf.atrous_convolution_layer(atrous51, [3, 3, 512, 512], 2, "SAME",
                                        wd, "atrous5_2"), leaky_param)

        print(atrous52)

        hyper_list.append(atrous52)

        hypercolumn = self._pack_tensor_list(hyper_list)
        print(hypercolumn)

        [b, w, h, c] = hypercolumn.get_shape().as_list()
        conv6 = mf.add_leaky_relu(
            mf.convolution_2d_layer(hypercolumn, [1, 1, c, 512], [1, 1],
                                    "SAME", wd, "conv6"), leaky_param)

        deconv1 = self._deconv2_wrapper(conv6, conv21, 256, wd, "deconv1")
        print(deconv1)

        deconv2 = self._deconv2_wrapper(deconv1, conv11, 64, wd, "deconv2")
        print(deconv2)

        conv7 = mf.add_leaky_relu(
            mf.convolution_2d_layer(deconv2, [1, 1, 64, 1], [1, 1], "SAME", wd,
                                    "conv7"), leaky_param)
        print(conv7)

        predict_list = list()
        predict_list.append(conv7)

        b = tf.shape(hypercolumn)[0]
        [bb, hh, ww, cc] = conv7.get_shape().as_list()
        dims = hh * ww * cc
        fc = tf.reshape(conv7, [b, dims], "vectorize")

        return predict_list, fc
Beispiel #3
0
    def model_infer(self, data_ph, model_params):
        input_ph = data_ph.get_input()
        leaky_param = model_params["leaky_param"]
        wd = model_params["weight_decay"]

        hyper_list = list()

        print(input_ph)

        conv11 = mf.add_leaky_relu(mf.convolution_2d_layer(
            input_ph, [3, 3, 3, 64], [1, 1],
            "SAME", wd, "conv1_1"), leaky_param)

        atrous1 = mf.add_leaky_relu(mf.atrous_convolution_layer(
            conv11, [3, 3, 64, 64], 2,
            "SAME", wd, "atrous1"), leaky_param)

        print(atrous1)
        hyper_list.append(atrous1)

        conv21 = mf.add_leaky_relu(mf.convolution_2d_layer(
            atrous1, [3, 3, 64, 128], [1, 1],
            "SAME", wd, "conv2_1"), leaky_param)

        atrous2 = mf.add_leaky_relu(mf.atrous_convolution_layer(
            conv21, [3, 3, 128, 128], 2,
            "SAME", wd, "atrous2"), leaky_param)

        print(atrous2)
        hyper_list.append(atrous2)

        conv31 = mf.add_leaky_relu(mf.convolution_2d_layer(
            atrous2, [3, 3, 128, 256], [1, 1],
            "SAME", wd, "conv3_1"), leaky_param)

        conv32 = mf.add_leaky_relu(mf.convolution_2d_layer(
            conv31, [3, 3, 256, 256], [1, 1],
            "SAME", wd, "conv3_2"), leaky_param)

        atrous3 = mf.add_leaky_relu(mf.atrous_convolution_layer(
            conv32, [3, 3, 256, 256], 2,
            "SAME", wd, "atrous3"), leaky_param)

        print(atrous3)
        hyper_list.append(atrous3)

        conv41 = mf.add_leaky_relu(mf.convolution_2d_layer(
            atrous3, [3, 3, 256, 512], [1, 1],
            "SAME", wd, "conv4_1"), leaky_param)

        conv42 = mf.add_leaky_relu(mf.convolution_2d_layer(
            conv41, [3, 3, 512, 512], [1, 1],
            "SAME", wd, "conv4_2"), leaky_param)
        atrous4 = mf.add_leaky_relu(mf.atrous_convolution_layer(
            conv42, [3, 3, 512, 512], 2,
            "SAME", wd, "atrous4"), leaky_param)

        print(atrous4)
        hyper_list.append(atrous4)

        conv51 = mf.add_leaky_relu(mf.convolution_2d_layer(
            atrous4, [3, 3, 512, 512], [1, 1],
            "SAME", wd, "conv5_1"), leaky_param)

        conv52 = mf.add_leaky_relu(mf.convolution_2d_layer(
            conv51, [3, 3, 512, 512], [1, 1],
            "SAME", wd, "conv5_2"), leaky_param)

        atrous5 = mf.add_leaky_relu(mf.atrous_convolution_layer(
            conv52, [3, 3, 512, 512], 2,
            "SAME", wd, "atrous5"), leaky_param)

        print(atrous5)

        hyper_list.append(atrous5)


        hypercolumn = self.pack_tensor_list(hyper_list)

        c_dimension = hypercolumn.get_shape().as_list()[3]

        conv6 = mf.add_leaky_relu(mf.convolution_2d_layer(
            hypercolumn, [1, 1, c_dimension, 1], [1, 1],
            "SAME", wd, "conv6"), leaky_param)

        tf.add_to_collection("image_to_write", data_ph.get_input())
        tf.add_to_collection("image_to_write", data_ph.get_label())
        tf.add_to_collection("image_to_write", data_ph.get_mask()) 
        tf.add_to_collection("image_to_write", conv6) 

        self.predict_list = list()
        self.predict_list.append(conv6)
    def model_infer(self, data_ph, model_params):
        input_ph = data_ph.get_input()
        lp = model_params["leaky_param"]
        wd = model_params["weight_decay"]

        # Disable the batch normalization
        bn = False
        # Once bn is disabled, there is no differece between train and test
        is_train = False

        hyper_list = list()

        print(input_ph)

        conv11 = mf.convolution_2d_layer(input_ph, 64, [3, 3], [1, 1], "SAME",
                                         "NHWC", bn, is_train, lp, wd,
                                         "conv1_1")

        # conv11 = mf.add_leaky_relu(mf.convolution_2d_layer(
        #     input_ph, [3, 3, 3, 64], [1, 1],
        #     "SAME", wd, "conv1_1"), leaky_param)
        conv12 = mf.convolution_2d_layer(conv11, 64, [3, 3], [1, 1], "SAME",
                                         "NHWC", bn, is_train, lp, wd,
                                         "conv1_2")

        # conv12 = mf.add_leaky_relu(mf.convolution_2d_layer(
        #     conv11, [3, 3, 64, 64], [1, 1],
        #     "SAME", wd, "conv1_2"), leaky_param)

        conv12_maxpool = mf.maxpool_2d_layer(conv12, [3, 3], [2, 2], "NHWC",
                                             "maxpool1")

        print(conv12_maxpool)
        #hyper_list.append(conv12_maxpool)

        conv21 = mf.convolution_2d_layer(conv12_maxpool, 128, [3, 3], [1, 1],
                                         "SAME", "NHWC", bn, is_train, lp, wd,
                                         "conv2_1")

        # conv21 = mf.add_leaky_relu(mf.convolution_2d_layer(
        #     conv12_maxpool, [3, 3, 64, 128], [1, 1],
        #     "SAME", wd, "conv2_1"), leaky_param)

        conv22 = mf.convolution_2d_layer(conv21, 128, [3, 3], [1, 1], "SAME",
                                         "NHWC", bn, is_train, lp, wd,
                                         "conv2_2")

        # conv22 = mf.add_leaky_relu(mf.convolution_2d_layer(
        #     conv21, [3, 3, 128, 128], [1, 1],
        #     "SAME", wd, "conv2_2"), leaky_param)

        conv22_maxpool = mf.maxpool_2d_layer(conv22, [3, 3], [2, 2], "NHWC",
                                             "maxpool2")

        print(conv22_maxpool)
        hyper_list.append(conv22_maxpool)

        conv31 = mf.convolution_2d_layer(conv22_maxpool, 256, [3, 3], [1, 1],
                                         "SAME", "NHWC", bn, is_train, lp, wd,
                                         "conv3_1")

        # conv31 = mf.add_leaky_relu(mf.convolution_2d_layer(
        #     conv22_maxpool, [3, 3, 128, 256], [1, 1],
        #     "SAME", wd, "conv3_1"), leaky_param)

        conv32 = mf.convolution_2d_layer(conv31, 256, [3, 3], [1, 1], "SAME",
                                         "NHWC", bn, is_train, lp, wd,
                                         "conv3_2")

        # conv32 = mf.add_leaky_relu(mf.convolution_2d_layer(
        #     conv31, [3, 3, 256, 256], [1, 1],
        #     "SAME", wd, "conv3_2"), leaky_param)
        atrous3 = mf.atrous_convolution_layer(conv32, 256, [3, 3], 2, "SAME",
                                              "NHWC", bn, is_train, lp, wd,
                                              "atrous3")

        # atrous3 = mf.add_leaky_relu(mf.atrous_convolution_layer(
        #     conv32, [3, 3, 256, 256], 2,
        #     "SAME", wd, "atrous3"), leaky_param)
        #conv33 = mf.add_leaky_relu(mf.convolution_2d_layer(
        #    conv32, [3, 3, 256, 256], [1, 1],
        #    "SAME", wd, "conv3_3"), leaky_param)

        #conv33_maxpool = mf.maxpool_2d_layer(conv33, [3, 3],
        #                                     [2, 2], "maxpool3")

        print(atrous3)
        hyper_list.append(atrous3)

        conv41 = mf.convolution_2d_layer(atrous3, 512, [3, 3], [1, 1], "SAME",
                                         "NHWC", bn, is_train, lp, wd,
                                         "conv4_1")

        conv42 = mf.convolution_2d_layer(conv41, 512, [3, 3], [1, 1], "SAME",
                                         "NHWC", bn, is_train, lp, wd,
                                         "conv4_2")

        atrous4 = mf.atrous_convolution_layer(conv42, 512, [3, 3], 2, "SAME",
                                              "NHWC", bn, is_train, lp, wd,
                                              "atrous4")

        print(atrous4)
        hyper_list.append(atrous4)

        atrous51 = mf.atrous_convolution_layer(atrous4, 512, [3, 3], 2, "SAME",
                                               "NHWC", bn, is_train, lp, wd,
                                               "atrous5_1")

        atrous52 = mf.atrous_convolution_layer(atrous51, 512, [3, 3], 2,
                                               "SAME", "NHWC", bn, is_train,
                                               lp, wd, "atrous5_2")

        print(atrous52)
        #hyper_list.append(atrous52)

        hyper_list.append(atrous52)

        hypercolumn = self._pack_tensor_list(hyper_list)
        print(hypercolumn)

        [b, w, h, c] = hypercolumn.get_shape().as_list()

        conv6 = mf.convolution_2d_layer(hypercolumn, 512, [1, 1], [1, 1],
                                        "SAME", "NHWC", bn, is_train, lp, wd,
                                        "conv6")

        deconv1 = self._deconv2_wrapper(conv6, conv21, 256, wd, lp, "deconv1")
        print(deconv1)

        deconv2 = self._deconv2_wrapper(deconv1, conv11, 64, wd, lp, "deconv2")
        print(deconv2)

        conv7 = mf.convolution_2d_layer(deconv2, 1, [1, 1], [1, 1], "SAME",
                                        "NHWC", False, is_train, lp, wd,
                                        "conv7")

        print(conv7)

        #tf.add_to_collection("image_to_write", data_ph.get_input())
        #tf.add_to_collection("image_to_write", data_ph.get_label())
        #tf.add_to_collection("image_to_write", data_ph.get_mask())
        #tf.add_to_collection("image_to_write", conv7)
        with tf.variable_scope("image_sum"):
            self._add_image_sum(data_ph.get_input(), data_ph.get_label(),
                                conv7, data_ph.get_mask())

        self.predict_list = list()
        self.predict_list.append(conv7)
    def model_infer(self, data_ph, model_params):
        input_ph = data_ph.get_input()
        leaky_param = model_params["leaky_param"]
        wd = model_params["weight_decay"]

        hyper_list = list()

        print(input_ph)

        conv11 = mf.add_leaky_relu(
            mf.convolution_2d_layer(input_ph, [3, 3, 3, 64], [1, 1], "SAME",
                                    wd, "conv1_1"), leaky_param)

        conv12 = mf.add_leaky_relu(
            mf.convolution_2d_layer(conv11, [3, 3, 64, 64], [1, 1], "SAME", wd,
                                    "conv1_2"), leaky_param)

        conv12_maxpool = mf.maxpool_2d_layer(conv12, [3, 3], [2, 2],
                                             "maxpool1")

        print(conv12_maxpool)
        #hyper_list.append(conv12_maxpool)

        conv21 = mf.add_leaky_relu(
            mf.convolution_2d_layer(conv12_maxpool, [3, 3, 64, 128], [1, 1],
                                    "SAME", wd, "conv2_1"), leaky_param)

        conv22 = mf.add_leaky_relu(
            mf.convolution_2d_layer(conv21, [3, 3, 128, 128], [1, 1], "SAME",
                                    wd, "conv2_2"), leaky_param)

        conv22_maxpool = mf.maxpool_2d_layer(conv22, [3, 3], [2, 2],
                                             "maxpool2")

        print(conv22_maxpool)
        hyper_list.append(conv22_maxpool)

        conv31 = mf.add_leaky_relu(
            mf.convolution_2d_layer(conv22_maxpool, [3, 3, 128, 256], [1, 1],
                                    "SAME", wd, "conv3_1"), leaky_param)

        conv32 = mf.add_leaky_relu(
            mf.convolution_2d_layer(conv31, [3, 3, 256, 256], [1, 1], "SAME",
                                    wd, "conv3_2"), leaky_param)

        atrous3 = mf.add_leaky_relu(
            mf.atrous_convolution_layer(conv32, [3, 3, 256, 256], 2, "SAME",
                                        wd, "atrous3"), leaky_param)
        #conv33 = mf.add_leaky_relu(mf.convolution_2d_layer(
        #    conv32, [3, 3, 256, 256], [1, 1],
        #    "SAME", wd, "conv3_3"), leaky_param)

        #conv33_maxpool = mf.maxpool_2d_layer(conv33, [3, 3],
        #                                     [2, 2], "maxpool3")

        print(atrous3)
        hyper_list.append(atrous3)

        conv41 = mf.add_leaky_relu(
            mf.convolution_2d_layer(atrous3, [3, 3, 256, 512], [1, 1], "SAME",
                                    wd, "conv4_1"), leaky_param)

        conv42 = mf.add_leaky_relu(
            mf.convolution_2d_layer(conv41, [3, 3, 512, 512], [1, 1], "SAME",
                                    wd, "conv4_2"), leaky_param)

        atrous4 = mf.add_leaky_relu(
            mf.atrous_convolution_layer(conv42, [3, 3, 512, 512], 2, "SAME",
                                        wd, "atrous4"), leaky_param)

        print(atrous4)
        hyper_list.append(atrous4)

        atrous51 = mf.add_leaky_relu(
            mf.atrous_convolution_layer(atrous4, [3, 3, 512, 512], 2, "SAME",
                                        wd, "atrous5_1"), leaky_param)

        atrous52 = mf.add_leaky_relu(
            mf.atrous_convolution_layer(atrous51, [3, 3, 512, 512], 2, "SAME",
                                        wd, "atrous5_2"), leaky_param)

        print(atrous52)
        #hyper_list.append(atrous52)

        hyper_list.append(atrous52)

        hypercolumn = self._pack_tensor_list(hyper_list)
        print(hypercolumn)

        [b, w, h, c] = hypercolumn.get_shape().as_list()
        conv6 = mf.add_leaky_relu(
            mf.convolution_2d_layer(hypercolumn, [1, 1, c, 512], [1, 1],
                                    "SAME", wd, "conv6"), leaky_param)

        deconv1 = self._deconv2_wrapper(conv6, conv21, 256, wd, "deconv1")
        print(deconv1)

        deconv2 = self._deconv2_wrapper(deconv1, conv11, 64, wd, "deconv2")
        print(deconv2)

        conv7 = mf.add_leaky_relu(
            mf.convolution_2d_layer(deconv2, [1, 1, 64, 1], [1, 1], "SAME", wd,
                                    "conv7"), leaky_param)
        print(conv7)

        stage2 = self._stage_conv(data_ph, conv7, 2, model_params)
        print(stage2)

        stage3 = self._stage_conv(data_ph, stage2, 3, model_params)
        print(stage3)

        self.predict_list = list()
        self.predict_list.append(conv7)
        self.predict_list.append(stage2)
        self.predict_list.append(stage3)

        with tf.variable_scope("image_sum"):
            self._add_image_sum(data_ph.get_input(), data_ph.get_label(),
                                data_ph.get_mask())
Beispiel #6
0
    def model_infer(self, data_ph, model_params):
        input_ph = data_ph.get_input()
        leaky_param = model_params["leaky_param"]
        wd = model_params["weight_decay"]

        hyper_list = list()

        print(input_ph)

        conv11 = mf.add_leaky_relu(mf.convolution_2d_layer(
            input_ph, [3, 3, 3, 64], [1, 1],
            "SAME", wd, "conv1_1"), leaky_param)

        conv12 = mf.add_leaky_relu(mf.convolution_2d_layer(
            conv11, [3, 3, 64, 64], [1, 1],
            "SAME", wd, "conv1_2"), leaky_param)

        conv12_maxpool = mf.maxpool_2d_layer(conv12, [3, 3],
                                             [2, 2], "maxpool1")

        print(conv12_maxpool)
        #hyper_list.append(conv12_maxpool)

        conv21 = mf.add_leaky_relu(mf.convolution_2d_layer(
            conv12_maxpool, [3, 3, 64, 128], [1, 1],
            "SAME", wd, "conv2_1"), leaky_param)

        conv22 = mf.add_leaky_relu(mf.convolution_2d_layer(
            conv21, [3, 3, 128, 128], [1, 1],
            "SAME", wd, "conv2_2"), leaky_param)

        conv22_maxpool = mf.maxpool_2d_layer(conv22, [3, 3],
                                             [2, 2], "maxpool2")

        print(conv22_maxpool)
        hyper_list.append(conv22_maxpool)

        conv31 = mf.add_leaky_relu(mf.convolution_2d_layer(
            conv22_maxpool, [3, 3, 128, 256], [1, 1],
            "SAME", wd, "conv3_1"), leaky_param)

        conv32 = mf.add_leaky_relu(mf.convolution_2d_layer(
            conv31, [3, 3, 256, 256], [1, 1],
            "SAME", wd, "conv3_2"), leaky_param)

        atrous3 = mf.add_leaky_relu(mf.atrous_convolution_layer(
            conv32, [3, 3, 256, 256], 2,
            "SAME", wd, "atrous3"), leaky_param)
        #conv33 = mf.add_leaky_relu(mf.convolution_2d_layer(
        #    conv32, [3, 3, 256, 256], [1, 1],
        #    "SAME", wd, "conv3_3"), leaky_param)

        #conv33_maxpool = mf.maxpool_2d_layer(conv33, [3, 3],
        #                                     [2, 2], "maxpool3")

        print(atrous3)
        hyper_list.append(atrous3)

        conv41 = mf.add_leaky_relu(mf.convolution_2d_layer(
            atrous3, [3, 3, 256, 512], [1, 1],
            "SAME", wd, "conv4_1"), leaky_param)

        conv42 = mf.add_leaky_relu(mf.convolution_2d_layer(
            conv41, [3, 3, 512, 512], [1, 1],
            "SAME", wd, "conv4_2"), leaky_param)

        atrous4 = mf.add_leaky_relu(mf.atrous_convolution_layer(
            conv42, [3, 3, 512, 512], 2,
            "SAME", wd, "atrous4"), leaky_param)

        print(atrous4)
        hyper_list.append(atrous4)

        atrous51 = mf.add_leaky_relu(mf.atrous_convolution_layer(
            atrous4, [3, 3, 512, 512], 2,
            "SAME", wd, "atrous5_1"), leaky_param)

        atrous52 = mf.add_leaky_relu(mf.atrous_convolution_layer(
            atrous51, [3, 3, 512, 512], 2,
            "SAME", wd, "atrous5_2"), leaky_param)

        print(atrous52)
        #hyper_list.append(atrous52)

        hyper_list.append(atrous52)

        #hypercolumn = self._pack_tensor_list(hyper_list)
        #print(hypercolumn)

        [b, w, h, c]= atrous52.get_shape().as_list()

        conv6 = mf.add_leaky_relu(mf.convolution_2d_layer(
            atrous52, [1, 1, c, 512], [1, 1],
            "SAME", wd, "conv6"), leaky_param)

        deconv1 = self._deconv2_wrapper(conv6, conv21, 
                    256, wd, "deconv1")
        print(deconv1)

        deconv2 = self._deconv2_wrapper(deconv1, conv11, 
                    64, wd, "deconv2")
        print(deconv2)

        # Add domain classifier
        if model_params['use_da']:
            da_conv1 = mf.add_leaky_relu(mf.convolution_2d_layer(
                    deconv2, [1, 1, 64, 64], [1, 1],
                    "SAME", wd, "da_conv1"), leaky_param)
            da_cls = mf.add_leaky_relu(mf.convolution_2d_layer(
                    da_conv1, [1, 1, 64, 2], [1, 1],
                    "SAME", wd, "da_cls"), leaky_param)
            self.da_cls = da_cls

        #deconv1 = mf.deconvolution_2d_layer(conv6, [3, 3, 256, 512], 
        #            [2, 2], [b, 111, 111, 256], 'VALID', wd, 'deconv1')
        #print(deconv1)

        #deconv2 = mf.deconvolution_2d_layer(deconv1, [3, 3, 64, 256], 
        #            [2, 2], [b, 224, 224, 64], 'VALID', wd, 'deconv2')

        #print(deconv2)

        conv7 = mf.add_leaky_relu(mf.convolution_2d_layer(
            deconv2, [1, 1, 64, 1], [1, 1],
            "SAME", wd, "conv7"), leaky_param)
        print(conv7)

        #tf.add_to_collection("image_to_write", data_ph.get_input())
        #tf.add_to_collection("image_to_write", data_ph.get_label())
        #tf.add_to_collection("image_to_write", data_ph.get_mask()) 
        #tf.add_to_collection("image_to_write", conv7) 
        with tf.variable_scope("image_sum"):
            self._add_image_sum(data_ph.get_input(), data_ph.get_label(), 
                    conv7, data_ph.get_mask())

        self.predict_list = list()
        self.predict_list.append(conv7)