Skip to content

Commit 9c6da0f

Browse files
committed
fix(face-recognition): move engine selection to model gallery, collapse backend entries
The previous commit put engine/model_pack options on backend gallery entries (`backend/index.yaml`). That was wrong — `GalleryBackend` (core/gallery/backend_types.go:32) has no `options` field, so the YAML decoder silently dropped those keys and all three "different insightface-*" backend entries resolved to the same container image with no distinguishing configuration. Correct split: * `backend/index.yaml` now has ONE `insightface` backend entry shipping the CPU + CUDA 12 container images. The Python backend bundles both the non-commercial insightface model packs (buffalo_l / buffalo_s) and the commercial-safe OpenCV Zoo weights (YuNet + SFace); the active engine is selected at LoadModel time via `options: ["engine:..."]`. * `gallery/index.yaml` gains three model entries — `insightface-buffalo-l`, `insightface-opencv`, `insightface-buffalo-s` — each setting the appropriate `overrides.backend` + `overrides.options` so installing one actually gives the user the intended engine. This matches how `rfdetr-base` lives in the model gallery against the `rfdetr` backend. The earlier e2e tests passed despite this bug because the Makefile targets pass `BACKEND_TEST_OPTIONS` directly to LoadModel via gRPC, bypassing any gallery resolution entirely. No code changes needed. Assisted-by: Claude:claude-opus-4-7
1 parent 9910655 commit 9c6da0f

2 files changed

Lines changed: 122 additions & 61 deletions

File tree

backend/index.yaml

