智能客服
你问我答,随时在线为你解决问题

























此版本文档已归档不再维护,推荐您使用最新版本。
| class info |
| com.huawei.hms.mlsdk.productvisionsearch.cloud.MLRemoteProductVisionSearchAnalyzer |
拍照购检测器:用于在提供的图像中,识别商品信息。拍照购检测器,调用云端API,检测模型在云端运行。创建拍照购检测器有两种方式,根据实际情况二选一。 收起 自动换行 深色代码主题 复制 |
- // 方式1:使用默认的参数配置
- MLRemoteProductVisionSearchAnalyzer analyzer = MLAnalyzerFactory.getInstance().getRemoteProductVisionSearchAnalyzer();
- // 方式2:使用自定义的参数配置
- // setLargestNumOfReturns 检测结果的最大数量
- MLRemoteProductVisionSearchAnalyzerSetting settings = new MLRemoteProductVisionSearchAnalyzerSetting.Factory()
- .setLargestNumOfReturns(1)
- .create();
- MLRemoteProductVisionSearchAnalyzer analyzer = MLAnalyzerFactory.getInstance().getRemoteProductVisionSearchAnalyzer(settings);
- // 通过Bitmap构造MLFrame
- MLFrame mlFrame = new MLFrame.Creator().setBitmap(bitmap).create();
- // 商品信息识别
- Task<List<MLProductVisionSearch>> task = analyzer.asyncAnalyseFrame(mlFrame);
- task.addOnSuccessListener(new OnSuccessListener<List<MLProductVisionSearch>>() {
- public void onSuccess(List<MLProductVisionSearch> resultList) {
- //检测成功的处理逻辑
- }})
- .addOnFailureListener(new OnFailureListener() {
- public void onFailure(Exception e) {
- // 检测失败的处理逻辑
- }});
| Return type | Method name |
| Task<List<MLProductVisionSearch>> | asyncAnalyseFrame(MLFrame frame) |
| void | stop() |
| MLRemoteProductVisionSearchAnalyzer | create(MLApplication app, MLRemoteProductVisionSearchAnalyzerSetting setting) |
| Method |
| public com.huawei.hmf.tasks.Task<List<MLProductVisionSearch>> asyncAnalyseFrame(MLFrame frame) |
| 从提供的图像中识别商品信息。 |
Parameters
| Parameter name | Parameter desc |
| frame | 图片对象。 |
Return
| Type | desc |
| com.huawei.hmf.tasks.Task<List<MLProductVisionSearch>> | 返回异步的任务对象。 |
| Method |
| public void stop() |
| 释放资源,包括释放输入输出流资源 |
| Method |
| public static synchronized MLRemoteProductVisionSearchAnalyzer create(MLApplication app, MLRemoteProductVisionSearchAnalyzerSetting setting) |
| 创建拍照购检测器对象 |
Parameters
| Parameter name | Parameter desc |
| app | MLApplication实例。 |
| setting | 拍照购检测参数配置器实例。 |
Return
| Type | desc |
| MLRemoteProductVisionSearchAnalyzer | 返回拍照购识别检测器对象。 |
智能客服
你问我答,随时在线为你解决问题
合作咨询
我们的专家服务团队将竭诚为您提供专业的合作咨询服务
解决方案
精准高效的一站式服务支持,助力开发者商业成功