Appearance
菜品识别-单商品识别
方法名
recognize
用法
用法示例
js
module.recognize({
//图片路径或网络地址
// url: "/storage/emulated/0/food/red_apple/red_apple.png",
url: "http://www.yeyuboke.com/uniplugin/food/eggplant/eggplant2.png",
//top N 数量
topN: 3
}, res => {
console.log(res)
})参数说明
| 参数名 | 参数类型 | 是否必填 | 默认值 | 参数描述 |
|---|---|---|---|---|
| url | String | 是 | 无 | 图片路径或网络地址 |
| topN | Integer | 否 | 1 | top N 数量 |
回调
回调示例
json
{
"message": "",
"data": {
"box": {
"x2": 1328,
"y2": 1328,
"x1": 0,
"y1": 0
},
"scores": [
1
],
"skuCodes": [
"紫茄子"
]
},
"code": 0
}回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| message | String | 消息提示 |
| data | Object | 数据对象 |
| data.box | Object | 当前商品的坐标框 |
| data.box.x1 | String | 商品左上角横坐标 |
| data.box.y1 | String | 商品左上角纵坐标 |
| data.box.x2 | String | 商品右下角横坐标 |
| data.box.y2 | String | 商品右下角纵坐标 |
| data.scores | Float[] | 长度等于skuCodes,对应每个skuCode的置信度 |
| data.skuCodes | String[] | 商品标识码SKU ID |
| code | Integer | 返回类型,0.成功,其他:失败 |
