Skip to content

anomaly

draem()

Yield a draem model.

Source code in quadra/utils/tests/fixtures/models/anomaly.py
67
68
69
70
@pytest.fixture
def draem():
    """Yield a draem model."""
    yield DraemModel()

efficient_ad_small()

Yield a draem model.

Source code in quadra/utils/tests/fixtures/models/anomaly.py
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
@pytest.fixture
def efficient_ad_small():
    """Yield a draem model."""

    class EfficientAdForwardWrapper(EfficientAdModel):
        """Wrap the forward method to avoid passing optional parameters."""

        def forward(self, x):
            return super().forward(x, None)

    model = EfficientAdForwardWrapper(
        teacher_out_channels=384,
        input_size=[256, 256],  # TODO: This is hardcoded may be not a good idea
        pretrained_teacher_type="nelson",
    )

    yield model

padim_resnet18()

Yield a padim model with resnet18 encoder.

Source code in quadra/utils/tests/fixtures/models/anomaly.py
 9
10
11
12
13
14
15
16
17
18
19
@pytest.fixture
def padim_resnet18():
    """Yield a padim model with resnet18 encoder."""
    yield PadimModel(
        input_size=[224, 224],  # TODO: This is hardcoded may be not a good idea
        backbone="resnet18",
        layers=["layer1", "layer2", "layer3"],
        pretrained_weights=None,
        tied_covariance=False,
        pre_trained=False,
    )

patchcore_resnet18()

Yield a patchcore model with resnet18 encoder.

Source code in quadra/utils/tests/fixtures/models/anomaly.py
54
55
56
57
58
59
60
61
62
63
64
@pytest.fixture
def patchcore_resnet18():
    """Yield a patchcore model with resnet18 encoder."""
    model = PatchcoreModel(
        input_size=[224, 224],  # TODO: This is hardcoded may be not a good idea
        backbone="resnet18",
        layers=["layer2", "layer3"],
        pre_trained=False,
    )

    yield _initialize_patchcore_model(model)