等待client.face.face.detectwithstreamasync不响应
我想使用microsoft.azure.cognitiveservices.vision.face for holoLens 2进行统一表面识别面部识别
。服务/face/quickstarts/client-libraries?tabs = visual-studio& pivots = programming-language-csharp“ rel =“ nofollow noreferrer”> face client client tutorial 尝试使用agait faceclient.face.face.detectectwithurlasyncclient.face.detectwithurlasyncc
以及等待faceclient.face.face.face.detectwithstreamasync
带有本地映像,但是该程序不会超过此代码线(根本没有响应,Unity也没有显示任何响应)。但是,在研究Azure资源指标时,它显示了成功的呼叫和输出数据。 我在Visual Studio中获得的唯一输出是“加载:模量:匿名托管的动态媒体组件”。
这是有问题的代码段:
using (Stream faceimagestream = File.OpenRead(filepath))
{
detectedFaces = await client.Face.DetectWithStreamAsync(faceimagestream, returnFaceAttributes: features);
}
I want to perform face recognition in Unity using Microsoft.Azure.CognitiveServices.Vision.Face for the Hololens 2.
I basically followed this Face Client Tutorial and tried using await faceClient.Face.DetectWithUrlAsync
as well as await faceClient.Face.DetectWithStreamAsync
with local images, but the program does not get past this line of code (no response at all, Unity also shows no response). However, when investigating the azure resources metrics, it shows successful calls and output data.
The only output I get in Visual Studio is "Loaded: Modul: Anonymously Hosted DynamicMethods Assembly".
This is the problematic code snippet:
using (Stream faceimagestream = File.OpenRead(filepath))
{
detectedFaces = await client.Face.DetectWithStreamAsync(faceimagestream, returnFaceAttributes: features);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决方案是根据基于任务的异步模式(TAP)而不是
Method.wait()
使用等待
,该模式已在教程的示例中使用(显然是不是为团结而建立的)。wait()
调用整个线程,因此Unity无响应。The solution was to use
await
according to the Task-based Asynchronous Pattern (TAP) instead ofmethod.Wait()
, which was used in the tutorial's example (which was obviously not built for Unity). TheWait()
call blocks the whole thread, therefore Unity does not respond.