face-recognition
Use face_recognition to detect faces, extract landmarks and encodings, compare identities, run the face_recognition and face_detection CLIs, and troubleshoot dlib/model installation.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- face-recognition
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Use face_recognition to detect faces, extract landmarks and encodings, compare identities, run the face_recognition and face_detection CLIs, and troubleshoot dlib/model installation.
- disable-model-invocation
- true
02 资源文件 9
- 参考文档references/api-reference.md6.1 KB
- 参考文档references/cli-reference.md4.0 KB
- 参考文档references/deployment.md3.6 KB
- 参考文档references/repo-provenance.md2.1 KB
- 参考文档references/repo-routing-metadata.json421 B
- 参考文档references/troubleshooting.md6.5 KB
- 参考文档references/workflows.md6.8 KB
- 脚本scripts/check_install.py9.1 KB
- 脚本scripts/showcase_api.py9.3 KB
03 SKILL.md 正文
Face Recognition Repo Skill
Purpose
Use this skill when the task involves the face_recognition Python package or
its installed console tools:
- detecting faces in photos or image folders;
- extracting face landmarks or 128-dimensional encodings;
- comparing known and unknown faces with distances or tolerance thresholds;
- running the
face_recognitionorface_detectioncommand-line tools; - adapting the repository's image, webcam/video, KNN/SVM, Flask, Raspberry Pi, Docker, or CUDA guidance without depending on the original checkout;
- debugging
dlib,face_recognition_models, model-file, CLI, optional dependency, or headless-display failures.
Read repo provenance before relying on version-sensitive facts or refreshing this skill for a newer checkout.
Install and quick checks
For normal package use, install the public distribution and verify imports:
python -m pip install face_recognition
python - <<'PY'
import face_recognition
print(face_recognition.__version__)
PY
For editable repository development, install the checkout with its package
metadata (python -m pip install -e .) and match a Python version supported by
the current repo/tests when practical. The core runtime dependencies are
dlib, face_recognition_models, numpy, Pillow, and Click.
Run scripts/check_install.py when installation, model loading, or console scripts are uncertain:
python scripts/check_install.py
If imports fail, or if face_recognition_models warns about pkg_resources,
read troubleshooting before changing package
versions.
Route by task
| If the user needs to... | Read or run |
|---|---|
Use Python functions (load_image_file, face_locations, face_landmarks, face_encodings, compare_faces, face_distance, batch_face_locations) |
API reference and workflows |
| Try a safe headless API demo on user-provided images | scripts/showcase_api.py |
| Recognize identities or detect face boxes from the shell | CLI reference |
| Adapt optional image, video/webcam, KNN/SVM, Flask, Raspberry Pi, or batch/CNN patterns | workflows |
| Package or deploy an app using Docker, CUDA, cloud hosts, or PyInstaller | deployment notes |
| Diagnose install/import/runtime problems | troubleshooting and then scripts/check_install.py |
| Decide whether this skill is stale for a checkout | repo provenance |
Operating rules
- Do not assume the original repository's
examples/,docs/,tests/, or image fixtures exist. Use user-provided images or the bundled scripts and references in this skill. - Always guard calls like
face_recognition.face_encodings(image)[0]; no face means an empty list, not a usable encoding. - Treat coordinates as
(top, right, bottom, left). Crop withimage[top:bottom, left:right]. - The default face detector is CPU-friendly HOG. The CNN detector and
batch_face_locationsare useful for accuracy/batch workflows, but CUDA is only an optional acceleration path, not a requirement for the core API. - Use
face_distanceor CLI--show-distanceto tune tolerance; lower tolerance is stricter and can reduce false positives at the cost of more false negatives. - For known-person folders, the CLI uses the image file basename as the label and expects one usable face per known image.
- Optional examples that need OpenCV, Flask, scikit-learn, scipy, Raspberry Pi camera hardware, GUI display, network streams, or Docker should stay optional unless the user explicitly asks for that workflow.
- Face recognition has fairness, age, privacy, consent, and legal constraints. The repository documents poorer performance on children and variation across demographic groups; surface these caveats in user-facing applications.
Evidence-backed helper scripts
- scripts/check_install.py checks importability, installed versions, core API smoke behavior, and CLI help availability.
- scripts/showcase_api.py is a headless adaptation of the image detection, landmark, distance, comparison, and batch example patterns. It accepts image paths supplied by the user and never reads the original repository examples.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).