SlowGuess/NeurIPS_2023_OCR huggingface dataset:
Noting that there is no real gradient defined for equation 1, following [17, 21, 31, 32], we approximate the gradient by copying gradients from the refined visual tokens  $z^l$  to the visual tokens  $h^l$  for  $l = 0, \dots, L$ . Thus, our proposed HVQ-Trans incorporates five terms into its objective, specified as:
$$
\mathbb {L} _ {H V Q - T r a n s} = \left\| \boldsymbol {h} ^ {0} - \tilde {\boldsymbol {h}} ^ {0} \right\| _ {2} ^ {2} + \sum_ {l = 1} ^ {L} \left[ \left\| \operatorname {s g} \left(\boldsymbol {h} ^ {l}\right) - \boldsymbol {e} ^ {l} \right\| _ {2} ^ {2} + \beta^ {l} \left\| \boldsymbol {h} ^ {l} - \operatorname {s g} \left(\boldsymbol {e} ^ {l}\right) \right\| _ {2} ^ {2} + \alpha^ {l} \mathbb {L} _ {P O T} ^ {l} \right] - \sum_ {j = 1} ^ {M} p _ {j} (\boldsymbol {x}) \log \mathcal {P} _ {x}, \tag {5}
$$
where the  $\mathfrak{sg}(\cdot)$  refers to the stop-gradient operation and  $\mathcal{P}_x$  the category label.  $\beta^l$  and  $\alpha^l$  are hyperparameters. The first term refers to the reconstruction loss. The second one in the scope of summation along  $L$  layers is the hierarchical prototypical loss, pushing the selected prototype  $e^l$  closer to the visual token  $h^l$ . The third term denotes the hierarchical commitment loss, optimizing the encoder by encouraging the output of the encoder  $h^l$  to stay close to the chosen prototype and prevent it from fluctuating too frequently from one prototype to another. The fourth term is the POT loss defined in Eq. 4. The last term is the cross entropy loss for training the classifier to adaptively switch the proper reconstruction expert and codebook. Following [21], we use the exponential moving average updates for codebooks. More details can be found in Appendix.
3 Connection with previous works
In unsupervised anomaly detection, only normal samples are available at the training stage. Unsupervised anomaly detection methods can be roughly categorized into density-based and reconstruction-based methods. Density-based methods estimate the distribution of normal data points to identify anomalous data points [4-6]. Our HVQ-Trans method adheres to the probabilistic variation framework but refrains from assuming a specific distribution of normal data. Therefore, the image prior is learned dynamically rather than relying on a static distribution. On the other hand, reconstruction-based methods assume that the model trained on normal data only can well reconstruct normal regions, but fail in anomalous regions [33-35]. Typical approaches include Auto-Encoder (AE) [36-38], Variational Auto-Encoder (VAE) [39, 40], and Generative Adversarial Net (GAN) [41-43]. However, most of these methods do not incorporate a reliable mechanism for encouraging the model to induce large reconstruction error on the anomalous region.
Adopting a memory matrix for unsupervised anomaly detection has proven to be an effective solution. The idea was first proposed in MemAE [9] by injecting an extra memory matrix to assemble normal patterns during training. Based on this paradigm, the memory-based models have attracted attention in recent years [15, 35, 44]. These methods always record the normal patterns into the memory, then recombine and re-weight the relevant patterns for reconstruction. However, if anomalous representations can be recovered through the re-weighting of normal patterns, the discriminating process may collapse. In contrast, our method compresses images into a discrete latent space, inspired by the vector quantization technology [21, 32], referring to ideas from lossy compression to relieve the model from modeling negligible information. Additionally, our hierarchical framework allows us to increase the size of the codebooks without incurring the codebook collapse problem, achieving meticulous anomaly detection at multiple levels with our prototype-oriented scoring method.
Table 1: Anomaly detection/localization results with AUROC metric on MVTec-AD. All methods are evaluated under the one-for-all settings. The learned model is applied to detect anomalies for all categories without fine-tuning. The best results are bold with black.
Category	US[46]	PSVDD[47]	PaDiM[48]	MKD[49]	DRAEM[50]	SimpleNet[51]	PatchCore[8]	RD4AD[52]	UTRAD[33]	UniAD[10]	Ours
Object	Bottle	84.0 / 67.9	85.5 / 86.7	97.9 / 96.1	98.7 / 91.8	97.5 / 87.6	97.7 / 91.2	100 / 97.4	98.7 / 97.7	100 / 96.4	99.7 / 98.1	100 ± 0.00 / 98.3 ± 0.04
Cable	60.0 / 78.3	64.4 / 62.2	70.9 / 81.0	78.2 / 89.3	57.8 / 71.3	87.6 / 88.1	95.3 / 93.6	85.0 / 83.1	97.8 / 97.1	95.2 / 97.3	99.0 ± 0.29 / 98.1 ± 0.04
Capsule	57.6 / 85.5	61.3 / 83.1	73.4 / 96.9	68.3 / 88.3	65.3 / 50.5	78.3 / 89.7	96.8 / 98.0	95.5 / 98.5	82.0 / 97.2	86.9 / 98.5	95.4 ± 0.21 / 98.8 ± 0.01
Hazelnut	95.8 / 93.7	83.9 / 97.4	85.5 / 96.3	97.1 / 91.2	93.7 / 96.9	99.2 / 95.7	99.3 / 97.6	87.1 / 98.7	99.8 / 98.2	99.8 / 98.1	100 ± 0.08 / 98.8 ± 0.02
Metal Nut	62.7 / 76.6	80.9 / 96.0	88.0 / 84.8	64.9 / 64.2	72.8 / 62.2	85.1 / 90.9	99.1 / 96.3	99.4 / 94.1	94.7 / 96.4	99.2 / 94.8	99.9 ± 0.02 / 96.3 ± 0.09
Pill	56.1 / 80.3	89.4 / 96.5	68.8 / 87.7	79.7 / 69.7	82.2 / 94.4	78.3 / 89.7	86.4 / 90.8	52.6 / 96.5	89.7 / 95.7	93.7 / 95.0	95.8 ± 0.49 / 97.1 ± 0.04
Screw	66.9 / 90.8	80.9 / 74.3	56.9 / 94.1	75.6 / 92.1	92.0 / 95.5	45.5 / 93.7	94.2 / 98.9	97.3 / 99.4	75.1 / 95.2	87.5 / 98.3	95.6 ± 0.60 / 98.9 ± 0.05
Toothbrush	57.8 / 86.9	99.4 / 98.0	95.3 / 95.6	75.3 / 88.9	90.6 / 97.7	94.7 / 97.5	100 / 98.8	99.4 / 99.0	89.7 / 97.5	94.2 / 98.4	93.6 ± 0.66 / 98.6 ± 0.04
Transistor	61.0 / 68.3	77.5 / 78.5	86.6 / 92.3	73.4 / 71.7	74.8 / 64.5	82.0 / 86.0	98.9 / 92.3	92.4 / 86.4	92.0 / 91.5	99.8 / 97.9	99.7 ± 0.12 / 97.9 ± 0.04
Zipper	78.6 / 84.2	77.8 / 95.1	79.7 / 94.8	87.4 / 86.1	98.8 / 98.3	99.1 / 97.0	97.1 / 95.7	99.6 / 98.1	95.5 / 97.3	95.8 / 96.8	97.9 ± 0.15 / 97.5 ± 0.10
Texture	Carpet	86.6 / 88.7	63.3 / 78.6	93.8 / 97.6	69.8 / 95.5	98.0 / 98.6	95.9 / 92.4	97.0 / 98.1	97.1 / 98.8	80.3 / 94.4	99.8 / 98.5	99.9 ± 0.03 / 98.7 ± 0.03
Grid	69.2 / 64.5	66.0 / 70.8	73.9 / 71.0	83.8 / 82.3	99.3 / 98.7	49.8 / 46.7	91.4 / 98.4	99.7 / 99.2	93.9 / 95.2	98.2 / 96.5	97.0 ± 0.69 / 97.0 ± 0.06
Leather	97.2 / 95.4	60.8 / 93.5	99.9 / 84.8	93.6 / 96.7	98.7 / 97.3	93.9 / 96.9	100 / 99.2	100 / 99.4	99.8 / 98.4	100 / 98.8	100 ± 0.00 / 98.8 ± 0.02
Tile	93.7 / 82.7	88.3 / 92.1	93.3 / 80.5	89.5 / 85.3	99.8 / 98.0	93.7 / 93.1	96.0 / 90.3	97.5 / 95.6	98.8 / 94.2	99.3 / 91.8	99.2 ± 0.32 / 92.2 ± 0.42
Wood	90.6 / 83.3	72.1 / 80.7	98.4 / 89.1	93.4 / 80.5	99.8 / 96.0	95.2 / 84.8	93.8 / 90.8	99.2 / 96.0	99.7 / 89.4	98.6 / 93.2	97.2 ± 0.40 / 92.4 ± 0.16
Mean	74.5 / 81.8	76.8 / 85.6	84.2 / 89.5	81.9 / 84.9	88.1 / 87.2	85.1 / 88.9	96.4 / 95.7	93.4 / 96.0	92.6 / 95.6	96.5 / 96.8	98.0 ± 0.11 / 97.3 ± 0.05
Figure 4: Qualitative results for anomaly localization on MVTec-AD. 'Recon/Pred-Sing' and 'Recon/Pred-Hier' are reconstructions/score maps with single/hierarchical VQLayer, respectively.
MVTec-AD [2] is a wildly-used industrial anomaly detection dataset with 15 classes, it covers more than 5k high-resolution images including objects and textures. For each class, the training samples are normal while the test samples can be either normal or anomalous. For each anomalous sample, the ground-truths of image label and segmentation are available for evaluation. In this paper, we investigate the unified case following [10], where only one model is used to handle all categories.
VisA [45] is a recently published large dataset, which consists of 9,621 normal and 1,200 anomalous high-resolution images. The dataset includes images with complex structures, objects placed in sporadic locations, and various types of objects. Anomalies encompass scratches, dents, color spots, cracks, and structural defects. All images are spatially resized to  $224 \times 224$  to facilitate training.
CIFAR-10 [45] is a classical image classification dataset of 10 categories. We adopt the challenging many-versus-many setting as in [10], where 5 classes are viewed as normal while the rest 5 classes are viewed as anomalies that remain unseen during training.
Evaluation metrics: We report the Area Under the Receiver Operator Curve (AUROC) on image-level anomaly detection and pixel-wise anomaly localization following the previous works [2, 10, 46].
4.2 Anomaly detection and localization performance on MVtec-AD
Implementation details: The input image size of MVtec-AD is  $224 \times 224 \times 3$ , after being fed into the pre-trained EfficientNet [20], the feature maps become  $14 \times 14 \times 272$ , namely, the patch size is 16. Then we reduce the channel dimension of each patch into 256, followed by feeding them into a 4-layer vanTrans-enc followed by the corresponding and a 4-layer VQTrans-dec. We use AdamW [53] with weight decay 0.0001 for optimization. Our model is trained for 1000 epochs on 2 GPUs (NVIDIA GeForce RTX 3080 10GB) with batch size 16. The learning rate is initialized as  $1 \times 10^{-4}$  and dropped by 0.1 after 800 epochs. Our model is trained from scratch besides the pre-trained EfficientNet. For more details, please refer to the Appendix.
Quantitative results of anomaly detection on MVtec-AD: As shown in Table 1, the proposed HVQ-Trans generally outperforms all the competitive baselines. Specifically, our model surpasses PatchCore and UniAD by  $1.6\%$  and  $1.5\%$  on average. The former is a SOTA method under the one-for-one setting, the latter is a SOTA method under the one-for-all setting. Especially, in the one-for-all case, our model far exceeds UniAD by  $8.5\%$  and  $8.1\%$  on Capsule and Screw, respectively. We attribute this to that our model is more robust for identical shortcuts thanks to our well-designed
Table 2: Anomaly detection/location results (image AUROC, pixel AUROC) on VisA. Our model is applied to all categories without specific parameter-tuning on each category.
Category	DRAEM[50]	JNLD[55]	OmniAL[54]	UniAD[10]	Ours
Complex structure	PCB1	83.9 / 94.0	82.9 / 98.0	77.7 / 97.6	95.4 / 99.3	96.7 / 99.4
PCB2	81.7 / 94.1	79.1 / 95.0	81.0 / 93.9	93.6 / 97.8	93.4 / 98.0
PCB3	87.7 / 94.1	90.1 / 98.5	88.1 / 94.7	88.6 / 98.3	92.0 / 98.3
PCB4	87.1 / 72.3	96.2 / 97.5	95.3 / 97.1	99.4 / 97.9	99.5 / 97.7
Multiple instances	Macaroni 1	68.6 / 89.8	90.5 / 93.3	92.6 / 98.6	92.2 / 99.3	93.1 / 99.4
Macaroni 2	60.3 / 83.2	71.3 / 92.1	75.2 / 97.9	85.9 / 98.0	86.2 / 98.5
Capsules	89.6 / 96.6	91.4 / 99.6	90.6 / 99.4	72.0 / 98.3	77.1 / 99.0
Candles	70.2 / 82.6	85.4 / 94.5	86.8 / 95.8	96.8 / 99.2	96.8 / 99.2
Single instance	Cashew	67.3 / 68.5	82.5 / 94.1	88.6 / 95.0	92.4 / 98.7	94.9 / 99.2
Chewing gum	90.0 / 92.7	96.0 / 98.9	96.4 / 99.0	99.4 / 99.2	99.4 / 98.8
Fryum	86.2 / 83.2	91.9 / 90.0	94.6 / 92.1	89.8 / 97.7	90.4 / 97.7
Pipe fryum	87.1 / 72.3	87.5 / 92.5	86.1 / 98.2	97.4 / 99.2	98.5 / 99.4
Mean	80.5 / 87.0	87.1 / 95.2	87.8 / 96.6	91.9 / 98.6	93.2 / 98.7
architecture and algorithm. Notably, the performance of various categories are significantly different (Toothbrush), which might due to the data distribution of each category is different, corresponding to different requests for representation ability. The switching mechanism learns individual codebooks and experts for each class, decreasing the distortion between multiple classes. To sum up, our model is proven to be effective and efficient for one-for-all anomaly detection applications.
Quantitative results of anomaly localization on MVtec-AD: Anomaly localization aims to detect the anomalous regions given anomalous samples. The localization results under the one-for-all setting are shown in Table 1. As we can see, our model outperforms all the competitive baselines on average. Specifically, as a strong SOTA baseline, UniAD is also left behind by our model by  $0.5\%$  on both settings averagely speaking. We attribute this to that the hierarchical VQ also plays an important role in precise localization besides the learnable query embeddings verified by UniAD since our HVQ-Trans only employs the traditional query embeddings. Moreover, localization requires more precise position information compared with its detection counterpart, a proper measurement alignment to enhance the real anomalous regions may be important, which is exactly what our POT is good at. Another interesting finding is reported in Appendix that although there exists information loss in reconstructing normal images, such information loss is even more significant in reconstructing anomalous images. Hence, the actual anomaly localization performance is improved.
Qualitative results of anomaly localization on MVtec-AD: As shown in Fig. 4, our method can successfully recover the anomalous regions with their corresponding normal patterns for both object anomalies (Left) and texture damages (Right). It can be seen that the model with hierarchical VQ layers could better generate normal patterns at abnormal regions, resulting in more accurate anomaly localization. More qualitative results are given in Appendix.
4.3 Anomaly detection on VisA
Quantitative results on VisA: Compared to MVTecAD, VisA poses greater difficulty due to its more complex structures and scenes with multiple misaligned instances. Table 2 demonstrates the superior performance of our model in comparison to the other three reconstruction-based methods under the unified setting. Our proposed model surpasses the best of the comparison methods, i.e., UniAD, by  $1.3\%$  on image-AUROC, leading to significantly superior performances than the modest recent unified model OmniAL [54] ( $5.4\%$  and  $2.1\%$  on detection and localization).
Qualitative results on VisA: Figure 5 illustrates the impressive performance of our reconstruction and localization in various categories. Even in multi-instance scenes, Our model effectively restores the anomaly region to its normal state. The reconstructed images exhibit a high level of fidelity, closely matching the appearance of normal regions and meeting expectations in recovering anomalies. More qualitative results are given in Appendix.
Figure 5: Qualitative results for anomaly localization on VisA.
Table 3: Anomaly detection results with AUROC metric on CIFAR-10 under the one-for-all setting. Normal indices indicate the names of normal classes. The best results are bold with black.
Normal Indices	US[46]	FCDD[56]	FCDD+OE[56]	PANDA[57]	MKD[49]	UniAD[10]	Ours
{01234}	51.3	55.0	71.8	66.6	64.2	84.4	82.6 ± 0.02
{56789}	51.3	50.3	73.7	73.2	69.3	80.9	84.3 ± 0.03
{02468}	63.9	59.2	85.3	77.1	76.4	93.0	92.4 ± 0.10
{13579}	56.8	58.5	85.0	72.9	78.7	90.6	91.9 ± 0.06
Mean	55.9	55.8	78.9	72.4	72.1	87.2	87.8 ± 0.04
Table 4: Ablation studies with AUROC metric on MVTec-AD. w/o VQ means without VQ.
w/o VQ	with VQ	Switching	POT	Detection	Localization
Single	Hierarchical	Codebook-Switching	Expert-Switching
✓	-	-	-	-	-	70.5	81.4
-	✓	-	-	-	-	96.2	96.8
-	✓	-	✓	-	-	96.4	96.8
-	-	✓	-	-	-	97.1	96.9
-	-	✓	✓	-	-	97.2	97.0
-	-	✓	-	-	✓	97.4	97.2
-	-	✓	✓	✓	-	97.6	97.2
-	-	✓	✓	✓	✓	98.0	97.3
4.4 Anomaly detection on CIFAR-10
Implementation details: In order to implement many-versus-many anomaly detection, we select 5 normal classes while the rest classes are viewed as anomalies. As shown in Table 3, {01234} means the normal samples include images from classes 0, 1, 2, 3, and 4, while the images from 5, 6, 7, 8, and 9 are anomalies. For statistical robustness, we repeat the splitting and obtain four combinations.
Quantitative results on CIFAR-10: As shown in Table 3, the performance of our model surpasses all the other competitors under many-versus-many setting with each dataset splitting. Besides, CIFAR-10 dataset itself is more complex than MVtec-AD because of its poor shooting conditions. Hence, the one-for-all setting on CIFAR-10 imposes stricter requirements for the model to exactly distinguish normal patterns from anomalous interference. Therefore, the substantial improvement further verifies the superiority of our method.
4.5 Ablation studies
Component study: To verify the effectiveness of the proposed modules, including single VQLayer, hierarchical VQLayers, switching mechanism for codebooks and reconstruction experts, and POT scoring, we implement extensive ablation studies on MVTec-AD. As shown in Table 4, we have the following observations: (i) The performance of the model without VQ drops by nearly  $26\%$  (96.4 to 70.5), which demonstrates that VQ plays the key role in anomaly detection and the vanilla Transformer is powerful to well reconstruct both the normal and anomaly. Our VQ module acts as the information bottleneck where only the normal information is allowed to pass through, thus degrading the reconstruction of anomalous; (ii) The hierarchical structure also presents performance gain since it provides local access to multi-level codebooks, thus reducing the search complexity per layer and releasing the codebook collapse issue; (iii) The switching brings slight improvements on MVTec-AD, while it achieves significant gains up to  $3.2\%$  on CIFAR-10, as shown in the Appendix. We attribute this to the different degrees of difficulty posed by the two dataset distributions. Our switching mechanism plays a more critical role for the complex datasets, i.e., CIFAR-10 in this case; (iv) The POT module is effective in detecting and localizing anomalies due to its cascade measurement alignment property.
Table 5: Different hierarchical structures.
Structure	Detection	Localization
hl→zl	94.9	96.5
hl-1 ⊕ hl→zl	97.2	97.0
hl-1 ⊕ θ →zl	98.0	97.3
Table 6: Different prototype numbers  $K$  .
K	Detection	Localization
1024	97.1	97.2
512	98.0	97.3
256	97.0	97.1
Different hierarchies: We demonstrate experiments to investigate the impact of various hierarchies, as shown in Table 5, where the different information is encoded in different layers. While the multi-level features  $h^l$  are concatenated with the global prototypes  $\theta$ , the joint performance over anomaly detection and localization increases. One possible explanation is that the global prototypes  $\theta$  at much higher abstraction levels may result in efficient latent representation for anomaly detection.
Robustness to prototype number: We conduct the experiments by using different prototype numbers  $K$  and show the AUC values in Table 6. Given different numbers of prototypes, our HVQ-Trans can still surpass most of the competitors in Table 1, proving the robustness of our method.
Visualizing how the prototypes work: In order to investigate what exactly the prototypes have learned, we further train a mapping function from the reconstructed feature to the observation space and present the visualization results in Fig. 6. We compulsively instructed the model to reconstruct the patches within the red box using prototypes from the codebook of a different, irrelevant category. As demonstrated in the figure, the reconstructed region is highly correlated to the prototypes, e.g., the centering region in the 'Cable' image is reconstructed as 'Grid'. The observations confirm that our iconic prototypes accurately represent typical normal patterns of each category, and only reconstruct the corresponding normal appearances as intended.
Figure 6: The top row illustrates the images can be well reconstructed with switched prototypes. The bottom row displays when the patches in the red box are forced to be reconstructed with irrelevant prototypes, the reconstructed region is in accordance with the given prototypes.
We introduce a unified model, HVQ-Trans, for multi-class Unsupervised Anomaly Detection under the one-for-all setting. The latent space is modeled as hierarchical discrete prototypes learned from normal training data. We vector quantize visual features to reconstruct normal patterns and employ a switching mechanism for codebook selection and exquisite reconstruction. Our hierarchical designation incorporates multi-level normative information and encourages the model to reconstruct anomalous images as normal. Furthermore, we propose the hierarchical prototype-oriented optimal transport module to regulate the prototypes and calibrate the anomaly score. Under the one-for-all setting, our model significantly surpasses competitors on MVtec-AD and VisA datasets, and provides visualization and interpretability for both anomaly localization and detection.
Discussion: In this work, the category labels are assumed to be available during the training stage. How to incorporate the model with clustering methods rather than category labels should be further studied. In practice, our model can assemble the normal iconic prototypes which may facilitate domain adaption for real scenes, and be potentially applied to time series, text, and video data. However, anomaly detection for video surveillance or social multimedia may raise privacy concerns.
This work was supported in part by the National Natural Science Foundation of China (NSFC) under Grant U21B2006; in part by the NSFC under Grant 82172860; in part by the NSFC under Grant 6220010437; in part by the Shaanxi Youth Innovation Team Project; in part by the Fundamental Research Funds for the Central Universities QTZX23037 and QTZX22160; in part by the Fundation of Aerospace under Grant SAST2021012; in part by the 111 Project under Grant B18039.
[49] Mohammadreza Salehi, Niousha Sadjadi, Soroosh Baselizadeh, Mohammad H Rohban, and Hamid R Rabiee. Multiresolution knowledge distillation for anomaly detection. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 14902-14912, 2021.
[50] Vitjan Zavrtanik, Matej Kristan, and Danijel Skočaj. Draem-a discriminatively trained reconstruction embedding for surface anomaly detection. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 8330-8339, 2021.
[51] Zhikang Liu, Yiming Zhou, Yuansheng Xu, and Zilei Wang. Simplenet: A simple network for image anomaly detection and localization. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 20402-20411, 2023.
[52] Hanqiu Deng and Xingyu Li. Anomaly detection via reverse distillation from one-class embedding. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 9737-9746, 2022.
[53] Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. In Int. Conf. Learn. Represent., 2019.
[54] Ying Zhao. Omnial: A unified cnn framework for unsupervised anomaly localization. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 3924-3933, 2023.
[55] Ying Zhao. Just noticeable learning for unsupervised anomaly localization and detection. In 2022 IEEE International Conference on Multimedia and Expo (ICME), pages 01-06. IEEE, 2022.
[56] Philipp Liznerski, Lukas Ruff, Robert A Vandermeulen, Billy Joe Franks, Marius Kloft, and Klaus-Robert Müller. Explainable deep one-class classification. In Int. Conf. Learn. Represent., 2021.
[57] Tal Reiss, Niv Cohen, Liron Bergman, and Yedid Hoshen. Panda: Adapting pretrained features for anomaly detection and segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 2806-2814, 2021.