I'm trying to train a mask-rcnn using my own dataset. I've been running into several issues with if statements like these:
if torch.nonzero(gt_class_ids < 0).size():
Essentially, this kind of if statement will always return True even if the size is actually equal to 0. The reason why is because size() returns a torch.Size object. However, if I change the if statement to be:
if torch.nonzero(gt_class_ids < 0).size()[0]:
then everything seems to work fine. There are multiple occurrences of this found within model.py. I'm using python-3.6, cuda-9.0, and pytorch-0.4.0. I know that others must've been able to use the code successfully, so I'm wondering: are these issues I've found legit, or is something else wrong (either with my dataset, python versioning, etc etc)?
I'm trying to train a mask-rcnn using my own dataset. I've been running into several issues with
if
statements like these:if torch.nonzero(gt_class_ids < 0).size():
Essentially, this kind of
if
statement will always returnTrue
even if the size is actually equal to 0. The reason why is becausesize()
returns atorch.Size
object. However, if I change theif
statement to be:if torch.nonzero(gt_class_ids < 0).size()[0]:
then everything seems to work fine. There are multiple occurrences of this found within
model.py
. I'm usingpython-3.6
,cuda-9.0
, andpytorch-0.4.0
. I know that others must've been able to use the code successfully, so I'm wondering: are these issues I've found legit, or is something else wrong (either with my dataset, python versioning, etc etc)?Thank you in advance.