Anomalib: A Look Inside the Mind Behind the Library

OpenVINO™ toolkit
OpenVINO-toolkit
Published in
9 min readMar 25, 2024

Author: Paula Ramos — Intel AI Evangelist

Anomaly detection is becoming an essential tool across industries to identify and respond to unusual events in an effective and timely manner. For example, in manufacturing, defect detection is used to improve quality control and quality assurance. In healthcare, it can be used to identify anomalies easily and early in patient scans. And in retail, it could be used for inventory management — detecting misplaced items or identifying slow-moving products.

To accurately perform anomaly detection, many developers have turned to the open-source deep learning library Anomalib, which offers numerous ready-to-use implementations to assist developers.

Paula Ramos, AI Evangelist at Intel, recently had the opportunity to sit down and talk to Samet Akcay, AI Research Engineer and Scientist at Intel and owner of the Anomalib repository, to learn more about the library and how it is helping developers.

Here are some snippets from their conversation:

Paula Ramos: Hi Samet, it’s great to connect with you. You have such an impressive background, I thought we could start off learning more about yourself.

Samet Akcay: Absolutely. I joined Intel in 2020, and today, I currently work as an AI Research Engineer and Scientist at the company, which is kind of a dual role. As an AI Research Engineer and Scientist, I engage in research and development activities, which can either result in academic publications or the development of tangible products. My work spans across several projects and products such as Anomalib, OpenVINO™ training extensions, and Intel® Geti™.

It’s a broad spectrum with wide responsibilities that allow me to collaborate with multiple teams across Intel.

Paula Ramos: It certainly sounds like you have quite a few responsibilities. I’m interested in learning a little bit more about your background and how you got started in AI.

Samet Akcay: Before joining Intel, I was a deep learning engineer for the company COSMONiO, which was acquired by Intel in 2020. There, I worked on anomaly detection tasks for the platform. For those who don’t know, the platform actually serves as one of the foundations of the innovative Geti platform.

But before that, I was on the academic path in this industry. I completed my PhD in computer science at Durham University in the UK, and I received a master’s degree in electrical engineering from Penn State in the US.

Paula Ramos: You mentioned you were already working on anomaly detection before joining Intel, and I know that work led to the start of Anomalib. What more can you tell us about that?

Samet Akcay: There were many challenges my team members and I faced during the research and development phase of anomaly detection — both in academia and in industry. Part of the problem was the complexity of implementing anomaly detection algorithms, either for research purposes or production purposes, due to the lack of useful libraries available. So, we noticed there was a clear gap in this field and an opportunity for us, with this great team, to fill that gap. That’s initially how Anomalib got started.

Paula Ramos: What is the value you and your team were trying to bring to the developer community?

Samet Akcay: Well, those who know me know I’m obsessed with simplicity and user-friendly product development.

The primary mission of Anomalib is to make anomaly detection more accessible and user-friendly without compromising on performance. It is designed to be super simple and user-friendly for whoever uses it. Whether you are a researcher or practitioner, with the library you can quickly get up to speed and easily design new anomaly detection models or leverage existing anomaly detection models in your system. This is what differentiates Anomalib from the other libraries.

Our main focus is to support both research and industry. We have a motto: from data to deployment. That means we cover the entire workflow. We provide comprehensive documentation and a plug-and-play approach to the entire workflow.

Paula Ramos: What were some of the challenges you and your team faced when developing Anomalib, and do you have any insight into how you overcame those challenges?

Samet Akcay: There are too many challenges to count. Our secret sauce to navigating through the challenges is having a “gelled team,” which comes from the book Clean Coder by Uncle Bob Martin. I would advise any developer, coder, or professional to check out that book to learn more.

But essentially, a gelled group is the evolution of a group of individuals into a cohesive unit. It is all about team members taking the time to really understand each other’s skill sets and motivations and how that translates into a solid working relationship. Once a team is gelled, the idea is they can effortlessly anticipate and support one another.

With all the challenges we had in Anomalib — all the way from data to designing data modules like the CLI and API and integrating all that back to OpenVINO training extensions — we were able to overcome and tackle them by having this gelled team. The gelled team in Anomalib is made up of three core engineers that have achieved remarkable milestones.

Paula Ramos: That is amazing to hear, especially when you consider the management, training, and deployment of the end-to-end library. How does Anomalib ensure its scalability and performance within the computer vision community?

Samet Akcay: Overall, Anomalib aims to deliver tailored solutions to specific use cases. The library itself includes a number of models that are optimized for different scenarios.

For example, if a user wants to handle large data sets, there are certain models in Anomalib that are specifically designed to maintain those performances at scale, but of course they come with a price such as longer training times.

On the other hand, there are some models that offer fast training, so users can train them very quickly within a couple of minutes. Although they might encounter some memory constraints with larger data sets. It’s a tradeoff between what users are trying to accomplish and the model they choose.

If a user wants to train a model quickly within a minute or two, they can choose the Padim model. But if their goal is to achieve high performance, they can go with Patchcore. But if they want to train the same model on a larger dataset, they may get an out-of-memory issue since these are memory-based models. In this case, they can train an EfficientAD model, but this often takes some time to train. It all depends on what the user wants.