Lines changed: 23 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -169,66 +169,40 @@
169169
nvidia-cuda-12: "cuda12-rfdetr"
170170
nvidia-l4t-cuda-12: "nvidia-l4t-arm64-rfdetr"
171171
- &insightface
172-
name: "insightface-buffalo-l"
173-
alias: "insightface-buffalo-l"
174-
# Upstream insightface is MIT but the buffalo_l *weights* are
175-
# released for NON-COMMERCIAL research use only.
176-
license: "insightface-non-commercial"
172+
name: "insightface"
173+
alias: "insightface"
174+
# Upstream insightface library is MIT. The pretrained model packs
175+
# (buffalo_l, buffalo_s, antelopev2) are released for NON-COMMERCIAL
176+
# research use only. The backend image also pre-bakes OpenCV Zoo
177+
# YuNet + SFace (Apache 2.0) for commercial use. Pick the engine
178+
# via model-gallery entries (insightface-buffalo-l / insightface-opencv
179+
# / insightface-buffalo-s) or set `options` in your model YAML.
180+
license: "mixed"
177181
description: |
178-
Face recognition backend using insightface's buffalo_l model pack
179-
(SCRFD-10GF detector + ResNet50 ArcFace embedder + genderage head).
180-
Best accuracy among the shipped options. NON-COMMERCIAL RESEARCH USE
181-
ONLY — the model weights carry upstream's research-only license.
182-
For commercial use see the insightface-opencv entry (Apache 2.0).
183-
Weights are pre-baked into the container at build time (~326MB).
182+
Face recognition backend powered by `insightface` (ONNX Runtime).
183+
Provides face verification (/v1/face/verify), face analysis
184+
(/v1/face/analyze), face embedding (/v1/embeddings), face
185+
detection (/v1/detection), and 1:N identification
186+
(/v1/face/{register,identify,forget}).
187+
Ships two engines in a single image: the insightface model packs
188+
(buffalo_l, buffalo_s — non-commercial) and the OpenCV Zoo
189+
YuNet + SFace pair (Apache 2.0). Select via `options: ["engine:..."]`
190+
in your model YAML, or install one of the ready-made model-gallery
191+
entries (insightface-buffalo-l / insightface-opencv /
192+
insightface-buffalo-s).
184193
urls:
185194
- https://github.com/deepinsight/insightface
195+
- https://github.com/opencv/opencv_zoo
186196
tags:
187197
- face-recognition
188198
- face-verification
189199
- face-embedding
190-
- research-only
191200
- gpu
192201
- cpu
193-
options:
194-
- "engine:insightface"
195-
- "model_pack:buffalo_l"
196202
capabilities:
197203
default: "cpu-insightface"
198204
nvidia: "cuda12-insightface"
199205
nvidia-cuda-12: "cuda12-insightface"
200-
- &insightface_opencv
201-
!!merge <<: *insightface
202-
name: "insightface-opencv"
203-
alias: "insightface-opencv"
204-
license: "apache-2.0"
205-
description: |
206-
Face recognition backend using OpenCV Zoo models (YuNet detector +
207-
SFace recognizer). APACHE 2.0 — safe for commercial use.
208-
Lower accuracy than buffalo_l and no age/gender analysis.
209-
Weights (~40MB) are pre-baked inside the backend image.
210-
tags:
211-
- face-recognition
212-
- face-verification
213-
- face-embedding
214-
- commercial-ok
215-
- gpu
216-
- cpu
217-
options:
218-
- "engine:onnx_direct"
219-
- "detector_onnx:models/opencv/yunet.onnx"
220-
- "recognizer_onnx:models/opencv/sface.onnx"
221-
- &insightface_buffalo_s
222-
!!merge <<: *insightface
223-
name: "insightface-buffalo-s"
224-
alias: "insightface-buffalo-s"
225-
description: |
226-
Smaller insightface pack for low-resource deployments (SCRFD-500MF
227-
detector + MBF embedder + genderage head). NON-COMMERCIAL RESEARCH
228-
USE ONLY. Not pre-baked; downloaded at first use (~159MB).
229-
options:
230-
- "engine:insightface"
231-
- "model_pack:buffalo_s"
232206
- &sam3cpp
233207
name: "sam3-cpp"
234208
alias: "sam3-cpp"
@@ -3782,21 +3756,9 @@
37823756
uri: "quay.io/go-skynet/local-ai-backends:latest-metal-darwin-arm64-llama-cpp-quantization"
37833757
mirrors:
37843758
- localai/localai-backends:latest-metal-darwin-arm64-llama-cpp-quantization
3785-
# insightface (face recognition)
3759+
# insightface (face recognition) — development and concrete image entries
37863760
- !!merge <<: *insightface
3787-
name: "insightface-buffalo-l-development"
3788-
capabilities:
3789-
default: "cpu-insightface-development"
3790-
nvidia: "cuda12-insightface-development"
3791-
nvidia-cuda-12: "cuda12-insightface-development"
3792-
- !!merge <<: *insightface_opencv
3793-
name: "insightface-opencv-development"
3794-
capabilities:
3795-
default: "cpu-insightface-development"
3796-
nvidia: "cuda12-insightface-development"
3797-
nvidia-cuda-12: "cuda12-insightface-development"
3798-
- !!merge <<: *insightface_buffalo_s
3799-
name: "insightface-buffalo-s-development"
3761+
name: "insightface-development"
38003762
capabilities:
38013763
default: "cpu-insightface-development"
38023764
nvidia: "cuda12-insightface-development"

