Here:
|
self.sample_weights = [image_weight * len(label_i["cls"]) for label_i, image_weight in zip(self.labels, calculate_image_weights(self.im_files))] |
|
self.__indices = generate_indices(self.sample_weights, target_size=len(self.im_files) * self._oversample_factor) |
len(label_i["cls"]) is the number of instances (objects/labels) in the image, so we literally set the resampling weight to zero if the image is empty. This still doesn't mean we completely ignore it, because
generate_indices ensures that all images are included at least once per epoch, even if the weight is zero:
|
for i, w in enumerate(weights): |
|
indices.extend([i] * int(max(round(w), 1))) |
but still, perhaps we should change to:
self.sample_weights = [image_weight * (1 + len(label_i["cls"])) for label_i, image_weight in zip(self.labels, calculate_image_weights(self.im_files))]
Should try out when we train V2.
Here:
flat-bug/src/flat_bug/datasets.py
Lines 214 to 215 in 0f52efe
len(label_i["cls"])is the number of instances (objects/labels) in the image, so we literally set the resampling weight to zero if the image is empty. This still doesn't mean we completely ignore it, becausegenerate_indicesensures that all images are included at least once per epoch, even if the weight is zero:flat-bug/src/flat_bug/datasets.py
Lines 83 to 84 in 0f52efe
but still, perhaps we should change to:
Should try out when we train V2.