Git Product home page Git Product logo

Comments (3)

StriveZs avatar StriveZs commented on July 18, 2024

Sorry for my bad English

from mvsnet_pytorch.

XYZ-qiyh avatar XYZ-qiyh commented on July 18, 2024

@zs670980918
你好,MVSNet网络用于模型训练的深度图gt是由mesh渲染得到的,这使得深度图gt并不是每个像素都有深度值的。在网络模型训练过程中,只有valid_pixels区域预测的深度值才参与loss的计算。
depth_visual.png文件中黑白颜色即代表是否为存在深度值,depth_visual.png文件是通过depth_gt得到的,程序中mask就是通过读取depth_visual.png文件得到的。

mask_filename = os.path.join(self.datapath, 'Depths/{}_train/depth_visual_{:0>4}.png'.format(scan, vid))

mask = self.read_img(mask_filename)

from mvsnet_pytorch.

StriveZs avatar StriveZs commented on July 18, 2024

@zs670980918
你好,MVSNet网络用于模型训练的深度图gt是由mesh渲染得到的,这使得深度图gt并不是每个像素都有深度值的。在网络模型训练过程中,只有valid_pixels区域预测的深度值才参与loss的计算。
depth_visual.png文件中黑白颜色即代表是否为存在深度值,depth_visual.png文件是通过depth_gt得到的,程序中mask就是通过读取depth_visual.png文件得到的。

mask_filename = os.path.join(self.datapath, 'Depths/{}_train/depth_visual_{:0>4}.png'.format(scan, vid))

mask = self.read_img(mask_filename)

你好,感谢你的回复,这部分的代码我基本已经看懂了,我最近也结合着原来的tensorflow版本代码进行也阅读,但是我发现好像原tensorflow版本的代码好像在loss计算中没有涉及使用到数据集中的mask,如下:
loss.py

def non_zero_mean_absolute_diff(y_true, y_pred, interval):
    """ non zero mean absolute loss for one batch """
    with tf.name_scope('MAE'):
        shape = tf.shape(y_pred)
        interval = tf.reshape(interval, [shape[0]])
        mask_true = tf.cast(tf.not_equal(y_true, 0.0), dtype='float32')
        denom = tf.reduce_sum(mask_true, axis=[1, 2, 3]) + 1e-7
        masked_abs_error = tf.abs(mask_true * (y_true - y_pred))            # 4D
        masked_mae = tf.reduce_sum(masked_abs_error, axis=[1, 2, 3])        # 1D
        masked_mae = tf.reduce_sum((masked_mae / interval) / denom)         # 1
    return masked_mae
def mvsnet_regression_loss(estimated_depth_image, depth_image, depth_interval):
    """ compute loss and accuracy """
    # non zero mean absulote loss
    masked_mae = non_zero_mean_absolute_diff(depth_image, estimated_depth_image, depth_interval)
    # less one accuracy
    less_one_accuracy = less_one_percentage(depth_image, estimated_depth_image, depth_interval)
    # less three accuracy
    less_three_accuracy = less_three_percentage(depth_image, estimated_depth_image, depth_interval)

    return masked_mae, less_one_accuracy, less_three_accuracy

train.py

# regression loss
loss0, less_one_temp, less_three_temp = mvsnet_regression_loss(
    depth_map, depth_image, depth_interval)
loss1, less_one_accuracy, less_three_accuracy = mvsnet_regression_loss(
    refined_depth_map, depth_image, depth_interval)
loss = (loss0 + loss1) / 2

根据上面的代码,我好想感觉它是根据深度间隔和GT深度计算得到的maksed_mae。
重新描述一下我的问题:
我看pytorch版本的代码直接使用到了数据集中mask,我想确认原始代码是否也用到了,因为根据我看了一下tensorflow版本的代码,好像不是直接用mask的。我想知道这个mask的使用是pytorch的作者自己创新写上去吗? 还是我自己太菜没有看懂原代码。如果我说的哪里有问题希望能够理解。十分感谢

from mvsnet_pytorch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.