AnyPattern: Towards In-context Image Copy Detection

Wenhao Wang, Yifan Sun, Zhentao Tan, Yi Yang
4/21/2024
7 citations
cs.CVcs.AI

Official code: WangWenhao0716/AnyPattern (12 stars, Python, MIT, last commit 2025-10-24). 1 more implementation below.

Abstract

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.

Show full abstract

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 $\rightarrow$ 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.

View on arXivView PDF

Code Implementations(2)

Code implementations of this paper
RepositoryTypeStarsLanguageLicenseLast commit
WangWenhao0716/AnyPatternOfficial12PythonMIT2025-10-24
WangWenhao0716/AnypatternStyleOfficial6PythonMIT2025-10-24
MIT

[IJCV 2025] The official implementation of "AnyPattern: Towards In-context Image Copy Detection"

120Python, ShellApr 20, 20241 years agoMIT
MIT

[IJCV 2025] The style extractor trained on AnyPattern

60PythonApr 26, 20241 years agoMIT

Similar Papers

Cite this paper

@article{wang2024anypattern,
  title  = {AnyPattern: Towards In-context Image Copy Detection},
  author = {Wenhao Wang and Yifan Sun and Zhentao Tan and Yi Yang},
  year   = {2024},
  eprint = {2404.13788},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2404.13788v3}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2404.13788.svg)](https://codeofpaper.com/paper/2404.13788)

Discussion