gallery/index.yaml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3651,6 +3651,105 @@
36513651
- filename: arcee-ai_AFM-4.5B-Q4_K_M.gguf
36523652
sha256: f05516b323f581bebae1af2cbf900d83a2569b0a60c54366daf4a9c15ae30d4f
36533653
uri: huggingface://bartowski/arcee-ai_AFM-4.5B-GGUF/arcee-ai_AFM-4.5B-Q4_K_M.gguf
3654+
- &insightface_buffalo_l
3655+
name: "insightface-buffalo-l"
3656+
url: "github:mudler/LocalAI/gallery/virtual.yaml@master"
3657+
icon: https://avatars.githubusercontent.com/u/53104118?s=200&v=4
3658+
# The insightface library is MIT but the `buffalo_l` weights are
3659+
# released for NON-COMMERCIAL research use only.
3660+
license: "insightface-non-commercial"
3661+
description: |
3662+
Face recognition model using insightface's `buffalo_l` pack
3663+
(SCRFD-10GF detector + ResNet50 ArcFace 512-d embedder + genderage head).
3664+
Highest accuracy among the shipped options. Pre-baked inside the
3665+
`insightface` backend image (~326MB).
3666+
3667+
NON-COMMERCIAL RESEARCH USE ONLY — the model weights carry upstream's
3668+
research-only license. For commercial use install `insightface-opencv`
3669+
(Apache 2.0).
3670+
tags:
3671+
- face-recognition
3672+
- face-verification
3673+
- face-embedding
3674+
- research-only
3675+
- gpu
3676+
- cpu
3677+
urls:
3678+
- https://github.com/deepinsight/insightface
3679+
overrides:
3680+
backend: insightface
3681+
parameters:
3682+
model: insightface-buffalo-l
3683+
options:
3684+
- "engine:insightface"
3685+
- "model_pack:buffalo_l"
3686+
known_usecases:
3687+
- face_recognition
3688+
- detection
3689+
- embeddings
3690+
- &insightface_opencv
3691+
name: "insightface-opencv"
3692+
url: "github:mudler/LocalAI/gallery/virtual.yaml@master"
3693+
license: apache-2.0
3694+
description: |
3695+
Face recognition model using OpenCV Zoo weights: YuNet detector +
3696+
SFace recognizer. APACHE 2.0 — safe for commercial use.
3697+
Lower accuracy than `buffalo_l` and no age/gender analysis
3698+
(SFace has no demographic head). Pre-baked inside the
3699+
`insightface` backend image (~40MB).
3700+
tags:
3701+
- face-recognition
3702+
- face-verification
3703+
- face-embedding
3704+
- commercial-ok
3705+
- gpu
3706+
- cpu
3707+
urls:
3708+
- https://github.com/opencv/opencv_zoo
3709+
overrides:
3710+
backend: insightface
3711+
parameters:
3712+
model: insightface-opencv
3713+
options:
3714+
- "engine:onnx_direct"
3715+
- "detector_onnx:models/opencv/yunet.onnx"
3716+
- "recognizer_onnx:models/opencv/sface.onnx"
3717+
known_usecases:
3718+
- face_recognition
3719+
- detection
3720+
- embeddings
3721+
- &insightface_buffalo_s
3722+
name: "insightface-buffalo-s"
3723+
url: "github:mudler/LocalAI/gallery/virtual.yaml@master"
3724+
icon: https://avatars.githubusercontent.com/u/53104118?s=200&v=4
3725+
license: "insightface-non-commercial"
3726+
description: |
3727+
Smaller insightface pack for low-resource deployments
3728+
(SCRFD-500MF detector + MBF embedder + genderage head, ~159MB).
3729+
NOT pre-baked: weights are downloaded on first use into the
3730+
backend's working directory.
3731+
3732+
NON-COMMERCIAL RESEARCH USE ONLY.
3733+
tags:
3734+
- face-recognition
3735+
- face-verification
3736+
- face-embedding
3737+
- research-only
3738+
- edge
3739+
- cpu
3740+
urls:
3741+
- https://github.com/deepinsight/insightface
3742+
overrides:
3743+
backend: insightface
3744+
parameters:
3745+
model: insightface-buffalo-s
3746+
options:
3747+
- "engine:insightface"
3748+
- "model_pack:buffalo_s"
3749+
known_usecases:
3750+
- face_recognition
3751+
- detection
3752+
- embeddings
36543753
- &rfdetr
36553754
name: "rfdetr-base"
36563755
url: "github:mudler/LocalAI/gallery/virtual.yaml@master"

0 commit comments

Comments
 (0)