-
Notifications
You must be signed in to change notification settings - Fork 443
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change sematic segmentation to consider bbox only annotations. (#3996)
* segmentation consider bbox only annotations * add unit test * add unit test * update fixture * use name attribute * revert tox file * update for 2.2.0rc4 --------- Co-authored-by: Yunchu Lee <yunchu.lee@intel.com>
- Loading branch information
Showing
8 changed files
with
58 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Copyright (C) 2024 Intel Corporation | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
"""Unit tests of classification datasets.""" | ||
|
||
from otx.core.data.dataset.segmentation import OTXSegmentationDataset | ||
from otx.core.data.entity.segmentation import SegDataEntity | ||
|
||
|
||
class TestOTXSegmentationDataset: | ||
def test_get_item( | ||
self, | ||
fxt_mock_dm_subset, | ||
) -> None: | ||
dataset = OTXSegmentationDataset( | ||
dm_subset=fxt_mock_dm_subset, | ||
transforms=[lambda x: x], | ||
mem_cache_img_max_size=None, | ||
max_refetch=3, | ||
) | ||
assert isinstance(dataset[0], SegDataEntity) | ||
assert "background" in [label_name.lower() for label_name in dataset.label_info.label_names] | ||
|
||
def test_get_item_from_bbox_dataset( | ||
self, | ||
fxt_mock_det_dm_subset, | ||
) -> None: | ||
dataset = OTXSegmentationDataset( | ||
dm_subset=fxt_mock_det_dm_subset, | ||
transforms=[lambda x: x], | ||
mem_cache_img_max_size=None, | ||
max_refetch=3, | ||
) | ||
assert isinstance(dataset[0], SegDataEntity) | ||
# OTXSegmentationDataset should add background when getting a dataset which includes only bbox annotations | ||
assert "background" in [label_name.lower() for label_name in dataset.label_info.label_names] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters