Content Moderation

Common structure of service response data

Parameter Type Required Description
signature String Yes The algorithm used for digital signature is "RSA-SHA256", and the signature will be base64 encoded. Download Tuputech’s public key certificatefirst, and then follow the steps below for authentication:
1. JSON.parse() parses received JSON data, and return JSON object which is named“data”.
2. “data” consists of two fields: “signature”-digital signature; “json”- string format of valid data.
3. use signature to verify json based on RSA-SHA25 algorithm (output type: base64), and receive the authentication result.
4. After passing the authentication, JSON.parse() json, JSON data returned. For more information, see the description of json below.
json String Yes After parsing json by JSON.parse(json), the result contains:
message:text corresponding to code parameter.
timestamp:The current UNIX timestamp of the server.
nonce:random number
Structure after JSON parsing
Parameter Type Required Description
code Number Yes Status code of the request, see Common Status Code Description.
message String Yes Status message of the request.
timestamp Number Yes The current UNIX timestamp of the server.
nonce Number Yes Random number
summary Array No Summary of the results. Disabled by default, please contact Tuputech to enable.
[taskId] Object Yes Result of tasks. Each task has its own taskID and [taskId] data structure.
... ... No Results of other tasks and requests.
summary
Parameter Type Required Description
code Number Yes Status code of the request, see Common Status Code Description.
name String Yes Image URL or file name
suggestion Number No Suggested handling. Valid values: 0: pass; 1: block; 2: review
riskType Number No Risk type.
riskTask String No Task.
tag String No Custom description of moderated images.
Sample summary code
{
  "summary": [
​    {
​      "code": 0,
​      "message": "success",
​      "name": "http://test.com/test1.jpg",
​      "suggestion": 0,
​      "riskType": 1,
​      "riskTask": "5b7be1f59b0c77a8c2afb351",
​      "tag": "t1"
​    },
​    {
​      "code": 14,
​      "message": "download fail",
​      "name": "http://test.com/test2.jpg",
​      "tag": "t2"
​    }
  ]
}
riskType
Value Risk Type Associated taskId (default rule)
0 Normal None
1 Politics 5b7be1f59b0c77a8c2afb351 (political figures recognition)
5e1d634d2809c24f6d909bd3 (text moderation with OCR)
2 Pornography 54bcfc6c329af61034f7c2fc (pornography detection)
5e1d634d2809c24f6d909bd3 (text moderation with OCR)
3 Violence & terrorism 5e1d70adeec2874f7318dc52 (violence & terrorism content detection)
5e1d634d2809c24f6d909bd3 (text moderation with OCR)
4 violation detection 5eddb86afaf52c4ca704ea41 (violation detection)
5ad37309616505867eeac264 (obscene content)
5e1d634d2809c24f6d909bd3 (text moderation with OCR)
5 Ad 56a8645b0c800bff40990cf1 (ad detection)
5e1d634d2809c24f6d909bd3 (text moderation with OCR)
6 Sensitive/offensive 5e1d634d2809c24f6d909bd3 (text moderation with OCR)
7 Profanity/abuse 5e1d634d2809c24f6d909bd3 (text moderation with OCR)

NOTE: The risk type is generated from the result of corresponding taskId based on multiple rules including scores threshold and tags priority.

Sample
{
  "signature": "signature_from_tupu_service", 
  "json": "{\"code\":0,\"message\":\"success\",\"nonce\":\"0.5442530125172196\",\"timestamp\":1595318082309}"
}

Task Result

Applicable Task

taskId:

  • Pornographic detection (taskId: 54bcfc6c329af61034f7c2fc)
  • Violence detection (taskId: 5e1d70adeec2874f7318dc52)
  • Ad detection (taskId: 56a8645b0c800bff40990cf1)
taskId parameters
Parameter Type Required Description
statistic Array Yes The number of images for under each classification.
reviewCount Number Yes The number of images requiring review
fileList Array Yes Moderation result for each image
topNStatistic Array No Data distribution of images moderated under each categories when a large number of categories are involved in the moderation process.
fileList
Parameter Type Required Description
rate Float Yes The score of the confidence level. Valid values: 0.0 to 1.0. A greater value indicates a higher confidence level of the results.
label Number Yes The category of the moderation result. (“-1” indicates failure in categorizing)
name String Yes If an image URL is uploaded, the value will be the uploaded URL. If an image file is uploaded, the value will be the filename of the image.
review Boolean Yes Whether human review is required.
tag String No The pre-set tag parameter of the image.
zip String No Identify the origin compressed file.
labels Array No If an image fall under multiple categories, it will display top N labels that have the highest level of probabilities.
rates Array No If an image fall under multiple categories, it will display the corresponding rates of the displayed labels.
subLabel Object No The subcategory of the moderation result.
allLabelRates Array No Rates of all labels. Please contact Tuputech to enable this service.
subLabel
Parameter Type Required Description
label Number Yes The category of the moderation result. (“-1” indicates failure in categorizing)
rate Float Yes The score of the confidence level. Valid values: 0.0 to 1.0. A greater value indicates a higher confidence level of the results.
review Boolean Yes Whether human review is required.
review
Value Risk Tag Nonrisk Tag
true Suggest reviewing Suggest reviewing
false Block Accept
  • Risk tag: the tags corresponding to the violating contents in the moderation for pornography, violence, political figures, ads and obscene.
  • Nonrisk tag: tags not related to violating contents.

JSON Sample

Example of pornography detection

{
  "54bcfc6c329af61034f7c2fc": {
​    "statistic": [
​      0,
​      0,
​      1
​    ],
​    "reviewCount": 0,
​    "fileList": [
​      {
​        "rate": 0.9927366971969604,
​        "label": 2,
​        "name": "http://tuputech.com/test.jpg",
​        "tag": "some_tag",
​        "zip": "zip_file_name",
​        "review": false,
​        "subLabel": {
​          "label": 30,
​          "rate": 0.99,
​          "review": false
​        }
​      }
​    ]
  },
  "nonce": "0.010413094889372587",
  "timestamp": 1435385737,
  "code": 0,
  "message": "success"
}

results matching ""

    No results matching ""