monodepth_model.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:monodepth360 作者: srijanparmeshwar 项目源码 文件源码
def equirectangular_net(self):
        with slim.arg_scope([slim.conv2d, slim.conv2d_transpose], activation_fn = tf.nn.elu):
            with tf.variable_scope("model", reuse = self.reuse_variables) as scope:
                # Calculate pyramid for equirectangular top image.
                self.top_pyramid = self.scale_pyramid(self.top, 4)

                with tf.variable_scope("scaling"):
                    self.depth_scale = tf.constant(0.25, shape = [1])
                    self.disparity_scale = tf.get_variable("disparity_scale", shape = [1], trainable = False,
                                                           initializer = tf.constant_initializer(1.0 / np.pi))

                if self.params.dropout:
                    resnet50 = lambda x: self.dropout_resnet50(x, scope)
                elif self.params.noise:
                    resnet50 = lambda x: self.noisy_resnet50(x, scope)
                else:
                    resnet50 = lambda x: self.resnet50(x, False)

                if self.mode == 'train':
                    # Calculate pyramid for equirectangular bottom image.
                    self.bottom_pyramid = self.scale_pyramid(self.bottom, 4)

                if self.params.test_crop:
                    crop_height = int(self.params.height / 8)
                    output1, output2, output3, output4 = resnet50(self.top[:, crop_height:-crop_height, :, :])
                else:
                    output1, output2, output3, output4 = resnet50(self.top)
                outputs = [output1, output2, output3, output4]

                if self.params.test_crop:
                    outputs = [restore(output, self.params.height) for output in outputs]

                if self.params.output_mode == "indirect":
                    self.outputs = [self.equirectangular_disparity_to_depth(output) for output in outputs]
                elif self.params.output_mode == "direct":
                    self.outputs = outputs
                elif self.params.output_mode == "attenuate":
                    self.outputs = [tf.concat(
                            [self.attenuate_equirectangular(tf.expand_dims(output[:, :, :, 0], 3), "top"), self.attenuate_equirectangular(tf.expand_dims(output[:, :, :, 1], 3), "bottom")],
                            3
                        ) for output in outputs]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号