想要深入了解《Pyramid Stereo Matching Network》代码

想要深入了解《Pyramid Stereo Matching Network》这篇论文,还是需要去看代码。下面就debug,代码,看方法执行的一个过程。

我选择的是submissuib.py文件。在
pred_disp=test(imgL,imgR)
这一行设置断点。开始debug。执行step into。
首先进入到module.py文件的 eval()方法中。

     def eval(self):
        Sets the module in evaluation mode.

        This has any effect only on certain modules. See documentations of
        particular modules for details of their behaviors in training/evaluation
        mode, if they are affected, e.g. :class:`Dropout`, :class:`BatchNorm`,
        etc.
    
        return self.train(False)

接着eval()方法会调用 train()方法。开始训练。进入train()方法:

    def train(self, mode=True):
        r"""Sets the module in training mode.

        This has any effect only on certain modules. See documentations of
        particular modules for details of their behaviors in training/evaluation
        mode, if they are affected, e.g. :class:`Dropout`, :class:`BatchNorm`,
        etc.

        Returns:
            Module: self
        """
        self.training = mode
        for module in self.children():
            module.train(mode)
        return self

开始会执行 self.training=mode这一行代码, 然后调用自身的 __setattr__方法,

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容