DatasetHybridSearch API, it supports two search methods: search by image and search by text.ci:DatasetHybridSearch permission to the action of the authorization policy. For all operation APIs supported by Cloud Infinite, see CI action.ap-jakarta.POST /datasetquery/hybridsearch HTTP/1.1Host: <AppId>.ci.ap-jakarta.myqcloud.comAuthorization: Auth StringContent-Length: xxxContent-Type: application/jsonAccept: application/json
{"DatasetName": "imagesearch","Mode": "pic","Templates": "ImageSearch","SearchURIs": ["cos://examplebucket-1250000000/test.jpg"],"Limit": 10,"MatchThreshold": 1,"Filter": {"$and": [{"MediaType": {"$in": ["image"]}},{"Size": {"$gt": 123}}]}}
{"DatasetName": "imagesearch","Mode": "text","Templates" : "ImageSearch","SearchText": "an image containing a large tree","Limit": 10,"MatchThreshold": 1,"Filter": {"$and": [{"MediaType": {"$in": ["image"]}},{"Size": {"$gt": 123}}]}}
Parameter Name | Description | Type | Required |
DatasetName | Dataset name, unique within the same account | String | Yes |
Mode | Specifies the input type for search. Default value: pic. Valid values: pic: Indicates an image search by inputting an image text: Indicates a text-based image search. It supports natural language input, such as "an image containing a large tree", and also supports entering a celebrity's name to search for related images | String | No |
Templates | Specifies the data type of the output. Valid values: ImageSearch: Performs image search and returns image results. It supports two modes: pic and text FullImageSearch: Performs a full image search and returns image results. Mode must be set to text | String | Yes |
SearchURIs | Resource identifier field. Currently, only COS Buckets are supported. Field rule: cos://<BucketName>/<Path>, where BucketName indicates the COS Bucket name and Path indicates the resource path. Example: cos://examplebucket-1250000000/test.jpg | String Array | No. Required when Mode is pic. |
SearchText | Search statement. Supports up to 60 UTF-8 encoded characters. For example, "an image containing a large tree" or the name of a celebrity | String | No. Required when Mode is text. |
Limit | Number of related images to return. Default value: 10. Value range: (0, 100] | Integer | No |
MatchThreshold | Limits the minimum relevance score for returned images. Only images with a relevance score greater than or equal to the MatchThreshold value are returned. Default value: 0. Value range: (0, 100] For example, if MatchThreshold is set to 80, only images with a relevance score greater than or equal to 80 are returned in the search results | Integer | No |
Filter | Simple query parameter conditions. This optional parameter can contain three conditions. For the data format, see Scalar Filtering Fields and Operator Support List | Container | No |
{"ImageResult": [{"URI": "cos://examplebucket-1250000000/test.jpg","Score": 99}],"RequestId": "NjYwYzEwYjhfNGQ2ODk0MGJfMjcxxxx"}
Parameter Name | Type | Description |
RequestId | String | Request ID |
ImageResult | Container Array | List of image search and recognition result information |
Parameter Name | Type | Description |
URI | String | Resource identifier field, indicating the COS address of the matched image |
Score | Integer | Match score of the related image |
POST /datasetquery/hybridsearch HTTP/1.1Authorization: q-sign-algorithm=sha1&q-ak=************************************&q-sign-time=1497530202;1497610202&q-key-time=1497530202;1497610202&q-header-list=&q-url-param-list=&q-signature=****************************************Host: 1234567890.ci.ap-jakarta.myqcloud.comContent-Length: 166Content-Type: application/jsonAccept: application/json{"DatasetName": "imagesearch","Mode": "pic","Templates": "ImageSearch","SearchURIs": ["cos://examplebucket-1250000000/query.jpg"],"Limit": 10,"MatchThreshold": 80}
HTTP/1.1 200 OKContent-Type: application/jsonServer: tencent-cix-ci-request-id: NjMxMDJhYTNfMThhYTk0MGFfYmU1OV8zZjc={"ImageResult": [{"URI": "cos://examplebucket-1250000000/query.jpg","Score": 100}],"RequestId": "NjYwYzEwYjhfNGQ2ODk0MGJfMjcxxxx"}
POST /datasetquery/hybridsearch HTTP/1.1Authorization: q-sign-algorithm=sha1&q-ak=************************************&q-sign-time=1497530202;1497610202&q-key-time=1497530202;1497610202&q-header-list=&q-url-param-list=&q-signature=****************************************Host: 1234567890.ci.ap-jakarta.myqcloud.comContent-Type: application/jsonAccept: application/json{"DatasetName": "imagesearch","Mode": "text","Templates": "ImageSearch","SearchText": "A front-facing photo of a man in a suit","Limit": 10,"MatchThreshold": 50}
HTTP/1.1 200 OKContent-Type: application/jsonServer: tencent-ci{"ImageResult": [{ "URI": "cos://examplebucket-1250000000/image_01.webp", "Score": 59 },{ "URI": "cos://examplebucket-1250000000/image_02.webp", "Score": 58 },{ "URI": "cos://examplebucket-1250000000/image_03.webp", "Score": 58 },{ "URI": "cos://examplebucket-1250000000/image_04.webp", "Score": 57 },{ "URI": "cos://examplebucket-1250000000/image_05.webp", "Score": 56 }],"RequestId": "NmExZDJiMTBfMjYyOTVhMTVfMTYyYzk1XzIxN2E="}
{"DatasetName": "imagesearch","Mode": "text","Templates": "ImageSearch","SearchText": "Zhang San","Limit": 10,"MatchThreshold": 50}
{"ImageResult": [{ "URI": "cos://examplebucket-1250000000/person_01.webp", "Score": 88 },{ "URI": "cos://examplebucket-1250000000/person_02.webp", "Score": 85 }],"RequestId": "NmExZDJiMGVfMjYyOTVhMTVfMTYyYzk1XzIxNzk="}
Apakah halaman ini membantu?
Anda juga dapat Menghubungi Penjualan atau Mengirimkan Tiket untuk meminta bantuan.
masukan