Updated on 2025-05-08 GMT+08:00

Image Search

The image search connector is used to connect to the Huawei Cloud Image Search.

Image Search leverages deep learning and image recognition technologies to deliver service- and industry-specific feature vectorization and search capabilities. It helps your search of exact or fuzzy match images from the specified gallery.

Creating an Image Search Connection

  1. Log in to the new ROMA Connect console.
  2. In the navigation pane on the left, choose Connector. On the page displayed, click New Connection.
  3. Select the image search connector.
  4. In the dialog box displayed, configure the connector and click OK.

    Parameter

    Description

    Name

    Enter the connector instance name.

    App Key

    Access key ID (AK) of the current account. Obtain the AK by referring to Access Keys. If an AK/SK pair has been generated, find the downloaded AK/SK file (such as credentials.csv).

    App Secret

    Secret access key (SK) of the current account. Obtain the SK by referring to Access Keys. If an AK/SK pair has been generated, find the downloaded AK/SK file (such as credentials.csv).

    Description

    Enter the description of the connector to identify it.

Action

  • Deleting data
  • Updating data
  • Checking data
  • Search
  • Adding data

Configuration Parameters

Table 1 Deleting data

Parameter

Description

project_id

Project ID.

service_name

Name of a service instance, which is specified when creating a service instance.

region_id

Region ID.

force

Whether the deletion is idempotent. The default value is false. This parameter is valid only for the deletion of a specified ID.

  • false: An error message is returned if no data exists.
  • true: An empty message is returned if no data exists. This is used for idempotent deletion.

item_id

ID of a service instance. The value is a string of [1, 256] characters.

At least one of item_id, custom_tags, and custom_num_tags must be specified to delete data in a service instance by specified ID or condition.

If item_id is specified, data is deleted by specified ID. If item_id is not specified, data is deleted by condition.

custom_tags

User-defined character tag, which is used to delete data in a service instance by condition. The format is key-value pair.

  • Key: The value must be an existing key in the service instance custom_tags. You can configure the key when creating a service instance or add a key when updating a service instance.
  • Value: Tag value list. Data that matches one of the tag values is returned. The list length range is [1, 32], the tag value type is character string, and the character length range is [1, 64].

custom_num_tags

User-defined number tag, which is used to delete data in a service instance by the custom_num_tags condition. The format is key-value pair.

  • Key: The value must be an existing key in the service instance custom_num_tags. You can configure the key when creating a service instance or add a key when updating a service instance. Data without this value tag is directly filtered out.
  • Value: Tag Value range. Data whose tag value is within the specified value range will be matched.

from

Lower bound of the value (inclusive by default).

to

Upper bound of the value (inclusive by default).

Table 2 Updating data

Parameter

Description

project_id

Project ID.

service_name

Name of a service instance, which is specified when creating a service instance.

region_id

Region ID.

item_id

ID of a service instance. The value is a string of [1, 256] characters.

decs

Description of the data. The value is a string of [1, 2048] characters.

custom_tags

User-defined character tag, which is used for condition-based filtering. The format is key-value pair.
  • Key: The value must be an existing key in the service instance custom_tags. You can configure the key when creating a service instance or add a key when updating a service instance.
  • Value: The value is a character string of [1, 64] characters.

custom_num_tags

User-defined number tag, which is used for condition-based filtering. The format is key-value pair.

  • Key: The value must be an existing key in the service instance custom_num_tags. You can configure the key when creating a service instance or add a key when updating a service instance.
  • Value: The value is a number in double format.
Table 3 Checking data

Parameter

Description

project_id

Project ID.

service_name

Name of a service instance, which is specified when creating a service instance.

region_id

Region ID.

item_id

ID of a service instance. The value is a string of [1, 256] characters.

At least one of item_id, custom_tags, and custom_num_tags must be specified to delete data in a service instance by specified ID or condition.

If item_id is specified, data is deleted by specified ID. If item_id is not specified, data is deleted by condition.