Paula Ramos: What has been the computer vision community’s reaction to Anomalib, and how does it continue to grow?

Samet Akcay: I think the computer vision community has received Anomalib with great interest. The feedback has been overwhelmingly positive since its very first day. We have had tremendous growth since we released the library in February 2022, published our first paper, and open sourced it to the world.

If you look at the project’s star history, there’s exponential growth. We reached 500 stars in just a couple of days, the project was trending on GitHub Trends for quite a while, and we were featured on Papers with Code trends.

After we reached 1K stars, we steadily increased to almost 3.1K today.

Paula Ramos: Because it is open source, I imagine there is quite a lot of community collaboration that is going on.

Samet Akcay: Yes, the community contributes in many different ways. Some small ways are through documentation improvements and updating broken links. But then there are some critical bug fixes the community has contributed to as well.

Community contributors can create an issue or pull request, discuss it among one another, and propose changes. It’s unbelievably satisfying to see the amount of contribution coming from the developer community.

And that interest and uptake have led to other community news. For instance, we were recently accepted into the PyTorch Ecosystem, meaning more exposure for Anomalib on PyTorch’s project websites and blogs.

Paula: Congratulations. That is amazing to hear. For those who are new to anomaly detection, how would you advise them to get started?

Samet Akcay: Through the Anomalib project, we try to make the documentation tutorials and Jupyter Notebooks as beginner-friendly as possible. I would recommend beginning with those to lay the foundations of visual anomaly detection.

There are also issue channels and discussion channels with a number of commonly asked questions and answers, enabling developers to quickly get up to speed.

For developers who want to dive deeper into the details, they can read various papers in the library and theoretical foundations.

I usually recommend a top-down approach, which is originally proposed by Jeremy Howard, cofounder of fast.ai and answer.ai. With this approach, you start with a simple example and run a Python script or Jupyter Notebook to see how it works and get an understanding of the input and output. From there, you can slowly get into more details.

Paula Ramos: Are there any ethical considerations developers should be aware of when using Anomalib?

Samet Akcay: Anomalib is a powerful tool, and we need to ensure that all use of Anomalib complies with the relevant data protection and privacy laws. One thing we do within the project is commit ourselves to the transparency of our models so users can understand how decisions are made. This idea of explainable AI is crucial for accountability.

We are also working on some new performance metrics to ensure that all the decisions made by the model are valid, understandable, and explainable — not only to meet technical standards but also to build trust and accountability.

In addition, we continue to engage in ongoing dialogue with experts around ethics and security to keep our standards up to date with the latest considerations in AI.

Paula Ramos: That’s great to hear. Going forward, what else can users expect from Anomalib?

Samet Akcay: Well, Anomalib 1.0 has already been released. We worked really hard to make that happen.

Starting with version 1.X, users will gain access to a highly adaptable API, which will not only simplify the customization of Anomalib’s current feature but also pave the way for the integration of new functionalities and capabilities.

We released a completely new CLI, which will streamline the entire anomaly detection workflow — all the way from data to deployment. This new and intuitive CLI will cater to all users at all levels of expertise, from beginners to power users.

And as interest in generative AI continues to rise, we have also seen an interest in zero-shot and few-shot learning within the community vision community. So with version 1.0, we enabled these learning types in Anomalib. This means users will basically be able to use Anomalib detection models without training. We recently integrated a zero-shot/few-shot model called WinClip. It was published in CVPR last year and is now integrated into Anomalib. It is already part of the 1.0 release and will become OpenVINO compatible quite soon.

Paula Ramos: Lots to look forward to! Before I let you go, are there any final thoughts you want to leave for young developers or researchers looking to make a mark in the computer vision field?

Samet Akcay: The pace of AI is unbelievable. It sounds like it’s impossible to keep up with, but I always say, dive in headfirst with the problem that fascinates you. It’s like the top-down approach; start with the big picture and let your natural curiosity pull you deeper into the specifics as you go.

As you get deeper, you can start learning about how the internals work and go deeper into the lower-level details.

And, of course, let’s not forget about the power of contribution, especially within open source projects. Engage with the community even if it is as small as fixing a broken link in the documentation. Every contribution counts.

Additional Resources:

Defect Detection with Anomalib and the OpenVINO™ Toolkit

Code Demo: Defect Detection with Anomalib Edge AI Reference Kit

Anomalib: A Deep Learning Library for Anomaly Detection

About Paula Ramos:

Paula is an AI Evangelist at Intel. She has been an AI enthusiast and has worked in the computer vision field since the early 2000s. Follow her on Medium for more insights.

Notices & Disclaimers

Intel technologies may require enabled hardware, software, or service activation.

No product or component can be absolutely secure.

Your costs and results may vary.

© Intel Corporation. Intel, the Intel logo, and other Intel marks are trademarks of Intel Corporation or its subsidiaries. Other names and brands may be claimed as the property of others.

--

--

OpenVINO™ toolkit
OpenVINO-toolkit

Deploy high-performance deep learning productively from edge to cloud with the OpenVINO™ toolkit.