@superpigy
2021-12-21T15:38:49.000000Z
字数 4507
阅读 91
appid: 070f7f36a80311ebbb0c00155d090ad0
app secret: oKDVO6upheFvCMtiTcfWY9w8r5UXjkq1
请求接口上传文件上限 1M
BaseURL: https://weapp.ai.hamuna.club
AccessToken获取
URL:
/access_token/acquire
Header 包括:
content-type: multipart/form-data
app_id: 获取的app_id
方法: POST
参数:
{
'signature': aes(app_id={app_id}×tamp={timestamp}&noncer={noncer}, app_secret),
'client_id': 'client_id' // 目标设备ID,需固定,
'is_refresh': 'yes'
}
返回样例:
{
"success": "ok",
"data": {
"token": {
"token": "eb4785d4a4e14b6e9d8c9eb97a92341e",
"expired_time": 1584517993
},
"noncer": "random"
}
}
参数说明:
参数 | 说明 | 是否必须 | 类型 |
---|---|---|---|
app_id | 获取的app_id | 是 | str |
timestamp | UTC毫秒数 | 是 | str |
noncer | 随机字符串, 会返回到客户端, 避免中间人攻击 | 是 | str |
app_secret | app秘钥 | 是 |
用秘钥加密连接字符串得到签名, 正式服务器Token有效期为7200秒, 测试服务器有效时间无限. AES为ECB加密并使用Base64编码, 块大小为32,Padding
猪圈点数
URL:
```
/ml/pig_count
```
**请求头:**
```
content-type: multipart/form-data
app_id: 获取的app_id
client_id: 申请token的client_id
token: 获取的token
```
返回样例:
{
"success": "ok",
"data": {
"location": [
[
0.44792890548706055,
0.530472457408905,
0.6128923296928406,
0.6608350276947021,
0.8791984915733337
],
[
0.3167198598384857,
0.32818686962127686,
0.41282859444618225,
0.5314476490020752,
0.8544944524765015
],
...
],
"infer_node_id": 'infer' # 結果來自哪個推理節點
"count": 22
},
"errMsg": ""
}
参数:
参数 | 说明 | 是否必须 | 类型 |
---|---|---|---|
file | 点数图片 | 是 | jpg |
lat | 地理坐标 | 是 | float |
lng | 地理坐标 | 是 | float |
device_desc | 设备描述 | 是 | jpg |
点数范围location中每一个item前4个为定位坐标(归一化), 分别为,第五个为检测置信度得分
到原图的映射坐标计算公式,默认已经恢复到正常尺度, 如果没有,请根据公式恢复到正常尺度:
其中代表输入图片的宽高
猪圈点数
URL:
```
/ml/pig_count
```
**请求头:**
```
content-type: multipart/form-data
app_id: 获取的app_id
client_id: 申请token的client_id
token: 获取的token
```
返回样例:
{
"success": "ok",
"data": {
"location": [
[
0.44792890548706055,
0.530472457408905,
0.6128923296928406,
0.6608350276947021,
0,
0.8791984915733337
],
[
0.3167198598384857,
0.32818686962127686,
0.41282859444618225,
0.5314476490020752,
0,
0.8544944524765015
],
...
],
"infer_node_id": 'infer' # 結果來自哪個推理節點
"count": 22
},
"errMsg": ""
}
参数:
参数 | 说明 | 是否必须 | 类型 |
---|---|---|---|
file | 点数图片 | 是 | jpg |
lat | 地理坐标 | 是 | float |
lng | 地理坐标 | 是 | float |
device_desc | 设备描述 | 是 | jpg |
v2 | 值为1则使用新版本猪点数,不填则使用老版本点数 | 否 | int |
点数范围location中每一个item前4个为定位坐标(归一化), 分别为,最后一个为检测置信度得分
其中代表输入图片的宽高
監管攝像頭猪点数
URL:
/ml/pig_count_cam
请求头:
content-type: multipart/form-data
app_id: 获取的app_id
client_id: 申请token的client_id
token: 获取的token
返回样例:
{
"success": "ok",
"data": {
"location": [
[
0.44792890548706055,
0.530472457408905,
0.6128923296928406,
0.6608350276947021,
0.8791984915733337
],
[
0.3167198598384857,
0.32818686962127686,
0.41282859444618225,
0.5314476490020752,
0.8544944524765015
],
...
],
"infer_node_id": 'infer' # 結果來自哪個推理節點
"count": 22
},
"errMsg": ""
}
参数:
参数 | 说明 | 是否必须 | 类型 |
---|---|---|---|
file | 点数图片 | 是 | jpg |
lat | 地理坐标 | 是 | float |
lng | 地理坐标 | 是 | float |
device_desc | 设备描述 | 是 | jpg |
点数范围location中每一个item前4个为定位坐标(归一化), 分别为,第五个为检测置信度得分
到原图的映射坐标计算公式,默认已经恢复到正常尺度, 如果没有,请根据公式恢复到正常尺度:
其中代表输入图片的宽高
死猪测长测重
URL:
/ml/pig_length_weight
请求头:
content-type: multipart/form-data
app_id: 获取的app_id
client_id: 申请token的client_id
token: 获取的token
返回样例:
{
"success": "ok",
"data": {
"weight": "16.07",
"length": "60.75",
"ml_output": {
"bbox": [0.41155293583869934, 0.18497280776500702, 0.6115382313728333, 0.8869619369506836] #猪身位置,
"keypoints": [
[0, 0.5544663071632385, 0.7754763960838318],
[1, 0.5544663071632385, 0.7754763960838318],
...
] # 关键点位置
}
},
"errMsg": ""
}
参数:
参数 | 说明 | 是否必须 | 类型 |
---|---|---|---|
file | 点数图片 | 是 | jpg |
lat | 地理坐标 | 是 | float |
lng | 地理坐标 | 是 | float |
device_desc | 设备描述 | 是 | str |
id | 重复理赔id校验 | 否 | str |
长度为厘米, 重量为kg
猪身位置(bbox)前4个为0-1坐标
关键点位置(keypoints) 为 [id, x, y]
点取值范围: [0,1]
参考点数方法恢复点在图片上的尺度masks为像素级猪身分割图, 值1所在的像素位置为猪身像素点位置,可参考mask绘图将猪身高亮显示
重复理赔校验id格式为"{保单号}|{理赔单号}"
死猪测长测重(带QRCode校验)
URL:
/ml/pig_length_weight_qrcode
请求头:
content-type: multipart/form-data
app_id: 获取的app_id
client_id: 申请token的client_id
token: 获取的token
返回样例:
{
"success": "ok",
"data": {
"weight": "16.07",
"length": "60.75",
"ml_output": {
"bbox": [0.41155293583869934, 0.18497280776500702, 0.6115382313728333, 0.8869619369506836, 0.8508504629135132] #猪身位置,
"keypoints": [
[0.5544663071632385, 0.7754763960838318, 0.5],
[0.5544663071632385, 0.7754763960838318, 0.5570072531700134],
...
] # 关键点位置
}
},
"errMsg": ""
}
参数:
参数 | 说明 | 是否必须 | 类型 |
---|---|---|---|
file | 点数图片 | 是 | jpg |
lat | 地理坐标 | 是 | float |
lng | 地理坐标 | 是 | float |
device_desc | 设备描述 | 是 | str |
qrcodes | 识别到的二维码信息 | 是 | list |
参数qrcodes的格式为:
#QRCODE FORMAT
[
{
'content': 'abcde',
'x': 1,
'y': 2,
},
{
'content': 'abcde',
'x': 1,
'y': 2,
}
]
content 为二维码内容, x, y为二维码对应在图片上的坐标 范围[0, 1]