π [Merge] branch 'MODEL' into TEST
Browse files
yolo/tools/data_loader.py
CHANGED
@@ -99,9 +99,6 @@ class YoloDataset(Dataset):
|
|
99 |
continue
|
100 |
annotations = annotations_index.get(image_info["id"], [])
|
101 |
image_seg_annotations = scale_segmentation(annotations, image_info)
|
102 |
-
if not image_seg_annotations:
|
103 |
-
continue
|
104 |
-
|
105 |
elif data_type == "txt":
|
106 |
label_path = labels_path / f"{image_id}.txt"
|
107 |
if not label_path.is_file():
|
|
|
99 |
continue
|
100 |
annotations = annotations_index.get(image_info["id"], [])
|
101 |
image_seg_annotations = scale_segmentation(annotations, image_info)
|
|
|
|
|
|
|
102 |
elif data_type == "txt":
|
103 |
label_path = labels_path / f"{image_id}.txt"
|
104 |
if not label_path.is_file():
|
yolo/tools/loss_functions.py
CHANGED
@@ -93,7 +93,7 @@ class YOLOLoss:
|
|
93 |
targets_cls, targets_bbox = self.separate_anchor(align_targets)
|
94 |
predicts_box = predicts_box / self.vec2box.scaler[None, :, None]
|
95 |
|
96 |
-
cls_norm = targets_cls.sum()
|
97 |
box_norm = targets_cls.sum(-1)[valid_masks]
|
98 |
|
99 |
## -- CLS -- ##
|
|
|
93 |
targets_cls, targets_bbox = self.separate_anchor(align_targets)
|
94 |
predicts_box = predicts_box / self.vec2box.scaler[None, :, None]
|
95 |
|
96 |
+
cls_norm = max(targets_cls.sum(), 1)
|
97 |
box_norm = targets_cls.sum(-1)[valid_masks]
|
98 |
|
99 |
## -- CLS -- ##
|