Papers › AnyPattern: Towards In-context Image Copy Detection

AnyPattern: Towards In-context Image Copy Detection

21 Apr 2024arXiv:2404.13788archive 2025-07-28

Wenhao Wang, Yifan Sun, Zhentao Tan, Yi Yang

This paper explores in-context learning for image copy detection (ICD), i.e., prompting an ICD model to identify replicated images with new tampering patterns without the need for additional training. The prompts (or the contexts) are from a small set of image-replica pairs that reflect the new patterns and are used at inference time. Such in-context ICD has good realistic value, because it requires no fine-tuning and thus facilitates fast reaction against the emergence of unseen patterns. To accommodate the "seen → unseen" generalization scenario, we construct the first large-scale pattern dataset named AnyPattern, which has the largest number of tamper patterns ($90$ for training and $10$ for testing) among all the existing ones. We benchmark AnyPattern with popular ICD methods and reveal that existing methods barely generalize to novel patterns. We further propose a simple in-context ICD method named ImageStacker. ImageStacker learns to select the most representative image-replica pairs and employs them as the pattern prompts in a stacking manner (rather than the popular concatenation manner). Experimental results show (1) training with our large-scale dataset substantially benefits pattern generalization (+26.66 % μAP), (2) the proposed ImageStacker facilitates effective in-context ICD (another round of +16.75 % μAP), and (3) AnyPattern enables in-context ICD, i.e., without such a large-scale dataset, in-context learning does not emerge even with our ImageStacker. Beyond the ICD task, we also demonstrate how AnyPattern can benefit artists, i.e., the pattern retrieval method trained on AnyPattern can be generalized to identify style mimicry by text-to-image models. The project is publicly available at https://anypattern.github.io.

PaperPDFCodeCode 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="2404.13788")

Code

Syntology Ran 7 of 11 code samples harvested from 2 repositories linked to this paper; 4 have no recorded run. Of those that ran: 1 ran · our draft was wrong; 6 ran with no contract checked.

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

wangwenhao0716/anypattern officialmentioned in papermentioned on GitHubpytorchMIT report
WangWenhao0716/AnyPatternStyle officialmentioned 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

11 samples harvested; 7 ran; 0 honoured the contract we drafted; 4 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
6ran
4unverified

Licence: 0 of the 11 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 2 repositories linked to this paper, official or community; each sample names its own and says which. “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.

LogSumExp wangwenhao0716/anypattern/Train/dg/loss/cosfacepairwise.py official repository ran fingerprinted MIT (permissive) · 1b5f7cd991a55738 · report
build_metric wangwenhao0716/anypattern/Train/dg/models_gem_waveblock_balance_cos/metric.py official repository ran MIT (permissive) · a00d813e0d8c2e34 · report
cosine_sim wangwenhao0716/anypattern/Train/dg/layer.py official repository ran MIT (permissive) · 55b7eacdfa96a1c5 · report
cosine_sim wangwenhao0716/anypattern/Train/dg/models_gem_waveblock_balance_cos/metric.py official repository ran MIT (permissive) · 475146601a2a3bf5 · report
euclidean_dist wangwenhao0716/anypattern/Train/dg/loss/triplet.py official repository ran · our draft was wrong fingerprinted MIT (permissive) · e54804982d1e6d22 · report
pairwise_distance wangwenhao0716/anypattern/Train/dg/evaluators.py official repository ran MIT (permissive) · 818a78a0677bf92a · report
preprocessor WangWenhao0716/AnyPatternStyle/anypattern_style_extractor.py official repository ran MIT (permissive) · d2d8982282279307 · report
cosine_dist wangwenhao0716/anypattern/Train/dg/loss/triplet.py official repository unverified MIT (permissive) · 97bcc985e3ddff46 · report
create_model WangWenhao0716/AnyPatternStyle/anypattern_style_extractor.py official repository unverified MIT (permissive) · 59ed6bbf050d257e · report
evaluate_all wangwenhao0716/anypattern/Train/dg/evaluators.py official repository unverified MIT (permissive) · 16698586b4001b08 · report
extract_features wangwenhao0716/anypattern/Train/dg/evaluators.py official repository unverified MIT (permissive) · 66e24510952a66e6 · report

Tasks

Copy DetectionIn-Context Learning

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

SET

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