Skip to content
Back to skills

Embeddings And Classification

ASecurity

"Use Facenet embeddings for face comparison, SVM classifiers,

  • 247 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 8, 2026
businessapi

Works with

  • api

Security analysis

A100/100

Pro scans all 9 files and shows the line behind each finding

Scanned September 8, 2026

npx -y skills add VectorSpaceLab/AREX-Skill --skill embeddings-and-classification --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Embeddings And Classification?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Embeddings And Classification
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-embeddings-and-classification/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-embeddings-and-classification)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: embeddings-and-classification
description: "Use Facenet embeddings for face comparison, SVM classifiers,
  embedding export, clustering, and contributed recognition examples."
metadata:
  disco-role: operating
disable-model-invocation: true
license: MIT
---

# Facenet Embeddings and Classification

Use this sub-skill when a task starts from a trained Facenet model and asks for embeddings, face comparison, classifier training/classification, batch export, clustering, or contributed high-level recognition examples.

## When to read

- The user asks to compare faces or print a distance matrix.
- The user wants to train a classifier on identity folders or classify held-out images.
- The task needs exported `embeddings.npy`, `labels.npy`, or label strings.
- The user asks to cluster similar faces from a folder.
- The request mentions `compare`, `classifier`, `export_embeddings`, `batch_represent`, `cluster`, `predict`, or real-time face recognition.

## Prerequisites

1. A Facenet TF1 environment that imports `facenet`, `align.detect_face`, TensorFlow, NumPy, SciPy, scikit-learn, and OpenCV.
2. A model path accepted by Facenet: checkpoint directory or frozen `.pb`. Read [`../model-export-and-checkpoints/SKILL.md`](../model-export-and-checkpoints/SKILL.md) for model formats.
3. Aligned class-folder data for classifier/export workflows. If input images are raw photos, read [`../data-and-alignment/SKILL.md`](../data-and-alignment/SKILL.md) first.
4. Enough images per identity for classifier splitting; defaults in `classifier` require at least 20 images per class when `--use_split_dataset` is enabled.

## Workflow map

- **Compare images**: use [`scripts/build_compare_command.py`](scripts/build_compare_command.py), then read [`references/workflows.md`](references/workflows.md#compare-images).
- **Train or use an SVM classifier**: use [`scripts/build_classifier_command.py`](scripts/build_classifier_command.py), then read [`references/workflows.md`](references/workflows.md#train-or-use-an-svm-classifier).
- **Export embeddings as NumPy arrays**: use [`scripts/build_export_embeddings_command.py`](scripts/build_export_embeddings_command.py), then read [`references/workflows.md`](references/workflows.md#export-embeddings).
- **Cluster faces**: use [`scripts/build_cluster_command.py`](scripts/build_cluster_command.py), then read [`references/workflows.md`](references/workflows.md#cluster-faces).
- **Contributed examples**: read [`references/contributed-workflows.md`](references/contributed-workflows.md) before using contributed webcam, prediction, or Chinese-whispers code.

## Key runtime facts

- The embedding tensor is `embeddings:0`; image input is `input:0`; inference uses `phase_train:0` set to `False`.
- `facenet.load_data(paths, False, False, image_size)` loads already-aligned images and prewhitens by default.
- `compare` aligns each input image using MTCNN before model inference.
- `classifier` trains a linear `sklearn.svm.SVC(kernel='linear', probability=True)` over embeddings and stores `(model, class_names)` in a pickle.
- Contributed export and clustering scripts overlap with core workflows but have additional assumptions and older APIs.

## Output contract

- Compare emits a human-readable distance matrix; save stdout with the model/preprocessing settings if it will be used as evidence.
- Classifier training writes a pickle containing the fitted SVM and class names; keep it paired with the exact identity-folder mapping used for training.
- Export writes embeddings and labels with matching row order; preserve the label-string array when handing outputs to another model.
- Clustering writes images under the requested output directory; use a temporary directory and record the threshold/minimum cluster size.

## Validation

Use command builders with `--help` first. Run full model-backed commands only after model/data paths are available. For automation, treat model downloads, raw webcam capture, and large folder clustering as user-approved operations, not default smoke tests.

## Troubleshooting

Read [`references/troubleshooting.md`](references/troubleshooting.md) for classifier pickle mismatches, no detected face, empty embedding arrays, old SciPy image I/O, sklearn label issues, and contributed script hazards.

Files in this skill

  • SKILL.md4.2 KB
  • references/cli-reference.md1.5 KB
  • references/contributed-workflows.md2.1 KB
  • references/troubleshooting.md1.7 KB
  • references/workflows.md3.3 KB
  • scripts/build_classifier_command.py1.3 KB
  • scripts/build_cluster_command.py1.3 KB
  • scripts/build_compare_command.py860 B
  • scripts/build_export_embeddings_command.py1.5 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.