limit

Number of returned check results. The default value is 10. The value range is [1, 100]. This parameter is valid only for condition checks.

last_item

Sorting information about the last check result of the previous check. This parameter takes effect only for condition checks. You can use the last_item field in the result returned by the last check.

score

Score of the result.

id

Unique ID of a result.

custom_tags

User-defined character tag, which is used to search data in a service instance by condition. The format is key-value pair.

  • Key: The value must be an existing key in the service instance custom_tags. You can configure the key when creating a service instance or add a key when updating a service instance.
  • Value: Tag value list. Data that matches one of the tag values is returned. The list length range is [1, 32], the tag value type is character string, and the character length range is [1, 64].

custom_num_tags

User-defined number tag, which is used to search data in a service instance by condition. The format is key-value pair.

  • Key: The value must be an existing key in the service instance custom_num_tags. You can configure the key when creating a service instance or add a key when updating a service instance. Data without this value tag is directly filtered out.
  • Value: Tag Value range. Data whose tag value is within the specified value range will be matched.

from

Lower bound of the value (inclusive by default).

to

Upper bound of the value (inclusive by default).

Table 4 Search

Parameter

Description

project_id

Project ID.

service_name

Name of a service instance, which is specified when creating a service instance.

region_id

Region ID.

search_type

Search type. The value must be supported by the service instance. The search type list of a service instance can be configured when the service instance is created.

You can use the enumeration name or value (for example, IMAGE/0). The enumeration value may change. You are advised to use the enumeration name.

limit

Number of returned search results. The default value is 10. The value range is [1, 100].

offset

Offset of the search result, that is, the search result whose sequence number is within [offset, offset+limit] is returned. The default value is 0, and the value range is [0, N].

By default, the search requires that offset+limit ≤ 1,000.

For full retrieval, the offset must be 0.

last_item

Sorting information about the last research result of the previous search. This parameter is valid only in full retrieval scenarios. You can use the last_item field in the result returned by the previous search.

Currently, only KEYWORD supports full retrieval.

When full retrieval is used, the offset must be 0.

score

Score of the result.

id

Unique ID of a result.

min_score

Minimum score of the search result, which is used to filter the search result score. The value range is [0, 1].

Currently, this parameter takes effect only for the IMAGE and CATEGORY search types.

custom_tags

User-defined character tag, which is used for condition-based filtering. The format is key-value pair.

  • Key: The value must be an existing key in the service instance custom_tags. You can configure the key when creating a service instance or add a key when updating a service instance.
  • Value: Tag value list. Data that matches one of the tag values is returned. The list length range is [1, 32], the tag value type is character string, and the character length range is [1, 64].

custom_num_tags

User-defined number tag, which is used for condition-based filtering. The format is key-value pair.
  • Key: The value must be an existing key in the service instance custom_num_tags. You can configure the key when creating a service instance or add a key when updating a service instance. Data without this value tag is directly filtered out.
  • Value: Tag Value range. Data whose tag value is within the specified value range will be matched.

from

Lower bound of the value (inclusive by default).

to

Upper bound of the value (inclusive by default).

image_base64

Base64 character string of an image file. Either this parameter or image_url must be specified. The following requirements must be met:

  • Format: Currently, only JPEG, JPG, PNG, BMP, and WEBP images are supported.
  • Size: The image file size cannot exceed 5 MB.
  • Resolution: By default, the shortest side of an image must be greater than 64 px and the longest side must be less than 4,096 px. Some service types have special requirements. For details, see service type description.
  • Others: The image cannot contain rotation information.

image_url

Image file URL that can be accessed by the service. The value is a string of [1, 4096] characters. For image-based search, set either this parameter or image_base64.

keywords

Keyword list. The number of keywords is [1, 10], and the keyword length is [1, 64]. This parameter is mandatory when KEYWORD is used.

optional_params

This parameter is optional.

do_det

