圖片檢測

2020-02-15 02:01 更新

檢測圖片是否包含違法違規(guī)內(nèi)容


接口地址

POST https://developer.toutiao.com/api/v2/tags/image/
?? 注意
該接口請在開發(fā)者服務(wù)器端請求


輸入

請求 Headers

名稱描述
X-Token小程序 access_token,參考登錄憑證檢驗

請求 Body

{
  "targets": ["ad", "porn"],
  "tasks": [
    {
      "image": "https://image.url"
    }
  ]
}
名稱描述
targets圖片檢測服務(wù)類型,目前支持 porn、politics、ad、disgusting 四種
tasks檢測任務(wù)列表
image檢測的圖片鏈接


輸出

正確返回的 JSON 如下:

{
  "log_id": "2019010320551501001001621510071",
  "data": [
    {
      "code": 0,
      "task_id": "d18197c4-0f56-11e9-99a5-0242ac110004",
      "data_id": null,
      "cached": false,
      "predicts": [
        {
          "prob": 1,
          "model_name": "image_ocr",
          "target": "ad"
        },
        {
          "prob": 0,
          "model_name": "image_qrcode",
          "target": "ad"
        }
      ],
      "msg": "ok"
    },
    {
      "code": 0,
      "task_id": "d1aedc02-0f56-11e9-99a5-0242ac110004",
      "data_id": null,
      "cached": false,
      "predicts": [
        {
          "prob": 0.0005013857153244317,
          "model_name": "image_porn",
          "target": "porn"
        },
        {
          "prob": 0.022131478413939476,
          "model_name": "image_vulgar",
          "target": "porn"
        }
      ],
      "msg": "ok"
    }
  ]
}
名稱描述
log_id請求 id
data檢測結(jié)果列表
code檢測結(jié)果-狀態(tài)碼
msg檢測結(jié)果-消息
data_id檢測結(jié)果-數(shù)據(jù) id
task_id檢測結(jié)果-任務(wù) id
predicts檢測結(jié)果-置信度列表
target檢測結(jié)果-置信度-服務(wù)/目標
model_name檢測結(jié)果-置信度-模型/標簽
prob檢測結(jié)果-置信度-概率,值為 0 或者 1,當值為 1 時表示檢測的圖片有違法違規(guī)內(nèi)容比如是廣告

當 access_token 檢驗失敗時會返回如下信息:

{
  "error_id": "dd60b2bef95f40d7a4ace0bf5130d2e7",
  "code": 401,
  "message": "Authentication credentials were not provided.",
  "exception": "Authentication credentials were not provided."
}
以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號