Add Batch 2d229c79-e997-4718-b34f-5a6a908dc52e
Browse files- unmaskinganomaliesinroadscenesegmentation/d5c28a07-dce2-4420-9a84-49fe86cc69a6_content_list.json +3 -0
- unmaskinganomaliesinroadscenesegmentation/d5c28a07-dce2-4420-9a84-49fe86cc69a6_model.json +3 -0
- unmaskinganomaliesinroadscenesegmentation/d5c28a07-dce2-4420-9a84-49fe86cc69a6_origin.pdf +3 -0
- unmaskinganomaliesinroadscenesegmentation/full.md +310 -0
- unmaskinganomaliesinroadscenesegmentation/images.zip +3 -0
- unmaskinganomaliesinroadscenesegmentation/layout.json +3 -0
unmaskinganomaliesinroadscenesegmentation/d5c28a07-dce2-4420-9a84-49fe86cc69a6_content_list.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0503a994f5aad4be37f4f131856cc63c69f2bce1eb842271b51b6dc3e2db9bea
|
| 3 |
+
size 80709
|
unmaskinganomaliesinroadscenesegmentation/d5c28a07-dce2-4420-9a84-49fe86cc69a6_model.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5b78542a45b4f535ee8a7b30169b7fe54790774fa94b62524b58dd55b0cdfcc5
|
| 3 |
+
size 98630
|
unmaskinganomaliesinroadscenesegmentation/d5c28a07-dce2-4420-9a84-49fe86cc69a6_origin.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:82afdaa68c82465a814dcb737b2d6b446184e0a8e89adc6111a79da27bb4af82
|
| 3 |
+
size 3227133
|
unmaskinganomaliesinroadscenesegmentation/full.md
ADDED
|
@@ -0,0 +1,310 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Unmasking Anomalies in Road-Scene Segmentation
|
| 2 |
+
|
| 3 |
+
Shyam Nandan Rai $^{1}$ , Fabio Cermelli $^{1,2}$ , Dario Fontanel $^{1}$ , Carlo Masone $^{1}$ , Barbara Caputo $^{1}$ $^{1}$ Politecnico di Torino, $^{2}$ Italian Institute of Technology
|
| 4 |
+
|
| 5 |
+
first.last@polito.it
|
| 6 |
+
|
| 7 |
+
# Abstract
|
| 8 |
+
|
| 9 |
+
Anomaly segmentation is a critical task for driving applications, and it is approached traditionally as a per-pixel classification problem. However, reasoning individually about each pixel without considering their contextual semantics results in high uncertainty around the objects' boundaries and numerous false positives. We propose a paradigm change by shifting from a per-pixel classification to a mask classification. Our mask-based method, Mask2Anomaly, demonstrates the feasibility of integrating an anomaly detection method in a mask-classification architecture. Mask2Anomaly includes several technical novelties that are designed to improve the detection of anomalies in masks: i) a global masked attention module to focus individually on the foreground and background regions; ii) a mask contrastive learning that maximizes the margin between an anomaly and known classes; and iii) a mask refinement solution to reduce false positives. Mask2Anomaly achieves new state-of-the-art results across a range of benchmarks, both in the per-pixel and component-level evaluations. In particular, Mask2Anomaly reduces the average false positives rate by $60\%$ w.r.t. the previous state-of-the-art.
|
| 10 |
+
|
| 11 |
+
# 1. Introduction
|
| 12 |
+
|
| 13 |
+
Semantic segmentation [14, 41, 50, 48, 42] plays a pivotal role in self-driving cars, being used to obtain a detailed understanding of the surroundings of a vehicle. Generally, semantic segmentation models are trained to recognize a pre-defined set of semantic classes (e.g. car, pedestrian, road, etc.); however, in real-world applications, they may encounter objects not belonging to such categories (e.g. animals or cargo dropped on the road). Therefore, it is essential for these models to identify objects in a scene that are not present during training i.e. anomalies, both to avoid potential dangers and to enable continual learning [37, 8, 17, 7] and open-world solutions [6].
|
| 14 |
+
|
| 15 |
+
Anomaly segmentation (AS) [3, 47, 20, 27] addresses this problem, i.e. it aims to segment objects from classes
|
| 16 |
+
|
| 17 |
+

|
| 18 |
+
Figure 1: Per-pixel vs per-mask Anomaly Segmentation: Dense Hybrid [22], the state-of-the-art method for AS based on per-pixel classification can detect the anomalies, but it produces many false positives. Anomaly segmentation can be cast as a mask classification problem, but naively using MSP [25] on top of Mask2Former [12] does not produce good results. Our Mask2Anomaly exploits mask-transformers properties to refine the classification of anomalies, drastically reducing false positives. $f_{pixel}$ and $f_{mask}$ denotes per-pixel, and per-mask architecture. Anomalies in the output image are represented in red.
|
| 19 |
+
|
| 20 |
+
that were absent during training. Existing AS methods are built upon the idea of individually classifying the pixels and assigning to each of them an anomaly score. This score may be given by a pixel-level discriminative method [1, 27, 22, 43], by estimating the uncertainty of the individual pixel predictions [39], or by comparing the per-pixel discrepancy between the original image and a synthetic image generated from the semantic predictions [34, 45, 46]. However, reasoning on the pixels individually produces noisy anomaly scores, thus leading to a high number of false positives and poorly localized anomalies (see Fig. 1).
|
| 21 |
+
|
| 22 |
+
In this paper, we address this problem by casting AS as a mask classification task rather than a pixel classification. This idea stems from the recent advances in mask
|
| 23 |
+
|
| 24 |
+
transformer architectures [12, 13], which demonstrated that it is possible to achieve remarkable performance across various segmentation tasks by classifying masks, rather than pixels. We hypothesize that mask-transformer architectures are better suited to detect anomalies than per-pixel architectures [11, 26], because masks encourage objectness and thus can capture anomalies as whole entities, leading to more congruent anomaly scores and reduced false positives. To enable the segmentation of anomalies at the mask level, we revisit the Maximum Softmax Probability (MSP) [25], a classic method used in per-pixel AS, and apply it to the masks produced by a mask-transformer model. However, the effectiveness of such an approach hinges on the model's capability to output masks that capture well anomalies and we found that naively using MSP on top of the best mask-transformer architecture [12] does not yield good results (see Fig. 1). Hence, we propose several technical contributions to improve the capability of mask-transformer architectures to capture anomalies and reject false positives in driving scenes (see Fig. 1):
|
| 25 |
+
|
| 26 |
+
- At the architectural level, we propose a global masked-attention mechanism that allows the model to focus on both the foreground objects and on the background while retaining the efficiency of the original masked-attention [12].
|
| 27 |
+
- At the training level, we have developed a mask contrastive learning framework that utilizes outlier masks from additional out-of-distribution data to maximize the separation between anomalies and known classes.
|
| 28 |
+
- At the inference level, we propose a mask-based refinement solution that reduces false positives by filtering masks based on the panoptic principle [28] that distinguishes between “things” and “stuff”.
|
| 29 |
+
|
| 30 |
+
We integrate these contributions on top of the mask architecture [12] and term this solution Mask2Anomaly. To the best of our knowledge, Mask2Anomaly is the first demonstration of an AS method that detects anomalies at the mask level. We tested Mask2Anomaly on standard anomaly segmentation benchmarks for road scenes (Road Anomaly [34], Fishyscapes [4], Segment Me If You Can [9]), achieving the best results among all AS methods by a significant margin. In particular, Mask2Anomaly reduces on average the false positives rate by more than half w.r.t. the previous state-of-the-art. Code and pre-trained models will be made publicly available upon acceptance.
|
| 31 |
+
|
| 32 |
+
# 2. Related Work
|
| 33 |
+
|
| 34 |
+
Mask-based semantic segmentation. Traditionally, semantic segmentation methods [35, 11, 52, 32, 51] have adopted fully-convolutional encoder-decoder architectures [35, 2] and addressed the task as a dense classification problem. However, transformer architectures have recently
|
| 35 |
+
|
| 36 |
+
caused us to question this paradigm due to their outstanding performance in closely related tasks such as object detection [5] and instance segmentation [23]. In particular, [13] proposed a mask-transformer architecture that addresses segmentation as a mask classification problem. It adopts a transformer and a per-pixel decoder on top of the feature extraction. The generated per-pixel and mask embeddings are combined to produce the segmentation output. Building upon [13], [12] introduced a new transformer decoder adopting a novel masked-attention module and feeding the transformer decoder with one pixel-decoder high-resolution feature at a time.
|
| 37 |
+
|
| 38 |
+
So far, all these mask-transformers have been considered exclusively in a closed set setting, i.e., there are no unknown categories at test time. To the best of our knowledge, Mask2Anomaly is the first method that performs AS directly with mask-transformers, thus empowering these approaches with the capability to recognize anomalies in real-world settings.
|
| 39 |
+
|
| 40 |
+
Anomaly segmentation methods can be broadly divided into three categories: (a) Discriminative, (b) Generative, and (c) Uncertainty-based methods. Discriminative Methods are based on the classification of the model outputs. Hendrycks and Gimpel [25] established the initial AS discriminative baseline by applying a threshold over the maximum softmax probability (MSP) that distinguishes between in-distribution and out-of-distribution data. Other approaches use auxiliary datasets to improve performance [31, 27, 43] by calibrating the model over-confident outputs. Alternatively, [30] learns a confidence score by using the Mahalanobis distance, and [10] introduces an entropy-based classifier to discover out-of-distribution classes. Recently, discriminative methods tailored for semantic segmentation [4] directly segment anomalies in embedding space. In contrast, [22] proposes a hybrid approach that combines the known class posterior, dataset posterior, and an un-normalized data likelihood to estimate anomalies. Generative Methods provides an alternative paradigm to segment anomalies based on generative models [34, 16, 46, 45]. These approaches train generative networks to reconstruct anomaly-free training data and then use the generation discrepancy to detect an anomaly at test time. All the generative-based methods heavily rely on the generation quality and thus experience performance degradation due to image artifacts [20]. Finally, Uncertainty based methods segment anomalies by leveraging uncertainty estimates via Bayesian neural networks [39].
|
| 41 |
+
|
| 42 |
+
All the methods discussed above are based on per-pixel classification architectures and score the pixels individually without considering local semantics, leading to noisy anomaly predictions and many false positives. Mask2Anomaly overcomes this limitation by segmenting anomalies as semantically clustered masks, encouraging the
|
| 43 |
+
|
| 44 |
+

