npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

face-sdk-extractor

v0.1.2

Published

Vue 3 人脸特征提取组件。组件只负责选图、裁剪、人脸检测、SDK 标准 5 点对齐和 512 维特征提取;人员 ID、分组、入库和接口提交由业务层处理。

Readme

face-sdk-extractor

Vue 3 人脸特征提取组件。组件只负责选图、裁剪、人脸检测、SDK 标准 5 点对齐和 512 维特征提取;人员 ID、分组、入库和接口提交由业务层处理。

安装

pnpm add face-sdk-extractor

使用

<script setup>
import { ref } from 'vue'
import FaceSdkExtractor from 'face-sdk-extractor'

const extractor = ref(null)

function handleReady(info) {
  // { modelVersion, embeddingDim }
}

function handleSuccess(result) {
  // { feature, featureBase64, modelVersion, embeddingDim }
}

function handleError(error) {
  // { code, message }
}
</script>

<template>
  <FaceSdkExtractor
    ref="extractor"
    @ready="handleReady"
    @success="handleSuccess"
    @error="handleError"
  />
</template>

清空当前图片:

extractor.value?.reset()

替换模型文件

默认使用包内置 mobileface.onnxmobileface.json。如需使用项目文件:

<script setup>
import modelUrl from './models/mobileface.onnx?url'
import manifestUrl from './models/mobileface.json?url'

const modelAssets = { modelUrl, manifestUrl }
</script>

<template>
  <FaceSdkExtractor :model-assets="modelAssets" />
</template>

mobileface.json 需包含 modelVersioninputSizeembeddingDim

结果格式

success 返回:

{
  feature: Float32Array,        // 512 维 L2 归一化特征
  featureBase64: string,        // Float32 little-endian Base64
  modelVersion: 'face_mbf_512',
  embeddingDim: 512,
}

业务侧导入 iOS / App 时建议组装:

{
  personId,
  name,
  modelVersion: result.modelVersion,
  embeddingDim: result.embeddingDim,
  featureFormat: 'float32-le-base64',
  normalized: true,
  metric: 'COSINE',
  featureBase64: result.featureBase64,
  ...(groupId ? { groupId } : {}),
}

不要传空字符串 groupId;无分组时省略该字段。

错误码

常见错误:

  • INVALID_FILE_TYPE
  • FILE_TOO_LARGE
  • MODEL_LOAD_FAILED
  • FACE_NOT_FOUND
  • MULTIPLE_FACES
  • LANDMARK_MISSING
  • FACE_INCOMPLETE
  • ALIGNMENT_FAILED
  • EXTRACTION_FAILED

业务判断使用 codemessage 可直接展示。

构建交付

本地构建:

pnpm --filter face-sdk-extractor build

产物在 packages/face-sdk-extractor/dist/。npm 包只交付 dist/README.md,不交付 src/ 和构建配置。

模型和运行时随包内置,不访问 CDN。固定二进制依赖:

@mediapipe/[email protected] [email protected]

mobileface.onnx 构建后保持固定文件名,便于后续替换。