MiDaS icon indicating copy to clipboard operation
MiDaS copied to clipboard

Implementation detail of the robust loss

Open dfrumkin opened this issue 4 years ago • 5 comments

Looking at https://gist.github.com/ranftlr/1d6194db2e1dffa0a50c9b0a9549cbd2#file-loss-py-L31, it looks like you are computing the median over all the values, including invalid ones. Shouldn't this be a masked median? (It is not available off the shelf, but can be implemented efficiently in a roundabout way). And if it's a bug / feature, then how does it relate to trimming? Meaning the outliers may be coming from invalid values or the invalid values may make legal values look like outliers...

dfrumkin avatar Dec 11 '20 21:12 dfrumkin

I am wondering if the part trimmed, _ = torch.sort(res.view(-1), descending=False)[ : int(len(res) * (1.0 - trim)) ]

should be changed to trimmed, _ = torch.sort(res.view(-1), descending=False) trimmed = trimmed[: int(len(res.view(-1)) * (1.0 - trim))]

Mofafa avatar Jan 04 '21 08:01 Mofafa

I am wondering if the part trimmed, _ = torch.sort(res.view(-1), descending=False)[ : int(len(res) * (1.0 - trim)) ]

should be changed to trimmed, _ = torch.sort(res.view(-1), descending=False) trimmed = trimmed[: int(len(res.view(-1)) * (1.0 - trim))]

I think it should be changed to the second one, the first line won't perform trimming.

liuxiao1468 avatar Apr 14 '21 22:04 liuxiao1468

@dfrumkin Hi Guys, I wonder are you able to reproduce the training script. I am pretty to this and wonder how you achieved this. Thanks.

mathmax12 avatar May 13 '21 05:05 mathmax12

Same problem.

CJCHEN1230 avatar Sep 07 '23 03:09 CJCHEN1230