|
| 45 |
+
|
| 46 |
+

|
| 47 |
+
|
| 48 |
+

|
| 49 |
+
Figure 2: Mask2Anomaly Overview. Mask2Anomaly meta-architecture consists of an encoder, a pixel decoder, and a transformer decoder. We propose global mask attention (Sec. 3.2) that independently distributes the attention between foreground and background. V, K, and Q are Value, Key, and Query. $\phi$ is image features. $\phi^i$ , $\phi^{i+1}$ , $\phi^{i+2}$ are upsampled image features at multiple scales. Mask contrastive Loss $L_{CL}$ (Sec. 3.3) utilizes outlier masks to maximize the separation between anomalies and known classes. During anomaly inference, we utilize refinement mask $R_M$ (Sec. 3.4) to minimize false positives.
|
| 50 |
+
|
| 51 |
+

|
| 52 |
+
|
| 53 |
+
objectness of the predictions. To the best of our knowledge, this is the first work to use masks to score anomalies.
|
| 54 |
+
|
| 55 |
+
# 3. Method
|
| 56 |
+
|
| 57 |
+
In this section, we begin by introducing the problem-setting, followed by describing a generic mask-transformer architecture for anomaly segmentation. Next, we delve into our Mask2Anomaly architecture and its novel elements.
|
| 58 |
+
|
| 59 |
+
# 3.1. Preliminaries
|
| 60 |
+
|
| 61 |
+
Let us denote with $\mathcal{X} \subset \mathbb{R}^{3 \times H \times W}$ the space of RGB images, where $H$ and $W$ are the height and width, respectively, and with $\mathcal{Y} \subset \mathbb{N}^{K \times H \times W}$ the space of semantic labels that associate each pixel in an image to a semantic category from a predefined set $\mathcal{K}$ , with $|\mathcal{K}| = K$ . At training time we assume to have a dataset $\mathcal{D} = \{(x_i, y_i)\}_{i=1}^D$ , where $x_i \in \mathcal{X}$ is an image and $y_i \in \mathcal{Y}$ is its ground truth semantic mask. The goal for an anomaly segmentation model is to learn a function $f$ that maps the image space to an anomaly score space, i.e. $f: \mathcal{X} \mapsto \mathbb{R}^{H \times W}$ . For traditional semantic segmentation architectures based on per-pixel classification [11], the function $f$ can be obtained in various ways, for example, applying the Maximum Softmax Probability (MSP) [25] on top of the per-pixel classifier. Formally, given the pixel-wise class scores $S(x) \in [0, 1]^{K \times H \times W}$ obtained by segmenting the image $x$ with a per-pixel architec
|
| 62 |
+
|
| 63 |
+
ture, we compute the anomaly score as:
|
| 64 |
+
|
| 65 |
+
$$
|
| 66 |
+
f (x) = 1 - \max _ {k = 1} ^ {K} (S (x)). \tag {1}
|
| 67 |
+
$$
|
| 68 |
+
|
| 69 |
+
In this paper, we propose to adapt this framework based on MSP to mask-transformer segmentation architectures. We recall that the mask classification problem is formulated as a direct set prediction task with the goal of producing a fixed-size set of $N$ predictions [5]. Based on this idea, the mask classification meta-architecture for semantic segmentation consists of three parts: a) a backbone that acts as feature extractor, b) a pixel-decoder that upsamples the low-resolution features extracted from the backbone to produce high-resolution per-pixel embeddings, and c) a transformer decoder, made of $L$ transformer layers, that takes the image features to output a fixed number of object queries consisting of mask embeddings and their associated class scores $C \in \mathbb{R}^{N \times K}$ . The final class masks $M \in \mathbb{R}^{N \times (H \times W)}$ are obtained by multiplying the mask embeddings with the per-pixel embeddings. The mask-transformer is trained using a combination of binary cross-entropy loss and dice loss [38] for the class masks and cross-entropy loss for the class scores, unlike per-pixel architecture that is trained only on cross-entropy loss (more details on these losses are given in the supplementary material).
|
| 70 |
+
|
| 71 |
+
Given such a mask-transformer architecture, we propose
|
| 72 |
+
|
| 73 |
+

|
| 74 |
+
Figure 3: Limitation of Mask-Attention: Masked-attention [12] selectively attends to foreground regions resulting in low attention scores (dark regions) for anomalies. Anomalies are in red. Best viewed with zoom.
|
| 75 |
+
|
| 76 |
+
to calculate the anomaly scores for an input $x$ as
|
| 77 |
+
|
| 78 |
+
$$
|
| 79 |
+
f (x) = 1 - \max _ {k = 1} ^ {K} \left(\operatorname {s o f t m a x} (C) ^ {T} \cdot \operatorname {s i g m o i d} (M)\right). \tag {2}
|
| 80 |
+
$$
|
| 81 |
+
|
| 82 |
+
Here, $f(x)$ utilizes the same marginalization strategy of class and mask pairs as [13] to get anomaly scores. Without loss of generality, we implement the anomaly scoring (Eq. (2)) on top of the Mask2Former [12] architecture. However, this strategy hinges on the ability of the masks predicted by the segmentation architecture to capture anomalies well. We found that simply applying the MSP on top of Mask2Former as in Eq. (2) does not yield good results (see Fig. 1 and the results in Sec. 4.2). To overcome this problem, we introduce improvements in the architecture, training procedure, and anomaly inference mechanism. We name our method Mask2Anomaly, and its overview is shown in Fig. 2 (left). In the rest of the sections, we will discuss in detail the technical novelties of Mask2Anomaly.
|
| 83 |
+
|
| 84 |
+
# 3.2. Global Masked Attention
|
| 85 |
+
|
| 86 |
+
One of the key ingredients to Mask2Former [12] state-of-the-art segmentation results is the replacement of the cross-attention (CA) layer in the transformer decoder with a masked-attention (MA). The masked-attention attends only to pixels within the foreground region of the predicted mask for each query, under the hypothesis that local features are enough to update the query object features. The output of the $l$ -th masked-attention layer can be formulated as
|
| 87 |
+
|
| 88 |
+
$$
|
| 89 |
+
\operatorname {s o f t m a x} \left(\mathcal {M} _ {l} ^ {F} + Q K ^ {T}\right) V + X _ {i n} \tag {3}
|
| 90 |
+
$$
|
| 91 |
+
|
| 92 |
+
where $X_{in}\in \mathbb{R}^{N\times C}$ are the $N$ $C$ -dimensional query features from the previous decoder layer. The input queries $Q\in \mathbb{R}^{N\times C}$ are obtained by linearly transforming the query features with a learnable transformation whereas the keys and values $K,V$ are the image features under learnable linear transformations $f_{k}(.)$ and $f_{v}(.)$ . Finally, $\mathcal{M}_l^F$ is the predicted foreground attention mask that at each pixel location $(i,j)$ is defined as
|
| 93 |
+
|
| 94 |
+
$$
|
| 95 |
+
\mathcal {M} _ {l} ^ {F} (i, j) = \left\{ \begin{array}{l l} 0 & \text {i f} M _ {l - 1} (i, j) \geq 0. 5 \\ - \infty & \text {o t h e r w i s e ,} \end{array} \right. \tag {4}
|
| 96 |
+
$$
|
| 97 |
+
|
| 98 |
+
where $M_{l - 1}$ is the output mask of the previous layer.
|
| 99 |
+
|
| 100 |
+
By focusing only on the foreground objects, masked-attention grants faster convergence and better semantic segmentation performance than cross-attention. However, focusing only on the foreground region constitutes a problem for anomaly segmentation because anomalies may also appear in the background regions. Removing background information leads to failure cases in which the anomalies in the background are entirely missed, as shown in the example in Fig. 3. To ameliorate the detection of anomalies in these corner cases, we extend the masked attention with an additional term focusing on the background region (see Fig. 2, right). We call this a global masked-attention (GMA) formally expressed as
|
| 101 |
+
|
| 102 |
+
$$
|
| 103 |
+
\begin{array}{l} X _ {o u t} = \operatorname {s o f t m a x} \left(\mathcal {M} _ {l} ^ {F} + Q K ^ {T}\right) V \tag {5} \\ + \operatorname {s o f t m a x} \left(\mathcal {M} _ {l} ^ {B} + Q K ^ {T}\right) V + X _ {i n} \\ \end{array}
|
| 104 |
+
$$
|
| 105 |
+
|
| 106 |
+
where $\mathcal{M}_l^B$ is the additional background attention mask that complements the foreground mask $\mathcal{M}_l^F$ , and it is defined at the pixel coordinates $(i,j)$ as
|
| 107 |
+
|
| 108 |
+
$$
|
| 109 |
+
\mathcal {M} _ {l} ^ {B} (i, j) = \left\{ \begin{array}{l l} 0 & \text {i f} M _ {l - 1} (i, j) < 0. 5 \\ - \infty & \text {o t h e r w i s e .} \end{array} \right. \tag {6}
|
| 110 |
+
$$
|
| 111 |
+
|
| 112 |
+
The global masked-attention in Eq. (5) differs from the masked-attention by additionally attending to the background mask region, yet it retains the benefits of faster convergence w.r.t. the cross-attention.
|
| 113 |
+
|
| 114 |
+
# 3.3. Mask Contrastive Learning
|
| 115 |
+
|
| 116 |
+
The ideal characteristic of an anomaly segmentation model is to predict high anomaly scores for out-of-distribution (OOD) objects and low anomaly scores for indistribution (ID) regions. Namely, we would like to have a significant margin between the likelihood of known classes being predicted at anomalous regions and vice-versa. A common strategy used to improve this separation is to fine-tune the model with auxiliary out-of-distribution (anomalous) data as supervision [21, 22, 4].
|
| 117 |
+
|
| 118 |
+
Here we propose a contrastive learning approach to encourage the model to have a significant margin between the anomaly scores for in-distribution and out-of-distribution classes. Our mask-based framework allows us to straightforwardly implement this contrastive strategy by using as supervision outlier images generated by cutting anomalous objects from the auxiliary OOD data and pasting it on top of the training data. For each outlier image, we can then generate a binary outlier mask $M_{OOD}$ that is 1 for out-of-distribution pixels and 0 for in-distribution class pixels. With this setting, we first calculate the negative likelihood of in-distribution classes using the class scores $C$ and class masks $M$ as:
|
| 119 |
+
|
| 120 |
+
$$
|
| 121 |
+
l _ {N} = - \max _ {k = 1} ^ {K} (\operatorname {s o f t m a x} (C) ^ {T} \cdot \operatorname {s i g m o i d} (M)) \tag {7}
|
| 122 |
+
$$
|
| 123 |
+
|
| 124 |
+

|
| 125 |
+
Figure 4: Mask Refinement Illustration: To obtain the refined prediction, we multiply the prediction map with a refinement mask that is built by assigning zero anomaly scores for pixels that are categorized as "stuff", except for the "road". The refinement eliminates many false positives at the boundary of objects and in the background. The region to be masked is white in the refinement mask.
|
| 126 |
+
|
| 127 |
+
Ideally, for pixels corresponding to in-distribution classes $l_{N}$ should be $-1$ since the value of $\mathrm{softmax}(C)^T$ and sigmoid $(M)$ would be close to 1. On the other hand, for an anomalous pixel, sigmoid $(M)$ is ideally 0 as $\mathbf{M}$ contains only inlier classes mask that results in $l_{N}$ to be 0. Using $l_{N}$ , we define our contrastive loss as:
|
| 128 |
+
|
| 129 |
+
$$
|
| 130 |
+
\begin{array}{l} L _ {C L} = \frac {1}{2} (l _ {C L} ^ {2}), \\ l _ {C L} = \left\{ \begin{array}{l l} l _ {N} & \text {i f} M _ {O O D} = 0 \\ \max (0, m - l _ {N}) & \text {o t h e r w i s e ,} \end{array} \right. \tag {8} \\ \end{array}
|
| 131 |
+
$$
|
| 132 |
+
|
| 133 |
+
where the margin $m$ is a hyperparameter that decides the minimum distance between the out-of-distribution and indistribution classes.
|
| 134 |
+
|
| 135 |
+
# 3.4. Refinement Mask
|
| 136 |
+
|
| 137 |
+
False positives are one of the main problems in anomaly segmentation, particularly around object boundaries. Handcrafted methods such as iterative boundary suppression [27] or dilated smoothing have been proposed to minimize the false positives at boundaries or globally, however, they require tuning for each specific dataset. Instead, we propose a general refinement technique that leverages the capability of mask transformers [12] to perform all segmentation tasks. Our method stems from the panoptic perspective [28] that the elements in the scene can be categorized as things, i.e. countable objects, and stuff, i.e. amorphous regions. With this distinction in mind, we observe that in driving scenes, i) unknown objects are classified as things, and ii) they are often present on the road. Thus, we can proceed to remove most false positives by filtering out all the masks corresponding to "stuff", except the "road" category. We implement this removal mechanism in the form of a binary refinement mask $R_{M} \in [0,1]^{H \times W}$ , which contains zeros in the segments corresponding to the unwanted "stuff" masks and one otherwise. Thus, by multiplying $R_{M}$ with the predicted anomaly scores $f$ we filter out all the unwanted "stuff" masks and eliminate a large portion of the false positives (see Fig. 4). Formally, for an image $x$ the
|
| 138 |
+
|
| 139 |
+
refined anomaly scores $f^r$ is computed as:
|
| 140 |
+
|
| 141 |
+
$$
|
| 142 |
+
f ^ {r} (x) = R _ {M} \odot f (x), \tag {9}
|
| 143 |
+
$$
|
| 144 |
+
|
| 145 |
+
where $\odot$ is the Hadamard product.
|
| 146 |
+
|
| 147 |
+
$R_{M}$ is the dot product between the binarized output mask $\bar{M} \in \{0,1\}^{N \times (H \times W)}$ and the class filter $\bar{C} \in \{0,1\}^{1 \times N}$ , i.e. $R_{M} = \bar{C} \cdot \bar{M}$ . We define $\bar{M} = \operatorname{sigmoid}(M) > 0.5$ and the class filter $\bar{C}$ is equal to 1 only where the highest class score of $\operatorname{softmax}(C)$ belongs to "things" or "road" classes and is greater than 0.95.
|
| 148 |
+
|
| 149 |
+
# 4. Experiments
|
| 150 |
+
|
| 151 |
+
Dataset: We train Mask2Anomaly on Cityscapes [14] and for evaluation we use Road Anomaly [34], Fishyscapes [3] and Segment Me If You Can (SMIYC) benchmarks [9].
|
| 152 |
+
|
| 153 |
+
Road Anomaly: is a collection of 60 web images having anomalous objects located on or near the road.
|
| 154 |
+
|
| 155 |
+
Fishyscapes (FS): consists of two datasets, Fishyscape static (FS static) and Fishyscapes lost & found (FS lost & found). Fishyscape static is built by blending Pascal VOC [19] objects on Cityscapes images containing 30 validation and 1000 test images. Fishyscapes lost & found is based on a subset of the Lost and Found dataset [40], with 100 validation and 275 test images.
|
| 156 |
+
|
| 157 |
+
SMIYC: consists of two datasets, RoadAnomaly21 (SMIYC-RA21) and RoadObstacle21 (SMIYC-RO21). The SMIYC-RA21 contains 10 validation and 100 test images with diverse anomalies. The SMIYC-RO21 is collected with a focus on segmenting road anomalies and has 30 validation and 327 test images.
|
| 158 |
+
|
| 159 |
+
Evaluation Metrics: We evaluate all the anomaly segmentation methods at pixel and component levels. For pixel-wise evaluation, we use Area under the Precision-Recall Curve (AuPRC) and False Positive Rate at a true positive rate of $95\%$ $(\mathrm{FPR}_{95})$ . Since pixel-level evaluation metrics can neglect small anomalies and be biased towards anomalies with large sizes, we also include component-level evaluations using the averaged component-wise F1 $(F1^{*})$ , the positive predictive value (PPV), and the component-wise intersection over union (sIoU). Further, details of all the metrics can be found in the supplementary material.
|
| 160 |
+
|
| 161 |
+
Implementation Details: Our implementation is derived from [13, 12]. We use a ResNet-50 [24] encoder, and its weights are initialized from a model that is pre-trained with barlow-twins [49] self-supervision on ImageNet [15]. We freeze the encoder weights during training, saving memory and training time. We use a multi-scale deformable attention Transformer (MSDeformAttn) [53] as the pixel decoder. The MSDeformAttn gives features maps at $1/8, 1/16$ , and $1/32$ resolution, providing image features to the transformer decoder layers. Our transformer decoder is adopted from [12] and consists of 9 layers with
|
| 162 |
+
|
| 163 |
+
<table><tr><td rowspan="2">Methods</td><td colspan="2">SMIYC RA-21</td><td colspan="2">SMIYC RO-21</td><td colspan="2">FS L&F</td><td colspan="2">FS Static</td><td colspan="2">Road Anomaly</td><td colspan="2">Average</td></tr><tr><td>AuPRC ↑</td><td>FPR95 ↓</td><td>AuPRC ↑</td><td>FPR95 ↓</td><td>AuPRC ↑</td><td>FPR95 ↓</td><td>AuPRC ↑</td><td>FPR95 ↓</td><td>AuPRC ↑</td><td>FPR95 ↓</td><td>AuPRC ↑</td><td>FPR95 ↓</td></tr><tr><td>Max Softmax [25](ICLR'17)</td><td>27.97</td><td>72.02</td><td>15.72</td><td>16.6</td><td>1.77</td><td>44.85</td><td>12.88</td><td>39.83</td><td>15.72</td><td>71.38</td><td>14.81</td><td>48.93</td></tr><tr><td>Entropy [25](ICLR'17)</td><td>-</td><td>-</td><td>-</td><td>-</td><td>2.93</td><td>44.83</td><td>15.4</td><td>39.75</td><td>16.97</td><td>71.1</td><td>11.66</td><td>51.89</td></tr><tr><td>Mahalanobis [30](NeurIPS'18)</td><td>20.04</td><td>86.99</td><td>20.9</td><td>13.08</td><td>-</td><td>-</td><td>-</td><td>-</td><td>14.37</td><td>81.09</td><td>18.42</td><td>60.38</td></tr><tr><td>Image Resynthesis [34](ICCV'19)</td><td>52.28</td><td>25.93</td><td>37.71</td><td>4.7</td><td>5.7</td><td>48.05</td><td>29.6</td><td>27.13</td><td>-</td><td>-</td><td>31.32</td><td>26.45</td></tr><tr><td>Learning Embedding [4](IJCV'21)</td><td>37.52</td><td>70.76</td><td>0.82</td><td>46.38</td><td>4.65</td><td>24.36</td><td>57.16</td><td>13.39</td><td>-</td><td>-</td><td>26.18</td><td>45.43</td></tr><tr><td>Void Classifier [4](IJCV'21)</td><td>36.61</td><td>63.49</td><td>10.44</td><td>41.54</td><td>10.29</td><td>22.11</td><td>4.5</td><td>19.4</td><td>-</td><td>-</td><td>15.46</td><td>36.63</td></tr><tr><td>JSRNet [45](ICCV'21)</td><td>33.64</td><td>43.85</td><td>28.09</td><td>28.86</td><td>-</td><td>-</td><td>-</td><td>-</td><td>94.4</td><td>9.2</td><td>52.04</td><td>47.3</td></tr><tr><td>SML [27](ICCV'21)</td><td>46.8</td><td>39.5</td><td>3.4</td><td>36.8</td><td>31.67</td><td>21.9</td><td>52.05</td><td>20.5</td><td>17.52</td><td>70.7</td><td>30.28</td><td>37.88</td></tr><tr><td>SynBoost [16](CVPR'21)</td><td>56.44</td><td>61.86</td><td>71.34</td><td>3.15</td><td>43.22</td><td>15.79</td><td>72.59</td><td>18.75</td><td>38.21</td><td>64.75</td><td>56.36</td><td>32.86</td></tr><tr><td>Maximized Entropy [10](ICCV'21)</td><td>85.47</td><td>15.00</td><td>85.07</td><td>0.75</td><td>29.96</td><td>35.14</td><td>86.55</td><td>8.55</td><td>48.85</td><td>31.77</td><td>67.18</td><td>18.24</td></tr><tr><td>Dense Hybrid [22](ECCV'22)</td><td>77.96</td><td>9.81</td><td>87.08</td><td>0.24</td><td>47.06</td><td>3.97</td><td>80.23</td><td>5.95</td><td>31.39</td><td>63.97</td><td>64.74</td><td>16.79</td></tr><tr><td>PEBEL [43](ECCV'22)</td><td>49.14</td><td>40.82</td><td>4.98</td><td>12.68</td><td>44.17</td><td>7.58</td><td>92.38</td><td>1.73</td><td>45.1</td><td>44.58</td><td>47.15</td><td>31.47</td></tr><tr><td>Mask2Anomaly (Ours)</td><td>88.7</td><td>14.60</td><td>93.3</td><td>0.20</td><td>46.04</td><td>4.36</td><td>95.20</td><td>0.82</td><td>79.70</td><td>13.45</td><td>80.59</td><td>6.68</td></tr></table>
|
| 164 |
+
|
| 165 |
+
Table 1: Pixel level evaluation: On average, Mask2Anomaly shows significant improvement among the compared methods. Higher values for AuPRC are better, whereas for $\mathrm{FPR}_{95}$ lower values are better. The best and second best results are bold and underlined, respectively. $-$ indicates the unavailability of benchmark results.
|
| 166 |
+
|
| 167 |
+
<table><tr><td rowspan="2">Methods</td><td colspan="3">SMIYC RA-21</td><td colspan="3">SMIYC RO-21</td></tr><tr><td>sIoU ↑</td><td>PPV ↑</td><td>F1*↑</td><td>sIoU ↑</td><td>PPV ↑</td><td>F1*↑</td></tr><tr><td>Max Softmax [25](ICLR'17)</td><td>15.48</td><td>15.29</td><td>5.37</td><td>19.72</td><td>15.93</td><td>6.25</td></tr><tr><td>Ensemble [29](NuriIPS'17)</td><td>16.44</td><td>20.77</td><td>3.39</td><td>8.63</td><td>4.71</td><td>1.28</td></tr><tr><td>Mahalanobis [30](NeurIPS'18)</td><td>14.82</td><td>10.22</td><td>2.68</td><td>13.52</td><td>21.79</td><td>4.70</td></tr><tr><td>Image Resynthesis [34](ICCV'19)</td><td>39.68</td><td>10.95</td><td>12.51</td><td>16.61</td><td>20.48</td><td>8.38</td></tr><tr><td>MC Dropout [39](CVPR'20)</td><td>20.49</td><td>17.26</td><td>4.26</td><td>5.49</td><td>5.77</td><td>1.05</td></tr><tr><td>Learning Embedding [43](IJCV'21)</td><td>33.86</td><td>20.54</td><td>7.90</td><td>35.64</td><td>2.87</td><td>2.31</td></tr><tr><td>SML [27](ICCV'21)</td><td>26.00</td><td>24.70</td><td>12.20</td><td>5.10</td><td>13.30</td><td>3.00</td></tr><tr><td>SynBoost [16](CVPR'21)</td><td>34.68</td><td>17.81</td><td>9.99</td><td>44.28</td><td>41.75</td><td>37.57</td></tr><tr><td>Maximized Entropy [10](ICCV'21)</td><td>49.21</td><td>39.51</td><td>28.72</td><td>47.87</td><td>62.64</td><td>48.51</td></tr><tr><td>JSRNet [45](ICCV'21)</td><td>20.20</td><td>29.27</td><td>13.66</td><td>18.55</td><td>24.46</td><td>11.02</td></tr><tr><td>Void Classifier [4](IJCV'21)</td><td>21.14</td><td>22.13</td><td>6.49</td><td>6.34</td><td>20.27</td><td>5.41</td></tr><tr><td>Dense Hybrid [22](ECCV'22)</td><td>54.17</td><td>24.13</td><td>31.08</td><td>45.74</td><td>50.10</td><td>50.72</td></tr><tr><td>PEBEL [43](ECCV'22)</td><td>38.88</td><td>27.20</td><td>14.48</td><td>29.91</td><td>7.55</td><td>5.54</td></tr><tr><td>Mask2Former [12]</td><td>25.20</td><td>18.20</td><td>15.30</td><td>5.00</td><td>21.90</td><td>4.80</td></tr><tr><td>Mask2Anomaly (Ours)</td><td>60.40</td><td>45.70</td><td>48.60</td><td>61.40</td><td>70.30</td><td>69.80</td></tr></table>
|
| 168 |
+
|
| 169 |
+
Table 2: Component level evaluation: Mask2Anomaly achieves large improvement on component level evaluation metrics among the baselined methods. Higher values of sIoU, PPV, and $F1^*$ are better. The best and second best results are bold and underlined, respectively.
|
| 170 |
+
|
| 171 |
+
100 queries. We train Mask2Anomaly using a combination of binary cross-entropy loss and the dice loss [38] for class masks and cross-entropy loss for class scores. The network is trained with an initial learning rate of 1e-4 and batch size of 16 for 90 thousand iterations on AdamW [36] with a weight decay of 0.05. We use an image crop of $380 \times 760$ with large-scale jittering [18] along with a random scale ranging from 0.1 to 2.0.
|
| 172 |
+
|
| 173 |
+
Next, we train the Mask2Anomaly in a contrastive setting. We generate the outlier image using AnomalyMix [43] where we cut an object from MS-COCO [33] dataset image and paste them on the Cityscapes image. The corresponding binary mask for an outlier image is created by assigning 1 to the MS-COCO image area and 0 to the Cityscapes image area. We randomly sample 300 images from the MS-COCO dataset during training to generate outliers. We train the network for 4000 iterations with $m$ as 0.75, a learning rate of 1e-5, and batch size 8, keeping all the other hyperparameters the same as above. The probability of choosing an outlier in a training batch is kept at 0.2.
|
| 174 |
+
|
| 175 |
+

|
| 176 |
+
Figure 5: Qualitative Results: We observe that per-pixel classification architectures: Dense Hybrid [22] and Maximized Entropy [10] suffer from large false positives, whereas Mask2Anomaly, which is a mask-transformer, shows accurate pixel-wise anomaly segmentation results.
|
| 177 |
+
|
| 178 |
+
# 4.1. Main Results
|
| 179 |
+
|
| 180 |
+
Table 1 shows the pixel-level anomaly segmentation results achieved by Mask2Anomaly and recent SOTA methods on Fishyscapes, SMIYC, and Road Anomaly datasets. We can observe that Mask2Anomaly significantly improves the average AuPRC by $20\%$ and the $\mathrm{FPR}_{95}$ by $60\%$ compared to the second-best method. We observe that anomaly segmentation methods based on per-pixel architecture, such as JSRNet, perform exceptionally well on the Road Anomaly dataset. However, JSRNet does not generalize well on other datasets. On the other hand, Mask2Anomaly
|
| 181 |
+
|
| 182 |
+

|
| 183 |
+
Figure 6: Mask2Anomaly Qualitative Ablation: demonstrates the performance gain by progressively adding (left to right) proposed components. Masked-out regions by refinement mask are shown in white. Anomalies are represented in red.
|
| 184 |
+
|
| 185 |
+

|
| 186 |
+
|
| 187 |
+

|
| 188 |
+
|
| 189 |
+

|
| 190 |
+
|
| 191 |
+

|
| 192 |
+
|
| 193 |
+

|
| 194 |
+
|
| 195 |
+
yields excellent results on all the datasets. Moreover, the property of our mask architecture to encourage objectness, rather than individual pixel anomalies, not only reduces the false positive but also improves the localization of whole anomalies. Indeed, Tab. 2 demonstrates that Mask2Anomaly outperforms all the baselined methods on component-level evaluation metrics. To conclude, Mask2Anomaly yields state-of-the-art anomaly segmentation performance both in pixel and component metrics.
|
| 196 |
+
|
| 197 |
+
Qualitative results: To get a better understanding of the visual results, in Fig. 5 we visually compare the anomaly scores predicted by Mask2Anomaly and its closest competitors: Dense Hybrid [22] and Maximized Entropy [10]. The results from both: Dense Hybrid and Maximized Entropy exhibit a strong presence of false positives across the scene, particularly on the boundaries of objects ("things") and regions ("stuff"). On the other hand, Mask2Anomaly demonstrates precise segmentation of anomalies while at the same time having minimal false positives. Additional qualitative results are in the supplementary material.
|
| 198 |
+
|
| 199 |
+
Segmentation results: Another critical characteristic of any anomaly segmentation method is that it should not disrupt the in-distribution classification performance, or else it would make the semantic segmentation model unusable. We find that adding only GMA to the base model boosts in-distribution accuracy to 80.45 on the validation set of Cityscapes. The final Mask2Anomaly model maintains an in-distribution accuracy of $78.88\mathrm{mIoU}$ , which is still 1.46 points higher than the vanilla Mask2Former. Moreover, it is important to note that both Mask2Anomaly and Mask2Former are trained for 90k iterations, indicating that, although Mask2Anomaly additionally attends to the background mask region, it shows convergence similar to Mask2Former. Extended quantitative and qualitative segmentation results with both Mask2Anomaly and Mask2Former are presented in the supplementary material.
|
| 200 |
+
|
| 201 |
+
# 4.2. Ablations
|
| 202 |
+
|
| 203 |
+
All the results reported in this section are from the Fishyscapes lost and found validation dataset.
|
| 204 |
+
|
| 205 |
+

|
| 206 |
+
Figure 7: Visualization of negative attention maps and results: Global mask attention gives high attention scores to anomalous regions across all resolutions showing the best anomaly segmentation results among the compared attention mechanisms. Cross-attention performs better than mask-attention but has high false positives and low confidence prediction for the anomalous region. Darker regions represent low attention values. Details to calculate negative attention are given in Section:4.2.
|
| 207 |
+
|
| 208 |
+
Mask2Anomaly: Table 3(a) presents the results of a component-wise ablation of the technical novelties included in Mask2Anomaly. We use Mask2Former as the baseline. As shown in the table, removing any individual component from Mask2Anomaly drastically reduces the results, thus proving that their individual benefits are complimentary. In particular, we observe that the global masked attention has a big impact on the AuPRC and the contrastive learning is very important for the $\mathrm{FPR}_{95}$ . The mask refinement brings further improvements to both. Figure 6 visually demonstrates the positive effect of all the components.
|
| 209 |
+
|
| 210 |
+
Global Mask Attention: To better understand the effect of the global masked attention (GMA), in Tab. 3(c), we compare it to the masked-attention (MA) [12] and cross-attention (CA) [44]. We can observe that although the MA increases the mIoU w.r.t. the CA, it degrades all the metrics for anomaly segmentation, thus confirming our preliminary experiment shown in Fig. 3. On the other hand, the GMA provides improvements across all the metrics. This is confirmed visually in Fig. 7, where we show the negative attention maps for the three methods at different resolutions. The
|
| 211 |
+
|
| 212 |
+
<table><tr><td>GMA</td><td>CL</td><td>RM</td><td>AuPRC↑</td><td>FPR95↓</td></tr><tr><td></td><td></td><td></td><td>10.60</td><td>89.35</td></tr><tr><td>✓</td><td></td><td>✓</td><td>35.05</td><td>87.11</td></tr><tr><td></td><td>✓</td><td>✓</td><td>57.23</td><td>31.93</td></tr><tr><td>✓</td><td>✓</td><td></td><td>68.95</td><td>24.07</td></tr><tr><td>✓</td><td>✓</td><td>✓</td><td>69.41</td><td>9.46</td></tr></table>
|
| 213 |
+
|
| 214 |
+
(a)
|
| 215 |
+
|
| 216 |
+
<table><tr><td>\( \operatorname{margin}\left( m\right) \)</td><td>AuPRC↑</td><td>FPR95↓</td></tr><tr><td>1</td><td>65.37</td><td>11.61</td></tr><tr><td>0.95</td><td>65.40</td><td>12.20</td></tr><tr><td>0.90</td><td>66.05</td><td>13.49</td></tr><tr><td>0.80</td><td>66.20</td><td>14.89</td></tr><tr><td>0.75</td><td>69.41</td><td>9.46</td></tr><tr><td>0.50</td><td>62.07</td><td>13.26</td></tr></table>
|
| 217 |
+
|
| 218 |
+
(b)
|
| 219 |
+
|
| 220 |
+
<table><tr><td></td><td>mIoU↑</td><td>AuPRC↑</td><td>FPR95↓</td></tr><tr><td>CA [13]</td><td>76.43</td><td>20.30</td><td>89.35</td></tr><tr><td>MA [12]</td><td>77.42</td><td>10.60</td><td>89.39</td></tr><tr><td>GMA</td><td>80.45</td><td>32.35</td><td>25.95</td></tr></table>
|
| 221 |
+
|
| 222 |
+
(c)
|
| 223 |
+
|
| 224 |
+
<table><tr><td></td><td>AuPRC↑</td><td>FPR95↓</td></tr><tr><td>w/o Refinement Mask</td><td>68.95</td><td>24.07</td></tr><tr><td>L{things\road}</td><td>67.04</td><td>39.11</td></tr><tr><td>L{stuff\road}</td><td>69.41</td><td>9.46</td></tr></table>
|
| 225 |
+
|
| 226 |
+
(d)
|
| 227 |
+
|
| 228 |
+
<table><tr><td>Batch Outlier Probability</td><td>AuPRC↑</td><td>FPR95↓</td></tr><tr><td>0.1</td><td>63.01</td><td>14.66</td></tr><tr><td>0.2</td><td>69.41</td><td>9.46</td></tr><tr><td>0.5</td><td>69.20</td><td>11.03</td></tr><tr><td>1</td><td>68.77</td><td>10.53</td></tr></table>
|
| 229 |
+
|
| 230 |
+
negative attention is calculated by averaging all the queries (since there is no reference known object) and then subtracting one. Note that the GMA has a high response on the anomaly (the giraffe) across all resolutions.
|
| 231 |
+
|
| 232 |
+
Refinement Mask: Table 3(d) shows the performance gains due to the refinement mask. We observe that filtering out the {"stuff" \ "road"} regions of the prediction map improves the FPR<sub>95</sub> by 14.61 along with marginal improvement in AuPRC. On the other hand, removing the {"things" \ "road"} regions degrades the results, confirming our hypothesis that anomalies are likely to belong to the "things" category. Figure 6 qualitatively shows the improvement achieved with the refinement mask. Also, refinement mask adds a small overhead of 1.12 GFlops compared to Mask2Anomaly 258 GFlops inference cost.
|
| 233 |
+
|
| 234 |
+
Mask Contrastive Learning: We tested the effect of the margin in the contrastive loss $L_{CL}$ , and we report these results in Tab. 3(b). We find that the best results are achieved by setting $m$ to 0.75, but the performance is competitive for any value of $m$ in the table. Similarly, we tested the effect of the batch outlier probability, which is the likelihood of selecting an outlier image in a batch. The results shown in Tab. 3(e) indicate that the best performance is achieved at 0.2, but the results remain stable for higher values of the batch outlier probability.
|
| 235 |
+
|
| 236 |
+
Effect of bigger backbones: We demonstrate the efficacy of Mask2Anomaly by comparing it to the vanilla Mask2Former but using larger backbones. The results in Tab. 4 show that despite the disadvantage, Mask2Anomaly with a ResNet-50 still performs better than Mask2Former using large transformer-based backbones. It
|
| 237 |
+
|
| 238 |
+
(e)
|
| 239 |
+
Table 3: Mask2Anomaly Ablation tables: (a) Component-wise ablation of Mask2Anomaly. Results in italics show Mask2Former results. GMA: Global Mask Attention, CL: Contrastive Learning, and RM: Refinement Mask. (b) Shows the behavior of $L_{CL}$ on different margin(m) values. We empirically find the best results when m is 0.75. (c) Global masked attention (GMA) performs best among various attention mechanisms: Cross-Attention (CA) and Masked-Attention (MA). (d) We show the performance gain by using a refinement mask that masks the $\{stuff\backslash road\}$ regions as anomalies are categorized as things class. (e) Batch outlier probability is the likelihood of selecting an outlier image for a batch during contrastive training. Best result is achieved at 0.2 probability. (All the results reported on FS Lost & Found validation set).
|
| 240 |
+
|
| 241 |
+
<table><tr><td>Method</td><td>Backbone</td><td>AuPRC↑</td><td>FPR95↓</td><td>FLOPs↓</td><td>Training ↓ Parameters</td></tr><tr><td rowspan="4">Mask2Former [12]</td><td>ResNet-50</td><td>10.60</td><td>89.35</td><td>226G</td><td>44M</td></tr><tr><td>ResNet-101</td><td>9.11</td><td>45.83</td><td>293G</td><td>63M</td></tr><tr><td>Swin-T</td><td>24.54</td><td>37.98</td><td>232G</td><td>42M</td></tr><tr><td>Swin-S</td><td>30.96</td><td>36.78</td><td>313G</td><td>69M</td></tr><tr><td>Mask2Anomaly‡</td><td>ResNet-50</td><td>32.35</td><td>25.95</td><td>258G</td><td>23M</td></tr></table>
|
| 242 |
+
|
| 243 |
+
Table 4: Architectural Efficiency of Mask2Anomaly: Mask2Anomaly outperforms best Mask2Former architecture having Swin-S backbone with only $30\%$ trainable parameters. Mask2Anomaly‡ only uses global mask attention.
|
| 244 |
+
|
| 245 |
+
is also important to note that the number of training parameters for Mask2Anomaly can be reduced to $23M$ by using a frozen self-supervised pre-trained encoder, which is significantly less than all the Mask2Former variations.
|
| 246 |
+
|
| 247 |
+
# 5. Conclusion
|
| 248 |
+
|
| 249 |
+
In this work, we present Mask2Anomaly, a novel anomaly segmentation architecture established on masked architecture. Mask2Anomaly contains global mask attention specifically designed to improve the attention mechanism for anomaly segmentation tasks. Next, we develop a mask contrastive learning framework that utilizes outlier masks to maximize the separation between anomalies and known classes. Finally, we introduced mask refinement that reduces false positives and improves the overall performance. We show the efficacy of Mask2Anomaly and its components through extensive qualitative and quantitative results. We hope Mask2Anomaly will open doors for new anomaly segmentation methods based on mask architecture.
|
| 250 |
+
|
| 251 |
+
# References
|
| 252 |
+
|
| 253 |
+
[1] Matt Angus, Krzysztof Czarnecki, and Rick Salay. Efficacy of pixel-level ood detection for semantic segmentation. arXiv preprint arXiv:1911.02897, 2019. 1
|
| 254 |
+
[2] Vijay Badrinarayanan, Alex Kendall, and Roberto Cipolla. Segnet: A deep convolutional encoder-decoder architecture for image segmentation. IEEE TPAMI, 39(12):2481-2495, 2017. 2
|
| 255 |
+
[3] Hermann Blum, Paul-Edouard Sarlin, Juan Nieto, Roland Siegwart, and Cesar Cadena. Fishyscapes: A benchmark for safe semantic segmentation in autonomous driving. In Proceedings of the IEEE/CVF International Conference on Computer Vision Workshops, pages 0–0, 2019. 1, 5
|
| 256 |
+
[4] Hermann Blum, Paul-Edouard Sarlin, Juan Nieto, Roland Siegwart, and Cesar Cadena. The fishyscapes benchmark: Measuring blind spots in semantic segmentation. International Journal of Computer Vision, 129(11):3119-3135, 2021. 2, 4, 6
|
| 257 |
+
[5] Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, and Sergey Zagoruyko. End-to-end object detection with transformers. In European conference on computer vision, pages 213-229. Springer, 2020. 2, 3
|
| 258 |
+
[6] Jun Cen, Peng Yun, Junhao Cai, Michael Yu Wang, and Ming Liu. Deep metric learning for open world semantic segmentation. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 15333-15342, 2021. 1
|
| 259 |
+
[7] Fabio Cermelli, Dario Fontanel, Antonio Tavera, Marco Ciccone, and Barbara Caputo. Incremental learning in semantic segmentation from image labels. In CVPR, pages 4371-4381, 2022. 1
|
| 260 |
+
[8] Fabio Cermelli, Massimiliano Mancini, Samuel Rota Bulò, Elisa Ricci, and Barbara Caputo. Modeling the background for incremental learning in semantic segmentation. In CVPR, 2020. 1
|
| 261 |
+
[9] Robin Chan, Krzysztof Lis, Svenja Uhlemeyer, Hermann Blum, Sina Honari, Roland Siegwart, Mathieu Salzmann, Pascal Fua, and Matthias Rottmann. Segmentmeifyoucan: A benchmark for anomaly segmentation. arXiv preprint arXiv:2104.14812, 2021. 2, 5
|
| 262 |
+
[10] Robin Chan, Matthias Rottmann, and Hanno Gottschalk. Entropy maximization and meta classification for out-of-distribution detection in semantic segmentation. In Proceedings of the IEEE/cvf international conference on computer vision, pages 5128-5137, 2021. 2, 6, 7
|
| 263 |
+
[11] Liang-Chieh Chen, Yukun Zhu, George Papandreou, Florian Schroff, and Hartwig Adam. Encoder-decoder with atrous separable convolution for semantic image segmentation. In Proceedings of the European conference on computer vision (ECCV), pages 801-818, 2018. 2, 3
|
| 264 |
+
[12] Bowen Cheng, Ishan Misra, Alexander G Schwing, Alexander Kirillov, and Rohit Girdhar. Masked-attention mask transformer for universal image segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 1290–1299, 2022. 1, 2, 4, 5, 6, 7, 8
|
| 265 |
+
|
| 266 |
+
[13] Bowen Cheng, Alex Schwing, and Alexander Kirillov. Per-pixel classification is not all you need for semantic segmentation. Advances in Neural Information Processing Systems, 34:17864-17875, 2021. 2, 4, 5, 7, 8
|
| 267 |
+
[14] Marius Cordts, Mohamed Omran, Sebastian Ramos, Timo Rehfeld, Markus Enzweiler, Rodrigo Benenson, Uwe Franke, Stefan Roth, and Bernt Schiele. The cityscapes dataset for semantic urban scene understanding. In Proc. of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2016. 1, 5
|
| 268 |
+
[15] Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In 2009 IEEE conference on computer vision and pattern recognition, pages 248-255. IEEE, 2009. 5
|
| 269 |
+
[16] Giancarlo Di Biase, Hermann Blum, Roland Siegwart, and Cesar Cadena. Pixel-wise anomaly detection in complex driving scenes. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 16918-16927, 2021. 2, 6
|
| 270 |
+
[17] Arthur Douillard, Yifu Chen, Arnaud Dapogny, and Matthieu Cord. Plop: Learning without forgetting for continual semantic segmentation. In CVPR, 2021. 1
|
| 271 |
+
[18] Xianzhi Du, Barret Zoph, Wei-Chih Hung, and Tsung-Yi Lin. Simple training strategies and model scaling for object detection. arXiv preprint arXiv:2107.00057, 2021. 6
|
| 272 |
+
[19] Mark Everingham, Luc Van Gool, Christopher KI Williams, John Winn, and Andrew Zisserman. The pascal visual object classes (voc) challenge. International journal of computer vision, 88(2):303-338, 2010. 5
|
| 273 |
+
[20] Dario Fontanel, Fabio Cermelli, Massimiliano Mancini, and Barbara Caputo. Detecting anomalies in semantic segmentation with prototypes. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 113-121, 2021. 1, 2
|
| 274 |
+
[21] Matej Grcic, Petra Bevandić, and Sinisa Šegvic. Dense open-set recognition with synthetic outliers generated by real nvp. arXiv preprint arXiv:2011.11094, 2020. 4
|
| 275 |
+
[22] Matej Grcic, Petra Bevandić, and Siniša Šegvic. Densehybrid: Hybrid anomaly detection for dense open-set recognition. In European Conference on Computer Vision, pages 500-517. Springer, 2022. 1, 2, 4, 6, 7
|
| 276 |
+
[23] Kaiming He, Georgia Gkioxari, Piotr Dólar, and Ross Girshick. Mask r-cnn. In Proceedings of the IEEE international conference on computer vision, pages 2961-2969, 2017. 2
|
| 277 |
+
[24] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 770-778, 2016. 5
|
| 278 |
+
[25] Dan Hendrycks and Kevin Gimpel. A baseline for detecting misclassified and out-of-distribution examples in neural networks. arXiv preprint arXiv:1610.02136, 2016. 1, 2, 3, 6
|
| 279 |
+
[26] Gao Huang, Zhuang Liu, Laurens Van Der Maaten, and Kilian Q Weinberger. Densely connected convolutional networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 4700-4708, 2017. 2
|
| 280 |
+
[27] Sanghun Jung, Jungsoo Lee, Daehoon Gwak, Sungha Choi, and Jaegul Choo. Standardized max logits: A simple yet effective approach for identifying unexpected road obstacles in
|
| 281 |
+
|
| 282 |
+
urban-scene segmentation. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 15425-15434, 2021. 1, 2, 5, 6
|
| 283 |
+
[28] Alexander Kirillov, Kaiming He, Ross Girshick, Carsten Rother, and Piotr Dollar. Panoptic segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 9404-9413, 2019. 2, 5
|
| 284 |
+
[29] Balaji Lakshminarayanan, Alexander Pritzel, and Charles Blundell. Simple and scalable predictive uncertainty estimation using deep ensembles. Advances in neural information processing systems, 30, 2017. 6
|
| 285 |
+
[30] Kimin Lee, Kibok Lee, Honglak Lee, and Jinwoo Shin. A simple unified framework for detecting out-of-distribution samples and adversarial attacks. Advances in neural information processing systems, 31, 2018. 2, 6
|
| 286 |
+
[31] Shiyu Liang, Yixuan Li, and Rayadurgam Srikant. Enhancing the reliability of out-of-distribution image detection in neural networks. arXiv preprint arXiv:1706.02690, 2017. 2
|
| 287 |
+
[32] Guosheng Lin, Anton Milan, Chunhua Shen, and Ian Reid. Refinenet: Multi-path refinement networks for high-resolution semantic segmentation. In CVPR, 2017. 2
|
| 288 |
+
[33] Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dálár, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In Computer Vision-ECCV 2014: 13th European Conference, Zurich, Switzerland, September 6-12, 2014, Proceedings, Part V 13, pages 740-755. Springer, 2014. 6
|
| 289 |
+
[34] Krzysztof Lis, Krishna Nakka, Pascal Fua, and Mathieu Salzmann. Detecting the unexpected via image resynthesis. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 2152-2161, 2019. 1, 2, 5, 6
|
| 290 |
+
[35] Jonathan Long, Evan Shelhamer, and Trevor Darrell. Fully convolutional networks for semantic segmentation. In CVPR, 2015. 2
|
| 291 |
+
[36] Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. arXiv preprint arXiv:1711.05101, 2017. 6
|
| 292 |
+
[37] Umberto Michieli and Pietro Zanuttigh. Continual semantic segmentation via repulsion-attraction of sparse and disentangled latent representations. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 1114-1124, 2021. 1
|
| 293 |
+
[38] Fausto Milletari, Nassir Navab, and Seyed-Ahmad Ahmadi. V-net: Fully convolutional neural networks for volumetric medical image segmentation. In 2016 fourth international conference on 3D vision (3DV), pages 565-571. IEEE, 2016. 3, 6
|
| 294 |
+
[39] Jishnu Mukhoti and Yarin Gal. Evaluating bayesian deep learning methods for semantic segmentation. arXiv preprint arXiv:1811.12709, 2018. 1, 2, 6
|
| 295 |
+
[40] Peter Pinggera, Sebastian Ramos, Stefan Gehrig, Uwe Franke, Carsten Rother, and Rudolf Mester. Lost and found: detecting small road hazards for self-driving vehicles. In 2016 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), pages 1099-1106. IEEE, 2016. 5
|
| 296 |
+
[41] Ruoqi Sun, Xinge Zhu, Chongruo Wu, Chen Huang, Jianping Shi, and Lizhuang Ma. Not all areas are equal: Trans
|
| 297 |
+
|
| 298 |
+
fer learning for semantic segmentation via hierarchical region selection. In 2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 4355-4364, 2019. 1
|
| 299 |
+
[42] Antonio Tavera, Fabio Cermelli, Carlo Masone, and Barbara Caputo. Pixel-by-pixel cross-domain alignment for few-shot semantic segmentation. In 2022 IEEE/CVF Winter Conference on Applications of Computer Vision (WACV), pages 1959-1968, 2022. 1
|
| 300 |
+
[43] Yu Tian, Yuyuan Liu, Guansong Pang, Fengbei Liu, Yuanhong Chen, and Gustavo Carneiro. Pixel-wise energy-biased abstention learning for anomaly segmentation on complex urban driving scenes. In European Conference on Computer Vision, pages 246-263. Springer, 2022. 1, 2, 6
|
| 301 |
+
[44] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. Advances in neural information processing systems, 30, 2017. 7
|
| 302 |
+
[45] Tomas Vojir, Tomasz Sipka, Rahaf Aljundi, Nikolay Chumerin, Daniel Olmeda Reino, and Jiri Matas. Road anomaly detection by partial image reconstruction with segmentation coupling. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 15651-15660, 2021. 1, 2, 6
|
| 303 |
+
[46] Yingda Xia, Yi Zhang, Fengze Liu, Wei Shen, and Alan Yuille. Synthesize then compare: Detecting failures and anomalies for semantic segmentation. In Proceedings of the European Conference on Computer Vision (ECCV), 2020. 1, 2
|
| 304 |
+
[47] Yingda Xia, Yi Zhang, Fengze Liu, Wei Shen, and Alan L. Yuille. Synthesize then compare: Detecting failures and anomalies for semantic segmentation. In Computer Vision – ECCV 2020, pages 145–161, 2020. 1
|
| 305 |
+
[48] Yanchao Yang and Stefano Soatto. Fda: Fourier domain adaptation for semantic segmentation. In 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 4084-4094, 2020. 1
|
| 306 |
+
[49] Jure Zbontar, Li Jing, Ishan Misra, Yann LeCun, and Stéphane Deny. Barlow twins: Self-supervised learning via redundancy reduction. In International Conference on Machine Learning, pages 12310-12320. PMLR, 2021. 5
|
| 307 |
+
[50] Junyi Zhang, Ziliang Chen, Junying Huang, Liang Lin, and Dongyu Zhang. Few-shot structured domain adaptation for virtual-to-real scene parsing. In 2019 IEEE/CVF International Conference on Computer Vision Workshop (ICCVW), pages 9-17, 2019. 1
|
| 308 |
+
[51] Zhenli Zhang, Xiangyu Zhang, Chao Peng, Xiangyang Xue, and Jian Sun. Expuse: Enhancing feature fusion for semantic segmentation. In ECCV, 2018. 2
|
| 309 |
+
[52] Hengshuang Zhao, Jianping Shi, Xiaojuan Qi, Xiaogang Wang, and Jiaya Jia. Pyramid scene parsing network. In CVPR, 2017. 2
|
| 310 |
+
[53] Xizhou Zhu, Weijie Su, Lewei Lu, Bin Li, Xiaogang Wang, and Jifeng Dai. Deformable detr: Deformable transformers for end-to-end object detection. arXiv preprint arXiv:2010.04159, 2020. 5
|
unmaskinganomaliesinroadscenesegmentation/images.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a0e71f7300e76df11098e45e9de59f65fbfe43dd6504d7bc675bffeec8ca51cb
|
| 3 |
+
size 621530
|
unmaskinganomaliesinroadscenesegmentation/layout.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a0cedc79d00d593e85f88a6b8deff6dfe419b4be27136de87c34acd38ee6d1b8
|
| 3 |
+
size 392825
|