[Case Teaching] Huawei Cloud API image search speed of ImageSearch—AI helps you quickly classify images

Cloud services, APIs, SDKs, debugging, viewing, I can do it all

Read the short article and you can learn: Artificial Intelligence AI merges and categorizes photos of the same type

1 Introduction to the API plug-in of IntelliJ IDEA

The API plug-in supports VS Code IDE, IntelliJ IDEA and other platforms, as well as Huawei Cloud's self-developed CodeArts IDE. Based on the capabilities provided by Huawei Cloud services, it helps developers build applications more efficiently and conveniently. The API plug-in is associated with API Explorer, DevStar, CodeLabs, SDK Center, and CLI Center products under Huawei Cloud Services, and is committed to providing developers with a more stable, faster, and safer programming experience.

In this plug-in, we provide but are not limited to the following functions:

Connected to the Huawei Cloud API open platform, it supports users to retrieve APIs, view API documents, debug APIs, and provide SDK sample codes for users to learn how to use APIs.

Provides Huawei Cloud SDK code snippet completion function, and SDK dependency packages are automatically introduced to accelerate users' integration of Huawei Cloud APIs.

Connected to Huawei Cloud Development Experience Center Codelabs, it provides 500+ cloud service code examples and guided tutorials to help users learn quickly.

illustrate:

On a series of platforms such as IntelliJ IDEA and VS Code IDE, the name of the Huawei Cloud API plug-in is Huawei Cloud API. In CodeArts IDE, the API plug-in is natively built into the IDE, and its name is Huawei Cloud API Development Kit.

The use of API plug-ins on series platforms such as IntelliJ IDEA and VS Code IDE depends on the base plug-in. Please install the base plug-in in advance.

2 API plug-in installation--IntelliJ IDEA

2.1 IntelliJ IDEA and other platforms

Installation preparation: Download and install JDK1.8 or higher. Download and install IntelliJ IDEA 2020.2 or higher.

Note: The IntellIj platform also supports IDEs including Goland, Pycharm, etc. If you develop on other related IDEs, please download and configure the compiler or interpreter of the corresponding language. Here we take IDEA as an example to introduce the installation process of the IntelliJ platform plug-in. For other IntelliJ series IDEs, please refer to IDEA. https://developer.huaweicloud.com/develop/toolkit.html

start installation:

You can download and install the offline package directly from the IDE plug-in market or directly from the JetBrains plug-in market.

IDE installation

  1. Select File > Settings in the top menu bar of IntelliJ IDEA, and click Plugins in the left navigation bar of the Settings dialog box.
  2. Click Marketplace in the Plugins area and enter Huawei Cloud API in the search bar.
  3. Huawei Cloud API will appear in the Search Results area, click Install, and restart the IDE after completion.

Offline package installation:

  1. Enter the plug-in market and search for Huawei Cloud API, enter the plug-in details page, select the desired version of the API plug-in under the Versions tab, and click Download to download the offline plug-in compressed package and save it locally. .
  2. Select File > Settings in the top menu bar of IntelliJ IDEA, and click Plugins in the left navigation bar of the Settings dialog box.
  3. Click in the Plugins area, and then click Install Plugin from Disk....
  4. Select the offline installation package (no need to decompress it) in the Choose Plugin File dialog box, and follow the prompts on the IntelliJ IDEA installation page to complete the subsequent installation steps.

Note: If the IntelliJ IDE you want to install the plug-in for is already open on the desktop, enter the plug-in market and search for Huawei Cloud API. Enter the plug-in details page. In the upper right corner, the locally opened IDE will be identified. Click the corresponding button. In the pop-up Click OK in the IDE window, and the IDE background will start to install the corresponding version of the API plug-in.

Installation verification: After successfully installing the plug-in on the IntelliJ series platform, you can see the Huawei Cloud Toolkit icon in the left navigation bar. Click on the back panel and the words Huawei Cloud API will appear, indicating that the installation is successful.

2.2 API list

The API list is displayed on the left, and all APIs can be queried. Currently, there are 206 cloud services and APIs 9213.

Toolkit-Huawei Cloud

Release Notes

This example is developed based on Huawei Cloud SDK V3.0.

Features

Create an instance, and an image index library will be generated in the instance to store image features.

This example shows how to create an instance through the Java version of the SDK.

Preconditions

Get AK/SK

Developers need to obtain the ak, sk, and endpoint of the account before using it.

