Skip to content

Commit

Permalink
Remove all references of Draem
Browse files Browse the repository at this point in the history
Signed-off-by: Ashwin Vaidya <ashwinnitinvaidya@gmail.com>
  • Loading branch information
ashwinvaidya17 committed Apr 15, 2024
1 parent b259858 commit c094b8b
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 24 deletions.
22 changes: 0 additions & 22 deletions docs/source/guide/explanation/algorithms/anomaly/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -157,25 +157,3 @@ For more information on STFPM's training. We invite you to read Anomalib's `STFP
Reconstruction-based Models
---------------------------
These models initially extract features from a CNN or transformer and subsequently reconstruct the input image. The anomaly score is then calculated as the distance between the input image and the reconstructed image. OpenVINO Training Extensions currently supports `DRÆM – A discriminatively trained reconstruction embedding for surface anomaly detection <https://arxiv.org/pdf/2108.07610v2.pdf>`_.

DRÆM
^^^^

.. figure:: ../../../../../utils/images/draem.png
:width: 600
:align: center
:alt: Anomaly Task Types

A reconstruction-based algorithm, DRAEM consists of a reconstructive subnetwork and a discriminative subnetwork. DRAEM is trained on simulated anomaly images, which are produced by combining normal input images from the training set with a random Perlin noise mask extracted from an unrelated source of image data. The reconstructive subnetwork is an autoencoder trained to reconstruct the original input images from the augmented images. Combining L2 loss and structural similarity loss, the reconstructive submodel is trained. The input of the discriminative subnetwork is the channel-by-channel concatenation of the (augmented) input image and the output of the reconstructive subnetwork. The output of the discriminative subnetwork is an anomaly map containing the predicted anomaly scores for each pixel.

Training Parameters
~~~~~~~~~~~~~~~~~~~~

- ``Enable SSPCAB``: The default value is ``False``. If set to ``True``, the model will use the SSPCAB block.
- ``SSPCAB Lambda``: The default value is ``0.1``. This parameter is used to control the trade-off between the self-supervised reconstruction loss and the training loss.
- ``Anomaly Source Path``: The default value is ``None``. This parameter is used to specify the path to the anomaly source images.
- ``Beta``: Parameter that determines the opacity of the noise mask. The default is (0.1, 1.0).
- ``Optimizer``: Both the reconstructive subnetwork and the discriminative subnetwork are trained using the Adam optimizer.
- ``Loss``: The reconstructive subnetwork is trained using reconstruction loss which consists of a combination of L2 loss and Structural Similarity (SSIM) loss between the reconstructions and the original images. The discriminative subnetwork is trained using focal loss, computed between the pixel-level predictions and the ground truth masks of the augmented images.
- ``Additional Training Techniques``:
- ``Early Stopping``: Early stopping is used to prevent overfitting. The early stopping patience can be configured by the user. By default, early stopping is enabled with a patience of 20 epochs.
Binary file removed docs/utils/images/draem.png
Binary file not shown.
4 changes: 2 additions & 2 deletions tests/unit/algo/anomaly/test_otx_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import pytest
import torch
from otx.algo.anomaly.draem import Draem

from otx.algo.anomaly.padim import Padim
from otx.algo.anomaly.stfpm import Stfpm
from otx.core.data.entity.anomaly import (
Expand Down Expand Up @@ -62,7 +62,7 @@ def _get_batch(self, task: OTXTaskType) -> AnomalyModelInputs:
)
return batch

@pytest.mark.parametrize("model", [Draem, Padim, Stfpm])
@pytest.mark.parametrize("model", [Padim, Stfpm])
def test_model_instantiation(self, model):
"""Test if the model can be instantiated."""
anomaly_model = model()
Expand Down

0 comments on commit c094b8b

Please sign in to comment.