调用该接口启动以图搜图应用实例,进行图片检索。

使用限制

  • 单个阿里云账号调用该接口的每秒请求数(QPS)最大限制为100。
    说明 RAM用户共享阿里云账号配额。
  • 请提前为待检索图片,配置URL地址。
    说明 当前仅支持JPG格式的图片,且图片URL中不能包含中文。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

请求参数

名称 类型 是否必选 示例值 描述
Action String PictureSearchPicture

系统规定参数。取值:PictureSearchPicture。

AppInstanceId String 5a502d3fbab8410e8fd4be9037c7****

以图搜图应用实例ID。可调用QueryPictureSearchApps接口查询。

ContainPicUrl Boolean true

响应结果是否包含照片。

说明 当前设置为truefalse,均返回照片。
CurrentPage Integer 1

指定从返回结果中的第几页开始显示。最小取值为1。

EndTime Long 1614850651299

检索结束时间,格式为13位时间戳,单位为毫秒。

PageSize Integer 10

返回结果中,每页显示的记录数量。最大取值10,最小取值1,默认取值为10。

SearchPicUrl String https://example.com/test.jpg

待检索图片的地址,仅支持JPG格式的图片,且图片URL不能包含中文。

StartTime Long 1614297000000

检索起始时间,格式为13位时间戳,单位为毫秒。

Threshold Float 0.5

检索阈值,取值范围为0.0~1.0。

说明 为保证检索结果的准确性,推荐您将该参数的值设置为大于等于0.3。
PictureSearchType Integer 1

检索类型:

  • 1(默认):人脸
  • 0:人体

调用API时,除了本文介绍的该API的特有请求参数,还需传入公共请求参数。公共请求参数说明,请参见公共参数文档

返回数据

名称 类型 示例值 描述
Code String 200

接口返回码:

  • 200:表示成功。
  • 其它:表示错误码。错误码详情,请参见错误码
Data Struct

调用成功时,返回的数据。

CurrentPage Integer 1

当前页码。

PageCount Integer 1

总页数。

PageData Array of searchData

检索出的图片信息列表。

EventTime Long 1614500317482

创建检索任务的时间,格式为13位时间戳,单位为毫秒。

GatewayIotId String pZJUqijOyfpFOOGNPF7S00****

V系列边缘一体机的IotId。

IotId String 5RUngwC1RknD4lPiHgH300****

终端设备的IotId。

PicUrl String https://example.com/test.jpg

图片地址。

Threshold Float 0.5

图片检索相似度。

VectorId String vectorId86d9a5c32b9947278e526c2eef8a****

图片特征ID。

VectorType Integer 1

图片特征类型:

  • 0:人体
  • 1:人脸
PageSize Integer 10

每页显示的条数。

Total Integer 1

检索出的图片总数。

ErrorMessage String Specified parameter CurrentPage is not valid.

调用失败时,返回的出错信息。

RequestId String 3ddd5f30-7ccd-11eb-b164-bfd389491534

阿里云为该请求生成的唯一标识符。

Success Boolean true

是否调用成功:

  • true:调用成功。
  • false:调用失败。

示例

请求示例

http(s)://linkvisual.cn-shanghai.aliyuncs.com/?Action=PictureSearchPicture
&AppInstanceId=5a502d3fbab8410e8fd4be9037c7****
&ContainPicUrl=true
&CurrentPage=1
&EndTime=1614850651299
&PageSize=10
&SearchPicUrl=https://example.com/test.jpg
&StartTime=1614297000000
&Threshold=0.5
&<公共请求参数>

正常返回示例

XML格式

<PictureSearchPictureResponse>
  <RequestId>3ddd5f30-7ccd-11eb-b164-bfd389491534</RequestId>
  <Data>
        <PageSize>10</PageSize>
        <PageCount>1</PageCount>
        <CurrentPage>1</CurrentPage>
        <Total>1</Total>
        <PageData>
              <IotId>5RUngwC1RknD4lPiHgH300****</IotId>
              <VectorType>1</VectorType>
              <EventTime>1614500317482</EventTime>
              <GatewayIotId>pZJUqijOyfpFOOGNPF7S00****</GatewayIotId>
              <PicUrl>https://XXX.XXX/XXX</PicUrl>
              <Threshold>0.5</Threshold>
              <VectorId>vectorId86d9a5c32b9947278e526c2eef8a****</VectorId>
        </PageData>
  </Data>
  <Code>200</Code>
  <Success>true</Success>
</PictureSearchPictureResponse>

JSON格式

{
    "RequestId": "3ddd5f30-7ccd-11eb-b164-bfd389491534",
    "Data": {
        "PageSize": "10",
        "PageCount": "1",
        "CurrentPage": "1",
        "Total": "1",
        "PageData": [
            {
                "IotId": "5RUngwC1RknD4lPiHgH300****",
                "VectorType": "1",
                "EventTime": "1614500317482",
                "GatewayIotId": "pZJUqijOyfpFOOGNPF7S00****",
                "PicUrl": "https://XXX.XXX/XXX",
                "Threshold": "0.5",
                "VectorId": "vectorId86d9a5c32b9947278e526c2eef8a****"
            }
        ]
    },
    "Code": "200",
    "Success": true
}