[Info Need]: Image Anomaly Detection in TensorFlow 2 or Keras?

I’ve been working on anomaly detection problems on industrial products. Most of the samples are images (a few are audio data and others). As we’re focusing on an engineering solution, we need a reliable toolbox or library initially.

I’ve found this, Anomalib, an amazing library and best suited for this task. It’s in PyTorch and provides state of an art approach to address this task. I was wondering if there is any well-known library in TensorFlow 2 or Keras?

Some of the models are

  • Patch-Core
  • FastFlow
  • PaDim

Note, that there might be one or two open-source implementations in tf/keras. But I am looking for something reliable and supported, so it can give me an opportunity to continue my work with them.

[Update: 28 April, 2022]: Added Resources: GitHub - yzhao062/anomaly-detection-resources: Anomaly detection related books, papers, videos, and toolboxes


I think that it could be interesting to extract/analyze if there are some missing components to compose these networks in Keras-cv and then add some models.

It seems that the main reference public dataset in the repository is MVTec.

Here we could find a partial list of papers, metrics and the reference implementations on this dataset:

Also, it could be also nice to contribute an adapter to this dataset, or any popular dataset in this specific domain, at:


MVTech is the first choice to benchmark. Here is another one, BeanTech : BTAD Dataset | Papers With Code

Yes a partial list of anomaly detection benchmarks with the related papers and reference implementations is available at:

1 Like

Would be great also to contribute these models to TensorFlow Hub if possible
With that, it would make very easy for other users to transfer learning and fine-tune them

1 Like

It could be nice if the TFHub team could coordinate more explicetly with the new repositories where we are collecting reusable components API to compose models.

I’ve mentioned directly TFHub at:

So I hope you could have an internal follow-up between teams.

1 Like

Will look into that! thanks for bringing it up!

1 Like

I make a request to add the MV-Tec dataset to TensorFlow-Dataset. If anyone is interested, please support to make it acceptable to the developers. :pray:

[Add Information]

I’ve just encountered interesting work on this problem from Google Cloud Research.

1 Like

I implemented PaDiM with TensorFlow. It works very well for anomaly detection.
During the process. I summarized the current trends in research on anomaly detection.
This slide will help you.

Trends in AI Visual Inspection 2022/06

Best regards,
S. Choe


It’s a very informative presentation.
Have you reproduced MV-TEC results with your implemented padim? And have you any intention to extend it and create an anomalib-like tensorflow/keras library?

1 Like

Implementing PaDim or PatchCore was accomplished with TensorFlow.
I did not use anomalib by Intel.

His work really helped me a lot. You should look at his nice work. (You can ignore all other repositries on PaDiM with Tensorflow. Some of them are written in wrong algorithm…)



1 Like

Thanks for the recommendation. Here is another repository that provides some anomaly detection models (though I haven’t tested them yet).

Mostly, I was looking for a robust and resourceful toolbox for anomaly detection. And the anomalib was a good fit. It’s written in pytorch-lighting.

1 Like

I have tried that repository but it did now work well in my PC.
However it has code how to convert Wide ResNet pretrained network from PyTorch to TensorFlow.
Please share your test results.

1 Like

I have tried that repository but it did not work well on my PC.

I made a starter notebook about anomalib library; you can find the link down below. I think, the results are satisfactory. Currently it provides around 10 anomaly detection models.

1 Like

Thanks so very much. It is really great.

1 Like

This will help you to understand how it works.

AI Anomaly Detection with DL Feature Extraction

1 Like

Thanks for sharing. It’s really cool.
I made a proposal to add an anomaly detection model to KerasCV (link below). If you want to contribute, you’re welcome.

1 Like