/ Модель

Характеристики

Размер весов
72,9 МБ
Лицензия
Своя лицензия
Архитектура
edgeface · dense
Библиотека
transformers
Опубликована
3 июл 2026

edgeface

Эмбеддинги изображенийИзображение → embedding3 профессии

EdgeFace извлекает 512-мерные векторы признаков лиц для задач распознавания и проверки личности по изображениям.

16скачиваний за 30 дней0лайковвеса обновлены6 июл 2026

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

EdgeFace — модель для распознавания и верификации лиц, разработанная Idiap Research Institute и упакованная для Transformers. Она использует backbone семейства EdgeNeXt (реализация timm) и выдаёт вектор признаков размерности 512 для каждого лица. В репозитории доступны варианты с backbone EdgeNeXt Base, Small и X-Small; два компактных варианта используют встроенную в веса низкоранговую факторизацию линейных слоёв.

Модель предназначена для извлечения эмбеддингов лиц, которые можно сравнивать для проверки личности или использовать в системах распознавания. Обработчик изображений по умолчанию выравнивает лицо по пяти ориентирам MediaPipe на шаблон ArcFace 112×112; если детекция не удалась, он выполняет обычное масштабирование. Для выравнивания нужны MediaPipe и OpenCV. Модель принимает изображения и выдаёт векторы признаков. Лицензия указана как other, поэтому условия использования следует уточнить в карточке и сопутствующих материалах.

Сценарии применения

  • сравнение двух лиц для проверки совпадения личности
  • извлечение эмбеддингов лиц для системы распознавания
  • поиск похожих лиц по векторной базе
  • предобработка и выравнивание лиц перед сравнением

Ограничения

Качество зависит от успешного обнаружения и выравнивания лица; при сбое обработки применяется простое масштабирование. Для выравнивания требуются MediaPipe и OpenCV; условия лицензии типа other нужно проверить отдельно.

Для каких профессий подходит3

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

EdgeFace for 🤗 Transformers

EdgeFace (Idiap Research Institute) packaged as a transformers custom model. All four published variants live in this single repository as subfolders and are accessible through the standard AutoModel / AutoImageProcessor API with built-in MediaPipe face alignment.

EdgeFace replaces the classifier of an edgenext (timm) backbone with a 512-d embedding head trained for face recognition. Two variants additionally apply a static low-rank factorization to their linear layers — EdgeFace's "gamma" trick, baked into the pretrained weights and unrelated to PEFT adapters.

Model variants

SubfolderBackboneLow-rank ratioParams
edgeface-baseedgenext_base—~18 Mdefault
edgeface-s-gamma-05edgenext_small0.5~5 M
edgeface-xs-gamma-06edgenext_x_small0.6~3 M
edgeface-xxsedgenext_xx_small—~1 M

Installation

pip install transformers timm torch safetensors huggingface_hub numpy

# Face alignment (do_align=True) also requires:
pip install mediapipe opencv-python

Quick start

Pipeline (default — edgeface-xxs)

from transformers import pipeline

pipe = pipeline("image-feature-extraction", model="anjith2006/edgeface", trust_remote_code=True)

AutoModel (any variant)

import torch
import torch.nn.functional as F
from PIL import Image
from transformers import AutoModel, AutoImageProcessor

repo = "anjith2006/edgeface"
variant = "edgeface-xxs"   # or edgeface-base / edgeface-s-gamma-05 / edgeface-xs-gamma-06

model = AutoModel.from_pretrained(repo, subfolder=variant, trust_remote_code=True).eval()
processor = AutoImageProcessor.from_pretrained(repo, subfolder=variant, trust_remote_code=True)

@torch.no_grad()
def embed(path):
    img = Image.open(path).convert("RGB")
    inputs = processor(img, return_tensors="pt")   # do_align=True by default
    return F.normalize(model(**inputs).embeddings, dim=-1)

score = F.cosine_similarity(embed("a.jpg"), embed("b.jpg")).item()
print(f"{score:.4f}")  # → ~0.9+ same person, lower for different

Face alignment

