mirror of
https://github.com/hanzoai/anomalib.git
synced 2026-10-30 18:48:11 +00:00
The previous commit was meant to remove .github/workflows and removed every tracked path instead — 892 files, the whole repo. This puts back the 874 that were never in scope; the eighteen workflow files stay gone, for the reasons that commit gives. Content is byte-identical to 9d2aec9 outside .github/workflows.
60 lines
1.8 KiB
Python
60 lines
1.8 KiB
Python
"""Unit Tests - Folder3D Datamodule."""
|
|
|
|
# Copyright (C) 2023-2024 Intel Corporation
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
from torchvision.transforms.v2 import Resize
|
|
|
|
from anomalib.data import Folder3D
|
|
from tests.unit.data.datamodule.base.depth import _TestAnomalibDepthDatamodule
|
|
|
|
|
|
class TestFolder3D(_TestAnomalibDepthDatamodule):
|
|
"""Folder3D Datamodule Unit Tests."""
|
|
|
|
@pytest.fixture()
|
|
@staticmethod
|
|
def datamodule(dataset_path: Path) -> Folder3D:
|
|
"""Create and return a Folder 3D datamodule."""
|
|
_datamodule = Folder3D(
|
|
name="dummy",
|
|
root=dataset_path / "mvtec_3d/dummy",
|
|
normal_dir="train/good/rgb",
|
|
abnormal_dir="test/bad/rgb",
|
|
normal_test_dir="test/good/rgb",
|
|
mask_dir="test/bad/gt",
|
|
normal_depth_dir="train/good/xyz",
|
|
abnormal_depth_dir="test/bad/xyz",
|
|
normal_test_depth_dir="test/good/xyz",
|
|
train_batch_size=4,
|
|
eval_batch_size=4,
|
|
num_workers=0,
|
|
augmentations=Resize((256, 256)),
|
|
)
|
|
_datamodule.prepare_data()
|
|
_datamodule.setup()
|
|
|
|
return _datamodule
|
|
|
|
@pytest.fixture()
|
|
@staticmethod
|
|
def fxt_data_config_path() -> str:
|
|
"""Return the path to the test data config."""
|
|
return "examples/configs/data/folder_3d.yaml"
|
|
|
|
@staticmethod
|
|
def test_datamodule_from_config(fxt_data_config_path: str) -> None:
|
|
"""Test method to create a datamodule from a configuration file.
|
|
|
|
Args:
|
|
fxt_data_config_path (str): The path to the configuration file.
|
|
|
|
Returns:
|
|
None
|
|
"""
|
|
pytest.skip("The configuration file does not exist.")
|
|
_ = fxt_data_config_path
|