android 的 Microsoft FACE API- 示例应用程序出错

Microsoft FACE API for android- Error in Sample app

我正在使用 github (https://github.com/Microsoft/Cognitive-Face-Android) 中的 Cognitive-Face-Android 示例应用程序。

在@huxuan 的帮助下,我的订阅密钥可以使用了。但是,当我尝试在 android 模拟器中使用 运行 来在 Identification 中执行 "Detection" 或 "Add a group" 时,两者都会出错。

图片为jpeg格式,大小为54KB,符合FACEAPI文档中规定的限制。

谁能告诉我解决这个问题的方法是什么?

我刚刚在模拟器上下载了示例应用程序 运行 ,并使用了从网上下载的 JPG 图片,并将其存储在 Downloads 文件夹和 SD 卡中,并且它工作正常。

关于您在 GitHub 话题中提到的关于 Access denied. Invalid subsription key 的问题,请确保在文件

app\src\main\java\com\microsoft\projectoxford\face\samples\helper\SampleApp.java

你改变这一行

sFaceServiceClient = new FaceServiceRestClient(getString(R.string.subscription_key));

对此:

sFaceServiceClient = new FaceServiceRestClient("https://eastus2.api.cognitive.microsoft.com/face/v1.0",getString(R.string.subscription_key));

(或您的 API 密钥有效的任何区域)。