Papers › Focus the Discrepancy: Intra- and Inter-Correlation Learning for Image Anomaly Detection

Focus the Discrepancy: Intra- and Inter-Correlation Learning for Image Anomaly Detection

6 Aug 2023ICCV 2023 1arXiv:2308.02983archive 2025-07-28

Xincheng Yao, Ruoqi Li, Zefeng Qian, Yan Luo, Chongyang Zhang

Humans recognize anomalies through two aspects: larger patch-wise representation discrepancies and weaker patch-to-normal-patch correlations. However, the previous AD methods didn't sufficiently combine the two complementary aspects to design AD models. To this end, we find that Transformer can ideally satisfy the two aspects as its great power in the unified modeling of patch-wise representations and patch-to-patch correlations. In this paper, we propose a novel AD framework: FOcus-the-Discrepancy (FOD), which can simultaneously spot the patch-wise, intra- and inter-discrepancies of anomalies. The major characteristic of our method is that we renovate the self-attention maps in transformers to Intra-Inter-Correlation (I2Correlation). The I2Correlation contains a two-branch structure to first explicitly establish intra- and inter-image correlations, and then fuses the features of two-branch to spotlight the abnormal patterns. To learn the intra- and inter-correlations adaptively, we propose the RBF-kernel-based target-correlations as learning targets for self-supervised learning. Besides, we introduce an entropy constraint strategy to solve the mode collapse issue in optimization and further amplify the normal-abnormal distinguishability. Extensive experiments on three unsupervised real-world AD benchmarks show the superior performance of our approach. Code will be available at https://github.com/xcyao00/FOD.

PaperPDFConference PDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2308.02983")

Code

Syntology Ran 10 of 13 code samples harvested from 1 repository linked to this paper; 3 have no recorded run. Of those that ran: 1 ran · our draft was wrong; 9 ran with no contract checked.

By repository: official repository: 13 samples from 1 repository, 10 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

xcyao00/fod officialmentioned in papermentioned on GitHubpytorchMIT report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

13 samples harvested; 10 ran; 0 honoured the contract we drafted; 3 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

1ran · our draft was wrong
9ran
3unverified

Licence: 0 of the 13 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from xcyao00/FOD. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

Embedding2D xcyao00/FOD/models/model.py official repository ran MIT (permissive) · 5ed0a100400b50f9 · report
Encoder xcyao00/FOD/models/model.py official repository ran fingerprinted MIT (permissive) · 5ef174bf4fbeea2f · report
EncoderLayer xcyao00/FOD/models/model.py official repository ran MIT (permissive) · 69586fc628c7ebb6 · report
PositionalEmbedding xcyao00/FOD/models/model.py official repository ran MIT (permissive) · 9aadfb2a17c8c080 · report
compute_pro_retrieval_metrics xcyao00/fod/utils/utils.py official repository ran MIT (permissive) · b45f413cb8bb72e2 · report
denormalization xcyao00/fod/utils/visualizer.py official repository ran MIT (permissive) · 3dcadf77eb559329 · report
embedding_concat xcyao00/fod/utils/utils.py official repository ran fingerprinted MIT (permissive) · ef0e6b962918f4b4 · report
entropy_loss xcyao00/fod/losses.py official repository ran fingerprinted MIT (permissive) · d6ada2dc4e5d3719 · report
idx_1d_to_pos_2d xcyao00/fod/create_distance_maps.py official repository ran fingerprinted MIT (permissive) · 11596f92ff71fb9a · report
to_var xcyao00/fod/utils/utils.py official repository ran · our draft was wrong fingerprinted MIT (permissive) · 502c50812b7f31ab · report
Attention2D xcyao00/FOD/models/model.py official repository unverified MIT (permissive) · 36da03ed71d4d479 · report
FOD xcyao00/FOD/models/model.py official repository unverified MIT (permissive) · de8248efbce530f7 · report
kl_loss xcyao00/fod/losses.py official repository unverified MIT (permissive) · a2f6a358aed78f39 · report

Tasks

Anomaly DetectionSelf-Supervised Learning

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

Absolute Position EncodingsAdamAttentionBPEDense ConnectionsDropoutLabel SmoothingLayer NormalizationLinear LayerMulti-Head AttentionPosition-Wise Feed-Forward LayerResidual ConnectionSoftmaxTransformer

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections