Serge-weihao / CCNet-Pure-Pytorch

Criss-Cross Attention (2d&3d) for Semantic Segmentation in pure Pytorch with a faster and more precise implementation.
MIT License
183 stars 21 forks source link

confusion in OhemCrossEntropy loss function #15

Open shrutishrestha opened 3 years ago

shrutishrestha commented 3 years ago

pred = prob[label, np.arange(len(label), dtype=np.int32)]

What does this line do in OhemCrossEntropy do?

Serge-weihao commented 3 years ago

https://github.com/Serge-weihao/CCNet-Pure-Pytorch/blob/ff51a27bc5e111b2e7ddc9258266a2fea4637ac6/loss/loss.py#L68 I guess that means to get the gt class related predicted score for each (valid) pixel.