From 927cadc7b9c81698f07e556de78e4e8ad1e68309 Mon Sep 17 00:00:00 2001 From: "Kim, Sungchul" Date: Mon, 3 Jul 2023 11:07:26 +0900 Subject: [PATCH] Fix typo --- .../pytorch_lightning/datasets/dataset.py | 10 +++++----- .../pytorch_lightning/datasets/test_dataset.py | 16 ++++++++-------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/otx/algorithms/visual_prompting/adapters/pytorch_lightning/datasets/dataset.py b/otx/algorithms/visual_prompting/adapters/pytorch_lightning/datasets/dataset.py index 5982f20b305..8cf4c013f91 100644 --- a/otx/algorithms/visual_prompting/adapters/pytorch_lightning/datasets/dataset.py +++ b/otx/algorithms/visual_prompting/adapters/pytorch_lightning/datasets/dataset.py @@ -41,7 +41,7 @@ logger = get_logger() -class OTXVIsualPromptingDataset(Dataset): +class OTXVisualPromptingDataset(Dataset): """Visual Prompting Dataset Adaptor. Args: @@ -236,10 +236,10 @@ def setup(self, stage: Optional[str] = None) -> None: ] ) - self.train_dataset = OTXVIsualPromptingDataset( + self.train_dataset = OTXVisualPromptingDataset( train_otx_dataset, train_transform, offset_bbox=self.config.offset_bbox ) - self.val_dataset = OTXVIsualPromptingDataset(val_otx_dataset, val_transform) + self.val_dataset = OTXVisualPromptingDataset(val_otx_dataset, val_transform) if stage == "test": test_otx_dataset = self.dataset.get_subset(Subset.TESTING) @@ -250,7 +250,7 @@ def setup(self, stage: Optional[str] = None) -> None: transforms.Normalize(mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), ] ) - self.test_dataset = OTXVIsualPromptingDataset(test_otx_dataset, test_transform) + self.test_dataset = OTXVisualPromptingDataset(test_otx_dataset, test_transform) if stage == "predict": predict_otx_dataset = self.dataset @@ -261,7 +261,7 @@ def setup(self, stage: Optional[str] = None) -> None: transforms.Normalize(mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375]), ] ) - self.predict_dataset = OTXVIsualPromptingDataset(predict_otx_dataset, predict_transform) + self.predict_dataset = OTXVisualPromptingDataset(predict_otx_dataset, predict_transform) def summary(self): """Print size of the dataset, number of images.""" diff --git a/tests/unit/algorithms/visual_prompting/adapters/pytorch_lightning/datasets/test_dataset.py b/tests/unit/algorithms/visual_prompting/adapters/pytorch_lightning/datasets/test_dataset.py index c37faba5c18..b1203d3bf35 100644 --- a/tests/unit/algorithms/visual_prompting/adapters/pytorch_lightning/datasets/test_dataset.py +++ b/tests/unit/algorithms/visual_prompting/adapters/pytorch_lightning/datasets/test_dataset.py @@ -12,7 +12,7 @@ from otx.algorithms.visual_prompting.adapters.pytorch_lightning.datasets.dataset import ( OTXVisualPromptingDataModule, - OTXVIsualPromptingDataset, + OTXVisualPromptingDataset, ) from otx.algorithms.visual_prompting.adapters.pytorch_lightning.datasets.pipelines import ( collate_fn, @@ -45,7 +45,7 @@ def dataset_mask(self) -> DatasetEntity: @e2e_pytest_unit def test_len(self, dataset_polygon) -> None: """Test __len__.""" - otx_dataset = OTXVIsualPromptingDataset(dataset_polygon, self.transform) + otx_dataset = OTXVisualPromptingDataset(dataset_polygon, self.transform) assert len(otx_dataset) == 1 @e2e_pytest_unit @@ -53,7 +53,7 @@ def test_len(self, dataset_polygon) -> None: def test_getitem(self, dataset_polygon, dataset_mask, use_mask: bool) -> None: """Test __getitem__.""" dataset = dataset_mask if use_mask else dataset_polygon - otx_dataset = OTXVIsualPromptingDataset(dataset=dataset, transform=self.transform) + otx_dataset = OTXVisualPromptingDataset(dataset=dataset, transform=self.transform) item = otx_dataset[0] @@ -74,7 +74,7 @@ def test_getitem(self, dataset_polygon, dataset_mask, use_mask: bool) -> None: @e2e_pytest_unit def test_convert_polygon_to_mask(self, dataset_polygon) -> None: """Test convert_polygon_to_mask.""" - otx_dataset = OTXVIsualPromptingDataset(dataset_polygon, self.transform) + otx_dataset = OTXVisualPromptingDataset(dataset_polygon, self.transform) polygon = Polygon(points=[Point(x=0.1, y=0.1), Point(x=0.2, y=0.2), Point(x=0.3, y=0.3)]) width = 100 @@ -89,7 +89,7 @@ def test_convert_polygon_to_mask(self, dataset_polygon) -> None: @e2e_pytest_unit def test_generate_bbox(self, dataset_polygon) -> None: """Test generate_bbox.""" - otx_dataset = OTXVIsualPromptingDataset(dataset_polygon, self.transform) + otx_dataset = OTXVisualPromptingDataset(dataset_polygon, self.transform) x1, y1, x2, y2 = 10, 20, 30, 40 width = 100 @@ -107,7 +107,7 @@ def test_generate_bbox(self, dataset_polygon) -> None: @e2e_pytest_unit def test_generate_bbox_from_mask(self, dataset_polygon) -> None: """Test generate_bbox_from_mask.""" - otx_dataset = OTXVIsualPromptingDataset(dataset_polygon, self.transform) + otx_dataset = OTXVisualPromptingDataset(dataset_polygon, self.transform) gt_mask = np.array([[0, 1, 0], [1, 1, 1], [0, 1, 0]]) width = 3 @@ -141,8 +141,8 @@ def test_setup(self, mocker, datamodule) -> None: datamodule.setup() - assert isinstance(datamodule.train_dataset, OTXVIsualPromptingDataset) - assert isinstance(datamodule.val_dataset, OTXVIsualPromptingDataset) + assert isinstance(datamodule.train_dataset, OTXVisualPromptingDataset) + assert isinstance(datamodule.val_dataset, OTXVisualPromptingDataset) @e2e_pytest_unit def test_train_dataloader(self, mocker, datamodule) -> None: