Skip to content

Commit 51c9784

Browse files
authored
adds negative sample support for mmdet od models (airctic#823)
* adds negative sample support for mmdet od models * updates changelog
1 parent b3299bd commit 51c9784

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Supports pytorch 1.8
88
### Added
99
- `iou_thresholds` parameter to `COCOMetric`
1010
- `SimpleConfusionMatrix` Metric
11+
- Negative samples support for mmdetection object detection models
1112

1213
### Changed
1314
- **Breaking:** Albumentations `aug_tfms` defaults.

icevision/models/mmdet/common/bbox/dataloaders.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def _img_meta(record):
111111

112112
def _labels(record):
113113
if len(record.detection.label_ids) == 0:
114-
raise RuntimeError("Negative samples still needs to be implemented")
114+
return torch.empty(0)
115115
else:
116116
tensor_label_ids = tensor(record.detection.label_ids)
117117
labels = convert_background_from_zero_to_last(
@@ -122,7 +122,7 @@ def _labels(record):
122122

123123
def _bboxes(record):
124124
if len(record.detection.label_ids) == 0:
125-
raise RuntimeError("Negative samples still needs to be implemented")
125+
return torch.empty((0, 4))
126126
else:
127127
xyxys = [bbox.xyxy for bbox in record.detection.bboxes]
128128
return tensor(xyxys, dtype=torch.float32)

0 commit comments

Comments
 (0)