PSMNet:Pyramid Stereo Matching Network学习测试笔记03-如何训练网络

写在前面的话:
2019年09月28日18:02:55补充说明:CSDN博客发布版权更新,如果您看了博客并且用到PSMNet相关东西,请注明引用原作者的文章:

@inproceedings{chang2018pyramid,
title={Pyramid Stereo Matching Network},
author={Chang, Jia-Ren and Chen, Yong-Sheng},
booktitle={Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition},
pages={5410–5418},
year={2018}
}

这里开始看PSMNet源码
数据集如何组织输入不看,只看这个网络做了哪些工作。

if self.training:  
           w, h = left_img.size
           th, tw = 256, 512
           x1 = random.randint(0, w - tw)
           y1 = random.randint(0, h - th)
           left_img = left_img.crop((x1, y1, x1 + tw, y1 + th))
           right_img = right_img.crop((x1, y1, x1 + tw, y1 + th))
           dataL = dataL[y1:y1 + th, x1:x1 + tw]
           processed = preprocess.get_transform(augment=False)  
           left_img   = processed(left_img)
           right_img  = processed(right_img)
           return left_img, right_img, dataL
        else:
           w, h = left_img.size
           print('WARRING:\tw = %d\th = %d' % (w, h))
           left_img = left_img.crop((w-960, h-544, w, h))
           right_img = right_img.crop((w-960, h-544, w, h))
           processed = preprocess.get_transform(augment=False)  
           left_img       = processed(left_img)
           right_img      = processed(right_img)
           return left_img, right_img, dataL

这里,是dataloader/SceneFlowLoader.py,数据输入经过预处理,如果是训练阶段,就会随机进行图像裁剪(常见的数据集扩充手法,还可以避免过拟合),如果是测试阶段,就会在原图上面添加四行空白作为扩充。另外preprocess还对输入的左右图像进行了预处理。


未完待续,因为转头整理发展路线去了,发现PSMNet就是PSPNet结合了GCNet

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值