Here: permalink.
Current state: I continued studying the notebook and somehow solved the crash problem. Here is my patched code of RetinaNetFocalLoss._unpad
:
def _unpad(self, bbox_tgt, clas_tgt): nonzero = torch.nonzero(clas_tgt-self.pad_idx) if nonzero.shape[0] > 0: i = torch.min(nonzero) else: i = clas_tgt.shape[0] return tlbr2cthw(bbox_tgt[i:]), clas_tgt[i:]-1+self.pad_idx
Details: this function expected list of classes, which may have some zeros at the start and no zeros further. For example: [0 0 0 15 6 9]
. There are zeros because of batches. But it’s also possible, that there are only zeros. So I created a workaround to handle this case.
Also I became alerted about how the model is built after reading Retina net notebook merge idx issue
I plan to try both slicing variants: [0,2,1]
and [-2:-4:-1]
.