{"id":4053,"date":"2022-10-10T13:28:58","date_gmt":"2022-10-10T21:28:58","guid":{"rendered":"https:\/\/live-cometml.pantheonsite.io\/?p=4053"},"modified":"2025-04-29T14:07:59","modified_gmt":"2025-04-29T14:07:59","slug":"powering-anomaly-detection-for-industry-4-0","status":"publish","type":"post","link":"https:\/\/www.comet.com\/site\/blog\/powering-anomaly-detection-for-industry-4-0\/","title":{"rendered":"Powering Anomaly Detection for Industry\u00a04.0"},"content":{"rendered":"\n<h3 class=\"wp-block-heading graf graf--h3\">What is Industry&nbsp;4.0?<\/h3>\n\n\n\n<p><span style=\"font-weight: 400;\">You\u2019ve probably heard the buzz: Industry 4.0 is revolutionizing the way companies manufacture, develop and distribute their products. But, what exactly is Industry 4.0? <\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">To understand the Fourth Industrial Revolution, it helps to remember the first three.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\"> The First Industrial Revolution began at the end of the 18th century and focused on mechanizing industrial processes. The Second Industrial Revolution introduced electrification, and the Third Industrial Revolution championed automatization. Each of these periods focused on reducing human intervention in industry, but what\u2019s left once factories are mechanized, electrified, and automated? The Fourth Industrial Revolution is all about harnessing the power of data and leveraging it to simulate cognition in industry. <\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">More than anything, <\/span><span style=\"font-weight: 400;\">Industry 4.0 is a paradigm shift in the way we organize and manage industrial processes to make the most of cyber-physical systems. <\/span><span style=\"font-weight: 400;\">These smart manufacturing processes include artificial intelligence, machine learning, cloud- and edge-computing, Industrial IoT, distributed computing, augmented reality, and much, much more.<\/span><\/p>\n\n\n\n<h3 class=\"wp-block-heading graf graf--h3\">What is Anomaly Detection?<\/h3>\n\n\n\n<p><span style=\"font-weight: 400;\">One of the most popular ways that artificial intelligence is being incorporated into industrial manufacturing is through automated defect detection or anomaly detection. Anomaly detection is the process of identifying anomalous items in a stream of input data and is a critical component of quality assurance in any production line. <\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">Traditional manual defect detection methods are not only expensive and time-consuming but can also often be ineffective, as not all anomalies are visible to the human eye. However, with the advent of machine learning, computer vision can be leveraged to facilitate human operator work\u2013 or even completely automate this process!<\/span><\/p>\n\n\n\n<h3 class=\"wp-block-heading graf graf--h3\">Challenges of Anomaly Detection<\/h3>\n\n\n\n<p class=\"graf graf--p\">Anomaly detection faces several unique challenges. It\u2019s often difficult to obtain a large amount of anomalous data, making traditional supervised learning techniques impractical. These class imbalances also mean that popular evaluation metrics like accuracy aren\u2019t relevant.<\/p>\n\n\n\n<p class=\"graf graf--p\">Furthermore, the difference between a normal sample and an anomalous one can be microscopic. It isn&#8217;t always feasible to predefine all types of anomalies at the outset of an experiment. Fortunately, to address each of these challenges and more, a team of artificial intelligence researchers at Intel have developed a cutting-edge, easy-to-implement, open-source package called Anomalib.<\/p>\n\n\n\n<h3 class=\"wp-block-heading graf graf--h3\">What is Anomalib?<\/h3>\n\n\n\n<p class=\"graf graf--p\">Anomalib is an open-source deep learning library developed by Intel that makes it easy to benchmark different anomaly detection algorithms on both public and custom datasets, all by simply modifying a config file. As the largest public collection of anomaly detection algorithms and datasets, it has a strong focus on image-based anomaly detection. It\u2019s a comprehensive, end-to-end solution that includes cutting-edge algorithms, relevant evaluation methods, prediction visualizations, hyperparameter optimization, and inference deployment code with Intel\u2019s OpenVINO Toolkit.<\/p>\n\n\n\n<p class=\"graf graf--p\"><span style=\"font-weight: 400;\">Anomalib uses unsupervised ML techniques to learn an implicit representation of normality with AutoEncoders, GANs, or a combination of both. During inference, new samples are compared against the embeddings of normal samples to determine whether or not they are anomalous. In this way, Anomalib allows you to save your sparse anomalous data for testing purposes only. It currently supports <\/span><a href=\"https:\/\/openvinotoolkit.github.io\/anomalib\/reference_guide\/algorithms\/index.html\"><span style=\"font-weight: 400;\">ten cutting-edge anomaly detection models<\/span><\/a><span style=\"font-weight: 400;\">, including <\/span><a href=\"https:\/\/openvinotoolkit.github.io\/anomalib\/reference_guide\/algorithms\/fastflow.html\"><span style=\"font-weight: 400;\">FastFlow<\/span><\/a><span style=\"font-weight: 400;\">, <\/span><a href=\"https:\/\/openvinotoolkit.github.io\/anomalib\/reference_guide\/algorithms\/padim.html\"><span style=\"font-weight: 400;\">PaDiM<\/span><\/a><span style=\"font-weight: 400;\">, <\/span><a href=\"https:\/\/openvinotoolkit.github.io\/anomalib\/reference_guide\/algorithms\/patchcore.html\"><span style=\"font-weight: 400;\">PatchCore<\/span><\/a><span style=\"font-weight: 400;\">, and <\/span><a href=\"https:\/\/openvinotoolkit.github.io\/anomalib\/reference_guide\/algorithms\/cflow.html\"><span style=\"font-weight: 400;\">CFlow<\/span><\/a><span style=\"font-weight: 400;\"> models, but is also continuously updated with the latest state-of-the-art algorithms. You can also <\/span><a href=\"https:\/\/openvinotoolkit.github.io\/anomalib\/how_to_guides\/train_custom_data.html\"><span style=\"font-weight: 400;\">train models with custom data<\/span><\/a><span style=\"font-weight: 400;\"> or access public datasets like the MVTec or BeanTech <\/span><a href=\"https:\/\/openvinotoolkit.github.io\/anomalib\/how_to_guides\/notebooks\/100_datamodules\/102_mvtec.html\"><span style=\"font-weight: 400;\">datasets through the API<\/span><\/a><span style=\"font-weight: 400;\">. What\u2019s best, Anomalib makes end-to-end anomaly detection possible straight out-of-the-box, and without additional GPUs or super long training times.<\/span><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Why Anomalib?<\/h3>\n\n\n\n<p><span style=\"font-weight: 400;\">Anomalib can do more than just support POC projects, however. In the real world, machine learning is a highly iterative process, and the details of all these iterations can get pretty confusing, pretty fast. <\/span><span style=\"font-weight: 400;\">To optimize your model and get it production-ready, you\u2019ll need to log, manage, and version these details in an experiment tracking tool like Comet. <\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">By pairing Anomalib with Comet, you can take advantage of all of the cutting-edge models of Anomalib, keep track of your model iterations with Comet, and then implement them in a production environment with Comet\u2019s model management tools. In these ways, Anomalib and Comet make the perfect pair to power production-grade anomaly detection for Industry 4.0!<\/span><\/p>\n\n\n\n<h3 class=\"wp-block-heading graf graf--h3\">Anomalib + Comet for Anomaly Detection<\/h3>\n\n\n\n<p class=\"graf graf--p\">Comet is a powerful tool that allows you to <a href=\"https:\/\/www.comet.com\/site\/products\/artifacts-dataset-management\/\">manage and version your training data<\/a>, <a class=\"markup--anchor markup--p-anchor\" href=\"https:\/\/www.comet.com\/site\/products\/ml-experiment-tracking\/\" target=\"_blank\" rel=\"noopener\" data-href=\"https:\/\/www.comet.com\/site\/products\/ml-experiment-tracking\/\">track and compare training runs<\/a>, and <a class=\"markup--anchor markup--p-anchor\" href=\"https:\/\/www.comet.com\/site\/products\/model-production-monitoring\/\" target=\"_blank\" rel=\"noopener\" data-href=\"https:\/\/www.comet.com\/site\/products\/model-production-monitoring\/\">monitor your models in production<\/a>\u200a\u2014\u200aall in one platform. And now Comet is fully integrated with Anomalib for experiment management, benchmarking, and hyperparameter optimization!<\/p>\n\n\n\n<p class=\"graf graf--p\">The Comet + Anomalib integration offers the following features:<\/p>\n\n\n\n<ul class=\"wp-block-list postList\">\n<li>Autologging and custom logging of experiment- and project-level metrics and features, including system metrics, hyperparameters, graph definition, evaluation metrics, and more.<\/li>\n\n\n\n<li>Organize your project-level dashboard with <a class=\"markup--anchor markup--li-anchor\" data-href=\"https:\/\/www.comet.com\/docs\/v2\/guides\/comet-dashboard\/code-panels\/about-panels\/\" href=\"https:\/\/www.comet.com\/docs\/v2\/guides\/comet-dashboard\/code-panels\/about-panels\/\" target=\"_blank\" rel=\"noopener\">Comet\u2019s custom panels<\/a> for an overview that tailors to your team\u2019s specific needs.<\/li>\n\n\n\n<li><a class=\"markup--anchor markup--li-anchor\" data-href=\"https:\/\/www.comet.com\/site\/blog\/introducing-comets-new-image-panel\/\" href=\"https:\/\/www.comet.com\/site\/blog\/introducing-comets-new-image-panel\/\" target=\"_blank\" rel=\"noopener\">[New!] Image Panels<\/a> allow you to compare your images across different experiments and throughout different steps. Search for individual images and showcase selected images across individual experiment runs.<\/li>\n\n\n\n<li>Log benchmarked results to Comet as a means to track model drift.<\/li>\n\n\n\n<li>Isolate the best hyperparameters with HPO powered by the <a class=\"markup--anchor markup--li-anchor\" data-href=\"https:\/\/www.comet.com\/docs\/v2\/api-and-sdk\/python-sdk\/introduction-optimizer\/\" href=\"https:\/\/www.comet.com\/docs\/v2\/api-and-sdk\/python-sdk\/introduction-optimizer\/\" target=\"_blank\" rel=\"noopener\">Comet Optimizer<\/a>.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><a href=\"https:\/\/www.comet.com\/sherpan\/mvtec\/77680f1fce014070ac3f5aac2a4e55ed?experiment-tab=chart&amp;showOutliers=true&amp;smoothing=0&amp;transformY=smoothing&amp;xAxis=step\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"1896\" height=\"920\" src=\"https:\/\/www.comet.com\/site\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-03-at-8.06.10-PM.png\" alt=\"Auto-logged experiment-level charts of anomaly detection experiment with Comet + Anomalib for Industry 4.0\" class=\"wp-image-4054\" srcset=\"https:\/\/www.comet.com\/site\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-03-at-8.06.10-PM.png 1896w, https:\/\/www.comet.com\/site\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-03-at-8.06.10-PM-300x146.png 300w, https:\/\/www.comet.com\/site\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-03-at-8.06.10-PM-1024x497.png 1024w, https:\/\/www.comet.com\/site\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-03-at-8.06.10-PM-768x373.png 768w, https:\/\/www.comet.com\/site\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-03-at-8.06.10-PM-1536x745.png 1536w\" sizes=\"auto, (max-width: 1896px) 100vw, 1896px\" \/><\/a><figcaption class=\"wp-element-caption\">Auto-logged experiment-level charts<\/figcaption><\/figure>\n\n\n\n<h4 class=\"wp-block-heading graf graf--h4\">Logging<\/h4>\n\n\n\n<h5 class=\"wp-block-heading\">Experiment-level<\/h5>\n\n\n\n<p class=\"graf graf--p\">In single-experiment view, Comet logs appropriate evaluation metrics in both tabular and chart form. By definition, anomaly detection is a problem of class imbalances, and this makes for poor performance with traditional ML metrics like accuracy, which are designed around an assumption of balanced class distribution.<\/p>\n\n\n\n<p class=\"graf graf--p\">Instead, Anomalib + Comet calculates the F1 score and AUROC at both image and pixel levels. The F1 score combines precision and recall into a single metric by taking their harmonic mean, while still accounting for the precision-recall tradeoff. The AUROC curve describes how well a model can distinguish between classes by plotting a probability curve at various thresholds, or degrees of separability, and is another very important metric for evaluating classification problems with class imbalances.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><a href=\"https:\/\/www.comet.com\/sherpan\/mvtec\/archive\/70e20d4b28104cde83e72ba393e39f67?experiment-tab=images&amp;imageId=8d26527b8d424d6c8931100f5f8af591\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"1770\" height=\"535\" src=\"https:\/\/www.comet.com\/site\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-03-at-8.20.32-PM.png\" alt=\"Experiment-level graphics of an example of a broken bottle from the MVTec dataset in an anomaly detection experiment using Comet + Anomalib for Industry 4.0\" class=\"wp-image-4056\" srcset=\"https:\/\/www.comet.com\/site\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-03-at-8.20.32-PM.png 1770w, https:\/\/www.comet.com\/site\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-03-at-8.20.32-PM-300x91.png 300w, https:\/\/www.comet.com\/site\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-03-at-8.20.32-PM-1024x310.png 1024w, https:\/\/www.comet.com\/site\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-03-at-8.20.32-PM-768x232.png 768w, https:\/\/www.comet.com\/site\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-03-at-8.20.32-PM-1536x464.png 1536w\" sizes=\"auto, (max-width: 1770px) 100vw, 1770px\" \/><\/a><figcaption class=\"wp-element-caption\">Experiment-level graphics of an example of a broken bottle<\/figcaption><\/figure>\n\n\n\n<p class=\"graf graf--p\">But that\u2019s not all! Scrolling through the left-hand sidebar of the single-experiment view, you\u2019ll find that quite a few metrics and features are automatically logged for you! Basic contextual information like source code, system metrics, installed packages, and output are all logged. Experiment-specific hyperparameters, metrics, and graph definitions are also auto-logged, and with a simple edit to the Anomalib config file, you can also log images and other graphics to Comet. <span style=\"font-weight: 400;\">Keeping track of all these metrics is essential for producing production-ready models and monitoring them for concept and data drift.&nbsp; <\/span><\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><a href=\"https:\/\/www.comet.com\/sherpan\/mvtec\/77680f1fce014070ac3f5aac2a4e55ed?experiment-tab=params\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"1903\" height=\"911\" src=\"https:\/\/www.comet.com\/site\/wp-content\/uploads\/2022\/10\/hyperparameters-anomalib.gif\" alt=\"Auto-logged experiment-level hyperparameter tracking using Comet + Anomalib for Industry 4.0\" class=\"wp-image-4057\"\/><\/a><figcaption class=\"wp-element-caption\">Auto-logged experiment-level hyperparameter tracking<\/figcaption><\/figure>\n\n\n\n<h5 class=\"wp-block-heading\">Project-level<\/h5>\n\n\n\n<p class=\"graf graf--p\">In the panel-level view, you\u2019ll see charts automatically populated with performance metrics for a bird\u2019s eye view of your project across experiment runs. You can also add Comet\u2019s new Image Panels to this view to visualize specific prediction images across different experiments, as shown below:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><a href=\"https:\/\/www.comet.com\/sherpan\/mvtec\/view\/NHQvFHshwKmTfdOdmtixHmv6G\/panels\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"1915\" height=\"966\" src=\"https:\/\/www.comet.com\/site\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-03-at-7.59.35-PM.png\" alt=\"Project-level line charts of an anomaly detection experiment with Comet + Anomalib for Industry 4.0\" class=\"wp-image-4059\" srcset=\"https:\/\/www.comet.com\/site\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-03-at-7.59.35-PM.png 1915w, https:\/\/www.comet.com\/site\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-03-at-7.59.35-PM-300x151.png 300w, https:\/\/www.comet.com\/site\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-03-at-7.59.35-PM-1024x517.png 1024w, https:\/\/www.comet.com\/site\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-03-at-7.59.35-PM-768x387.png 768w, https:\/\/www.comet.com\/site\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-03-at-7.59.35-PM-1536x775.png 1536w\" sizes=\"auto, (max-width: 1915px) 100vw, 1915px\" \/><\/a><figcaption class=\"wp-element-caption\">Project-level line charts<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image aligncenter wp-image-4060 size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1007\" height=\"603\" src=\"https:\/\/www.comet.com\/site\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-03-at-8.02.16-PM.png\" alt=\"Project-level image panel of anomaly detection experiment with Comet + Anomalib for Inudstry 4.0\" class=\"wp-image-4060\" srcset=\"https:\/\/www.comet.com\/site\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-03-at-8.02.16-PM.png 1007w, https:\/\/www.comet.com\/site\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-03-at-8.02.16-PM-300x180.png 300w, https:\/\/www.comet.com\/site\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-03-at-8.02.16-PM-768x460.png 768w\" sizes=\"auto, (max-width: 1007px) 100vw, 1007px\" \/><figcaption class=\"wp-element-caption\">Project-level image panel<\/figcaption><\/figure>\n\n\n\n<p class=\"graf graf--p\">Lastly, it can be really important to see how things are shaping up between two specific experiment runs. Comet allows you to <a href=\"https:\/\/www.comet.com\/site\/blog\/how-to-compare-two-or-more-experiments-in-comet\/\">diff selected runs<\/a> for a more cross-sectional view of your project. This also allows you to compare specific metrics and parameters:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter wp-image-4061 size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1903\" height=\"911\" src=\"https:\/\/www.comet.com\/site\/wp-content\/uploads\/2022\/10\/exp_diffing-anomalib.gif\" alt=\"Diffing two selected experiment runs of an anomaly detection experiment using Comet + Anomalib for Industry 4.0\" class=\"wp-image-4061\"\/><figcaption class=\"wp-element-caption\">Diffing two selected experiment runs<\/figcaption><\/figure>\n\n\n\n<h4 class=\"wp-block-heading graf graf--h4\">Benchmarking<\/h4>\n\n\n\n<p class=\"graf graf--p\">Anomalib also includes a benchmarking script for relating results across different combinations of models, their parameters, and dataset categories. Log the model performance and throughputs to Comet as a means to track model drift, or export them to a CSV file. You can check out the <a class=\"markup--anchor markup--p-anchor\" href=\"https:\/\/openvinotoolkit.github.io\/anomalib\/tutorials\/benchmarking.html\" target=\"_blank\" rel=\"noopener\" data-href=\"https:\/\/openvinotoolkit.github.io\/anomalib\/tutorials\/benchmarking.html\">full documentation here<\/a>, and once your configuration is decided, perform your benchmarking with one simple command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">python tools\/benchmarking\/benchmark.py \\\n--config &lt;relative-or-absolute-path&gt;\/&lt;paramfile&gt;.yaml<\/pre>\n\n\n\n<h4 class=\"wp-block-heading graf graf--h4\">Hyperparameter Optimization<\/h4>\n\n\n\n<p class=\"graf graf--p\">Anomalib also supports hyperparameter optimization with the Comet Optimizer, making it easier to isolate the right combination of hyperparameters. See <a class=\"markup--anchor markup--p-anchor\" href=\"https:\/\/openvinotoolkit.github.io\/anomalib\/tutorials\/hyperparameter_optimization.html\" target=\"_blank\" rel=\"noopener\" data-href=\"https:\/\/openvinotoolkit.github.io\/anomalib\/tutorials\/hyperparameter_optimization.html\">here<\/a> for Anomalib\u2019s HPO docs, or see <a class=\"markup--anchor markup--p-anchor\" href=\"https:\/\/www.comet.com\/docs\/v2\/api-and-sdk\/python-sdk\/introduction-optimizer\/\" target=\"_blank\" rel=\"noopener\" data-href=\"https:\/\/www.comet.com\/docs\/v2\/api-and-sdk\/python-sdk\/introduction-optimizer\/\">here<\/a> for details on other possible configurations with Comet&#8217;s Optimizer.<\/p>\n\n\n\n<p class=\"graf graf--p\">At the top of your Comet optimizer report, you\u2019ll find each of your hyperparameters ranked by the evaluation method of your choice, in order of the largest magnitude of <a class=\"markup--anchor markup--p-anchor\" href=\"https:\/\/en.wikipedia.org\/wiki\/Spearman%27s_rank_correlation_coefficient#:~:text=%2C%20is%20a%20nonparametric%20measure%20of,described%20using%20a%20monotonic%20function.\" target=\"_blank\" rel=\"noopener\" data-href=\"https:\/\/en.wikipedia.org\/wiki\/Spearman%27s_rank_correlation_coefficient#:~:text=%2C%20is%20a%20nonparametric%20measure%20of,described%20using%20a%20monotonic%20function.\">Spearman correlation coefficient<\/a>, to the smallest. In the snapshot below, the learning rate had the largest correlation coefficient with the model\u2019s F1 score.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><a href=\"https:\/\/www.comet.com\/sherpan\/stfpm-mvtec\/view\/0SGhekkWYlAdf5CLWKs17HUeO\/panels?shareable=KmqevAwNpEl5Twds2dmgXUg0o\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"1907\" height=\"957\" src=\"https:\/\/www.comet.com\/site\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-03-at-7.54.56-PM.png\" alt=\"Comet Optimizer report of an anomaly detection experiment using Comet + Anomalib for Industry 4.0\" class=\"wp-image-4065\" srcset=\"https:\/\/www.comet.com\/site\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-03-at-7.54.56-PM.png 1907w, https:\/\/www.comet.com\/site\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-03-at-7.54.56-PM-300x151.png 300w, https:\/\/www.comet.com\/site\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-03-at-7.54.56-PM-1024x514.png 1024w, https:\/\/www.comet.com\/site\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-03-at-7.54.56-PM-768x385.png 768w, https:\/\/www.comet.com\/site\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-03-at-7.54.56-PM-1536x771.png 1536w\" sizes=\"auto, (max-width: 1907px) 100vw, 1907px\" \/><\/a><figcaption class=\"wp-element-caption\">Comet Optimizer report<\/figcaption><\/figure>\n\n\n\n<p class=\"graf graf--p\">You\u2019ll also find all of your experiment runs ranked by your evaluation metric, with the additional option to toggle the ranking based on any of the model\u2019s parameters. Lastly, Comet plots your evaluation metrics across all experiment runs in line plots, and feel free to add any of Comet\u2019s publicly available custom panels!<\/p>\n\n\n\n<h3 class=\"wp-block-heading graf graf--h3\">Getting Started<\/h3>\n\n\n\n<p class=\"graf graf--p\">To start tracking your Anomalib projects with Comet, just follow the four quick steps below. Feel free to follow along with <a class=\"markup--anchor markup--p-anchor\" href=\"https:\/\/colab.research.google.com\/drive\/10KHnJqXefh7Wbfdx5w6ht7LMDPhxEhKH#scrollTo=3Dr3VHzafL-z\" target=\"_blank\" rel=\"noopener\" data-href=\"https:\/\/colab.research.google.com\/drive\/10KHnJqXefh7Wbfdx5w6ht7LMDPhxEhKH#scrollTo=3Dr3VHzafL-z\">this Colab tutorial<\/a>, and be sure to check out this <a class=\"markup--anchor markup--p-anchor\" href=\"https:\/\/www.comet.com\/sherpan\/mvtec\/view\/NHQvFHshwKmTfdOdmtixHmv6G\/panels?utm_source=Comet&amp;utm_medium=referral&amp;utm_content=Comet+Anomalib\" target=\"_blank\" rel=\"noopener\" data-href=\"https:\/\/www.comet.com\/sherpan\/mvtec\/view\/NHQvFHshwKmTfdOdmtixHmv6G\/panels\">completed Anomalib project here<\/a>, courtesy of Comet\u2019s own ML Growth Engineer, Sid Mehta.<\/p>\n\n\n\n<h4 class=\"wp-block-heading graf graf--h4\">0. Setup and Installation<\/h4>\n\n\n\n<p class=\"graf graf--p\">Clone the Anomalib repo into your environment and install the necessary dependencies:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">git clone <a class=\"markup--anchor markup--pre-anchor\" href=\"https:\/\/github.com\/openvinotoolkit\/anomalib.git\" target=\"_blank\" rel=\"noopener\" data-href=\"https:\/\/github.com\/openvinotoolkit\/anomalib.git\">https:\/\/github.com\/openvinotoolkit\/anomalib.git<\/a>\ncd anomalib\npip install . --q<\/pre>\n\n\n\n<h4 class=\"wp-block-heading graf graf--h4\">1. Configure Comet Credentials<\/h4>\n\n\n\n<p class=\"graf graf--p\">If you don\u2019t already have a Comet account, you can sign up for free <a href=\"\/signup?utm_source=colab&amp;utm_medium=referral&amp;utm_campaign=AMS_US_EN_AWA_Online_Anomalib_Comet_Integration\">here<\/a>. Make sure to grab your API key from your account settings so you can configure your Comet credentials in <a href=\"https:\/\/www.comet.com\/docs\/v2\/guides\/tracking-ml-training\/configuring-comet\/\">any of several ways<\/a>. For the sake of simplicity, we&#8217;ll set them directly through environment variables here:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">export COMET_API_KEY = &lt;Your-Comet-API-Key&gt;\nexport COMET_PROJECT_NAME = &lt;Your-Comet-Project-Name&gt; # this will default to the name of your dataset<\/pre>\n\n\n\n<h4 class=\"wp-block-heading graf graf--h4\">2. Modify the Anomalib config&nbsp;File<\/h4>\n\n\n\n<p class=\"graf graf--p\">Next, we\u2019ll need to modify our Anomalib config file to enable logging. The easiest way to do this is to open the existing configuration file at <code class=\"markup--code markup--p-code\">anomalib\/anomalib\/models\/&lt;model-of-your-choice&gt;\/config.yaml<\/code> and adjust the following parameters:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">visualization:\n    show_images: true\n    save_images: true\n    log_images: true\n    mode: full # options: [\"full\", \"simple\"]\nlogging:\n    logger: comet\n    log_graph: true<\/pre>\n\n\n\n<p class=\"graf graf--p\">Alternatively, you can copy your particular model&#8217;s default config template into a new YAML file and adjust the parameters as needed. In <a class=\"markup--anchor markup--p-anchor\" href=\"https:\/\/colab.research.google.com\/drive\/10KHnJqXefh7Wbfdx5w6ht7LMDPhxEhKH#scrollTo=VqJ_ZWfWI36v\" target=\"_blank\" rel=\"noopener\" data-href=\"https:\/\/colab.research.google.com\/drive\/10KHnJqXefh7Wbfdx5w6ht7LMDPhxEhKH#scrollTo=VqJ_ZWfWI36v\">this Colab notebook<\/a>, we\u2019ve also demonstrated how to use <code class=\"markup--code markup--p-code\">pyyaml<\/code> to write a config file in an interactive environment. <strong class=\"markup--strong markup--p-strong\">Note<\/strong> that each model supported by Anomalib has a different config file structure.<\/p>\n\n\n\n<h4 class=\"wp-block-heading graf graf--h4\">3. Training<\/h4>\n\n\n\n<p class=\"graf graf--p\">By default,&nbsp;<code class=\"markup--code markup--p-code\">!python tools\/train.py<\/code> runs the PaDiM model on the bottle category from the MVTec AD (CC BY-NC SA 4.0) dataset.<\/p>\n\n\n\n<p class=\"graf graf--p\">To use a different algorithm, just switch out the model name in the config file path to another supported algorithm. To use a custom dataset, just update the relevant Anomalib config file accordingly with the path to your dataset.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">python tools\/train.py \\\n--config anomalib\/models\/&lt;specific-model-name&gt;\/&lt;config-file&gt;.yaml<\/pre>\n\n\n\n<p><span style=\"font-weight: 400;\">Now just head over to the Comet UI to check out your results!<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">In the real world, machine learning is a highly iterative process and you\u2019ll likely have many more training runs to visualize and organize. Comet makes it easy to track these runs, share them with members of your team, and collaborate within your organization. By pairing Anomalib with Comet, you can take advantage of all the cutting-edge algorithms of Anomalib, and create production-worthy, maintainable models for your next Industry 4.0 project.<\/span><\/p>\n\n\n\n<h3 class=\"wp-block-heading graf graf--h3\">Beyond Model&nbsp;Training<\/h3>\n\n\n\n<p class=\"graf graf--p\">Used the Anomalib+Comet integration to train an anomaly detection model that you are now ready to deploy? Comet\u2019s role in aiding your Industry 4.0 journey doesn\u2019t stop at <a href=\"https:\/\/www.comet.com\/site\/products\/ml-experiment-tracking\/\">Experiment Management<\/a>; Comet also provides a <a href=\"https:\/\/www.comet.com\/site\/products\/model-production-monitoring\/\">Model Production Monitoring<\/a> (MPM) platform and <a href=\"https:\/\/www.comet.com\/site\/products\/machine-learning-model-versioning\/\">Model Registry<\/a>. With MPM, you can monitor your model while it is in production in a manufacturing environment. MPM can send alerts when it detects anomalies or data drift, signaling it is time to re-train.<\/p>\n\n\n\n<p class=\"graf graf--p\">Contact the Comet team today to learn more about MPM!<\/p>\n\n\n\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link wp-element-button\" href=\"https:\/\/www.comet.com\/site\/about-us\/contact-us\/\">Contact us<\/a><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>What is Industry&nbsp;4.0? You\u2019ve probably heard the buzz: Industry 4.0 is revolutionizing the way companies manufacture, develop and distribute their products. But, what exactly is Industry 4.0? To understand the Fourth Industrial Revolution, it helps to remember the first three. The First Industrial Revolution began at the end of the 18th century and focused on [&hellip;]<\/p>\n","protected":false},"author":22,"featured_media":4100,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"customer_name":"","customer_description":"","customer_industry":"","customer_technologies":"","customer_logo":"","footnotes":""},"categories":[8,5],"tags":[17,18,14,19,20,21,22],"coauthors":[133],"class_list":["post-4053","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-comet-community-hub","category-partners-integrations","tag-anomalib","tag-anomaly-detection","tag-comet-ml","tag-industry-4-0","tag-integrations","tag-intel","tag-smart-manufacturing"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.9 (Yoast SEO v25.9) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Powering Anomaly Detection for Industry\u00a04.0<\/title>\n<meta name=\"description\" content=\"Building and tracking production anomaly detection models for Industry 4.0 has never been easier with the new Anomalib+Comet integration.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.comet.com\/site\/blog\/powering-anomaly-detection-for-industry-4-0\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Powering Anomaly Detection for Industry\u00a04.0\" \/>\n<meta property=\"og:description\" content=\"Building and tracking production anomaly detection models for Industry 4.0 has never been easier with the new Anomalib+Comet integration.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.comet.com\/site\/blog\/powering-anomaly-detection-for-industry-4-0\/\" \/>\n<meta property=\"og:site_name\" content=\"Comet\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/cometdotml\" \/>\n<meta property=\"article:published_time\" content=\"2022-10-10T21:28:58+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-04-29T14:07:59+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.comet.com\/site\/wp-content\/uploads\/2022\/10\/Anomalib_LinkedIn_V2.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"1003\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Abby Morgan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@anmorgan2414\" \/>\n<meta name=\"twitter:site\" content=\"@Cometml\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Abby Morgan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Powering Anomaly Detection for Industry\u00a04.0","description":"Building and tracking production anomaly detection models for Industry 4.0 has never been easier with the new Anomalib+Comet integration.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.comet.com\/site\/blog\/powering-anomaly-detection-for-industry-4-0\/","og_locale":"en_US","og_type":"article","og_title":"Powering Anomaly Detection for Industry\u00a04.0","og_description":"Building and tracking production anomaly detection models for Industry 4.0 has never been easier with the new Anomalib+Comet integration.","og_url":"https:\/\/www.comet.com\/site\/blog\/powering-anomaly-detection-for-industry-4-0\/","og_site_name":"Comet","article_publisher":"https:\/\/www.facebook.com\/cometdotml","article_published_time":"2022-10-10T21:28:58+00:00","article_modified_time":"2025-04-29T14:07:59+00:00","og_image":[{"width":1920,"height":1003,"url":"https:\/\/www.comet.com\/site\/wp-content\/uploads\/2022\/10\/Anomalib_LinkedIn_V2.png","type":"image\/png"}],"author":"Abby Morgan","twitter_card":"summary_large_image","twitter_creator":"@anmorgan2414","twitter_site":"@Cometml","twitter_misc":{"Written by":"Abby Morgan","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.comet.com\/site\/blog\/powering-anomaly-detection-for-industry-4-0\/#article","isPartOf":{"@id":"https:\/\/www.comet.com\/site\/blog\/powering-anomaly-detection-for-industry-4-0\/"},"author":{"name":"Abby Morgan","@id":"https:\/\/www.comet.com\/site\/#\/schema\/person\/826ee39a2e30cf9d8d73155de09bb7b2"},"headline":"Powering Anomaly Detection for Industry\u00a04.0","datePublished":"2022-10-10T21:28:58+00:00","dateModified":"2025-04-29T14:07:59+00:00","mainEntityOfPage":{"@id":"https:\/\/www.comet.com\/site\/blog\/powering-anomaly-detection-for-industry-4-0\/"},"wordCount":1837,"publisher":{"@id":"https:\/\/www.comet.com\/site\/#organization"},"image":{"@id":"https:\/\/www.comet.com\/site\/blog\/powering-anomaly-detection-for-industry-4-0\/#primaryimage"},"thumbnailUrl":"https:\/\/www.comet.com\/site\/wp-content\/uploads\/2022\/10\/Anomalib_LinkedIn_V2.png","keywords":["Anomalib","Anomaly Detection","Comet ML","Industry 4.0","Integrations","Intel","Smart Manufacturing"],"articleSection":["Comet Community Hub","Partners &amp; Integrations"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.comet.com\/site\/blog\/powering-anomaly-detection-for-industry-4-0\/","url":"https:\/\/www.comet.com\/site\/blog\/powering-anomaly-detection-for-industry-4-0\/","name":"Powering Anomaly Detection for Industry\u00a04.0","isPartOf":{"@id":"https:\/\/www.comet.com\/site\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.comet.com\/site\/blog\/powering-anomaly-detection-for-industry-4-0\/#primaryimage"},"image":{"@id":"https:\/\/www.comet.com\/site\/blog\/powering-anomaly-detection-for-industry-4-0\/#primaryimage"},"thumbnailUrl":"https:\/\/www.comet.com\/site\/wp-content\/uploads\/2022\/10\/Anomalib_LinkedIn_V2.png","datePublished":"2022-10-10T21:28:58+00:00","dateModified":"2025-04-29T14:07:59+00:00","description":"Building and tracking production anomaly detection models for Industry 4.0 has never been easier with the new Anomalib+Comet integration.","breadcrumb":{"@id":"https:\/\/www.comet.com\/site\/blog\/powering-anomaly-detection-for-industry-4-0\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.comet.com\/site\/blog\/powering-anomaly-detection-for-industry-4-0\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.comet.com\/site\/blog\/powering-anomaly-detection-for-industry-4-0\/#primaryimage","url":"https:\/\/www.comet.com\/site\/wp-content\/uploads\/2022\/10\/Anomalib_LinkedIn_V2.png","contentUrl":"https:\/\/www.comet.com\/site\/wp-content\/uploads\/2022\/10\/Anomalib_LinkedIn_V2.png","width":1920,"height":1003,"caption":"Comet + Anomalib graphic"},{"@type":"BreadcrumbList","@id":"https:\/\/www.comet.com\/site\/blog\/powering-anomaly-detection-for-industry-4-0\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.comet.com\/site\/"},{"@type":"ListItem","position":2,"name":"Powering Anomaly Detection for Industry\u00a04.0"}]},{"@type":"WebSite","@id":"https:\/\/www.comet.com\/site\/#website","url":"https:\/\/www.comet.com\/site\/","name":"Comet","description":"Build Better Models Faster","publisher":{"@id":"https:\/\/www.comet.com\/site\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.comet.com\/site\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.comet.com\/site\/#organization","name":"Comet ML, Inc.","alternateName":"Comet","url":"https:\/\/www.comet.com\/site\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.comet.com\/site\/#\/schema\/logo\/image\/","url":"https:\/\/www.comet.com\/site\/wp-content\/uploads\/2025\/01\/logo_comet_square.png","contentUrl":"https:\/\/www.comet.com\/site\/wp-content\/uploads\/2025\/01\/logo_comet_square.png","width":310,"height":310,"caption":"Comet ML, Inc."},"image":{"@id":"https:\/\/www.comet.com\/site\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/cometdotml","https:\/\/x.com\/Cometml","https:\/\/www.youtube.com\/channel\/UCmN63HKvfXSCS-UwVwmK8Hw"]},{"@type":"Person","@id":"https:\/\/www.comet.com\/site\/#\/schema\/person\/826ee39a2e30cf9d8d73155de09bb7b2","name":"Abby Morgan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.comet.com\/site\/#\/schema\/person\/image\/dbbf1ae921ee179c768f508340415946","url":"https:\/\/secure.gravatar.com\/avatar\/28d4934d14261b4afe12e226f0eaa57c4fb0c2761ad4586eb9a5bec3b8160bc9?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/28d4934d14261b4afe12e226f0eaa57c4fb0c2761ad4586eb9a5bec3b8160bc9?s=96&d=mm&r=g","caption":"Abby Morgan"},"description":"AI\/ML Growth Engineer @ Comet","sameAs":["https:\/\/www.comet.com\/","https:\/\/www.linkedin.com\/in\/anmorgan24\/","https:\/\/x.com\/anmorgan2414"],"url":"https:\/\/www.comet.com\/site\/blog\/author\/abigailmcomet-com\/"}]}},"_links":{"self":[{"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/posts\/4053","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/users\/22"}],"replies":[{"embeddable":true,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/comments?post=4053"}],"version-history":[{"count":3,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/posts\/4053\/revisions"}],"predecessor-version":[{"id":15817,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/posts\/4053\/revisions\/15817"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/media\/4100"}],"wp:attachment":[{"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/media?parent=4053"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/categories?post=4053"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/tags?post=4053"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/coauthors?post=4053"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}