The Jocloud interactive video moderation helps to moderate video streams in real time particularly for Jocloud interactive video solutions. Specifically, it can detect improper information in video streams and can provide management and control suggestions.
Once a room (roomId) moderation task starts, the system pulls video data from Jocloud transport system and captures screenshots for moderation periodically.
The Jocloud interactive video moderation service is used to detect illegal information of real-time video streams, and an asynchronous callback returns an illegal result.
The followingmoderation category action and corresponding labelare provided:
Detection Type | Description | Action | Primary Label | Secondary Label |
---|---|---|---|---|
Porn recognition | Recognize porn and sexy contents in pictures | porn | ||
normal: normal | normal: normal | |||
sexy: sexy | female_underwear: female underwear female_sexy_chest_l12: female sexy chest level 12 female_sexy_chest_l3: female sexy chest level 3 female_sexy_chest_l4: female sexy chest level 4 female_backless: female backless female_sexy_leg: female sexy leg female_focus_leg: female focus leg bathing_suit: bathing suit male_topless: male topless male_normal_topless: male normal topless other_sexy: other sexy |
|||
porn: porn | sex_product: sex aids naked_private_part: exposed sensitive parts extensive_naked: extensive naked sex_behavior: sex behavior naked_female_back: naked famale back naked_hip: naked hip sex_bulge: sex bulge focus_female_crotch: focus female crotch focus_male_crotch: focus male crotch hand_on_sexy: hand on sexy lick: lick kiss: kiss sm: SM sperm: sperm naked_child: naked child other_dirty: other dirty tongue_out: tongue out female_focus_hip: female focus hip male_underwear: male underwear porn_pip: porn pip |
|||
Terrorism recognition | Recognize bloody and terrorism contents in pictures | terrorism | normal: normal fire_explosion: fire explosion gun: gun knife: knife crowd: crowd flag_of_terrorism: flag of terrorism special_dress: special dress disgusted: disgusted with_weapon: with weapon bloody: bloody uniform: uniform |
nil |
Sensitive information recognition | Recognize sensitive contents in pictures | antispam | normal: normal special_building: special building rmb: RMB map_of_China: map of China cartoons_of_leaders: cartoons of leaders flags_of_China: flags of China Tibetan_buddhism: Tibetan buddhism other_antispam: Other sensitive information tank: tank fighter: fighter cannon: cannon battleship: battleship |
nil |
Sensitive figure recognition | Recognize domestic and overseas politicians, and public figures in pictures | sface | normal: normal sface: sensitive figure involved |
nil |
Illegal recognition | Identify whether the picture contains illegal scene information | illegal | normal: normal minor: minor drug: drug drive: drive gamble: gamble smoke: smoke id_infomation: id infomation tattoo: tattoo inbed: lie on the bed |
nil |
AD recognition | Identify whether the image contains advertising information | ad | normal: normal QR_code: QR code bar_code: bar code applet_code: applet code |
nil |
OCR recognition | Identify whether the picture contains suspected violation text information | ocr | normal: normal ocr_politics: politics ocr_terrorism: terrorism ocr_porn: porn ocr_illegal: illegal ocr_abuse: abuse ocr_ad: ad |
nil |
Restriction Category | Description |
---|---|
Screenshot interval | Screenshot every 2 seconds |
Saving duration | The system will save suspected illegal video screenshots, and return URL of files and a detection result back to the user. The saving duration is 3 hours, and the files may become invalid beyond that duration. Please export them in time. |
Concurrency restriction | Each user’s real-time stream detection tasks run simultaneously cannot exceed 200 by default. Please contact customer supports for more concurrency supports. |
Stream pulling timeout | The task will stop when the live streaming is stopped or the stream pulling cannot be implemented continuously for over 10 minutes due to other causes; and this event will be returned to the service side for determining whether to initiate the task request again. |
Item | Description |
---|---|
Request method | POST |
Request protocol | HTTPS |
Request domain | ai.jocloud.com |
Request path | app/{appId}/v1/video/stream/start?traceId=xxxxx |
Request parameter | traceId is a uuid string for fault locating during troubleshooting. You should use different values for requests. |
Request header | Content-Type: application/json;charset=UTF-8 token: Authentication token, generated on the basis of Identity Authentication |
Request body | json string, defined as follows |
Name | Data Type | Required | Description |
---|---|---|---|
roomId | String | Yes | Room ID, unique identifier for a moderation task |
uids | String array | No | User ID list of moderated users. If the list is empty, all users in the roon are being moderated. |
context | JSON | No | Context of the service side, which is passed through during callbackk |
actions | String array | Yes | Detection type. Options include: - porn: porn recognition - terrorism: terrorism recognition - antispam: sensitive information recognition - sface: sensitive figure recognition - illegal: illegal scene information recognition - ad: ad information recognition - ocr: ocr information recognition |
statusCallback | String | No | HTTP callback address for moderation status (HTTP and HTTPs protocols are supported) |
resultCallback | String | No | HTTP callback address for moderation result (HTTP and HTTPs protocols are supported) |
resultCallbackLevel | String | No | Result callback level control, you can use one of the following: - pass: all audit results will be called back - review: will call back only when review and block results are identified - block: It will call back when the block result is recognized. The default is 'pass', all results are called back |
sequence | String | No | This value is used for a signature in a callback notification request. This field is required during the callback. See result callback description for detailed application method. |
- Moderation tasks are identified by roomId uniquely. If the same roomId has started moderation tasks for multiple times, the system will return an error.
- In this case, suspend existing moderation tasks and then update the task moderation configuration.
Data in a respond message body is JSON, and the specific fields are described as below:
Name | Type | Required | Description |
---|---|---|---|
code | Integer | Yes | Error code in request |
message | String | Yes | Description on error message |
traceId | String | Yes | traceId content in the pass-through parameter |
roomId | String | Yes | Room ID, unique identifier for a moderation task |
context | JSON | No | Context in the corresponding request |
timestamp | Integer | Yes | Current unix timestamp in seconds |
- When starting the task, resultCallback and statusCallback can be null. In this case, you can use the search API to get task status and result.
- If you need to use the callback method to get result and task status, make sure the HTTP callback service is stable;
- When the access to callback address fails or the returned status code is not 200, Jocloud background prompts Try Again for no More Than 5 Times. .
Use HTTPS POST method to access the URL provided by the user, and the status and result are filled in the HTTP request body in a JSON string format. See the next section for specific formats.
Add one checksum item in header of HTTP request to validate whether the contents are legal, preventing the contents from tampering.
A checksum string is generated based on the following steps
Generate a checksum value based on sequence + body string data in task starting parameters by using SHA256 algorithm.
Name | Data Type | Required | Description |
---|---|---|---|
roomId | String | Yes | Room ID, unique identifier for a moderation task |
context | JSON | No | Context parameter during the pass-through of the task initiating request |
timestamp | Integer | Yes | Current unix timestamp of server in seconds |
uid | String | Yes | User ID |
results[] | JSON array | No | Returning result data. Each element indicates a processing result of one action. For the specific structure, see Table result as below |
Table result
Name | Type | Required | Description |
---|---|---|---|
code | Integer | Yes | Error code in data and action |
message | String | Yes | Error message description |
action | String | Yes | Detection type, corresponding to a detection type (actions) in the call request |
label | String | Yes | Detection result label with a value related to action. For specific values, see moderation types above and corresponding label specification table. |
rate | Floating-point number | Yes | Probability of detection result label, with the value range: [0.00 - 1.00]. The greater the value, the higher the credibility. |
suggestion | String | Yes | Operation suggested to perform, with the value range: - pass: normal, no need of operating; - block: illegal, suggested to punish illegal contents; - review: suspected, an uncertain detection result, and needing further manual moderation; |
extraData[] | JSON array | No | When the actions are terrorism or antispam or illegal, this field does not exist The array element of sensitive figure recognition (sface) is detected face information, see Table sface-extraData for details. The array element of porn recognition (porn) is detected face information, see Table porn-extraData for details. |
(1)When action is 'sface', the element struct in result->extraData array as follow
Table sface-extraData
Name | Type | Required | Description |
---|---|---|---|
label | String | Yes | Detected face label |
rate | Floating-point number | Yes | Probability of detection result label, with the value range: [0.00 - 1.00]. The greater the value, the higher the credibility |
name | String | Yes | Detected names of sensitive figures |
x | Integer | Yes | X-coordinate of detected top left of face in the picture |
y | Integer | Yes | Y-coordinate of detected top left of face in the picture |
w | Integer | Yes | Detected face width |
h | Integer | Yes | Detected face height |
(2)When action is 'porn', the element struct in result->extraData array as follow
Table porn-extraData
Name | Type | Required | Description |
---|---|---|---|
label | String | Yes | Detected secondary label |
rate | Floating-point number | Yes | Probability of detection result label, with the value range: [0.00 - 1.00]. The greater the value, the higher the credibility |
Name | Type | Required | Description |
---|---|---|---|
code | Integer | Yes | 432: stop for stream timeout |
message | String | Yes | Description on error message |
traceId | String | Yes | traceId content in the pass-through parameter |
roomId | String | Yes | Room ID, unique identifier for a moderation task |
context | JSON | No | Context in the corresponding request |
timestamp | Integer | Yes | Current unix timestamp in seconds |
Item | Description |
---|---|
Request Method | POST |
Request Protocol | HTTPS |
Request Domain Name | ai.jocloud.com |
Request Path | app/{appId}/v1/video/stream/results?traceId=xxxxx&roomId=xxxxxx |
Request Parameter | traceId is a uuid string, and used for fault locating during troubleshooting. You should use different values for requests roomId is the room ID corresponding to the moderation task to be searched. |
Request Header | Content-Type: application/json;charset=UTF-8 token: Authentication token, generated on the basis of Identity Authentication |
Name | Type | Required | Description |
---|---|---|---|
code | Integer | Yes | Error code in request |
message | String | Yes | Description on error message |
traceId | String | Yes | traceId content in the pass-through parameter |
roomId | String | Yes | Room ID, unique identifier for a moderation task |
context | String | No | User context, context in the corresponding task starting parameter |
status | String | Yes | Task statuses (running - being running, stopped - stopped normally, error - error occurred) |
errCode | Integer | Yes | Task status code |
errMessage | String | Yes | Description information |
timestamp | Integer | Yes | Current unix timestamp in seconds |
results[] | results array | No | Save multiple recent result data. When the call succeeds (code==200), each element in the array is a structure in Table 2 results. |
Table. results
Name | Type | Required | Description |
---|---|---|---|
uid | String | Yes | User ID |
timestamp | Integer | Yes | Time of getting the recognition result (unix timestamp in seconds) |
result[] | result array | No | Save multiple recent result data of action recognition. Each element in the array is a structure in Table. result. |
Item | Description |
---|---|
Request Method | POST |
Request Protocol | HTTPS |
Request Domain Name | ai.jocloud.com |
Request Path | app/{appId}/v1/video/stream/stop?traceId=xxxxx&roomId=yyyy |
Request Parameter | traceId is a uuid string, and used for fault locating during troubleshooting. You should use different values for requests. roomId is the room ID corresponding to the moderation task to be stopped. |
Request Header | Content-Type: application/json;charset=UTF-8 token: Authentication token, generated on the basis of Identity Authentication |
Data in return body is JSON, and the specific field is described as below:
Name | Type | Required | Description |
---|---|---|---|
code | Integer | Yes | Error code in request |
message | String | Yes | Description on error message |
traceId | String | Yes | traceId content in the pass-through parameter |
roomId | String | Yes | Room ID, unique identifier for a moderation task |
context | JSON | No | Context in the corresponding request |
timestamp | Integer | Yes | Current unix timestamp of server in seconds |
Query all running tasks
Item | Description |
---|---|
Request Method | GET |
Request Protocol | HTTPS |
Request Domain Name | ai.jocloud.com |
Request Path | app/{appId}/v1/video/stream/tasks?traceId=xxxxx |
Request Parameter | traceId is a uuid string, and used for fault locating during troubleshooting. You should use different values for requests. |
Request Header | Content-Type: application/json;charset=UTF-8 token: Authentication token, generated on the basis of Identity Authentication |
Data in return body is JSON, and the specific field is described as below:
Name | Type | Required | Description |
---|---|---|---|
code | Integer | Yes | Error code in request |
message | String | Yes | Description on error message |
traceId | String | Yes | traceId content in the pass-through parameter |
timestamp | Integer | Yes | Current unix timestamp of server in seconds |
tasks[] | JSON array | Yes | task lisk info, as follow |
Table. task
Name | Type | Required | Description |
---|---|---|---|
roomId | String | Yes | roomId use in start task |
uids | String array | Yes | uids use in start task |
timestamp | Integer | Yes | Current unix timestamp of server in seconds |
context | JSON | No | Context in the corresponding request |
The following demonstrates the sample codes of python.
# -*- coding: utf-8 -*-
#! python3.5
import requests
import uuid
import base64
host = "https://ai.jocloud.com"
appid = 1234567890 # Your service ID
restful_id = '**********' # Your certificate ID
restful_secret = '**********' # Your certificate key
traceid = str(uuid.uuid4())
dataid = str(uuid.uuid4())
# url
url = host + '/app/%s/v1/video/live/start?traceId=%s' % (appid, traceid)
# headers
headers = {
"content-type": "application/json"
}
auth = base64.b64encode(("%s:%s" % (restful_id, restful_secret)).encode('utf-8'))
headers['token'] = 'Base ' + auth.decode()
# Live streaming URL to be recognized
streamurl = 'rtmp://mytest.com/live/123456789'
# Context information to be used by the service side. It facilitates follow-up processing of the callback message, for example:
context = {
'myid': 123,
'myname': 'test'
}
# Recognition result and status callback address. The recognition result and status notification will be called back through http POST
resultCb = 'http://192.168.1.100:12345/result'
statusCb = 'http://192.168.1.100:12345/status'
# content
values = {
'actions': ['v-porn'],
'url': streamurl,
'streamId': "demo-test",
'resultCb': resultCb,
'statusCb': statusCb,
'sequence': 'test',
'context': context
}
# request
res = requests.post(url, json=values, headers=headers)
print ('code=%s, data=%s\n' % (res.status_code, res.text))
The returned call results are as below:
{
"code": 200,
"message": "OK",
"traceId": "f35a8abb-db6c-48f2-af7e-f6c0921b7b0d",
"taskId": "acee5522-b198-4325-9434-61b41eb2e08a",
"timestamp": 1576567090,
"streamId": "demo-test",
"context": {
"myid": 123,
"myname": "test"
}
}
# -*- coding: utf-8 -*-
#! python3.5
import requests
import uuid
import base64
host = "https://ai.jocloud.com"
appid = 1234567890 # Your service ID
restful_id = '**********' # Your certificate ID
restful_secret = '**********' # Your certificate key
task_id = "acee5522-b198-4325-9434-61b41eb2e08a" # Fill in the taskId content returned when the task starts.
traceid = str(uuid.uuid4())
dataid = str(uuid.uuid4())
# url
url = host + '/app/%s/v1/video/live/results?traceId=%s&taskId=%s' % (appid, traceid, task_id)
# headers
headers = {
"content-type": "application/json"
}
auth = base64.b64encode(("%s:%s" % (restful_id, restful_secret)).encode('utf-8'))
headers['token'] = 'Base ' + auth.decode()
# request
res = requests.get(url, headers=headers)
print ('url=%s\ncode=%s\ndata=%s\n' % (url, res.status_code, res.text))
The returned call results as below:
{
"code": 200,
"message": "OK",
"traceId": "fe0a8278-0ed6-4c74-80ab-fb1066605227",
"taskId": "acee5522-b198-4325-9434-61b41eb2e08a",
"timestamp": 1576567239,
"streamId": "demo-test",
"context": {
"myid": 123,
"myname": "test"
},
"results": [
{
"result": [
{
"action": "v-porn",
"label": "normal",
"rate": 0.99952548742294312,
"suggestion": "pass",
"timestamp": 1576567232,
"url": "http://jocloud-ai-openapi.oss-cn-hangzhou.aliyuncs.com/live/10034/cccc2dcc-5472-4fbf-ae1b-5a906ea46c46.jpg"
}
],
"timestamp": 1576567233
},
{
"result": [
{
"action": "v-porn",
"label": "normal",
"rate": 0.99910759925842285,
"suggestion": "pass",
"timestamp": 1576567227,
"url": "http://jocloud-ai-openapi.oss-cn-hangzhou.aliyuncs.com/live/10034/f5540914-c5d4-41b6-8080-42a218f16a34.jpg"
}
],
"timestamp": 1576567228
},
{
"result": [
{
"action": "v-porn",
"label": "normal",
"rate": 0.9999052882194519,
"suggestion": "pass",
"timestamp": 1576567222,
"url": "http://jocloud-ai-openapi.oss-cn-hangzhou.aliyuncs.com/live/10034/50bf73a6-2555-48c2-8f33-13d2002f7e76.jpg"
}
],
"timestamp": 1576567223
},
{
"result": [
{
"action": "v-porn",
"label": "normal",
"rate": 0.99971604347229004,
"suggestion": "pass",
"timestamp": 1576567217,
"url": "http://jocloud-ai-openapi.oss-cn-hangzhou.aliyuncs.com/live/10034/4696a8a5-78f8-4c32-b696-aebbf79685bc.jpg"
}
],
"timestamp": 1576567218
},
{
"result": [
{
"action": "v-porn",
"label": "normal",
"rate": 0.99987661838531494,
"suggestion": "pass",
"timestamp": 1576567212,
"url": "http://jocloud-ai-openapi.oss-cn-hangzhou.aliyuncs.com/live/10034/6002efb8-e6d4-4527-afd8-1fd4a951d655.jpg"
}
],
"timestamp": 1576567213
}
],
"status": "running"
}
# -*- coding: utf-8 -*-
#! python3.5
import requests
import uuid
import base64
host = "https://ai.jocloud.com"
appid = 1234567890 # Your service ID
restful_id = '**********' # Your certificate ID
restful_secret = '**********' # Your certificate key
traceid = str(uuid.uuid4())
dataid = str(uuid.uuid4())
# headers
headers = {
"content-type": "application/json"
}
auth = base64.b64encode(("%s:%s" % (restful_id, restful_secret)).encode('utf-8'))
headers['token'] = 'Base ' + auth.decode()
traceid = str(uuid.uuid4())
task_id = 'acee5522-b198-4325-9434-61b41eb2e08a' # Fill in the taskId content returned when the task starts
# url
url = host + '/app/%s/v1/video/live/stop?traceId=%s&taskId=%s' % (appid, traceid, task_id)
# request
res = requests.post(url, json={}, headers=headers)
print ('url=%s\ncode=%s\ndata=%s\n' % (url, res.status_code, res.text))
The returned call results are as below:
{
"code": 200,
"message": "OK",
"traceId": "9eb28f1d-a307-4e93-bcf4-66e531aa12f1",
"taskId": "acee5522-b198-4325-9434-61b41eb2e08a",
"timestamp": 1576567306
}
Version | Date | Description |
---|---|---|
v2.2.3 | 2020-10-15 | Add new label in OCR recognition |
v2.2.2 | 2020-10-13 | Add 'inbed' label in Illegal recognition |
v2.2.1 | 2020-09-05 | Add 'resultCallbackLevel' parameter, support to control the result callback level |
v2.2.0 | 2020-08-31 | Add ad and ocr recognition; Update labels of 'terrorism' and 'antispam' recognition |
v2.1.0 | 2020-08-24 | Add illegal recognition |
v2.0.0 | 2020-08-17 | Add secondary labels in the porn recognition |
v1.1.0 | 2020-06-30 | Remove 'interval' param in request, Set to 2s to intercept one frame |
v1.0.0 | 2020-05-09 | Initial version |