You need to have a Huawei Cloud account and the Access Key (AK) and Secret Access Key (SK) corresponding to the account. Please create and view your AK/SK on the "My Credentials-Access Key" page of the Huawei Cloud Console. See Access Keys for more information.

endpoint refers to the application areas of Huawei Cloud services and the terminal nodes of each service. For details, please view the regions and terminal nodes.

Operating environment

For Java JDK 1.8 and above, it is recommended to use the JAVA version SDK by installing dependencies through Maven.

SDK acquisition and installation

Just add the corresponding version of dependencies to the pom.xml file of the Maven project.

Take the introduction of the content audit SDK version 3.0.67 as an example:

<dependency>

    <groupId>com.huaweicloud.sdk</groupId>

    <artifactId>huaweicloud-sdk-imagesearch</artifactId>

    <version>3.0.67</version>

</dependency>

3 Create an image search instance

The image content review sample code only needs to replace the AK/SK information with the actual AK/SK. In the code, you can use the setName or setModel method of the CreateInstanceReq class to configure the instance name and model name, and run it after the configuration is completed.

import com.huaweicloud.sdk.core.auth.ICredential;
import com.huaweicloud.sdk.core.auth.BasicCredentials;
import com.huaweicloud.sdk.core.exception.ConnectionException;
import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
import com.huaweicloud.sdk.core.exception.ServiceResponseException;
import com.huaweicloud.sdk.imagesearch.v1.ImageSearchClient;
import com.huaweicloud.sdk.imagesearch.v1.model.RunCreateInstanceRequest;
import com.huaweicloud.sdk.imagesearch.v1.model.CreateInstanceReq;
import com.huaweicloud.sdk.imagesearch.v1.model.RunCreateInstanceResponse;
import com.huaweicloud.sdk.imagesearch.v1.region.ImageSearchRegion;

public class ImageSearchCreateInstanceDemo {
    public static void main(String[] args) {
        String ak = "<YOUR AK>";
        String sk = "<YOUR SK>";
        ICredential auth = new BasicCredentials()
            .withAk(ak)
            .withSk(sk);
        
        ImageSearchClient client = ImageSearchClient.newBuilder()
            .withCredential(auth)
            .withRegion(ImageSearchRegion.valueOf("cn-north-4"))
            .build();
        RunCreateInstanceRequest request = new RunCreateInstanceRequest();
        CreateInstanceReq body = new CreateInstanceReq();
        body.setName("instance-name");
        body.setModel("common-search");
        request.setBody(body);
        try {
            RunCreateInstanceResponse response = client.runCreateInstance(request);
            System.out.println(response.toString());
        } catch (ConnectionException e) {
            System.out.println(e.getMessage());
        } catch (RequestTimeoutException e) {
            System.out.println(e.getMessage());
        } catch (ServiceResponseException e) {
            System.out.println(e.getHttpStatusCode());
            System.out.println(e.getErrorCode());
            System.out.println(e.getErrorMsg());
        }
    }
}

4 Delete image search instance

To delete the instance example code, just replace the AK/SK information with the actual AK/SK. In the code, you can use the setInstanceName method of the RunDeleteInstanceRequest class to configure the instance name, and run it after the configuration is completed.

import com.huaweicloud.sdk.core.auth.ICredential;
import com.huaweicloud.sdk.core.auth.BasicCredentials;
import com.huaweicloud.sdk.core.exception.ConnectionException;
import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
import com.huaweicloud.sdk.core.exception.ServiceResponseException;
import com.huaweicloud.sdk.imagesearch.v1.ImageSearchClient;
import com.huaweicloud.sdk.imagesearch.v1.model.RunDeleteInstanceRequest;
import com.huaweicloud.sdk.imagesearch.v1.model.RunDeleteInstanceResponse;
import com.huaweicloud.sdk.imagesearch.v1.region.ImageSearchRegion;

public class ImageSearchDeleteInstanceDemo {
    public static void main(String[] args) {
        String ak = "<YOUR AK>";
        String sk = "<YOUR SK>";
        ICredential auth = new BasicCredentials()
            .withAk(ak)
            .withSk(sk);
        
        ImageSearchClient client = ImageSearchClient.newBuilder()
            .withCredential(auth)
            .withRegion(ImageSearchRegion.valueOf("cn-north-4"))
            .build();
        RunDeleteInstanceRequest request = new RunDeleteInstanceRequest();
        request.setInstanceName("instance-name");
        try {
            RunDeleteInstanceResponse response = client.runDeleteInstance(request);
            System.out.println(response.toString());
        } catch (ConnectionException e) {
            System.out.println(e.getMessage());
        } catch (RequestTimeoutException e) {
            System.out.println(e.getMessage());
        } catch (ServiceResponseException e) {
            System.out.println(e.getHttpStatusCode());
            System.out.println(e.getErrorCode());
            System.out.println(e.getErrorMsg());
        }
    }
}

