CoolFace
Modelpublic

Aleksandar/nearid-siglip2

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes115downloads
Model Card

NearID โ€” Identity Representation Learning via Near-identity Distractors

Paper: NearID Code: github.com/Aleksandar/NearID Paper: NearID: Identity Representation Learning via Near-identity Distractors

![ECCV 2026](https://arxiv.org/abs/2604.01973) ![Paper](https://arxiv.org/abs/2604.01973) ![Project Page](https://gorluxor.github.io/NearID/) ![GitHub](https://github.com/Gorluxor/NearID) ![KAUST](https://www.kaust.edu.sa/) ![Snap Research](https://research.snap.com/)

<!-- <a href="https://arxiv.org/abs/2604.01973" target="_blank"><img src="https://img.shields.io/badge/ECCV-2026-red" alt="ECCV 2026"></a> -->

NearID produces identity-aware image embeddings that remain stable across background and context changes while correctly rejecting near-identity distractors (visually similar but different instances placed in the same context). It is designed for evaluating identity preservation in personalized image generation.

Architecture

PropertyValue
Base modelgoogle/siglip2-so400m-patch14-384
BackboneSigLIP2 SO400M ViT/14 @ 384 px (frozen)
Pooling headMulti-head Attention Pooling (MAP), initialised from SigLIP2 weights (trained)
Embedding dim1152
NormalisationL2 (built-in, config.normalize_embeddings=True)
Total parameters~428 M
Trainable parameters~15 M (head-only; backbone weights are frozen to preserve pretrained priors)
Input resolution384 ร— 384
Formatsafetensors (fp16)

Quick Start

python
from transformers import AutoModel, AutoImageProcessor
from PIL import Image

model = AutoModel.from_pretrained("Aleksandar/nearid-siglip2", trust_remote_code=True)
processor = AutoImageProcessor.from_pretrained("Aleksandar/nearid-siglip2")

inputs = processor(images=Image.open("photo.jpg"), return_tensors="pt")

# Full output (ModelOutput with image_embeds, last_hidden_state, pooler_output)
outputs = model(**inputs)
embedding = outputs.image_embeds  # [1, 1152], L2-normalised

# Tensor shortcut
embedding = model.get_image_features(**inputs)  # [1, 1152]
Note on image processor: The original training used SiglipImageProcessor (slow). The release defaults to SiglipImageProcessorFast for performance. To use the original slow processor, pass use_fast=False to AutoImageProcessor.from_pretrained().

Pairwise Similarity

python
import torch

emb_a = model.get_image_features(**processor(images=img_a, return_tensors="pt"))
emb_b = model.get_image_features(**processor(images=img_b, return_tensors="pt"))

similarity = (emb_a @ emb_b.T).item()  # cosine similarity (embeddings are normalised)

Batch Inference

python
images = [Image.open(p) for p in image_paths]
inputs = processor(images=images, return_tensors="pt", padding=True)
embeddings = model.get_image_features(**inputs)  # [B, 1152]

# Pairwise similarity matrix
sim_matrix = embeddings @ embeddings.T

Evaluation

Near-Identity Discrimination & Alignment (Table 1)

We evaluate on three complementary benchmarks: NearID (object-level near-identity discrimination), MTG (part-level discrimination + oracle alignment), and DreamBench++ (human-judgment alignment).

Scoring ModelNearID SSR โ†‘NearID PA โ†‘MTG MO โ†‘MTG MOpair โ†‘MTG SSR โ†‘MTG PA โ†‘DB++ MH โ†‘
CLIP ViT-L/1410.3120.920.2390.4840.00.00.493
DINOv2 ViT-L/1420.4334.550.3240.5190.00.00.492
SigLIP2 (backbone)30.7448.810.1800.3660.00.00.516
VSM32.1346.700.3940.4457.024.50.190
NearID (Ours)99.1799.710.4650.48635.046.50.545

SSR and PA are averaged across seven inpainting settings (three excluded from training). MO/MOpair = metric-to-oracle correlation; MH = metric-to-human correlation (Fisher-z averaged).

DreamBench++ Per-Method Human Alignment (Table 2)

NearID improves over SigLIP2 on every personalization method tested, with Fisher-z averaged MH of 0.545 vs 0.516.

Training Details

Training Data

NearID was trained on the NearID dataset, which consists of multi-view positives per identity paired with near-identity distractors: different but semantically similar instances inpainted into the exact same background using an ensemble of generation pipelines (Flux, PowerPaint, SDXL, Qwen). Part-level training signal is provided by the MTG dataset.

Training Procedure

HyperparameterValue
Tuning strategyHead-only (backbone frozen)
Loss functionNearID loss (InfoNCE + near-identity distractor ranking, ฮฑ = 0.5, ฯ„ = 0.07)
OptimiserAdamW
Learning rate1e-4
LR scheduleCosine with 100 warmup steps
Batch size128
Epochs11
Precisionfp16 mixed precision
Hardware1 ร— NVIDIA A100
Training time~6.5 hours
FrameworkPyTorch + HuggingFace Accelerate

Intended Uses

Primary use cases:

  • โ€”Evaluating identity preservation in personalized image generation (e.g., scoring outputs of DreamBooth, Textual Inversion, IP-Adapter)
  • โ€”Embedding extraction for identity-aware retrieval or clustering
  • โ€”Benchmarking and research on near-identity discrimination

Out-of-scope uses:

  • โ€”This model is not a face recognition or person re-identification system
  • โ€”Surveillance or tracking without consent
  • โ€”Production biometric authentication (the model has not been audited for that purpose)
  • โ€”Demographic classification or profiling

Limitations

  • โ€”Domain: NearID was trained on synthetic inpaintings of common objects. Performance on domains not represented in the training set (e.g., highly specialised industrial parts, medical imagery) has not been evaluated.
  • โ€”Resolution: The model expects 384 ร— 384 input. Performance may degrade on images significantly below this resolution or with heavy compression.
  • โ€”Single-image scoring: The model scores individual images independently; it does not reason over video or image sequences.
  • โ€”Generative models: The near-identity distractors were generated using specific inpainting pipelines. Novel generation artifacts from unseen pipelines may affect discrimination performance.

Citation

bibtex
@article{cvejic2026nearid,
  title={NearID: Identity Representation Learning via Near-identity Distractors},
  author={Cvejic, Aleksandar and Abdal, Rameen and Eldesokey, Abdelrahman and Ghanem, Bernard and Wonka, Peter},
  journal={arXiv preprint arXiv:2604.01973},
  year={2026}
}

See more at https://arxiv.org/abs/2604.01973 for the full paper.