-
Notifications
You must be signed in to change notification settings - Fork 949
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why use padding_mode='border'? #20
Comments
Thanks for the question! I'm going to leave this one for @mrharicot. Thanks! |
Do you have any explanation why it predicts zero disparities on the edge or why it helps "stabilize training"? |
Hi @kwea123 , I don't know exactly why these effects occur, but could take some guesses. It isn't too hard to change the network to have zero padding instead of 'border' padding, so it could be worth investigating this effect yourself. Do report back if you make any interesting findings! Thanks, |
@mrharicot @mdfirman When you used the zero padding as opposed to border padding, were you masking out the corresponding portion for the target frame? If you used zero padding when creating the warped frame, but you didn't mask out the corresponding portion for the target frame, this could lead to strange results. Ideally, you'd just apply the fly-out mask once to the view-synthesis loss, no? |
Hello, be careful with zero padding, due to how interpolation is done, the pixels that are sampled right on the frontier will have a mix of gray (more specifically the color [0,0,0]) and the valid color. you need to explicitely filter out the out of bound pixels and not only padd with zeros. Here is a quick discussion about it : https://discuss.pytorch.org/t/spatial-transformer-networks-boundary-grid-interpolation-behaviour/8891 |
As @ClementPinard mentioned, using |
When warping the image, you use
padding_mode='border'
, which causes border effects (e.g. on the left and bottom for image 2->1)monodepth2/trainer.py
Lines 381 to 384 in ec10cf1
In the code it seems that you compute the reconstruction loss on the whole image, including the border effect parts (if I'm wrong, correct me). Wouldn't it degrades the model's performance?
What I've seen others doing (e.g. struct2depth) is to use a mask, and only compute the loss on the masked (valid) area. This can be done using
padding_mode='zeros'
to generate the valid mask. E.g., black areas are not contributing to the loss.What's your opinion?
The text was updated successfully, but these errors were encountered: