| class info |
| com.huawei.hms.mlsdk.productvisionsearch.cloud.MLRemoteProductVisionSearchAnalyzer |
Represents the product visual search analyzer, which detects product information from a supplied image. After the cloud API is called, the detection model runs on the cloud. A product visual search analyzer can be created in either of the following ways:
|
- // Method 1: Use default parameter settings.
- MLRemoteProductVisionSearchAnalyzer analyzer = MLAnalyzerFactory.getInstance().getRemoteProductVisionSearchAnalyzer();
- // Method 2: Use customized parameter settings.
- // setLargestNumOfReturns: maximum number of detection results.
- MLRemoteProductVisionSearchAnalyzerSetting settings = new MLRemoteProductVisionSearchAnalyzerSetting.Factory()
- .setLargestNumOfReturns(1)
- .create();
- MLRemoteProductVisionSearchAnalyzer analyzer = MLAnalyzerFactory.getInstance().getRemoteProductVisionSearchAnalyzer(settings);
- // Construct MLFrame by using the bitmap.
- MLFrame mlFrame = new MLFrame.Creator().setBitmap(bitmap).create();
- // Detect product information.
- Task<List<MLProductVisionSearch>> task = analyzer.asyncAnalyseFrame(mlFrame);
- task.addOnSuccessListener(new OnSuccessListener<List<MLProductVisionSearch>>() {
- public void onSuccess(List<MLProductVisionSearch> resultList) {
- // Processing logic for success.
- }})
- .addOnFailureListener(new OnFailureListener() {
- public void onFailure(Exception e) {
- // Processing logic for failure.
- }});
| 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) |
| Detects product information in a supplied image. |
Parameters
| Parameter name | Parameter desc |
| frame | Image object. |
Return
| Type | desc |
| com.huawei.hmf.tasks.Task<List<MLProductVisionSearch>> | Returns the asynchronous task object. |
| Method |
| public void stop() |
| Releases resources, including input and output streams. |
| Method |
| public static synchronized MLRemoteProductVisionSearchAnalyzer create(MLApplication app, MLRemoteProductVisionSearchAnalyzerSetting setting) |
| Creates a product visual search analyzer object. |
Parameters
| Parameter name | Parameter desc |
| app | MLApplication instance. |
| setting | Instance of the product visual search configurator. |
Return
| Type | desc |
| MLRemoteProductVisionSearchAnalyzer | Returns the product visual search analyzer object. |