Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a bug that training is stuck while detection model is trained on distrubited environment #3904

Merged
merged 3 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/otx/core/data/dataset/detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ def _get_item_impl(self, index: int) -> DetDataEntity | None:
bboxes,
format=tv_tensors.BoundingBoxFormat.XYXY,
canvas_size=img_shape,
dtype=torch.float32,
),
labels=torch.as_tensor([ann.label for ann in bbox_anns]),
labels=torch.as_tensor([ann.label for ann in bbox_anns], dtype=torch.long),
)

return self._apply_transforms(entity)
Expand Down
1 change: 1 addition & 0 deletions src/otx/core/data/dataset/instance_segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ def _get_item_impl(self, index: int) -> InstanceSegDataEntity | None:
bboxes,
format=tv_tensors.BoundingBoxFormat.XYXY,
canvas_size=img_shape,
dtype=torch.float32,
),
masks=tv_tensors.Mask(masks, dtype=torch.uint8),
labels=torch.as_tensor(labels),
Expand Down
2 changes: 2 additions & 0 deletions src/otx/core/metrics/fmeasure.py
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,8 @@ class FMeasure(Metric):
IoU > threshold are reduced to one. This threshold can be determined automatically by setting `vary_nms_threshold`
to True.

# TODO(someone): need to update for distriubted training. refer https://lightning.ai/docs/torchmetrics/stable/pages/implement.html

Args:
label_info (int): Dataclass including label information.
vary_nms_threshold (bool): if True the maximal F-measure is determined by optimizing for different NMS threshold
Expand Down
2 changes: 1 addition & 1 deletion src/otx/core/model/detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ def _convert_pred_entity_to_compute_metric(
"preds": [
{
"boxes": bboxes.data,
"scores": scores,
"scores": scores.type(torch.float32),
"labels": labels,
}
for bboxes, scores, labels in zip(
Expand Down
Loading