Whether to perform object detection.

  • true (default): Perform target detection.
  • false: Not perform target detection.

box

Coordinate of the target rectangular box. If this parameter is specified, the box is directly used as the target without object detection. The format is x1,y1,x2,y2 (without spaces). x1/y1 indicates the coordinates of the upper left corner of the target, and x2/y2 indicates the coordinates of the lower right corner of the target. The requirements are as follows:

  • 0 ≤ x1 < x2 ≤ width. By default, x2−x1 ≥ 15. For details, see the service type description.
  • 0 ≤ y1 < y2 ≤ height. By default, y2−y1 ≥ 15. For details, see the service type description.

do_cls

Whether to perform object classification.

  • true (default): Perform object classification.
  • false: Not perform object classification.

category

Object category. If the object category is specified, the object is not classified and the category is used. For details about the category information, see the service type description.

collapse_key

Deduplication tag name, which must be an existing key in custom_tags of the service instance.

  • If this parameter is set, data with the same value under the key is deduplicated, and only the data with the highest score is retained.
  • Data without this tag is directly filtered out.

max_scan_num

Maximum number of scanned nodes. A larger value indicates a higher query precision and slower query speed. The default value is 10000.

nprobe

Number of center points. A larger value indicates a higher query precision and slower query speed. The default value is 100.

Table 5 Adding data

Parameter

Description

project_id

Project ID.

service_name

Name of a service instance, which is specified when creating a service instance.

region_id

Region ID.

force

Whether to forcibly add data.

  • false (default): Not add data that already exists.
  • true: Overwrite data that already exists.

item_id

ID of a service instance. The value is a string of [1, 256] characters.

desc

Description of the data. The value is a string of [1, 2048] characters.

custom_tags

User-defined character tag, which is used for condition-based filtering. The format is key-value pair.
  • Key: The value must be an existing key in the service instance custom_tags. You can configure the key when creating a service instance or add a key when updating a service instance.
  • Value: The value is a character string of [1, 64] characters.

custom_num_tags

User-defined number tag, which is used for condition-based filtering. The format is key-value pair.

  • Key: The value must be an existing key in the service instance custom_num_tags. You can configure the key when creating a service instance or add a key when updating a service instance.
  • Value: The value is a number in double format.

image_base64

Base64 character string of an image file. Either this parameter or image_url must be specified when an image is saved to the database. The following requirements must be met:

  • Format: Currently, only JPEG, JPG, PNG, BMP, and WEBP images are supported.
  • Size: The image file size cannot exceed 5 MB.
  • Resolution: By default, the shortest side of an image must be greater than 64 px and the longest side must be less than 4,096 px. Some service types have special requirements. For details, see service type description.
  • Others: The image cannot contain rotation information.

image_url

Image file URL that can be accessed by the service. The value is a string of [1, 4096] characters. When adding an image, set either this parameter or image_base64.

keywords

Keyword list. The number of keywords is [1, 100], and the keyword length is [1, 64]. Specify this parameter when adding data to a service instance that supports keyword search. Otherwise, a keyword is automatically generated.

optional_params

This parameter is optional.

do_det

Whether to perform object detection.

  • true (default): Perform target detection.
  • false: Not perform target detection.

box

Coordinate of the target rectangular box. If this parameter is specified, the box is directly used as the target without object detection. The format is x1,y1,x2,y2 (without spaces). x1/y1 indicates the coordinates of the upper left corner of the target, and x2/y2 indicates the coordinates of the lower right corner of the target. The requirements are as follows:

  • 0 ≤ x1 < x2 ≤ width. By default, x2−x1 ≥ 15. For details, see the service type description.
  • 0 ≤ y1 < y2 ≤ height. By default, y2−y1 ≥ 15. For details, see the service type description.

do_cls

Whether to perform object classification.

  • true (default): Perform object classification.
  • false: Not perform object classification.

category

Object category. If the object category is specified, the object is not classified and the category is used. For details about the category information, see the service type description.