tencent cloud

Feedback

Querying Image Moderation Job Result

Last updated: 2023-05-05 17:38:18

    Feature Overview

    This API is used to query the result of the specified image moderation job.

    Note:

    Image moderation results are retained for one month, so you can query moderation results in the past month through this API.

    SDK Recommendation

    CI SDK provides complete capabilities of demo, automatic integration, and signature calculation. You can easily and quickly call APIs through the SDK. For more information, see SDK Overview.

    Request

    Sample request

    GET /image/auditing/<jobId> HTTP/1.1
    Host: <BucketName-APPID>.ci.<Region>.myqcloud.com
    Date: <GMT Date>
    Authorization: <Auth String>
    
    Note:

    Request headers

    This API only uses Common Request Headers.

    Request body

    This request does not have a request body.

    Response

    Response headers

    This API only returns Common Response Headers.

    Response body

    The response body returns application/xml data. The following contains all the nodes:

    <Response>
      <JobsDetail>
        <JobId></JobId>
        <State></State>
        <CreationTime></CreationTime>
        <Object></Object>
        <Label></Label>
        <Result>1</Result>
        <PornInfo>
            <HitFlag>1</HitFlag>
            <Label>xxx</Label>
            <SubLabel>SexBehavior</SubLabel>
            <Score>100</Score>
            <OcrResults>
                <Text></Text>
                <Keywords></Keywords>
                <Location>
                    <X></X>
                    <Y></Y>
                    <Width></Width>
                    <Height></Height>
                    <Rotate></Rotate>
                </Location>
            </OcrResults>
        </PornInfo>
        <AdsInfo>
            <HitFlag>1</HitFlag>
            <Label>xxx</Label>
            <SubLabel>SexBehavior</SubLabel>
            <Score>100</Score>
            <OcrResults>
                <Text></Text>
                <Keywords></Keywords>
                <Location>
                    <X></X>
                    <Y></Y>
                    <Width></Width>
                    <Height></Height>
                    <Rotate></Rotate>
                </Location>
            </OcrResults>
        </AdsInfo>
      </JobsDetail>
      <RequestId></RequestId>
    </Response>
    

    The nodes are as described below:

    Parameter Type Description
    Response Container Moderation job result.

    Response has the following sub-nodes:

    Parameter Type Description
    JobsDetail Container Job details.
    RequestId String ID automatically generated by the server for a request when the request is sent, which can be used to facilitate fault locating.

    JobsDetail has the following sub-nodes:

    Parameter Type Description
    Code String Error code, which will be returned only if State is Failed. For more information, see Error Codes.
    Message String Error message, which will be returned only if State is Failed.
    DataId String This field will return the original content if the DataId parameter is configured during job submission, which can contain up to 512 bytes. You can use this field to uniquely identify the data to be moderated in your business.
    JobId String Moderation job ID.
    State String Status of the moderation job. Valid values: Submitted, Success, Failed, Auditing.
    CreationTime String Creation time of the moderation job.
    Object String The name of the file to be moderated, which will be returned if Object is selected during job creation.
    Url String The URL of the file to be moderated, which will be returned if Url is selected during job creation.
    CompressionResult Integer Whether the image is compressed. Valid values: 0 (no), 1 (yes).
    Text String The specific text content recognized by OCR in the image, which will be returned if text content detection is enabled in the moderation policy.
    Label String This field is used to return the maliciousness label with the highest priority in the detection result, which represents the moderation result suggested by the model. We recommend you handle different types of violations and suggestions based on your business needs. Return values: Normal, Porn, Ads.
    Result Integer This field indicates the moderation result. You can perform subsequent operations based on the result. We recommend you handle different results based on your business needs. Valid values: 0 (normal), 1 (sensitive), 2 (suspiciously sensitive, with human review recommended).
    Category String Moderation category hit by the image.
    SubLabel String Second-level label hit by the image.
    PornInfo Container The moderation result of the pornographic information moderation scene.
    AdsInfo Container The moderation result of the advertising information moderation scene.
    UserInfo Container Business field. This field will not exist if UserInfo is not set during job creation.
    ListInfo Blocklist/Allowlist status of the account. Container
    ForbidState Integer If you set automatic freezing during request, this field indicates the status of the image. 0: not frozen; 1: frozen, 2: file moved.

    PornInfo and AdsInfo have the following sub-nodes:

    Parameter Type Description
    HitFlag Integer The moderation result returned for the moderation scene. Return values: 0 (normal); 1 (confirmed as a violation of the current scene); 2 (suspected as a violation of the current scene).
    Score Integer The confidence the moderation result hits the moderation scene. Value range: 0–100. The higher the value, the more likely the content hits the currently returned moderation scene. A value in the range of 0–60, 61–90, or 91–100 means the image is normal, suspiciously sensitive, or sensitive respectively. For example, Porn 99 means that the content is very likely to be pornographic.
    Label String This field indicates the overall result label of the screenshot, which may be SubLabel, a person name, etc.
    Category String This field indicates the specific moderation category hit; for example, Sexy represents the sexy category in the Porn label. It may be null, indicating that no category is hit or there is no relevant category.
    SubLabel String This field indicates the specific sub-label hit by the moderation job; for example, SexBehavior is a sub-label under the Porn label.
    Note: This field may return null, indicating that no specific sub-labels are hit.
    OcrResults Container Array This field represents the detailed OCR result, including the text recognition result and hit keyword. It will be returned if there is non-compliant content.
    LibResults Container Array This field returns results based on recognition against the risk library.
    Note: This field will not be returned if no samples in the risk library are hit.

    LibResults has the following sub-nodes:

    Parameter Type Description
    ImageId String This field represents the hit image sample ID in the risk library.
    Score Integer This field returns the confidence under the current label. Value range: 0–100. The higher the value, the more likely the image hits a sample in the risk library. For example, Porn 99 means that the content is very likely to hit a pornographic sample in the library.

    OcrResults has the following sub-nodes:

    Parameter Type Description
    Text String The specific text content recognized by OCR in the image.
    Keywords String Array Keywords hit by the current moderation scene.
    Location Container This parameter is used to return the position (X and Y coordinates of the top-left corner, length, width, and rotation angle) of the OCR detection frame in the image for quick location of the recognized text.

    Location has the following sub-nodes:

    Name Type Description
    X Float This parameter is used to return the pixel position of the abscissa (X) of the top-left corner of the detection frame. It can be combined with other parameters to uniquely determine the size and position of the detection frame.
    Y Float This parameter is used to return the pixel position of the ordinate of the top-left corner (Y) of the detection frame. It can be combined with other parameters to uniquely determine the size and position of the detection frame.
    Width Float This parameter is used to return the width of the detection frame (the length starting from the top-left corner and extending to the right on the X axis). It can be combined with other parameters to uniquely determine the size and position of the detection frame.
    Height Float This parameter is used to return the height of the detection frame (the length starting from the top-left corner and extending down the Y axis). It can be combined with other parameters to uniquely determine the size and position of the detection frame.
    Rotate Float This parameter is used to return the rotation angle of the detection frame. Valid values: 0–360 (degrees), and the direction is counterclockwise rotation. This parameter can be combined with the X and Y coordinate parameters to uniquely determine the specific position of the detection frame.

    ObjectResults has the following sub-nodes:

    Name Type Description
    Name String This field is used to return the name of the recognized object, such as person name.
    Location Container This parameter is used to return the position (X and Y coordinates of the top-left corner, length, width, and rotation angle) of the recognition result in the image for you to quickly locate information.

    UserInfo has the following sub-nodes:

    Node Name (Keyword) Description Type Required
    TokenId Account information, which can contain up to 128 bytes. String No
    Nickname Nickname information, which can contain up to 128 bytes. String No
    DeviceId Device information, which can contain up to 128 bytes. String No
    AppId Unique app ID, which can contain up to 128 bytes. String No
    Room Room ID information, which can contain up to 128 bytes. String No
    IP IP address information, which can contain up to 128 bytes. String No
    Type Business type, which can contain up to 128 bytes. String No
    ReceiveTokenId User account to receive messages, which can contain up to 128 bytes. String No
    Gender Gender information, which can contain up to 128 bytes. String No
    Level Level information, which can contain up to 128 bytes. String No
    Role Role information, which can contain up to 128 bytes. String No

    ListInfo has the following sub-nodes:

    Node Name (Keyword) Type Description
    ListResults Container Array Results in all hit lists.

    ListResults has the following sub-nodes:

    Node Name (Keyword) Description Type
    ListType Integer Type of the hit list. Valid values: 0 (allowlist), 1 (blocklist).
    ListName String Name of the hit list.
    Entity String Entity hit in the list.

    Use Cases

    Request

    GET /image/auditing/iab1ca9fc8a3ed11ea834c525400863904 HTTP/1.1
    Accept: */*
    Authorization:q-sign-algorithm=sha1&q-ak=AKIDZfbOAo7cllgPvF9cXFrJD0**********&q-sign-time=1497530202;1497610202&q-key-time=1497530202;1497610202&q-header-list=&q-url-param-list=&q-signature=28e9a4986df11bed0255e97ff90500557e0ea057
    Host:bucket-1250000000.ci.ap-beijing.myqcloud.com
    

    Response

    HTTP/1.1 200 OK
    Content-Type: application/xml
    Content-Length: 666
    Connection: keep-alive
    Date: Thu, 15 Jun 2017 12:37:29 GMT
    Server: tencent-ci
    x-ci-request-id: NTk0MjdmODlfMjQ4OGY3XzYzYzhfMjc=
    
    <Response>
        <JobsDetail>
            <JobId>iab1ca9fc8a3ed11ea834c525400863904</JobId>
            <State>Success</State>
            <CreationTime>2021-05-21T10:44:32+08:00</CreationTime>
            <Object>example.jpg</Object>
            <Label>Ads</Label>
            <Result>1</Result>
            <AdsInfo>
                <HitFlag>1</HitFlag>
                <Label>xxx</Label>
                <SubLabel>SexBehavior</SubLabel>
                <Score>100</Score>
                <OcrResults>
                    <Text></Text>
                    <Keywords></Keywords>
                    <Location>
                        <X></X>
                        <Y></Y>
                        <Width></Width>
                        <Height></Height>
                        <Rotate></Rotate>
                    </Location>
                </OcrResults>
            </AdsInfo>
        </JobsDetail>
        <RequestId></RequestId>
    </Response>
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support