{"id":"ced176d0-8ab2-4617-b5d2-215e9cacfc84","arxiv_id":"2412.11802","paper_version":1,"verdict":"CONDITIONAL","confidence":"MODERATE","novelty_score":6.0,"correctness_risk":"medium","formal_verification":"none","parameter_count":8,"one_line_summary":"AMI-Net adaptively masks anomalous regions in pretrained feature maps, inpaints them with a transformer, and uses reconstruction error for real-time industrial anomaly detection and localization.","lead":"This paper presents AMI-Net, an unsupervised defect detection network that masks suspected defective image regions using learned normal-feature clusters, then reconstructs those regions and scores the difference. It reports near-state-of-the-art accuracy on two industrial benchmarks with 11.48 ms inference, relevant for real-time quality inspection.","discovery_kind":"new_method","skeptic_critique":{"model":"deepseek-v4-flash","headline":"The central claim depends on a mask whose quality is never measured; Eq. 16's boundary statistics are underspecified and Eqs. 13–14 are inconsistent, so miscalibration could invalidate the adaptive-masking advantage.","rationale":"The reader's conditional verdict is appropriate, and the weakest assumption identified by the reader is also the most load-bearing concern in my read. The paper's headline advantage over prior mask-based methods is precisely that the test-time mask is adaptive rather than random. If the adaptive mask is miscalibrated, the mechanism described in the abstract and Section III simply does not deliver what is claimed: defects may remain visible to the inpainting network and be reconstructed, or normal regions may be masked and then reconstructed with high error, producing false positives. Because the final anomaly score in Eq. 18 is computed after the mask is applied, the mask error is not a minor implementation detail but a direct threat to the central claim. The mathematical presentation compounds the problem: Eq. 13 defines d_ij with a min over i, which makes d_ij independent of i, and Eq. 14 then sums over j to define d_i, which would be the same for every cluster. This makes it impossible for a reader to determine what quantity the boundary r_i in Eq. 16 is actually summarizing. The paper also does not state whether the mean and standard deviation in Eq. 16 are computed per test image, per category from training data, or globally; each choice has very different failure modes. A per-image statistic would be unstable on images with large defects, while a training-time statistic would be sensitive to distribution shift. The manuscript's own failure cases in Section IV-G—subtle defects missed and background noise detected—are consistent with either failure mode, but the paper does not analyze them through the lens of mask calibration. The missing controlled ablation is equally important. The paper compares against RIAD and other methods, but it never compares AMI-Net against itself with a random mask at test time. Without that within-model ablation, the observed improvements over RIAD could come from the pre-trained feature reconstruction targets, the clustering-based distance scoring, or other architectural choices, rather than from the adaptive mask. The concrete test I propose would settle this: measure the mask's precision and recall directly against ground-truth defect maps, and compare adaptive-mask performance with random-mask and oracle-mask performance under the same trained checkpoint. This is a verification gap rather than evidence of fraud or incompetence, and the released code makes the test feasible. I therefore keep the verdict at CONDITIONAL rather than moving to ACCEPT or REJECT.","tokens_in":21962,"tokens_out":6568,"duration_ms":61664,"concrete_test":"Run the released code on MVTec AD test images; for each image, export the adaptive mask before inpainting, upsample it to input resolution, and compute recall (fraction of ground-truth defect pixels masked) and precision (masked pixels that are defect) per category. Then run the same trained checkpoint twice: (i) with the adaptive mask replaced by a uniform random mask with the same number of masked tokens, and (ii) with an oracle mask from ground-truth annotations. If (i) matches adaptive-mask AUROC, the adaptive mask is not the source of the gain; if (ii) substantially exceeds adaptive-mask AUROC, the mask is miscalibrated and the central claim is unsupported.","verdict_should_be":"UNCHANGED","load_bearing_attack":"The paper's central claim is that the adaptive mask generator hides anomalous tokens while preserving normal tokens, enabling the inpainting network to suppress defect reconstruction. For this to be true, the cluster-boundary rule in Eq. 16 must be well-defined and correctly calibrated on every test image. It is not. Eq. 13 defines d_ij as min over i of R(...), so d_ij is independent of i; Eq. 14 then defines d_i = sum_j d_ij, making d_i identical for all clusters. The intended per-cluster distances (presumably distances from tokens assigned to cluster i) are never written down. It is also unspecified whether the mean and std in Eq. 16 are computed from the current test image, from a training-set buffer, or from a fitted distribution. This is not a cosmetic detail: if the statistics are per test image, a heavily defective image inflates mean and std and pushes the boundary r_i above anomalous tokens, so defects remain unmasked and can be reconstructed; if the statistics come from training, pose/lighting shift on a normal test image can mask large normal regions and create false positives. The failure cases in Sec. IV-G (subtle defects missed, background noise flagged) are exactly the signature of this miscalibration. The paper also never reports mask-level precision/recall against ground-truth defect maps, and no ablation replaces the adaptive mask with a random mask of the same average ratio, so the claimed benefit over random masking is not demonstrated by controlled evidence. The final anomaly score (Eq. 18) is computed after masking, so any miscalibration propagates directly into both image- and pixel-level AUROC.","agreement_with_reader":"agree"},"referee_report":{"model":"deepseek-v4-flash","summary":"The paper proposes AMI-Net, an unsupervised industrial anomaly detection and localization method that reconstructs multi-scale features extracted by a pre-trained WideResNet50. During training the model randomly masks variable numbers of feature tokens and learns to inpaint them, while also training cluster tokens with a clustering loss. During testing, an adaptive mask generator clusters feature tokens and masks tokens whose distance to the nearest cluster center exceeds a per-cluster boundary, after which an inpainting transformer reconstructs the masked features; the final anomaly score is the distance between the input and reconstructed features. Experiments on MVTec AD and BTAD are reported under one-for-one, one-for-all, and few-shot settings, with inference time reported as 11.48 ms.","tokens_in":22312,"tokens_out":2609,"duration_ms":27981,"significance":"If the adaptive mask generator works as claimed, AMI-Net would be a practically valuable contribution: it offers competitive image- and pixel-level AUROC on MVTec AD (99.0/98.2), best results on BTAD (95.1/97.5), strong one-for-all performance (97.2/97.5), reasonable few-shot localization, and a fast single-pass inference. The paper also ships code, which is a concrete reproducibility asset, and the experiments span multiple training regimes and include ablations over key hyperparameters. However, the central claim is that the adaptive mask hides anomalous tokens while preserving normal tokens; the manuscript does not provide direct evidence of mask quality, does not isolate the adaptive mask from random masking in a controlled within-model ablation, and contains an inconsistency in the cluster-distance equations that makes the mask generation procedure not precisely reproducible as written.","major_comments":[{"comment":"The distance definitions are internally inconsistent and the cluster boundary is underspecified. Eq. (13) defines d_ij as the minimum over i of R(T^i_clu, T^{2j}_F(I)), so d_ij is independent of i; Eq. (14) then defines d_i as the sum over j of d_ij, which makes d_i identical for every cluster i. The intended per-cluster distance set is never written down, and this also undermines the clustering loss in Eq. (15), whose intra-class term becomes vacuous under the written definitions. Eq. (16) additionally uses the notation d_ij without specifying whether the mean and standard deviation are computed per test image, from a training-set buffer, or from a fitted distribution. This is load-bearing because the adaptive mask is the core novelty: if, for example, the mean and std are computed per test image, a heavily defective image will inflate them and push the boundary above anomalous tokens, leaving defects unmasked; if they come from training statistics, distribution shift can mask normal regions. The equations must be corrected and the statistics precisely specified.","section":"§III-D, Eqs. (13)–(16)"},{"comment":"The claimed benefit of adaptive masking over random masking is not demonstrated by a controlled within-model experiment. The training procedure uses random positional and quantitative masking, while testing uses the adaptive mask, so the reported accuracy could in principle be attributed to the training strategy, the reconstruction objective, or the cluster token branch rather than to the adaptive mask itself. The paper should add an ablation in which the same trained inpainting network is evaluated with (a) the adaptive mask, (b) a random mask of the same average mask ratio, and (c) no mask, reporting image/pixel AUROC and AP. The paper also never reports mask-level precision/recall of the adaptive mask against ground-truth defect maps, which is the most direct way to confirm that the mask actually covers defects and preserves normal regions. The failure cases in §IV-G (missed subtle defects, false positives on background noise) are consistent with a miscalibrated boundary, which makes this missing evidence particularly important.","section":"§III-D2 and §IV-E"},{"comment":"The sensitivity of the final anomaly score to the mask generator is not characterized. Because the final score in Eq. (18) is computed after masking exactly the tokens that the adaptive mask generator flagged, the reported detection and localization results partly inherit the mask generator's decisions; this is a design coupling, not necessarily a fatal flaw, but the manuscript presents the adaptive mask as if it were validated independently. The ablation in Fig. 9(f) reports that varying lambda does not affect the pixel AUROC metric at all, while the text says lambda controls whether normal features are erroneously masked. This should be analyzed: if pixel AUROC is insensitive to the cluster boundary, the paper should explain why, and it should report mask-level metrics that respond to lambda. Without such analysis, the role of the adaptive mask generator in the overall performance is not established.","section":"§III-D, §IV-E6"}],"minor_comments":[{"comment":"There are several typos and inconsistent names: 'establishs' in the Introduction, 'TrsutMAE' in §II-A1 and Table I, and 'Cluser Tokens' in the heading of §IV-E3.","section":"§I, §II-A"},{"comment":"Reference [13] is cited multiple times in section headings and the bibliography entry appears incomplete or misformatted; please verify the MVTec AD reference and all other entries against the publisher's format.","section":"References"},{"comment":"The DiffNet row for k=8 reports '82.3-' with a missing pixel-level AUROC; please fill in the value or mark it clearly as not reported.","section":"Table IV"},{"comment":"The text says 'The variation in parameter lambda does not affect the pixel AUROC metric' but Fig. 9(f) appears to show small fluctuations; please reconcile the text with the figure or explain why these fluctuations are within noise.","section":"§IV-E6"}],"recommendation":"major_revision","confidential_remarks":"The paper's practical claims are plausible and the experimental scope is broad, but the central mechanism — the adaptive mask generator — is not reproducibly specified in Eqs. (13)–(16) and is not isolated by a controlled ablation. These are fixable with additional experiments and rewriting, so I do not recommend rejection, but the manuscript is not ready for acceptance in its current form."},"author_rebuttal":null,"desk_editor":{"model":"deepseek-v4-flash","letter":"Quick take: this is a solid engineering contribution, not a conceptual breakthrough. The adaptive mask generator—cluster tokens plus positional encoding thresholded to build a test-time mask—is genuinely new relative to RIAD, SSM, InTra, and ST-MAE, and the experimental breadth is real. The random-ratio training masking is sensible for multi-scale defects, and using multi-scale pretrained features as reconstruction targets is a reasonable design. Reported numbers are competitive: 99.0/98.2 on MVTec one-for-one, 97.2/97.5 one-for-all, 95.1/97.5 on BTAD, with 11.48 ms inference. They also include failure cases and a limitation section, which is more than most papers in this area do.\n\nThe soft spots are not fatal but they are real. The biggest one is the missing controlled ablation. The improvement over RIAD could come from the pretrained feature targets, the transformer, or the adaptive mask; there is no experiment that keeps everything fixed and swaps the adaptive mask for a random mask of the same average ratio. The central claim—that adaptive masking is what drives the gain—is therefore not demonstrated by the evidence shown. Second, the cluster-boundary rule in Eq. 16 is under-specified. Eq. 13 defines d_ij as a min over i, which makes it independent of i, and Eq. 14 then sums over j, so d_i would be identical for all clusters. The intended per-cluster distance is never written correctly. It is also unclear whether the mean and std in Eq. 16 are computed per test image, from a training-set buffer, or from a fitted distribution. If per test image, a heavily defective image inflates the boundary and defects stay unmasked; if from training, pose or lighting shift on a normal test image can mask large normal regions and create false positives. The failure cases in Fig. 11 look exactly like this miscalibration. The paper also never reports mask-level precision/recall against ground-truth defect maps, which would directly validate the mask generator. Finally, the circularity is real but not fatal: the mask generator is itself an anomaly detector, so the final score inherits its decisions. That is a design coupling, not a derivation error, but it strengthens the need for the missing ablation.\n\nWho is this for? Practitioners in industrial inspection who want a fast, accurate method and are willing to treat the adaptive mask as a heuristic. The math is not the paper's strength; the experiments are. I would send it to peer review—the issues are fixable—but I would ask for the controlled within-model ablation and a precise, consistent definition of Eqs. 13–16 before accepting.","headline":"Solid engineering paper with a genuinely new adaptive test-time mask idea, but the central ablation is missing and the cluster-boundary rule is underspecified.","tokens_in":22848,"tokens_out":1915,"would_cite":true,"duration_ms":18050,"reading_group":"yes","serious_thinker":"yes","would_accept_peer_review":true},"rs_alignment":null,"lean_confirmation":null,"pith_extraction":{"msc":[],"pacs":[],"model":"deepseek-v4-flash","headline":"AMI-Net's core claim is that reconstruction-based anomaly detection should mask predicted anomalies, not random patches, and reconstruct multi-scale features, not pixels; on MVTec AD this reaches 99.0% image and 98.2% pixel AUROC.","keywords":["anomaly detection","anomaly localization","adaptive mask inpainting","feature reconstruction","cluster tokens","vision transformer","industrial defect detection","MVTec AD"],"falsifier":"Run the released code on MVTec AD, record the adaptive mask for every test image, and compare it with the ground-truth defect mask: if the mean intersection-over-union is near zero on any category, or if defects like cable swaps are left unmasked, the central claim that the generator masks anomalous regions while preserving normal ones is falsified. Sweeping $\\lambda$ in Eq. 16 and observing a narrow accuracy peak would further show that the boundary is miscalibrated.","tokens_in":21762,"feed_emoji":"🔍","tokens_out":7993,"duration_ms":67826,"temperature":0.7,"pith_summary":"AMI-Net is an unsupervised industrial defect detection method built on a simple bet: if a reconstruction network can be made to inpaint the defective region rather than copy it, the defect will stand out as reconstruction error. To do this, the paper replaces pixel targets with multi-scale feature maps from a pre-trained WideResNet50, trains an inpainting transformer under random masks of variable size and position, and adds an adaptive mask generator that identifies which feature tokens are anomalous by their distance to learned cluster tokens. At test time the generator masks those anomalous tokens, the inpainter restores them from visible normal context, and the difference between input and reconstructed features localizes the defect. On MVTec AD the method reports 99.0% image-level and 98.2% pixel-level AUROC in the one-for-one setting, 97.2%/97.5% in the one-for-all setting, and 11.48 ms per image inference. A sympathetic reader would care because the method addresses the core weakness of reconstruction approaches, defect reconstruction, without requiring defect samples or multiple test-time passes.","feed_headline":"Adaptive defect masks push industrial anomaly detection to 99%","feed_subtitle":"AMI-Net masks only the anomalous regions, then inpaints them from normal context, reaching 99.0% image AUROC on MVTec AD.","key_machinery":"The load-bearing mechanism is the adaptive mask generator: a set of P trainable cluster tokens aggregated by a one-block transformer (the semantic aggregation network) over feature tokens that carry fixed positional embeddings. Distance between a cluster token and a feature token is defined as the Euclidean distance times the cosine dissimilarity; each feature token is assigned to its nearest cluster, and a cluster's boundary is $r_i = \\mathrm{mean}(d_{ij}) + 0.5\\,\\mathrm{std}(d_{ij})$. Tokens beyond this boundary are masked, and the inpainting network, a stack of eight transformer blocks, reconstructs the masked tokens from the visible ones. A second load-bearing component is the reconstruction target itself: multi-scale features from layers 2 through 4 of a pre-trained WideResNet50, resized and concatenated, which the paper argues are more semantically separable between normal and abnormal than pixels. Finally, the training-time random positional and quantitative masking, with the mask ratio sampled uniformly from 0 to 1, teaches the inpainter to handle defects of arbitrary size, and the feature jittering variant adds robustness to noise.","core_discovery":"The central claim is that the right reconstruction target is not the image but a multi-scale semantic feature representation, and the right mask is not random but adaptive. Given a test image, AMI-Net extracts features with a frozen pre-trained CNN, projects them into tokens, and assigns each token to one of P learned cluster tokens using a distance that multiplies Euclidean distance by cosine dissimilarity. The cluster boundary is set as mean distance plus 0.5 standard deviation; tokens beyond the boundary are treated as anomalous and masked, while normal tokens stay visible. Positional embedding is added before clustering so global defects, such as swapped cables or misplaced transistors, which look locally normal but appear in wrong positions, are caught. The inpainting transformer then fills the masked positions from the visible normal context, so defective regions are suppressed in the reconstruction. The anomaly score is the product of Euclidean distance and cosine dissimilarity between input and reconstructed features, upsampled to the original resolution. The paper argues this design prevents the generalization failure of plain autoencoders, removes the test-time randomness of prior mask-based methods, and needs only a single forward pass.","pith_inferences":["The adaptive mask generator effectively turns a reconstruction network into a two-stage detector: first a fast clustering-based proposal of anomalous tokens, then an inpainting-based verification; this suggests the mask quality, not the inpainter, is the accuracy bottleneck, so improving cluster boundary calibration should pay off more than enlarging the inpainter.","Because the mask is generated per test image from cluster statistics, the method should transfer to new object categories without retraining only if the pre-trained features remain tightly clustered; a natural test is to evaluate the generator's mask precision on categories unseen during training.","The paper's sketched extension to abnormal training samples, pasting extracted defect regions onto normal samples, could turn AMI-Net into a semi-supervised method; one could test whether the adaptive mask generator then learns to ignore pasted defects during training and still detects real ones.","The distance-as-product-of-Euclidean-and-cosine design couples scale and direction, so normal features with large magnitude but slightly wrong direction may be masked; this could explain the reported false positives on low-contrast noise."],"forward_implications":["On MVTec AD, AMI-Net with feature jittering reports 99.0% image-level and 98.2% pixel-level AUROC in the one-for-one setting, trailing PatchCore by only 0.1% in detection while running more than four times faster.","On BTAD, it reports 95.1% image and 97.5% pixel AUROC, the best among compared methods, supporting better generalization to texture-dominated datasets.","In the one-for-all setting, a single unified model reports 97.2% image and 97.5% pixel AUROC on MVTec AD, surpassing UniAD by 0.7 percentage points in both metrics.","In the few-shot setting with 2, 4, or 8 training images per category, AMI-Net achieves the best localization and second-best detection among the compared few-shot methods.","The single forward pass at 11.48 ms per image makes the method suitable for real-time industrial inspection without multiple complementary masks."],"supporting_citations":[{"why":"MVTec AD is the main benchmark dataset that supplies the 15 categories and the ground-truth masks used to measure detection and localization AUROC.","marker":"[13]"},{"why":"BTAD provides the second, texture-heavy industrial dataset, and the VT-ADL baseline against which AMI-Net is compared.","marker":"[14]"},{"why":"RIAD is the canonical mask-based inpainting method that AMI-Net improves upon by replacing random test-time masks with adaptive masks.","marker":"[2]"},{"why":"MAE supplies the masking-and-reconstruction paradigm and the fixed masking ratio that AMI-Net generalizes to a variable ratio.","marker":"[38]"},{"why":"MKD provides the evidence that normal and abnormal patterns are more discriminative in feature space, motivating the use of pre-trained features as reconstruction targets.","marker":"[35]"},{"why":"PatchCore is the strongest detection competitor on MVTec AD and represents the memory-bank feature-embedding approach against which AMI-Net's speed-accuracy trade-off is measured.","marker":"[31]"},{"why":"UniAD is the one-for-all multi-class baseline that AMI-Net surpasses, and the source of the feature jittering strategy used in the enhanced variant.","marker":"[40]"},{"why":"WideResNet50 is the pre-trained backbone selected for multi-scale feature extraction, chosen for its balance of semantic richness and inference speed.","marker":"[36]"},{"why":"ImageNet is the pretraining dataset for the feature extractor, which is used frozen and defines the semantic feature space for reconstruction.","marker":"[37]"}],"fun_headline_variants":["Adaptive masks fix anomaly detection: 99% AUROC","AMI-Net: mask defects, not pixels, for 99% accuracy","Single-pass defect detection via adaptive inpainting","Semantic features drive adaptive masking for 99% AUROC","Adaptive mask inpainting: real-time anomaly detection at 99%"],"cache_read_input_tokens":3200,"weakest_assumption_plain":"The method assumes that, on every test image, normal feature tokens form clusters tight enough that a per-cluster boundary of mean distance plus 0.5 standard deviation separates anomalous tokens from normal ones; the paper does not state whether these statistics come from the test image itself or from training data, and small miscalibration would either leave defects unmasked or mask large normal regions.","fun_headline_variants_meta":{"raw":{"variants":["Adaptive masks fix anomaly detection: 99% AUROC","AMI-Net: mask defects, not pixels, for 99% accuracy","Single-pass defect detection via adaptive inpainting","Semantic features drive adaptive masking for 99% AUROC","Adaptive mask inpainting: real-time anomaly detection at 99%"]},"model":"deepseek-v4-flash","effort":"low","cost_usd":0.00053,"raw_usage":{"total_tokens":2600,"prompt_tokens":1037,"completion_tokens":1563,"prompt_tokens_details":{"cached_tokens":384},"prompt_cache_hit_tokens":384,"prompt_cache_miss_tokens":653,"completion_tokens_details":{"reasoning_tokens":1474}},"tokens_in":653,"tokens_out":1563,"duration_ms":9732,"temperature":1.0,"reasoning_tokens":1474,"cache_read_input_tokens":384,"cache_creation_input_tokens":0},"cache_creation_input_tokens":0},"created_at":"2026-08-11T14:34:25.806514+00:00","model_set":{"reader":"deepseek-v4-flash"},"falsifier":"Run the released code on MVTec AD, record the adaptive mask for every test image, and compare it with the ground-truth defect mask: if the mean intersection-over-union is near zero on any category, or if defects like cable swaps are left unmasked, the central claim that the generator masks anomalous regions while preserving normal ones is falsified. Sweeping $\\lambda$ in Eq. 16 and observing a narrow accuracy peak would further show that the boundary is miscalibrated.","supporting_citations":[{"cited_title":"Mvtec ad — a comprehensive real-world dataset for unsupervised anomaly detection,","cited_arxiv_id":null,"evidence_quote":"MVTec AD is the main benchmark dataset that supplies the 15 categories and the ground-truth masks used to measure detection and localization AUROC."},{"cited_title":"Vt- adl: A vision transformer network for image anomaly detection and localization,","cited_arxiv_id":null,"evidence_quote":"BTAD provides the second, texture-heavy industrial dataset, and the VT-ADL baseline against which AMI-Net is compared."},{"cited_title":"Reconstruction by inpainting for visual anomaly detection,","cited_arxiv_id":null,"evidence_quote":"RIAD is the canonical mask-based inpainting method that AMI-Net improves upon by replacing random test-time masks with adaptive masks."},{"cited_title":"Masked au- toencoders are scalable vision learners,","cited_arxiv_id":null,"evidence_quote":"MAE supplies the masking-and-reconstruction paradigm and the fixed masking ratio that AMI-Net generalizes to a variable ratio."},{"cited_title":"Multiresolution knowledge distillation for anomaly detection,","cited_arxiv_id":null,"evidence_quote":"MKD provides the evidence that normal and abnormal patterns are more discriminative in feature space, motivating the use of pre-trained features as reconstruction targets."},{"cited_title":"Towards total recall in industrial anomaly detection,","cited_arxiv_id":null,"evidence_quote":"PatchCore is the strongest detection competitor on MVTec AD and represents the memory-bank feature-embedding approach against which AMI-Net's speed-accuracy trade-off is measured."},{"cited_title":"A unified model for multi-class anomaly detection,","cited_arxiv_id":null,"evidence_quote":"UniAD is the one-for-all multi-class baseline that AMI-Net surpasses, and the source of the feature jittering strategy used in the enhanced variant."},{"cited_title":"Imagenet large scale visual recognition challenge,","cited_arxiv_id":null,"evidence_quote":"ImageNet is the pretraining dataset for the feature extractor, which is used frozen and defines the semantic feature space for reconstruction."}],"review_version":1}