Skip to content

菜品识别-单商品识别

方法名

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)
})

参数说明

参数名参数类型是否必填默认值参数描述
urlString图片路径或网络地址
topNInteger1top N 数量

回调

回调示例

json
{
    "message": "",
    "data": {
        "box": {
            "x2": 1328,
            "y2": 1328,
            "x1": 0,
            "y1": 0
        },
        "scores": [
            1
        ],
        "skuCodes": [
            "紫茄子"
        ]
    },
    "code": 0
}

回调说明

参数名参数类型参数描述
messageString消息提示
dataObject数据对象
data.boxObject当前商品的坐标框
data.box.x1String商品左上角横坐标
data.box.y1String商品左上角纵坐标
data.box.x2String商品右下角横坐标
data.box.y2String商品右下角纵坐标
data.scoresFloat[]长度等于skuCodes,对应每个skuCode的置信度
data.skuCodesString[]商品标识码SKU ID
codeInteger返回类型,0.成功,其他:失败