dbolya / yolact

A simple, fully convolutional model for real-time instance segmentation.
MIT License
5k stars 1.33k forks source link

modified 2 bugs in coco.py #807

Open blueFeather111 opened 1 year ago

blueFeather111 commented 1 year ago

I think there are 2 bugs in the pullitem(self, index) function in coco.py when the annotation is empty, it will go to the else branch: if self.transform is not None: ... else: img, , , = self.transform(img, np.zeros((1, height, width), dtype=np.float), np.array([[0, 0, 1, 1]]), (1) {'num_crowds': 0, 'labels': np.array([0])}) masks = None target = None

if target.shape[0] == 0: (2) print('Warning: Augmentation output an example with no ground truth. Resampling...') return self.pull_item(random.randint(0, len(self.ids)-1))

I think position (1): np.array([0,0,1,1]) => np.array([0.0, 0.0, 1.1, 1.1]) they have to be float, because in augmentation.py they will be used in np.multiply. position (2): if target.shape[0] == 0 => if target == None or target.shape[0] == 0, because if target == None target will have no shape.

maybe you have fixed this, I haven't found in the issue list here so I write this. if this has already been fixed please skip.