聚美智数


图像内容理解

<p>[TOC]</p> <h3>简介</h3> <ul> <li>该请求用于图像内容理解,支持输入图片和提问信息,多维度识别与理解图片内容,包括人、物、行为、场景、文字等,输出对图片内容的描述。用于图片内容问答,图片打标签,图片物体识别等业务场景。图像内容理解服务涉及2个子接口。 <ol> <li>图像内容理解-提交请求:支持传入图片、提问等参数,创建图像内容理解任务,该接口会返回任务ID。</li> <li>图像内容理解-获取结果:在任务成功创建后,支持传入任务ID,查看任务处理的状态、获取处理完成后返回的结果。</li> </ol></li> </ul> <h3>接口调用说明</h3> <h4>请求方式</h4> <p>如接口没有单独说明,所有接口均为:<strong>POST</strong></p> <h4>请求格式</h4> <p>如接口没有单独说明,所有接口均为:<strong>application/form-data</strong></p> <h4>请求参数</h4> <p>请求参数均包括公共参数和业务参数(业务参数见具体接口说明) 如接口没有单独说明,所有接口调用时,均需要把<strong>公共参数</strong>和<strong>业务参数</strong>一并放在<strong>请求参数</strong>中提交</p> <p>&lt;a name=&quot;公共请求参数&quot;&gt;&lt;/a&gt;</p> <h5>公共请求参数</h5> <table> <thead> <tr> <th>名称</th> <th>类型</th> <th>必须</th> <th>&lt;div style=&quot;width:420px;&quot;&gt;说明&lt;/div&gt;</th> </tr> </thead> <tbody> <tr> <td>appId</td> <td>String</td> <td>是</td> <td>服务商分配的唯一标识</td> </tr> <tr> <td>timestamp</td> <td>Long</td> <td>是</td> <td>当前时间戳(毫秒)</td> </tr> <tr> <td>sign</td> <td>String</td> <td>是</td> <td>签名,详见签名算法说明</td> </tr> </tbody> </table> <h5>签名算法说明</h5> <pre><code>sign = sha256(appId + appSecret + timestamp)</code></pre> <p>用服务商分配的 <strong>appId</strong>、服务商分配的 <strong>appSecret</strong>,当前时间戳(毫秒) <strong>timestamp</strong>,按上述顺序拼接成字符串,再进行 <strong>sha256</strong> 哈希得到。如下:</p> <pre><code class="language-java">String appId = &amp;quot;xyzxy2121zxyz&amp;quot;; String timestamp = &amp;quot;1555378976238&amp;quot;; String appSecret = &amp;quot;efcefcef1121cefcefc1212121&amp;quot;; String str = appId + appSecret + timestamp; String sign = sha256(str);</code></pre> <h4>返回说明</h4> <h5>公共返回字段说明</h5> <p>所有接口均返回以下公共字段:</p> <table> <thead> <tr> <th>字段名</th> <th>&lt;div style=&quot;width:420px&quot;&gt;说明&lt;/div&gt;</th> </tr> </thead> <tbody> <tr> <td>code</td> <td>返回码,详见:code返回码说明</td> </tr> <tr> <td>msg</td> <td>code对应的描述</td> </tr> <tr> <td>charge</td> <td>计费标志 true为计费,false为不计费</td> </tr> <tr> <td>taskNo</td> <td>本次请求号</td> </tr> <tr> <td>data</td> <td>返回具体结果,object类型,详见data返回字段描述</td> </tr> </tbody> </table> <p>&lt;a name=&quot;code返回码说明&quot;&gt;&lt;/a&gt;</p> <table> <thead> <tr> <th>code</th> <th>&lt;div style=&quot;width:420px;&quot;&gt;说明&lt;/div&gt;</th> </tr> </thead> <tbody> <tr> <td>200</td> <td>成功</td> </tr> <tr> <td>400</td> <td>参数错误</td> </tr> <tr> <td>404</td> <td>接口地址不正确</td> </tr> <tr> <td>500</td> <td>系统维护,请稍候再试</td> </tr> <tr> <td>601</td> <td>接口未开通</td> </tr> <tr> <td>602</td> <td>账号停用</td> </tr> <tr> <td>604</td> <td>接口停用</td> </tr> <tr> <td>606</td> <td>调用超限,请稍候再试</td> </tr> <tr> <td>607</td> <td>ip不在白名单</td> </tr> <tr> <td>609</td> <td>请求过于频繁,请稍候再试</td> </tr> <tr> <td>610</td> <td>请求超时</td> </tr> <tr> <td>999</td> <td>其他,以实际返回为准</td> </tr> </tbody> </table> <hr /> <h3>提交请求</h3> <h4>请求地址</h4> <p><code>https://api.jumdata.com/image/understanding/request</code></p> <h4>业务参数</h4> <p>参数说明</p> <table> <thead> <tr> <th>名称</th> <th>类型</th> <th>必须</th> <th>&lt;div style=&quot;width:420px;&quot;&gt;说明&lt;/div&gt;</th> </tr> </thead> <tbody> <tr> <td>image</td> <td>String</td> <td>否</td> <td>图片的base64</td> </tr> <tr> <td>url</td> <td>String</td> <td>否</td> <td>图片完整 url,url 长度不超过 1024 字节</td> </tr> <tr> <td>question</td> <td>String</td> <td>是</td> <td>提问信息,如“这张图片里有什么?”、“图中的人物是谁,并进行简单介绍”,限制 100 个字符之内</td> </tr> </tbody> </table> <ul> <li>image、url 必须提供一个,优先级:url &gt; base64。大小不超过10M,最短边至少64px,最长边最大8192px,图片格式支持jpg/jpeg/png格式。超过4096px的图片,将被自动等比例压缩至4096px进行处理,压缩后会影响处理效果</li> </ul> <h4>成功返回样例</h4> <pre><code class="language-json">{ &amp;quot;code&amp;quot;: 200,// 返回码,详见返回码说明 &amp;quot;msg&amp;quot;: &amp;quot;成功&amp;quot;,// 返回码对应描述 &amp;quot;taskNo&amp;quot;: &amp;quot;043439882226367117195632&amp;quot;,// 本次请求号 &amp;quot;charge&amp;quot;: true, // 计费标志 &amp;quot;data&amp;quot;: { &amp;quot;taskId&amp;quot;: &amp;quot;xxxx&amp;quot; //用于查询 } }</code></pre> <h4>失败返回样例</h4> <pre><code class="language-json">{ &amp;quot;code&amp;quot;: 400,// 返回码,详见返回码说明 &amp;quot;taskNo&amp;quot;: &amp;quot;255033697205413852131601&amp;quot;,// 本次请求号 &amp;quot;charge&amp;quot;: false,// 计费标志 &amp;quot;msg&amp;quot;: &amp;quot;图片不能为空&amp;quot;// 返回码对应描述 }</code></pre> <hr /> <h3>获取结果</h3> <h4>请求地址</h4> <p><code>https://api.jumdata.com/image/understanding/get-result</code></p> <h4>业务参数</h4> <p>参数说明</p> <table> <thead> <tr> <th>名称</th> <th>类型</th> <th>必须</th> <th>&lt;div style=&quot;width:420px;&quot;&gt;说明&lt;/div&gt;</th> </tr> </thead> <tbody> <tr> <td>taskId</td> <td>String</td> <td>是</td> <td>提交请求接口返回的taskId</td> </tr> </tbody> </table> <h4>成功返回样例</h4> <pre><code class="language-json">{ &amp;quot;code&amp;quot;: 200,//返回码,详见返回码说明 &amp;quot;msg&amp;quot;: &amp;quot;成功&amp;quot;,//返回码对应描述 &amp;quot;taskNo&amp;quot;: &amp;quot;571436032193067500962066&amp;quot;,//本次请求号 &amp;quot;charge&amp;quot;: false,//计费标志,查询结果接口不计费 &amp;quot;data&amp;quot;: { &amp;quot;resultCode&amp;quot;: &amp;quot;0&amp;quot;,//任务状态,0:处理成功;1:处理中 &amp;quot;description&amp;quot;: &amp;quot;这张图里面有:\n\n1. 一个人正在讲台上讲话, xxxxxx&amp;quot;,//针对输入的 question 问题,对图片内容进行分析后输出的答案 &amp;quot;resultMsg&amp;quot;: &amp;quot;处理成功&amp;quot; //任务状态描述 } } </code></pre> <h4>失败返回样例</h4> <pre><code class="language-json">{ &amp;quot;code&amp;quot;: 400,// 返回码,详见返回码说明 &amp;quot;msg&amp;quot;: &amp;quot;taskId不能为空&amp;quot;, // 返回码对应描述 &amp;quot;taskNo&amp;quot;: &amp;quot;255033697205413852131601&amp;quot;,// 本次请求号 &amp;quot;charge&amp;quot;: false, //计费标志,查询结果接口不计费 }</code></pre>

页面列表

ITEM_HTML