vicoslab / mixed-segdec-net-comind2021

Official PyTorch implementation for "Mixed supervision for surface-defect detection: from weakly to fully supervised learning"
Other
290 stars 89 forks source link

Exceptions when training with less negative than positive samples / question about `__getitem__` #35

Open AnikaP opened 1 year ago

AnikaP commented 1 year ago

I noticed that there will be exceptions if a sample contains less negative then positive samples. The issues occur in dataset.py, __getitem__. Ensuring the random choice sample size is not too big (size=min(self.num_neg, self.num_negatives_per_one_positive * self.num_pos), dataset.py, line 39) and using num_neg for the mod (ix = index % self.num_neg , dataset.py, line 48) would fix this.