Exemplo n.º 1
0
    def _deconv2_wrapper(self, input_tensor, sample_tensor, output_channel, wd,
                         layer_name):
        [b, h, w, _] = sample_tensor.get_shape().as_list()
        [_, _, _, c] = input_tensor.get_shape().as_list()

        deconv = mf.deconvolution_2d_layer(input_tensor,
                                           [3, 3, output_channel, c], [2, 2],
                                           [b, h, w, output_channel], 'VALID',
                                           wd, layer_name)
        return deconv
Exemplo n.º 2
0
    def _deconv2_wrapper(self, input_tensor, sample_tensor, output_channel, wd,
                         layer_name):
        [b, h, w, _] = sample_tensor.get_shape().as_list()
        [_, _, _, c] = input_tensor.get_shape().as_list()
        b = tf.shape(sample_tensor)[0]
        #deconv_shape = [16, h, w, output_channel]
        deconv_shape = tf.pack([b, h, w, output_channel])
        deconv = mf.deconvolution_2d_layer(input_tensor,
                                           [3, 3, output_channel, c], [2, 2],
                                           deconv_shape, 'VALID', wd,
                                           layer_name)
        deconv.set_shape([None, h, w, output_channel])

        return deconv
    def _resize_deconv(self, input_tensor, desire_shape, output_channel, wd,
                       layer_name):
        b, w, h, c = input_tensor.get_shape().as_list()
        with tf.variable_scope(layer_name):
            if w != desire_shape[0] or h != desire_shape[1]:
                input_tensor = tf.image.resize_images(
                    input_tensor, [desire_shape[0], desire_shape[1]])

            deconv = mf.deconvolution_2d_layer(
                input_tensor, [3, 3, output_channel, c], [1, 1],
                [b, desire_shape[0], desire_shape[1], output_channel], "SAME",
                wd, 'deconv')

        return deconv
    def _deconv2_wrapper(self, input_tensor, sample_tensor, output_channel, wd,
                         lp, layer_name):
        [b, h, w, _] = sample_tensor.get_shape().as_list()
        [_, _, _, c] = input_tensor.get_shape().as_list()

        deconv = mf.deconvolution_2d_layer(input_tensor, output_channel,
                                           [3, 3], [2, 2], "VALID", [h, w],
                                           "NHWC", False, False, lp, wd,
                                           layer_name)

        # deconv = mf.deconvolution_2d_layer(input_tensor,
        #             [3, 3, output_channel, c],
        #             [2, 2], [b, h, w, output_channel], 'VALID',
        #             wd, layer_name)
        return deconv