360 Secure SkillHub
360 安全技能中心

iFLYTEK Face Compare

通过 Python 脚本调用讯飞人脸识别 API,比对两张本地人脸图片,返回 0-100 相似度分数、是否同一人、置信度与人脸检测状态。需先配置 XF_FACE_APP_ID、XF_FACE_API_KEY、XF_FACE_API_SECRET,图片需可访问且含清晰正面人脸,运行时需要网络。

dzy-1026
dzy-1026
热度 79.39
最近更新 2026-05-11 17:29:05
分类:安全依赖:代码执行 / 第三方 API / 读写文件应用场景:API 集成 / 数据处理

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add xfyun-face-compare
Metadata
name
face-compare
description
Compare two face images and return similarity score using iFlytek Face Recognition API.
homepage
https://www.xfyun.cn/doc/face/xf-silent-in-vivo-detection/API.html
metadata
{"openclaw":{"emoji":"👤","requires":{"bins":["python3"],"env":["XF_FACE_APP_ID","XF_FACE_API_KEY","XF_FACE_API_SECRET"]},"primaryEnv":"XF_FACE_APP_ID"}}

👤 Face Compare

Compare two face images and calculate their similarity score using iFlytek's advanced face recognition technology.

Designed for identity verification, face matching, and security authentication scenarios.


✨ Features

  • High-accuracy face comparison
  • Base64 image encoding support
  • Multiple image format support (jpg, png, bmp)
  • Detailed similarity scoring
  • One-command execution

🚀 Usage

python {baseDir}/scripts/index.py "<image1_path>" "<image2_path>"

Example:

python {baseDir}/scripts/index.py "/path/to/face1.jpg" "/path/to/face2.jpg"

📋 Input Specification

Image Requirements

  • Supported formats: JPG, PNG, BMP
  • File size: < 4MB recommended
  • Image should contain clear, frontal face
  • One face per image for best results

⚠ Constraints

  • Both image paths must be valid and accessible
  • Images must contain detectable faces
  • API credentials must be configured
  • Network connection required

🔧 Environment Setup

Required:

  • Python available in PATH
  • Environment variables configured:
export XF_FACE_APP_ID=your_app_id
export XF_FACE_API_KEY=your_api_key
export XF_FACE_API_SECRET=your_api_secret

Or configure it in ~/.openclaw/openclaw.json:

{
	"env": {
		"XF_FACE_APP_ID": "your_app_id",
		"XF_FACE_API_KEY": "your_api_key",
		"XF_FACE_API_SECRET": "your_api_secret"
	}
}

📦 Output

Returns JSON response with:

  • Similarity score (0-100)
  • Comparison result (same person or not)
  • Confidence level
  • Face detection status

🎯 Target Use Cases

  • Identity verification
  • Access control systems
  • Duplicate account detection
  • Photo matching services
  • Security authentication
  • Attendance systems

🛠 Extensibility

Future enhancements may include:

  • Batch face comparison
  • Face quality assessment
  • Multiple face detection
  • Liveness detection integration
  • Custom threshold configuration

Built for automation workflows and AI-driven identity verification.