From 7dfa60cf30fab5fef7110bb523dc0815a4a2b5aa Mon Sep 17 00:00:00 2001 From: ofri masad Date: Wed, 28 Feb 2024 14:57:20 +0200 Subject: [PATCH 1/2] fix bug --- .../transforms/detection/legacy_detection_transform_mixin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/super_gradients/training/transforms/detection/legacy_detection_transform_mixin.py b/src/super_gradients/training/transforms/detection/legacy_detection_transform_mixin.py index f3c28184c2..2b2466ac71 100644 --- a/src/super_gradients/training/transforms/detection/legacy_detection_transform_mixin.py +++ b/src/super_gradients/training/transforms/detection/legacy_detection_transform_mixin.py @@ -26,7 +26,7 @@ def __call__(self, sample: Union["DetectionSample", Dict[str, Any]]) -> Union["D else: sample = self.convert_input_dict_to_detection_sample(sample) sample = self.apply_to_sample(sample) - return self.convert_detection_sample_to_dict(sample, include_crowd_target="crowd_targets" in sample) + return self.convert_detection_sample_to_dict(sample, include_crowd_target=hasattr(sample, "crowd_targets")) @classmethod def convert_input_dict_to_detection_sample(cls, sample_annotations: Dict[str, Union[np.ndarray, Any]]) -> DetectionSample: From 1a2de2d85d2e99e069b17cb7186db02c95f6d1c3 Mon Sep 17 00:00:00 2001 From: ofri masad Date: Wed, 28 Feb 2024 16:32:31 +0200 Subject: [PATCH 2/2] fixed according to review --- .../transforms/detection/legacy_detection_transform_mixin.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/super_gradients/training/transforms/detection/legacy_detection_transform_mixin.py b/src/super_gradients/training/transforms/detection/legacy_detection_transform_mixin.py index 2b2466ac71..1b9112bc25 100644 --- a/src/super_gradients/training/transforms/detection/legacy_detection_transform_mixin.py +++ b/src/super_gradients/training/transforms/detection/legacy_detection_transform_mixin.py @@ -24,9 +24,10 @@ def __call__(self, sample: Union["DetectionSample", Dict[str, Any]]) -> Union["D if isinstance(sample, DetectionSample): return self.apply_to_sample(sample) else: + has_crowd_target = "crowd_target" in sample sample = self.convert_input_dict_to_detection_sample(sample) sample = self.apply_to_sample(sample) - return self.convert_detection_sample_to_dict(sample, include_crowd_target=hasattr(sample, "crowd_targets")) + return self.convert_detection_sample_to_dict(sample, include_crowd_target=has_crowd_target) @classmethod def convert_input_dict_to_detection_sample(cls, sample_annotations: Dict[str, Union[np.ndarray, Any]]) -> DetectionSample: