diff --git a/yolo/tools/data_loader.py b/yolo/tools/data_loader.py index 5f7245f..794c6f0 100644 --- a/yolo/tools/data_loader.py +++ b/yolo/tools/data_loader.py @@ -99,9 +99,6 @@ def filter_data(self, dataset_path: Path, phase_name: str, sort_image: bool = Fa continue annotations = annotations_index.get(image_info["id"], []) image_seg_annotations = scale_segmentation(annotations, image_info) - if not image_seg_annotations: - continue - elif data_type == "txt": label_path = labels_path / f"{image_id}.txt" if not label_path.is_file(): diff --git a/yolo/tools/loss_functions.py b/yolo/tools/loss_functions.py index ec23855..54fd7cf 100644 --- a/yolo/tools/loss_functions.py +++ b/yolo/tools/loss_functions.py @@ -93,7 +93,7 @@ def __call__(self, predicts: List[Tensor], targets: Tensor) -> Tuple[Tensor, Ten targets_cls, targets_bbox = self.separate_anchor(align_targets) predicts_box = predicts_box / self.vec2box.scaler[None, :, None] - cls_norm = targets_cls.sum() + cls_norm = max(targets_cls.sum(), 1) box_norm = targets_cls.sum(-1)[valid_masks] ## -- CLS -- ##