image-advertisement-detection
图片广告检测
自动检测图片中是否存在水印、二维码、条形码及小程序码等广告特征,返回违规类型与置信度,辅助平台内容审核。
调用价格
5 匠币/次
快速接入
保持统一返回结构,直接通过服务端发起请求即可接入。
https://openapi.toolkk.com/v1/image-advertisement-detectioncURL 示例
curl --request POST \
--url 'https://openapi.toolkk.com/v1/image-advertisement-detection' \
--header 'Content-Type: application/json' \
--header 'X-API-Key: YOUR_API_KEY' \
--data '{\n "imageBase64": "iVBORw0KGgo...",\n "imgType": "0"\n}'Python 示例
import os
import requests
url = "https://openapi.toolkk.com/v1/image-advertisement-detection"
payload = {
"imageBase64": "iVBORw0KGgo...",
"imgType": "0"
}
headers = {
"Content-Type": "application/json",
"X-API-Key": os.getenv("TOOLKK_API_KEY", "YOUR_API_KEY"),
}
response = requests.request("POST", url, headers=headers, json=payload, timeout=30)
response.raise_for_status()
print(response.json())Go 示例
package main
import (
"bytes"
"fmt"
"io"
"net/http"
)
func main() {
endpoint := "https://openapi.toolkk.com/v1/image-advertisement-detection"
payload := []byte("{\n \"imageBase64\": \"iVBORw0KGgo...\",\n \"imgType\": \"0\"\n}")
req, err := http.NewRequest("POST", endpoint, bytes.NewBuffer(payload))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("X-API-Key", "YOUR_API_KEY")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
panic(err)
}
fmt.Println(string(body))
}Java 示例
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class ToolkkExample {
public static void main(String[] args) throws Exception {
String payload = "{\n \"imageBase64\": \"iVBORw0KGgo...\",\n \"imgType\": \"0\"\n}";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://openapi.toolkk.com/v1/image-advertisement-detection"))
.method("POST", HttpRequest.BodyPublishers.ofString(payload))
.header("Content-Type", "application/json")
.header("X-API-Key", "YOUR_API_KEY")
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}PHP 示例
<?php
$endpoint = 'https://openapi.toolkk.com/v1/image-advertisement-detection';
$payload = "{\n \"imageBase64\": \"iVBORw0KGgo...\",\n \"imgType\": \"0\"\n}";
$ch = curl_init($endpoint);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'X-API-Key: YOUR_API_KEY',
],
CURLOPT_POSTFIELDS => $payload,
]);
$response = curl_exec($ch);
if ($response === false) {
throw new RuntimeException(curl_error($ch));
}
curl_close($ch);
echo $response;响应示例
{
"result": "2",
"resultMsg": "不合规",
"resultItems": [
{
"nonComplianceType": 0,
"msg": "存在水印",
"probability": 0.91
}
]
}示例用于理解返回结构,实际结果以接口返回为准。
- 鉴权方式
- 请求头传入 X-API-Key
- 默认限流
- 20 次/分钟
- 超时时间
- 30000 ms
服务端调用时,将 API Key 放在 X-API-Key 请求头中。
建议按 response code 与业务字段双重判断调用结果。
高频调用场景请结合速率限制与重试策略使用。
请求字段
从服务端发起请求,并在 X-API-Key 请求头中传入密钥。
请求字段
以下字段根据示例 JSON 自动提取,仅作接入参考。
| 字段路径 | 类型 | 必填 | 说明 | 示例值 |
|---|---|---|---|---|
| imageBase64 | string | 未标注 | 未标注 | iVBORw0KGgo... |
| imgType | string | 未标注 | 未标注 | 0 |
请求示例
{
"imageBase64": "iVBORw0KGgo...",
"imgType": "0"
}- 鉴权方式
- 请求头传入 X-API-Key
- 默认限流
- 20 次/分钟
- 超时时间
- 30000 ms
响应字段
示例用于理解返回结构,实际结果以接口返回为准。
响应字段
以下字段根据示例 JSON 自动提取,仅作接入参考。
| 字段路径 | 类型 | 必填 | 说明 | 示例值 |
|---|---|---|---|---|
| result | string | 未标注 | 未标注 | 2 |
| resultMsg | string | 未标注 | 未标注 | 不合规 |
| resultItems | array | 未标注 | 未标注 | [{"nonComplianceType":0,"msg":"存在水印","probability":0.91}] |
| resultItems[] | object | 未标注 | 未标注 | {...} |
| resultItems[].nonComplianceType | number | 未标注 | 未标注 | 0 |
| resultItems[].msg | string | 未标注 | 未标注 | 存在水印 |
| resultItems[].probability | number | 未标注 | 未标注 | 0.91 |
响应示例
{
"result": "2",
"resultMsg": "不合规",
"resultItems": [
{
"nonComplianceType": 0,
"msg": "存在水印",
"probability": 0.91
}
]
}$.code == 200接口简介
接口能力、应用场景、使用限制与常见问题。
接口能力
提交单张图片的Base64内容,检查水印、二维码、条形码、小程序码等广告风险信号。结果包含整体判断、文字说明,以及命中项目的类型、说明和置信度,适合接入图片审核流程。它帮助发现需要复核的元素,不读取二维码里的网址,也没有返回广告文字、元素坐标或自动去除水印后的图片。
应用场景
内容平台可在图片入库时保存风险结果,将命中素材交给人工;商品资料系统可检查图片中是否存在引流元素;运营审核页可同时展示原图、整体说明与各项提示,方便审核人员结合发布规范判断。分流规则、人工结论和后续处置由调用方实现,应使用目标业务样本验证,避免只凭一次命中就自动封禁或删除材料。
从输入到结果
将单张图片编码为Base64,填入 imageBase64,并参照当前示例设置 imgType 为字符串0。取得结果后联合查看 result、resultMsg 和 resultItems;示例中2对应不合规,命中项0的说明为存在水印。展示时保留每项说明,并检查 probability 是否为可处理的数值。其他状态或类型需按实际定义确认,不能仅凭数字推断含义。
范围与限制
置信度是辅助判断信号,0.91不表示整个服务具有91%的准确率,也不是水印面积占比。没有命中项仍需结合整体状态判断;失败、缺失或未知状态不能直接作为通过。公开定义未明确文件规格、全部类型枚举、动画逐帧能力或结果时效,接入前应验证目标素材。检测不替代平台发布规则或人工审核,也不保证识别全部广告元素。
常见问题
发现二维码会返回其中的网址吗?
当前结果是风险类型、说明及置信度,没有二维码内容字段。读取码内信息需要另行处理。
置信度0.91可以当作准确率吗?
不能。它描述这一命中项的模型信号,不代表整个服务在所有图片上的准确率;业务阈值需要结合样本验证。