1
$\begingroup$

I’m trying to train an autoencoder on the hazelnut dataset of MVTec AD for reconstruction to detect anomalies.

I’m am trying to replicate the results of this study: https://arxiv.org/pdf/2008.12977.pdf

In particular, the simpler setup used in the study as reference, with features a simple AE model with no skip connection and no stain model. Just a plain 6 layer encoder and 6 layer decoder. The encoder layers have 16-32-64-128-256-512 filters, strided conv with kernel of 5, BatchNorm, and leakuRelu activation. The decoder have the same filter sizes, and have upsampling, conv (kernel=5), batchnorm, leakyRelu and sigmoid at the final layer. As in the paper, i’m using MSE as loss, Adam as optimizer (batch of 16) and i’m augmenting the input data with some cropping, rotations and flipping.

Although I feel like I have been doing what is described in the paper, my model is unable to learn any anything meaningful and only shows very rough and blurred white shadows for reconstruction:

hazelnuts originals and reconstructions

The code and my notebook is available here : Jupyter Notebook Viewer

I don’t get what I am doing wrong here, I know that some things could improve the situation (e.g. using SSIM as loss), but I’m more interested in achieving the results of the paper ( 0.9 AUC% in the setup ). Do you have any idea what could be wrong ?

$\endgroup$
3
  • $\begingroup$ Hi, just brushed over your code and wanted to mention that I don't see any standardizations on the images. When you perform the augmentations, before that we usually normalize images (pixel values) to be in the range [0, 1]; Is it done already? $\endgroup$
    – Suvo
    Commented Nov 7, 2023 at 7:28
  • $\begingroup$ Hi, thx for your comment, yes, it is done with the ToTensor transform that automatically turns the images into (0,1) tensors. At the end, i think this behavior and quality of reconstruction is normal, considering the size of my latent space. $\endgroup$
    – JeanMi
    Commented Nov 9, 2023 at 10:32
  • $\begingroup$ If it is too large which I think is in your case, it could be a problem. Here I found a similar thread [ai.stackexchange.com/questions/37272/… $\endgroup$
    – Suvo
    Commented Nov 9, 2023 at 12:42

0

You must log in to answer this question.