Visual Anomaly Detection
- Melissa Montero

- Feb 1, 2024
- 5 min read
Updated: Apr 16, 2024

Sample images from VisA dataset
Introduction to Visual Anomaly Detection
When we think of deep learning applied to images or videos, our minds immediately jump to classification or object detection, having an image or video, the ability to recognize an object or an action and where it is happening. But, what about scenarios where the goal is not just to spot a specific object or situation but to identify when something changed in an object or something deviates from the expected behavior? Consider, for instance, an industrial factory looking to detect a defect in its products or a traffic surveillance system seeking to detect an accident in a normal traffic flow. In these cases, the defects and the accidents can take numerous forms and show in unexpected ways, making anomaly detection a handy solution.
We understand anomaly detection as the identification of objects, data, or events that fall outside the “normal/typical” patterns. Anomaly detection is widely used in traditional statistics for data analysis of structured datasets and time data series where a group of data can be clustered together and any data outside it can be called an outlier. However, when it comes to anomaly detection in images and videos the challenges are considerably more complex, even though the principle is the same, find outlier images or frames with an anomaly. As you know visual features are more difficult to identify and extract than numerical ones, and often demands a substantial amount of data where statistical and processing machine learning approaches fall behind but with the help of deep learning techniques for automatic feature extraction, anomaly detection for image and video is expanding requiring less handcrafting and improving the generalization capabilities.

General concept of anomaly detection, candies are normal samples
while lollipops are anomalies, outliers
Although we can understand visual anomaly detection as a binary classification between normal and anomalous classes, anomalous samples for its nature are difficult to obtain. Usually datasets will have an imbalance of normal and anomalous samples, making supervised approaches insufficient for real live cases. For this reason anomaly detection makes use of unsupervised or weakly supervised methods.
In unsupervised methods a large set of normal samples is used during training to learn the boundary of normal patterns and during testing any pattern that falls outside this boundary is considered an anomaly. Thus certain events or data that may be considered normal by humans but not represented in the train dataset may be labeled as abnormal.
On the other hand, weakly supervised methods use a large set of normal samples alongside a small number of anomaly samples to learn a normal distribution of data but limited by the characteristics of the anomalous samples. Anomalies are then identified by comparing the samples against the normal behavior, anything out of that normality can be considered an anomaly.
Unsupervised/weakly supervised anomaly detection are really useful when the normal behavior is well-defined but the potential anomalies can be diverse and unknown in advance. As well, anomaly detection is highly dependent on the context, an object or an activity that is considered normal in one scenario may be considered an anomaly in a different scenario.
Detecting anomalies in visual data can be achieved through either image anomaly detection or video anomaly detection. Image anomaly detection comes into play when anomalies can be identified from a single input image, for instance it can be used to detect product defects or to identify unusual objects within an environment.

Image anomaly detection representation. Receiving a pcb’s image input the anomaly detector will “stamp” normal on pcb’s image without defects and anomaly on pcb’s image with a defect.
(Sample images from VisA dataset)
However, there are situations where an image alone may not provide sufficient information to identify anomalies accurately. In such cases, temporal information becomes crucial. Video anomaly detection methods are then utilized to detect anomalous actions, activities, or temporal relationships of actions. For instance, identifying a fight in a public space or detecting an unattended bag left for an extended period at an airport requires the application of video anomaly detection techniques.

Video anomaly detection representation. Receiving a frames sequence the video anomaly detector will calculate the anomaly score, resulting in a low score for normal frames and high score for
anomalous frames. (Sample frames from dataset)
Performance Evaluation
A model performance can be evaluated quantitatively by comparing the predicted results with the ground truth labels. However for anomaly detection some predictions may not be discrete values but continuous values in a range of [0, 1], so a threshold must be selected first to define the range of normality and the range of abnormality, usually scores below the threshold are considered normal and above the threshold considered abnormal.
Once normality and abnormality is well defined, a performance metric can be calculated. Even though there is not a standard metric for anomaly detection and different anomaly detection methods use different metrics, like precision, recall, F1 score, true positive rate and false positive rate, the most common evaluation metric for image and video anomaly detection is ROC-AUC.
The ROC-AUC is the area under the curve (AUC) of the receiver operating characteristic (ROC) curve, a plot of the true positive rate(TPR) against the false positive rate(FPR). The curve is obtained by calculating the FPR and TPR under multiple sets of thresholds. The value of ROC-AUC can range from 0 to 1. A model with higher value of ROC-AUC is considered better than a model with a lower ROC-AUC.
To get the values for the ROC-AUC for an specific threshold, you need the number of abnormal samples correctly detected called true positives(TP), the abnormal samples mistakenly detected as normal called false negatives(FN), the normal samples mistakenly detected as abnormal called false positives(FP) and the normal samples correctly detected as normal called true negatives(TN). Take a look at the confusion matrix below to have a better visualization of the described metrics.

