Political Figures Recognition

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

taskId

5b7be1f59b0c77a8c2afb351

taskId Struct
Parameter Type Required Description
fileList Array Yes Result of each image.
fileList Struct

Describes the file list and recognition results of the uploaded images

Parameter Type Required Description
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.
objects Array Yes All the faces detected.
label Number Yes Search result.
similarity Number Yes Level of confidence that the faces match. Valid values: 0.0 to 1.0. A greater value indicates a higher probability that the input face belongs to the figure recognized.
faceId String Yes The name of the figure whose face is recognized as the most similar to the input one.
review Boolean Yes Whether human review is required.
faceUrl String No Image URL of the figure recognized.
typeName String No The category of the figure recognized.
featureId String No The feature ID of the figure recognized.
facePosition Array No The coordinates of the face in the image. The base point is the upper left corner of the image. The values are the percentage of the image size. The returned coordinates are upper-left coordinate, upper-right coordinate, lower-right coordinate, and lower-left coordinate successively.
tag String No The pre-set tag parameter of the image.
Objects

Describe the recognition results of all the faces in one image.

Parameter Type Required Description
similarity Number Yes Level of confidence that the faces match. Valid values: 0.0 to 1.0. A greater value indicates a higher probability that the input face belongs to the figure recognized.
faceId String Yes The name of the figure whose face is recognized as the most similar to the input one.
label Number Yes Search results.
review Boolean Yes Whether human review is required.
facePosition Array No The coordinates of the face in the image. The base point is the upper left corner of the image. The values are the percentage of the image size. The returned coordinates are upper-left coordinate, upper-right coordinate, lower-right coordinate, and lower-left coordinate successively.
typeName String No The category of the figure recognized.
faceUrl String No Image URL of the figure recognized.
featureId String No The feature ID of the figure recognized.

taskID & label

label Description
0 Political figures
2 Non-political figures
3 No face detected
-1 Fail to recognize

JSON Sample

{
  "5b7be1f59b0c77a8c2afb351": {
​      "fileList": [
​        {
​          "name": "https://www.tuputech.com/test.jpg",
​          "objects": [
​            {
​              "facePosition": [
​              [
​                0.28205128205128205,
​                0.16666666666666666
​              ],
​              [
​                0.6538461538461539,
​                0.16666666666666666
​              ],
​              [
​                0.6538461538461539,
​                0.5384615384615384
​              ],
​              [
​                0.28205128205128205,
​                0.5384615384615384
​              ]
​              ],
​              "similarity": 0.91219645738601685,
​              "typeName": "xxx",
​              "faceId": "YYY",
​              "review": false,
​              "label": 0,
​              "faceUrl": "http://person.jpg",
​              "featureId": "5fc71e0438ecdf209dddc20f"
​            }
​          ],
​          "similarity": 0.91219645738601685,
​          "label": 0,
​          "review": false,
​          "facePosition": [
​            [
​              0.28205128205128205,
​              0.16666666666666666
​            ],
​            [
​              0.6538461538461539,
​              0.16666666666666666
​            ],
​            [
​              0.6538461538461539,
​              0.5384615384615384
​            ],
​            [
​              0.28205128205128205,
​              0.5384615384615384
​            ]
​          ],
​          "typeName": "xxx",
​          "faceId": "YYY",
​          "faceUrl": "http://person.jpg",
​          "featureId": "5fc71e0438ecdf209dddc20f",
​          "tag": "test"
​        }
​      ]
  },
  "code": 0,
  "message": "success",
  "nonce": "0.19657901975332637",
  "timestamp": 1505124155500
}

results matching ""

    No results matching ""