LIVIAETS/SizeLoss_WSS

Implementation of loss in the paper

McHz1s opened this issue · 1 comments

Hello!
Which loss in losses.py is proposed by the paper?
It seems Pathak is the one to be compared.

Hello,

The one to use is NaivePenalty for the 2D case, and BatchNaivePenalty that was used for the 3D setting.

In our case the bounds were computed at the dataloader level from one of the class in bounds.py, though in the end they could come from anywhere.

This code was already quite flexible (in the sense you can bound any function, not just size), you could simplify it a bit if you stick to a sizeloss or something like that. The bounds tensor, inside the NaivePenalty function, has the following shape: B×K×D×2:

  • B is the batch size;
  • K is the number of classes (you can bound only a subset of them, with the idc parameter);
  • D is the dimensionality of the value to constraint, 1 for size, 2 for centroid, etc;
  • 2 is simply for lower and upper bounds.

Depending on your setting, you could modify that to simplify it a bit if it is not needed.

Let me know,

Hoel