等待client.face.face.detectwithstreamasync不响应

发布于 2025-02-05 10:57:17 字数 775 浏览 2 评论 0原文

我想使用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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

樱花细雨 2025-02-12 10:57:17

解决方案是根据基于任务的异步模式(TAP)而不是Method.wait()使用等待,该模式已在教程的示例中使用(显然是不是为团结而建立的)。 wait()调用整个线程,因此Unity无响应。

The solution was to use await according to the Task-based Asynchronous Pattern (TAP) instead of method.Wait(), which was used in the tutorial's example (which was obviously not built for Unity). The Wait() call blocks the whole thread, therefore Unity does not respond.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文