5 Filter photos of the same type in the album and merge them into categories

Use the following code (from ImageSearchService.py) to synchronously query the image search service (IS) in a specific Region. Before calling, please replace the following variables {your ak string}, {your sk string}, {your region string}, { according to the actual situation. your endpoint string}, {your projectId string} and {your file path string}

class ImageSearchService(object):
    def __init__(self, service_name, region, ak, sk, end_point_url, project_id):
        self.end_point_url = end_point_url
        self.project_id = project_id
        self.sig = signer.Signer()
        self.sig.Key = ak
        self.sig.Secret = sk
        self.name = service_name
        self.region = region

    def create_instance(self, project_id, model, name, description="", tags=["test-tags"]):
        uri = "https://imagesearch.cn-north-4.myhuaweicloud.com/v1/%s/service"%project_id
        data = {"project_id": project_id,
                "model": model,
                "name": name,
                "description": description,
                "tags": tags
                }
        json_data = json.dumps(data)
        r = signer.HttpRequest("POST", uri)
        r.body = json_data
        r.headers = {"content-type": "application/json"}
        self.sig.Sign(r)
        resp = requests.request(r.method, 
                                r.scheme+"://"+r.host+r.uri, 
                                headers=r.headers, 
                                data=r.body)
        # print(resp.status_code, resp.reason)
        # print(resp.content)
        return resp

    def delete_instance(self, project_id, instance_name):
        uri = "https://imagesearch.cn-north-4.myhuaweicloud.com/v1/%s/service/%s"%(project_id, instance_name)
        data = {}
        json_data = json.dumps(data)
        r = signer.HttpRequest("DELETE", uri)
        r.body = json_data
        r.headers = {"content-type": "application/json"}
        self.sig.Sign(r)
        resp = requests.request(r.method, 
                                r.scheme+"://"+r.host+r.uri, 
                                headers=r.headers, 
                                data=r.body)
        # print(resp.status_code, resp.reason)
        # print(resp.content)
        return resp
        
    def check_user_instance(self, end_point_url, project_id, instance_name):
        uri = "%s/v1/%s/service/%s"%(end_point_url, project_id, instance_name)
        print(uri)
        data = {}
        json_data = json.dumps(data)
        r = signer.HttpRequest("GET", uri)
        r.body = json_data
        r.headers = {"content-type": "application/json"}
        self.sig.Sign(r)
        resp = requests.request(r.method, 
                                r.scheme+"://"+r.host+r.uri, 
                                headers=r.headers, 
                                data=r.body)
        # print(resp.status_code, resp.reason)
        # print(resp.content)
        return resp

    def add_picture(self, project_id, instance_name, path, file="", is_crop=False, tags={"test-tags": "test-default"}):
        print("call add_picture: %s, length of file path %d"%(path, len(path)))
        uri = "https://imagesearch.cn-north-4.myhuaweicloud.com/v1/%s/%s/image"%(project_id, instance_name)
        # print(uri)
        data = {}
        data["path"] = path
        data["file"] = file
        data["tags"] = tags
        json_data = json.dumps(data)
        r = signer.HttpRequest("POST", uri)
        r.body = json_data
        r.headers = {"content-type": "application/json"}
        self.sig.Sign(r)
        resp = requests.request(r.method, 
                                r.scheme+"://"+r.host+r.uri, 
                                headers=r.headers, 
                                data=r.body)
        # print(resp.status_code, resp.reason)
        # print(resp.content)
        return resp

    def search_picture(self, project_id, instance_name, 
                       path="", box={"height": 0, "width": 0, "x": 0, "y": 0}, 
                       file="", is_crop=False, limit=0, offset=0):
        uri = "https://imagesearch.cn-north-4.myhuaweicloud.com/v1/%s/%s/image/search"%(project_id, instance_name)
        
        data = {}
        data["path"] = path
        data["file"] = file
        json_data = json.dumps(data)
        r = signer.HttpRequest("POST", uri)
        r.body = json_data
        r.headers = {"content-type": "application/json"}
        self.sig.Sign(r)
        resp = requests.request(r.method, 
                                r.scheme+"://"+r.host+r.uri, 
                                headers=r.headers, 
                                data=r.body)
        # print(resp.status_code, resp.reason)
        # print(resp.content)
        return resp

    def delete_picture(self, project_id, instance_name, path):
        uri = "https://imagesearch.cn-north-4.myhuaweicloud.com/v1/%s/%s/image"%(project_id, instance_name)
        data = {}
        data["path"] = path
        json_data = json.dumps(data)
        r = signer.HttpRequest("DELETE", uri)
        r.body = json_data
        r.headers = {"content-type": "application/json"}
        self.sig.Sign(r)
        resp = requests.request(r.method, 
                                r.scheme+"://"+r.host+r.uri, 
                                headers=r.headers, 
                                data=r.body)
        # print(resp.status_code, resp.reason)
        # print(resp.content)
        return resp

    def check_picture(self, project_id, instance_name, path):
        uri = "https://imagesearch.cn-north-4.myhuaweicloud.com/v1/%s/%s/image/check"%(project_id, instance_name)
        
        data = {}
        data["path"] = path
        json_data = json.dumps(data)
        r = signer.HttpRequest("POST", uri)
        r.body = json_data
        r.headers = {"content-type": "application/json"}
        self.sig.Sign(r)
        resp = requests.request(r.method, 
                                r.scheme+"://"+r.host+r.uri, 
                                headers=r.headers, 
                                data=r.body)
        # print(resp.status_code, resp.reason)
        # print(resp.content)
        return resp

    def update_picture(self, project_id, instance_name, path, tags={}):
        uri = "https://imagesearch.cn-north-4.myhuaweicloud.com/v1/%s/%s/image"%(project_id, instance_name)
        data = {}
        data["path"] = path
        data["tags"] = tags
        json_data = json.dumps(data)
        r = signer.HttpRequest("PUT", uri)
        r.body = json_data
        r.headers = {"content-type": "application/json"}
        self.sig.Sign(r)
        resp = requests.request(r.method, 
                                r.scheme+"://"+r.host+r.uri, 
                                headers=r.headers, 
                                data=r.body)
        # print(resp.status_code, resp.reason)
        # print(resp.content)
        return resp

Run the example

Execute bash config.bash, the script will automatically depend on the python environment, and then enter AK, SK, and Project ID according to the system prompts.

After the configuration is successful, cfg.ini will be automatically generated with similar content. The configuration of the hwc part is consistent with the configuration result. Of course, you can also configure the cfg.ini file manually.

[hwc]
    ak=******
    sk=******
    project_id=63kkdjkd******9dkst3tskdgi53
    [endpoint]
    cn-north-1=https://imagesearch.cn-north-1.myhuaweicloud.com
    cn-north-4=https://imagesearch.cn-north-4.myhuaweicloud.com
    ap-southeast-1=https://imagesearch.ap-southeast-1.myhuaweicloud.com

Enter python3 unit_test.py to execute unit testing

Enter python3 run.py to execute the demo program

operation result

Unit test output

create_instance 
.
 check_user_instance is_788802
https://imagesearch.cn-north-4.myhuaweicloud.com/v1/your_project_id/service/is_788802
<Response [200]>
.
 add_picture_by_local is_788802
call add_picture: ./test_picture/43474673_7bb4465a86.jpg, length of file path 38
.
 add_picture_by_url is_788802
call add_picture: https://is-smirk.obs.cn-north-4.myhuaweicloud.com:443/flowers_recognition/train/11405573_24a8a838cc_n.jpg, length of file path 105
.
 search_picture_by_local is_788802
.
 search_picture_by_url is_788802
.
 update_picture is_788802
.
 check_picture is_788802
.
 delete_picture is_788802
.
 delete_instance is_788802
.

Ran 10 tests in 18.108s

OK

Demonstration program output

