标签: face-api

由于订阅密钥无效而拒绝访问(Face API)

我在使用Microsoft Face API时遇到问题.以下是我的示例请求:

curl -v -X POST "https://westus.api.cognitive.microsoft.com/face/v1.0/detect?returnFaceId=true&returnFaceLandmarks=false&returnFaceAttributes=age,gender" -H "Content-Type: application/json" -H "Ocp-Apim-Subscription-Key: 1xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxd" --data-ascii "{\"url\":\"http://www.mrbeantvseries.co.uk/bean3.jpg\"}"
Run Code Online (Sandbox Code Playgroud)

我使用来自我的认知服务帐户的订阅ID,我收到以下回复:

{
  "error": {
    "code": "Unspecified",
    "message": "Access denied due to invalid subscription key. Make sure you are subscribed to an API you are trying to call and provide the right key."
  }
}
Run Code Online (Sandbox Code Playgroud)

不确定我是否错过了那里的任何东西.有人可以帮我吗?非常感谢.

face-detection microsoft-cognitive face-api

11
推荐指数
3
解决办法
1万
查看次数

无法找到Microsoft Cognitive Services的订阅密钥

我需要处理Microsoft认知服务(Face API).我从https://github.com/Microsoft/Cognitive-face-android下载了代码.现在我无法为它生成订阅密钥.无论我做什么,我都会陷入这个页面 在此输入图像描述

从其他地方我可以找到订阅密钥.谢谢

microsoft-cognitive face-api

6
推荐指数
1
解决办法
3678
查看次数

face-api.js-为什么浏览器的faceapi.detectAllFaces()比服务器的要快?

我想在服务器端使用人脸检测。因此,我为此任务找到了face-api.js。我发现每次通话faceapi.detectAllFaces()持续约10秒。但是,当我启动浏览器示例时,只有第一个函数持续10秒,所有下一个函数持续不到一秒。

我的服务器端代码(您可以在ageAndGenderRecognition.ts中看到类似的代码):

import * as faceapi from 'face-api.js';
import { canvas, faceDetectionNet, faceDetectionOptions, saveFile } from './commons';
await faceDetectionNet.loadFromDisk('../../weights')
await faceapi.nets.faceLandmark68Net.loadFromDisk('../../weights')
await faceapi.nets.ageGenderNet.loadFromDisk('../../weights')

const img = await canvas.loadImage('../images/bbt1.jpg')

console.time();
const results = await faceapi.detectAllFaces(img, faceDetectionOptions);
// ~10 seconds.
console.timeEnd();

console.time();
const results2 = await faceapi.detectAllFaces(img, faceDetectionOptions);
// ~10 seconds again.
console.timeEnd();
Run Code Online (Sandbox Code Playgroud)

为什么faceapi.detectAllFaces()浏览器示例中(首次通话除外)比ageAndGenderRecognition.ts更快?我可以对faceapi.detectAllFaces()功能执行相同的操作的速度相同吗?

javascript performance node.js face-api tensorflow.js

6
推荐指数
2
解决办法
724
查看次数

如何使用face-api.js检测活人脸而不是照片?

我正在使用face-api.js 对人而不是照片进行人脸识别。但是,如果用户放置照片,它就能够识别它。我怎样才能做到这一点?

face-api

6
推荐指数
1
解决办法
2181
查看次数

如何通过提供Windows.Media.FaceAnalysis DetectedFace列表使用Microsoft Cognitive服务检测面部属性?

我可以从Live Web Cam获得面孔作为Windows.Media.FaceAnalysis DetectedFace对象列表。现在,我想将这些面孔传递给Microsoft Cognitive Services API,以检测面孔并获取面孔属性。我怎样才能做到这一点?

IList<DetectedFace> faces = null;

// Create a VideoFrame object specifying the pixel format we want our capture image to be (NV12 bitmap in this case).
// GetPreviewFrame will convert the native webcam frame into this format.
const BitmapPixelFormat InputPixelFormat = BitmapPixelFormat.Nv12;
using (VideoFrame previewFrame = new VideoFrame(InputPixelFormat, (int)this.videoProperties.Width, (int)this.videoProperties.Height))
{
    await this.mediaCapture.GetPreviewFrameAsync(previewFrame);

    // The returned VideoFrame should be in the supported NV12 format but we need to verify this.
    if (FaceDetector.IsBitmapPixelFormatSupported(previewFrame.SoftwareBitmap.BitmapPixelFormat)) …
Run Code Online (Sandbox Code Playgroud)

c# microsoft-cognitive uwp face-api azure-cognitive-services

5
推荐指数
1
解决办法
491
查看次数

图像大小太小Azure Face API Android

我正在尝试在Android上使用Azure Face API。我正在从设备相机捕获图像,然后将其转换为InputStream以发送到detect方法。我不断收到错误“ com.microsoft.projectoxford.face.rest.ClientException:图像大小太小”

我检查了文档,图像大小为1.4Mb,在1Kb-4Mb范围内。我不明白为什么它不起作用。

Bitmap bitmap = cameraKitImage.getBitmap();
ByteArrayOutputStream bos = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 100, bos);
bitmapdata = bos.toByteArray();

