JiaRenChang / PSMNet

Pyramid Stereo Matching Network (CVPR2018)
MIT License
1.43k stars 424 forks source link

A bug when there is no point satisfy disp < maxdisp #90

Closed youmi-zym closed 5 years ago

youmi-zym commented 5 years ago

Hi: I find there are some images' disparity of SceneFlow are bigger than maxdisp,

mask = disp_true < args.maxdisp
mask.detach_()

mask is all zero here, there will be a error when calculating loss, and it can't be backward.

An example: image

The code will run well with batch-size bigger than 1, but batch-size=1 will lead this bug

my advice is before model forward, check wether mask is all 0:

mask = (disp_true < args.max_disp)
mask = mask.detach().type_as(disp_true)
if mask.sum() < 1.0:
    continue
JiaRenChang commented 5 years ago

Hi, @youmi-zym Thank you. I will modified it.