['hwc', 'endpoint']
[('cn-north-1', 'https://imagesearch.cn-north-1.myhuaweicloud.com'), ('cn-north-4', 'https://imagesearch.cn-north-4.myhuaweicloud.com'), ('ap-southeast-1', 'https://imagesearch.ap-southeast-1.myhuaweicloud.com')]
https://imagesearch.cn-north-1.myhuaweicloud.com
your_AK
https://imagesearch.cn-north-4.myhuaweicloud.com/v1/your_project_id/service/hwc_demo
call add_picture: 151385301_153eacf6b5_n.jpg, length of file path 26
add picture success: ./test_picture/train/151385301_153eacf6b5_n.jpg
call add_picture: 200557977_bf24d9550b.jpg, length of file path 24
add picture success: ./test_picture/train/200557977_bf24d9550b.jpg
call add_picture: 6953297_8576bf4ea3.jpg, length of file path 22
add picture success: ./test_picture/train/6953297_8576bf4ea3.jpg
call add_picture: 134409839_71069a95d1_m.jpg, length of file path 26
add picture success: ./test_picture/train/134409839_71069a95d1_m.jpg
call add_picture: 510874382_f7e3435043.jpg, length of file path 24
add picture success: ./test_picture/train/510874382_f7e3435043.jpg
call add_picture: 15987457_49dc11bf4b.jpg, length of file path 23
add picture success: ./test_picture/train/15987457_49dc11bf4b.jpg
call add_picture: 164670176_9f5b9c7965.jpg, length of file path 24
add picture success: ./test_picture/train/164670176_9f5b9c7965.jpg
call add_picture: 2059172936_032ffc12aa.jpg, length of file path 25
add picture success: ./test_picture/train/2059172936_032ffc12aa.jpg
call add_picture: 2093263381_afd51358a3.jpg, length of file path 25
add picture success: ./test_picture/train/2093263381_afd51358a3.jpg
call add_picture: 3203779656_3580151ea4_m.jpg, length of file path 27
add picture success: ./test_picture/train/3203779656_3580151ea4_m.jpg
call add_picture: 13920113_f03e867ea7_m.jpg, length of file path 25
add picture success: ./test_picture/train/13920113_f03e867ea7_m.jpg
call add_picture: 5794835_d15905c7c8_n.jpg, length of file path 24
add picture success: ./test_picture/train/5794835_d15905c7c8_n.jpg
call add_picture: 146023167_f905574d97_m.jpg, length of file path 26
add picture success: ./test_picture/train/146023167_f905574d97_m.jpg
call add_picture: 486234138_688e0_n.jpg, length of file path 21
add failed
call add_picture: 486234138_688e0_n.jpg, length of file path 21
call add_picture: 184682652_c927a49226_m.jpg, length of file path 26
add picture success: ./test_picture/train/184682652_c927a49226_m.jpg
call add_picture: 40410814_fba3837226_n.jpg, length of file path 25
add picture success: ./test_picture/train/40410814_fba3837226_n.jpg
call add_picture: 80846315_d997645bea_n.jpg, length of file path 25
add picture success: ./test_picture/train/80846315_d997645bea_n.jpg
call add_picture: 413815348_764ae83088.jpg, length of file path 24
add picture success: ./test_picture/train/413815348_764ae83088.jpg
call add_picture: 200557979_a16112aac1_n.jpg, length of file path 26
add picture success: ./test_picture/train/200557979_a16112aac1_n.jpg
call add_picture: 163978992_8128b49d3e_n.jpg, length of file path 26
add picture success: ./test_picture/train/163978992_8128b49d3e_n.jpg
call add_picture: 43474673_7bb4465a86.jpg, length of file path 23
add picture success: ./test_picture/train/43474673_7bb4465a86.jpg
call add_picture: 21652746_cc379e0eea_m.jpg, length of file path 25
add picture success: ./test_picture/train/21652746_cc379e0eea_m.jpg
call add_picture: 118974357_0faa23cce9_n.jpg, length of file path 26
add failed
call add_picture: 118974357_0faa23cce9_n.jpg, length of file path 26
call add_picture: 154332674_453cea64f4.jpg, length of file path 24
add picture success: ./test_picture/train/154332674_453cea64f4.jpg
call add_picture: 162362896_99c7d851c8_n.jpg, length of file path 26
add picture success: ./test_picture/train/162362896_99c7d851c8_n.jpg
call add_picture: 160456948_38c3817c6a_m.jpg, length of file path 26
add picture success: ./test_picture/train/160456948_38c3817c6a_m.jpg
call add_picture: 5794839_200acd910c_n.jpg, length of file path 24
add picture success: ./test_picture/train/5794839_200acd910c_n.jpg
call add_picture: 3179751458_9646d839f6_n.jpg, length of file path 27
add picture success: ./test_picture/train/3179751458_9646d839f6_n.jpg
call add_picture: 2183357362_4b4da4b6b5.jpg, length of file path 25
add picture success: ./test_picture/train/2183357362_4b4da4b6b5.jpg
call add_picture: 141652526_2be95f21c3_n.jpg, length of file path 26
add failed
call add_picture: 141652526_2be95f21c3_n.jpg, length of file path 26
call add_picture: 169371301_d9b91a2a42.jpg, length of file path 24
add picture success: ./test_picture/train/169371301_d9b91a2a42.jpg
call add_picture: 200288046_0032f322ff_n.jpg, length of file path 26
add picture success: ./test_picture/train/200288046_0032f322ff_n.jpg
call add_picture: 3450344423_63ba3190e3.jpg, length of file path 25
add failed
call add_picture: 3450344423_63ba3190e3.jpg, length of file path 25
call add_picture: 11405573_24a8a838cc_n.jpg, length of file path 25
add picture success: ./test_picture/train/11405573_24a8a838cc_n.jpg
call add_picture: 2141413229_3f0425f972_n.jpg, length of file path 27
add picture success: ./test_picture/train/2141413229_3f0425f972_n.jpg
call add_picture: 3554620445_082dd0bec4_n.jpg, length of file path 27
add failed
call add_picture: 3554620445_082dd0bec4_n.jpg, length of file path 27
call add_picture: 44079668_34dfee3da1_n.jpg, length of file path 25
add picture success: ./test_picture/train/44079668_34dfee3da1_n.jpg
call add_picture: 40411019_526f3fc8d9_m.jpg, length of file path 25
add picture success: ./test_picture/train/40411019_526f3fc8d9_m.jpg
call add_picture: 2609353769_dc3654f12f.jpg, length of file path 25
add picture success: ./test_picture/train/2609353769_dc3654f12f.jpg
call add_picture: 40410963_3ac280f23a_n.jpg, length of file path 25
add picture success: ./test_picture/train/40410963_3ac280f23a_n.jpg
[('40410814_fba3837226_n.jpg', 0.8202), ('40411019_526f3fc8d9_m.jpg', 0.7959), ('44079668_34dfee3da1_n.jpg', 0.7957), ('40410963_3ac280f23a_n.jpg', 0.7948), ('200288046_0032f322ff_n.jpg', 0.7419), ('184682652_c927a49226_m.jpg', 0.7291), ('5794839_200acd910c_n.jpg', 0.6738), ('163978992_8128b49d3e_n.jpg', 0.6732), ('200557977_bf24d9550b.jpg', 0.6675), ('134409839_71069a95d1_m.jpg', 0.6608)]
[('162362896_99c7d851c8_n.jpg', 0.9541), ('163978992_8128b49d3e_n.jpg', 0.9534), ('21652746_cc379e0eea_m.jpg', 0.93), ('413815348_764ae83088.jpg', 0.8996), ('5794835_d15905c7c8_n.jpg', 0.8991), ('5794839_200acd910c_n.jpg', 0.8933), ('134409839_71069a95d1_m.jpg', 0.8806), ('169371301_d9b91a2a42.jpg', 0.8272), ('43474673_7bb4465a86.jpg', 0.78), ('44079668_34dfee3da1_n.jpg', 0.7677)]
[('15987457_49dc11bf4b.jpg', 0.7605), ('151385301_153eacf6b5_n.jpg', 0.7571), ('80846315_d997645bea_n.jpg', 0.7416), ('11405573_24a8a838cc_n.jpg', 0.6828), ('146023167_f905574d97_m.jpg', 0.6674), ('13920113_f03e867ea7_m.jpg', 0.6639), ('160456948_38c3817c6a_m.jpg', 0.6396), ('510874382_f7e3435043.jpg', 0.6251)]
[('2141413229_3f0425f972_n.jpg', 1.0), ('2093263381_afd51358a3.jpg', 0.6334)]

The demo program will automatically create an image search service instance named hwc_id_demo in North China-Beijing 4, and add the pictures under test_picture/train to the instance.

Then test the pictures under test_picture/test as the search results for searching pictures. In this demo, the returned results with a similarity less than 0.6 are filtered.

6 Experience the charm of plug-ins

Huawei Cloud devkit is now online: Toolkit-Huawei Cloud

Guess you like

Origin blog.csdn.net/hwxiaozhi/article/details/132871475