new FaceTask().execute(new ByteArrayInputStream(bitmapdata));

Face[] faces = faceServiceClient.detect(inputStreams[0], true, false, null);
Run Code Online (Sandbox Code Playgroud)

android azure microsoft-cognitive face-api

5
推荐指数
1
解决办法
636
查看次数

使用face-api.js进行人脸检测后,有没有办法自动裁剪人脸?

detectSingleFace我已经在我的 React 项目中实现了 Face-API,该项目正在从图片中检测单个人脸。

现在我想更进一步。我希望face-api在检测后自动裁剪脸部。因此,我可以将其存储在某些服务器、状态或本地存储中。有什么办法可以做到吗?

在这里您可以看到我想要实现的屏幕截图示例,一侧是图片,另一侧是自动裁剪的脸部(我想实现)。 在此输入图像描述

这是我在codesandbox 中的实时代码链接

下面是我的face-api代码模块

PhotoFaceDetection.js

import React, { useState, useEffect, useRef } from "react";
import * as faceapi from "face-api.js";
import Img from "./assets/mFace.jpg";
import "./styles.css";

const PhotoFaceDetection = () => {
  const [initializing, setInitializing] = useState(false);
  const [image, setImage] = useState(Img);
  const canvasRef = useRef();
  const imageRef = useRef();

  // I want to store cropped image in this state
  const [pic, setPic] = useState();

  useEffect(() => {
    const loadModels = async () …
Run Code Online (Sandbox Code Playgroud)

javascript face-recognition reactjs face-api react-hooks

5
推荐指数
1
解决办法
4207
查看次数

如何在不保存图像的情况下将 Numpy 数组图像转换为 JPEG?

我正在使用 Microsoft Azure 的 Face API 来检测视频中人物的情绪。我有一个可以正确处理本地图像的 Python 程序,现在我尝试拍摄本地视频并将每个帧发送到 API,并存储每个分析的结果。

发送到 Azure 的 Face API 的数据需要是读取为字节的 PNG/JPG 文件:

image_data=open(image_source, "rb").read()
Run Code Online (Sandbox Code Playgroud)

OpenCV 似乎是使用 Python 逐帧浏览视频的标准,但帧是 Numpy 数组类型。您可以将视频的每一帧保存为 JPG 到磁盘,如下所示:

import cv2 # OpenCV
vidcap = cv2.VideoCapture('vid.mp4')
success, image = vidcap.read()
count = 1
while success:
  cv2.imwrite("video_data/frame_%d.jpg" % count, image)    
  success, frame = vidcap.read() # frame is a Numpy array
  print('Saved frame ', count)
  count += 1
Run Code Online (Sandbox Code Playgroud)

但这并不是我想要的。有没有办法在不将文件保存到磁盘的情况下进行 Numpy 数组到 JPG 的转换?我只想将其转换为 JPG,然后将该图像作为字节发送到 Azure API。

感谢任何和所有的建议和指导,谢谢!

编辑:我通过将 Numpy 数组框架转换为 PIL 图像对象并通过 BytesIO …

python opencv numpy face-api

2
推荐指数
1
解决办法
3026
查看次数

带有本地图像的 C# Azure Face API。错误请求例外

昨天我编辑了来自Microsoft Azure Face API Quickstart 的代码,我可以识别本地图像中的人。

当我训练具有多个图像的组时,我收到了错误请求异常,并且在检查图像之前收到了错误请求

 Dictionary<string, string[]> personDictionary = new Dictionary<string, string[]>
         {
             { "Jonas", new[] {"jonasTrain2.jpg"}},
             {"Thomas", new [] {"thomasTrain1.jpg"}}
         };
        string sourceImageFilePath = @"C:\Users\jonas\Desktop\FAces\Test\jonasTest1.jpg";

        Console.WriteLine($"Create a person group ({personGroupId}).");
        await client.PersonGroup.CreateAsync(personGroupId, personGroupId, recognitionModel: recognitionModel);

        foreach (var groupedFace in personDictionary.Keys)
        {
            await Task.Delay(250);
            Person person = await client.PersonGroupPerson.CreateAsync(personGroupId: personGroupId, name: groupedFace);
            Console.WriteLine($"Create a person group person '{groupedFace}'");

            foreach (var similarImage in personDictionary[groupedFace])
            {
                Console.WriteLine($"Add face to the person group person ({groupedFace}) from image `{similarImage}`");
                FileStream fs …
Run Code Online (Sandbox Code Playgroud)

c# azure face-api azure-cognitive-services

1
推荐指数
1
解决办法
886
查看次数

如何使用face-api获取视频中的人脸位置检测?

我正在使用 face-api 库。 https://github.com/justadudewhohacks/face-api.js

我正在尝试获取视频中的面部位置。

我想申请。它可以设置我的脸第一位置。然后它可以提供信息我的脸移动了多少。

例如,我的视频宽度 = 600 像素,高度 = 400 像素。然后我想得到我的眼睛位置,比如我的左眼位置离右边 200 像素,离底部 300 像素。那是我左眼的第一个位置。设置第一个位置后,如果我移动,应用程序会显示警报或弹出窗口。

javascript face-api facial-identification

0
推荐指数
1
解决办法
1938
查看次数