From 0b48d16d4f21686190be4fb84559b0f346bb0061 Mon Sep 17 00:00:00 2001 From: Gabriel Gutierrez Date: Sun, 19 May 2024 19:30:28 -0300 Subject: [PATCH 1/3] chore: Add missing import statements for datasets, readers, and models --- minerva/analysis/metrics/__init__.py | 2 ++ minerva/data/datasets/__init__.py | 4 ++++ minerva/data/readers/__init__.py | 13 +++++++++++++ minerva/models/nets/__init__.py | 13 +++++++++++++ minerva/pipelines/__init__.py | 3 +++ 5 files changed, 35 insertions(+) diff --git a/minerva/analysis/metrics/__init__.py b/minerva/analysis/metrics/__init__.py index a42ffc9..4eba4f1 100644 --- a/minerva/analysis/metrics/__init__.py +++ b/minerva/analysis/metrics/__init__.py @@ -1 +1,3 @@ from .pixel_accuracy import PixelAccuracy + +__all__ = ["PixelAccuracy"] diff --git a/minerva/data/datasets/__init__.py b/minerva/data/datasets/__init__.py index e69de29..1b89ac6 100644 --- a/minerva/data/datasets/__init__.py +++ b/minerva/data/datasets/__init__.py @@ -0,0 +1,4 @@ +from base import SimpleDataset +from supervised_dataset import SupervisedReconstructionDataset + +__all__ = ["SimpleDataset", "SupervisedReconstructionDataset"] diff --git a/minerva/data/readers/__init__.py b/minerva/data/readers/__init__.py index e69de29..248069d 100644 --- a/minerva/data/readers/__init__.py +++ b/minerva/data/readers/__init__.py @@ -0,0 +1,13 @@ +from patched_array_reader import PatchedArrayReader +from png_reader import PNGReader +from reader import _Reader +from tiff_reader import TiffReader +from zarr_reader import PatchedZarrReader + +__all__ = [ + "PatchedArrayReader", + "PatchedZarrReader", + "PNGReader", + "TiffReader", + "_Reader", +] diff --git a/minerva/models/nets/__init__.py b/minerva/models/nets/__init__.py index e69de29..60aaa45 100644 --- a/minerva/models/nets/__init__.py +++ b/minerva/models/nets/__init__.py @@ -0,0 +1,13 @@ +from base import SimpleSupervisedModel +from deeplabv3 import DeepLabV3 +from setr import SETR_PUP +from unet import UNet +from wisenet import WiseNet + +__all__ = [ + "SimpleSupervisedModel", + "DeepLabV3", + "SETR_PUP", + "UNet", + "WiseNet", +] diff --git a/minerva/pipelines/__init__.py b/minerva/pipelines/__init__.py index e69de29..b781c4b 100644 --- a/minerva/pipelines/__init__.py +++ b/minerva/pipelines/__init__.py @@ -0,0 +1,3 @@ +from base import Pipeline + +__all__ = ["Pipeline"] From 53d5c4b4e1f95a68a610a392175c6475fbd8bcff Mon Sep 17 00:00:00 2001 From: Gabriel Gutierrez Date: Sun, 19 May 2024 19:40:11 -0300 Subject: [PATCH 2/3] chore: Refactor import statements for datasets, readers, and models --- minerva/data/datasets/__init__.py | 4 ++-- minerva/data/readers/__init__.py | 10 +++++----- minerva/models/nets/__init__.py | 10 +++++----- minerva/pipelines/__init__.py | 2 +- minerva/transforms/__init__.py | 2 ++ tests/data/datasets/test_simple_dataset.py | 3 ++- tests/data/readers/test_patched_array_reader.py | 2 +- tests/models/nets/test_setr.py | 2 +- tests/models/nets/test_unet.py | 6 +++--- 9 files changed, 22 insertions(+), 19 deletions(-) diff --git a/minerva/data/datasets/__init__.py b/minerva/data/datasets/__init__.py index 1b89ac6..3bf9c44 100644 --- a/minerva/data/datasets/__init__.py +++ b/minerva/data/datasets/__init__.py @@ -1,4 +1,4 @@ -from base import SimpleDataset -from supervised_dataset import SupervisedReconstructionDataset +from .base import SimpleDataset +from .supervised_dataset import SupervisedReconstructionDataset __all__ = ["SimpleDataset", "SupervisedReconstructionDataset"] diff --git a/minerva/data/readers/__init__.py b/minerva/data/readers/__init__.py index 248069d..ab97212 100644 --- a/minerva/data/readers/__init__.py +++ b/minerva/data/readers/__init__.py @@ -1,8 +1,8 @@ -from patched_array_reader import PatchedArrayReader -from png_reader import PNGReader -from reader import _Reader -from tiff_reader import TiffReader -from zarr_reader import PatchedZarrReader +from .patched_array_reader import PatchedArrayReader +from .png_reader import PNGReader +from .reader import _Reader +from .tiff_reader import TiffReader +from .zarr_reader import PatchedZarrReader __all__ = [ "PatchedArrayReader", diff --git a/minerva/models/nets/__init__.py b/minerva/models/nets/__init__.py index 60aaa45..2618877 100644 --- a/minerva/models/nets/__init__.py +++ b/minerva/models/nets/__init__.py @@ -1,8 +1,8 @@ -from base import SimpleSupervisedModel -from deeplabv3 import DeepLabV3 -from setr import SETR_PUP -from unet import UNet -from wisenet import WiseNet +from .base import SimpleSupervisedModel +from .deeplabv3 import DeepLabV3 +from .setr import SETR_PUP +from .unet import UNet +from .wisenet import WiseNet __all__ = [ "SimpleSupervisedModel", diff --git a/minerva/pipelines/__init__.py b/minerva/pipelines/__init__.py index b781c4b..d5fe143 100644 --- a/minerva/pipelines/__init__.py +++ b/minerva/pipelines/__init__.py @@ -1,3 +1,3 @@ -from base import Pipeline +from .base import Pipeline __all__ = ["Pipeline"] diff --git a/minerva/transforms/__init__.py b/minerva/transforms/__init__.py index 255bd2c..d1dc8c7 100644 --- a/minerva/transforms/__init__.py +++ b/minerva/transforms/__init__.py @@ -1 +1,3 @@ from .transform import Flip, PerlinMasker, TransformPipeline, _Transform + +__all__ = ["Flip", "PerlinMasker", "TransformPipeline", "_Transform"] diff --git a/tests/data/datasets/test_simple_dataset.py b/tests/data/datasets/test_simple_dataset.py index 042fb1c..f519293 100644 --- a/tests/data/datasets/test_simple_dataset.py +++ b/tests/data/datasets/test_simple_dataset.py @@ -1,6 +1,7 @@ import numpy as np import pytest -from minerva.data.datasets.base import SimpleDataset + +from minerva.data.datasets import SimpleDataset class _SimpleReader: diff --git a/tests/data/readers/test_patched_array_reader.py b/tests/data/readers/test_patched_array_reader.py index 425473a..4cc4eed 100644 --- a/tests/data/readers/test_patched_array_reader.py +++ b/tests/data/readers/test_patched_array_reader.py @@ -1,6 +1,6 @@ import numpy as np -from minerva.data.readers.patched_array_reader import PatchedArrayReader +from minerva.data.readers import PatchedArrayReader def test_patched_array_reader_no_stride_1(): diff --git a/tests/models/nets/test_setr.py b/tests/models/nets/test_setr.py index 0fbab6e..093f4de 100644 --- a/tests/models/nets/test_setr.py +++ b/tests/models/nets/test_setr.py @@ -1,7 +1,7 @@ import pytest import torch -from minerva.models.nets.setr import SETR_PUP +from minerva.models.nets import SETR_PUP def test_setr_loss(): diff --git a/tests/models/nets/test_unet.py b/tests/models/nets/test_unet.py index 916fe0a..275fc15 100644 --- a/tests/models/nets/test_unet.py +++ b/tests/models/nets/test_unet.py @@ -1,8 +1,8 @@ +import lightning as L import torch - -from minerva.models.nets.unet import UNet import torchmetrics -import lightning as L + +from minerva.models.nets import UNet from minerva.utils.data import RandomDataModule From 9445b39c878805c3e21f2c96ec3a7a3bd001bdeb Mon Sep 17 00:00:00 2001 From: Gabriel Gutierrez Date: Sun, 19 May 2024 19:41:01 -0300 Subject: [PATCH 3/3] chore: Refactor import statements for datasets, readers, and models --- tests/models/nets/test_wisenet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/models/nets/test_wisenet.py b/tests/models/nets/test_wisenet.py index 239c2e7..132f0ba 100644 --- a/tests/models/nets/test_wisenet.py +++ b/tests/models/nets/test_wisenet.py @@ -1,6 +1,6 @@ import torch -from minerva.models.nets.wisenet import WiseNet +from minerva.models.nets import WiseNet def test_wisenet_loss():