我在使用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)
不确定我是否错过了那里的任何东西.有人可以帮我吗?非常感谢.
我需要处理Microsoft认知服务(Face API).我从https://github.com/Microsoft/Cognitive-face-android下载了代码.现在我无法为它生成订阅密钥.无论我做什么,我都会陷入这个页面

从其他地方我可以找到订阅密钥.谢谢
我想在服务器端使用人脸检测。因此,我为此任务找到了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()功能执行相同的操作的速度相同吗?
我正在使用face-api.js 对人而不是照片进行人脸识别。但是,如果用户放置照片,它就能够识别它。我怎样才能做到这一点?
我可以从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
我正在尝试在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) 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) 我正在使用 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 …
昨天我编辑了来自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) 我正在使用 face-api 库。 https://github.com/justadudewhohacks/face-api.js
我正在尝试获取视频中的面部位置。
我想申请。它可以设置我的脸第一位置。然后它可以提供信息我的脸移动了多少。
例如,我的视频宽度 = 600 像素,高度 = 400 像素。然后我想得到我的眼睛位置,比如我的左眼位置离右边 200 像素,离底部 300 像素。那是我左眼的第一个位置。设置第一个位置后,如果我移动,应用程序会显示警报或弹出窗口。
face-api ×10
javascript ×3
azure ×2
c# ×2
android ×1
node.js ×1
numpy ×1
opencv ×1
performance ×1
python ×1
react-hooks ×1
reactjs ×1
uwp ×1