Anomaly detection confusion matrix representation
With that you can calculate the true positive rate (TPR), and the false positive rate (FPR) which are used to calculate the ROC-AUC as follows:
TPR = TP / (TP + FN)
FPR = FP / (FP + TN)
Some researchers think that average precision (AP) may be a more suitable metric to evaluate anomaly detection due to the high imbalance nature of the samples given that TN is usually larger than TP. AP is the area under the curve of the Precision-Recall plot, the horizontal axis coordinate is recall and the vertical axis coordinate is precision. Equivalent to the ROC curve, a point on the PR curve corresponds to the precision and recall values at a certain threshold. Precision and recall can be calculated as follows:
Recall = TPR = TP / (TP + FN)
Precision = TP / (TP + FP)
Detection Methods
In the upcoming blogs, we will explore deeper the world of image and video anomaly detection, unraveling various approaches and methodologies. Our exploration will follow the insightful categorization proposed by researchers, as depicted in the figure below:

Visual anomaly detection categorization
The next blog will be dedicated to image anomaly detection, where we'll describe semi-supervised methods, unsupervised feature embedding-based techniques, and unsupervised reconstruction-based methodologies. Following that, we will release another blog solely focusing on video anomaly detection. This piece will elaborate on unsupervised methods, categorized by detection logic and input usage, and delve into weekly supervised methods, further divided by input modality.
Anomaly detection is closely related with anomaly localization, where detection focuses on determining whether a sample exhibits an anomaly or not; while localization focuses on finding the bounding box where the anomalies are present. These blogs will pay attention to anomaly detection mechanisms even though most of the deep learning base methods can take care of both in a single end-to-end pipeline.
Stay tuned for an in-depth exploration of the intricacies of anomaly detection in images and videos.




https://soicau247.com/ bữa lướt thử vì thấy mấy đứa bạn hay nhắc, kiểu vào xem cho biết chứ mình cũng không “chốt số” gì đâu. Ấn tượng đầu là trang nhìn khá dễ thở, thông tin chia theo từng khối nên kéo xuống không bị lạc. Mình thích nhất đoạn họ để phần “Xổ số Miền Bắc ngày 03/06/2026” rõ ràng, nhìn cái là biết đang xem ngày nào. Với lại mấy bảng lô tô đầu/đuôi trình bày dạng cột gọn gàng, mắt mình vốn dễ rối mà xem vẫn ổn. Nói chung giao diện không màu mè, bấm qua lại cũng nhanh, nhất là khu vực bảng đầu/đuôi lô tô hiển thị ngay dưới tiêu đề ngày 03/06/2026.
f8bet80 bữa mình cũng thấy ai đó hỏi linh tinh nên bấm vào nghía thử cho biết thôi. Mình không đọc sâu, chủ yếu xem họ trình bày trang ra sao. Cảm giác đầu tiên là bố cục khá dễ chịu, có đoạn giới thiệu ngắn gọn rồi kéo xuống là gặp phần hỏi đáp luôn, kiểu ai cần gì thì lướt tới đó đọc nhanh khỏi phải tìm. Chữ với khoảng trắng nhìn thoáng, đọc lướt không bị rối mắt. Mình còn để ý họ có nhắc chuyện đôi khi bị chặn truy cập và có link thay thế, nghe cũng thực tế vì nhiều trang hay gặp vụ này. Nói chung mình thích nhất là khối FAQ đặt…
https://keonhacai55.shop/ hôm trước thấy mấy đứa bạn nói qua nên mình ghé thử cho biết, kiểu xem giao diện với cách họ trình bày nội dung thôi. Vào trang cái là thấy mấy bài nhận định/soi kèo hiện ra ngay, xếp theo dạng danh sách nên nhìn lướt cũng biết trận nào đang được đưa lên trước. Mình để ý có bài Napoli vs Torino, tiêu đề ghi luôn giờ thi đấu nên khỏi phải mò thêm, khá tiện nếu chỉ muốn xem nhanh lịch. Chữ trên web nhìn rõ, khoảng cách dòng ổn nên đọc không bị mỏi mắt. Kéo xuống thì các bài được chia thành từng khối riêng, nhìn cái là phân biệt được, menu cũng đặt…
https://32win.host/ mình ghé thử cho biết vì thấy mọi người nói nhiều, kiểu vào xem giao diện ra sao thôi. Ấn tượng đầu là trang nhìn khá thoáng, chữ không bị dồn dập nên lướt một vòng cũng nhẹ đầu. Mình thích cách họ chia nội dung thành từng khối rõ ràng, có mấy đoạn trình bày theo dạng bảng “mục nội dung / thông tin chi tiết” nên đọc nhanh vẫn hiểu ý chính. Menu để ngay chỗ dễ thấy, bấm qua lại giữa các phần không bị rối, load cũng ổn. Có đoạn nhắc về bảo mật nhiều lớp với hỗ trợ 24/7, đọc lướt thấy yên tâm hơn chút dù mình không đăng ký gì. Nói chung…
https://tr88s.bio/ hôm trước mình lướt thấy link nên bấm vào xem thử cho biết, kiểu tò mò thôi chứ không định làm gì nhiều. Ấn tượng đầu là trang viết giới thiệu khá thẳng, có nhắc luôn nền tảng hoạt động từ 2018 và nói tới mấy giấy phép quốc tế nên cảm giác họ để thông tin “lộ thiên” chứ không vòng vo. Mình cũng thích cách họ trình bày: nội dung chia thành từng khối nhìn dễ chịu, đọc lướt vẫn nắm được ý chính, không bị dồn chữ. Thanh menu để ngay chỗ dễ thấy, bấm qua lại mấy mục không bị lag hay rối. Nói chung mình chỉ xem sơ sơ thôi, nhưng phần tiêu đề…