The image processor detects and aligns the face by default, warping it onto the ArcFace 112×112 template using 5 MediaPipe landmarks — the same alignment the weights were trained with.

# Full image → detect face, align, normalize (default)
inputs = processor(img, return_tensors="pt")

# Pre-aligned 112×112 crop → skip detection, just normalize
inputs = processor(crop, do_align=False, return_tensors="pt")

# Known landmarks → skip detection, align from provided 5 points
inputs = processor(img, landmarks=pts, return_tensors="pt")  # pts: ndarray (5, 2)

If detection fails the processor falls back to a plain resize so batches never crash.

MediaPipe backend

# "auto" (default): try the Tasks API, fall back to legacy solutions.face_mesh
# "tasks":          force the modern API — downloads face_landmarker.task once to ~/.cache/edgeface/
# "solutions":      force the legacy API (older mediapipe installs)
processor = AutoImageProcessor.from_pretrained(
    repo, subfolder=variant, trust_remote_code=True, mp_backend="tasks"
)

# Offline / custom bundle:
processor = AutoImageProcessor.from_pretrained(
    repo, subfolder=variant, trust_remote_code=True,
    mp_model_path="/path/to/face_landmarker.task"
)
# or: export EDGEFACE_MP_MODEL=/path/to/face_landmarker.task

Batch usage

imgs = [Image.open(p).convert("RGB") for p in paths]
inputs = processor(imgs, return_tensors="pt")
with torch.no_grad():
    embs = F.normalize(model(**inputs).embeddings, dim=-1)  # (N, 512)

Local import without trust_remote_code

Clone the source repo and import the package directly:

from edgeface import register_edgeface
register_edgeface()  # wires EdgeFace into AutoConfig / AutoModel / AutoImageProcessor

model = AutoModel.from_pretrained("anjith2006/edgeface", subfolder="edgeface-xxs").eval()
processor = AutoImageProcessor.from_pretrained("anjith2006/edgeface", subfolder="edgeface-xxs")

LoRA fine-tuning

The static low-rank layers in the gamma variants are plain nn.Linear modules, so PEFT targets them without any naming collision:

from peft import LoraConfig, get_peft_model

model = AutoModel.from_pretrained(repo, subfolder=variant, trust_remote_code=True)

# Gamma variants (edgeface-s-gamma-05, edgeface-xs-gamma-06):
lora_cfg = LoraConfig(r=8, lora_alpha=16, target_modules=["linear1", "linear2"])

# Base / XXS variants (no factorized layers — target the backbone linears directly):
# print([n for n, _ in model.named_modules() if isinstance(_, torch.nn.Linear)])
lora_cfg = LoraConfig(r=8, lora_alpha=16, target_modules=["fc1", "fc2"])

model = get_peft_model(model, lora_cfg)
model.print_trainable_parameters()

Source files

FilePurpose
configuration_edgeface.pyEdgeFaceConfig
modeling_edgeface.pyEdgeFaceModel, LowRankLinear, EdgeFaceOutput
image_processing_edgeface.pyEdgeFaceImageProcessor (MediaPipe alignment + normalize)
convert_edgeface.pyDownload original .pt checkpoints, convert, push
example.pySame-person / different-person sanity check

License

The pretrained weights and original alignment code are © Idiap Research Institute. The original EdgeFace license governs all weight files and derivative uses. See NOTICE for details. Verify compliance before commercial use or redistribution.

Citation

@article{george2024edgeface,
  title   = {EdgeFace: Efficient Face Recognition Model for Edge Devices},
  author  = {George, Anjith and Ecabert, Christophe and Otroshi Shahreza, Hatef
             and Kotwal, Ketan and Marcel, Sebastien},
  journal = {IEEE Transactions on Biometrics, Behavior, and Identity Science},
  year    = {2024},
  doi     = {10.1109/TBIOM.2024.3352169}
}

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · transformers · image-feature-extraction

Нельзя запустить

Модели нужен код из репозитория; автор пока не в списке доверенных организаций.

Класс архитектуры
EdgeFaceModel
Ревизия весов
d3a967a

0 моделей