Skip to content

Instantly share code, notes, and snippets.

@snowwalf
Last active April 16, 2019 14:38
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save snowwalf/26462d05a2a68815f320de1c51147b17 to your computer and use it in GitHub Desktop.
Save snowwalf/26462d05a2a68815f320de1c51147b17 to your computer and use it in GitHub Desktop.
视频鉴黄/鉴暴恐/暴恐检测API

Table of Contents generated with DocToc

智能视频分析

Request

POST /v1/video
Content-Type: application/json

{
    "mode": 0,
    "interval": 5,
    "uri": "http://cdn.duitang.com/uploads/sexy001.mp4",
    "cmds": ["pulp"]
}

请求参数说明

参数名称 是否必填 说明
mode 0. 按时间间隔采样,默认取值
1. 关键帧采样
2. 全帧采样
interval mode=0时生效,指定采样间隔,单元:秒。默认为5秒。
uri URI表示待鉴定的视频下载链接
cmds AI命令,目前仅支持pulp(鉴黄)

Response

200 OK
Content-Type: application/json

{
    "frames": 1024,
    "pulp": []
}
200 OK
Content-Type: application/json

{
    "frames": 1024,
    "pulp": [
        {
            "offset": 1.253,
            "result": {
                "confidences": [
                    "index": 0,      
                    "class": "pulp", 
                    "score": 0.9987
                ]
            }
            "uri": "http://192.168.224.166:8098/video/images/AQAAAHbDauoKRNMU/000065000.jpg"
	    },
        ...
    ]
}

返回参数说明

字段 取值 说明
frames int 表示视频推理总帧数

鉴黄结果

字段 取值 说明
offset float offset表示涉黄视频帧在视频中时间戳,单位为秒,精确到毫秒
index {0,1} index表示涉黄视频帧类型0:pulp 1:sexy
class {"pulp","sexy"} class表示涉黄视频帧分类名称,分别为色情、性感
score float 视频帧鉴黄结果的准确度,取值范围0~1,1为准确度最高
uri string uri表示涉黄视频帧图片的本地下载地址
  • 正常的视频帧不返回结果

图片鉴黄

图片剑皇服务用以检测图片的内容是否为正常(norm)、性感(sexy)或色情(pulp)

Request

POST /v1/eval  Http/1.1
Content-Type: application/json

{
    "data": {
        "uri": "http://cdn.duitang.com/uploads/item/201205/24/20120524122218_YR5Mz.jpeg" 
    }
}

请求字段说明:

字段 取值 说明
uri string 图片资源地址

Response

200 ok

[
    {
        "code": 0,
        "message": "",
        "result": {
            "confidences": [
                {
                    "index": 2,      
                    "class": "norm", 
                    "score": 0.9987
                }
            ]
        }	
    }
]

返回字段说明:

字段 取值 说明
code int 0:表示处理成功;不为0:表示出错
message string 描述结果或出错信息
index {0,1,2} index为对应class在synset list中的位置0:pulp,1:sexy,2:norm
class {"pulp","sexy","norm"} 图片内容鉴别结果,分为色情、性感或正常3类
score float 将图片判别为某一类的准确度,取值范围0~1,1为准确度最高

使用手册

账户密码

登录账户:qiniu
密码:qiniu123
切换到root账户:使用shell命令 sudo -i, 输入上述账户的密码

服务启动

  • 启动docker(默认开机自启动)
  • 使用/home/qboxserver/ava-video/start.sh脚本,启动相关服务

服务使用

  • 视频鉴黄,访问9000端口
  • 图片鉴黄,访问9100端口
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment