Documentation ¶
Index ¶
- Constants
- type Client
- type Device
- type ImageModerationRequest
- type ImageModerationRequestParams
- type ImageModerationResponse
- type ImageModerationResponseParams
- type LabelDetailItem
- type LabelResult
- type LibDetail
- type LibResult
- type Location
- type ObjectDetail
- type ObjectResult
- type OcrResult
- type OcrTextDetail
- type RecognitionResult
- type RecognitionTag
- type User
Constants ¶
const ( // `DryRun` Operation. It means that the request would have succeeded, but the `DryRun` parameter was used. DRYRUNOPERATION = "DryRunOperation" // The operation failed. FAILEDOPERATION = "FailedOperation" // An internal error occurred. INTERNALERROR = "InternalError" // An internal error occurred. INTERNALERROR_INTERNALERROR = "InternalError.InternalError" // The parameter is incorrect. INVALIDPARAMETER = "InvalidParameter" // INVALIDPARAMETER_IMAGEASPECTRATIOTOOLARGE = "InvalidParameter.ImageAspectRatioTooLarge" // INVALIDPARAMETER_IMAGEDATATOOSMALL = "InvalidParameter.ImageDataTooSmall" // The image resolution is too low. INVALIDPARAMETER_IMAGESIZETOOSMALL = "InvalidParameter.ImageSizeTooSmall" // The image content is incorrect. INVALIDPARAMETER_INVALIDIMAGECONTENT = "InvalidParameter.InvalidImageContent" // The parameter is invalid. INVALIDPARAMETER_INVALIDPARAMETER = "InvalidParameter.InvalidParameter" // The parameter value is incorrect. INVALIDPARAMETERVALUE = "InvalidParameterValue" // The image content parameter is empty. INVALIDPARAMETERVALUE_EMPTYIMAGECONTENT = "InvalidParameterValue.EmptyImageContent" // The image resolution is too low. INVALIDPARAMETERVALUE_IMAGESIZETOOSMALL = "InvalidParameterValue.ImageSizeTooSmall" // `FileContent` and `FileUrl` are empty. INVALIDPARAMETERVALUE_INVALIDCONTENT = "InvalidParameterValue.InvalidContent" // The `DataId` format is incorrect. INVALIDPARAMETERVALUE_INVALIDDATAID = "InvalidParameterValue.InvalidDataId" // The image file content size is exceptional. INVALIDPARAMETERVALUE_INVALIDFILECONTENTSIZE = "InvalidParameterValue.InvalidFileContentSize" // The image content is incorrect. INVALIDPARAMETERVALUE_INVALIDIMAGECONTENT = "InvalidParameterValue.InvalidImageContent" // The parameter value is incorrect. INVALIDPARAMETERVALUE_INVALIDPARAMETER = "InvalidParameterValue.InvalidParameter" // The quota limit is exceeded. LIMITEXCEEDED = "LimitExceeded" // The parameter is missing. MISSINGPARAMETER = "MissingParameter" // The operation was denied. OPERATIONDENIED = "OperationDenied" // The number of requests exceeds the frequency limit. REQUESTLIMITEXCEEDED = "RequestLimitExceeded" // The resource is in use. RESOURCEINUSE = "ResourceInUse" // The resource is insufficient. RESOURCEINSUFFICIENT = "ResourceInsufficient" // The resource does not exist. RESOURCENOTFOUND = "ResourceNotFound" // The resource is unavailable. RESOURCEUNAVAILABLE = "ResourceUnavailable" // Image file download failed. RESOURCEUNAVAILABLE_IMAGEDOWNLOADERROR = "ResourceUnavailable.ImageDownloadError" // The image resource is incorrect. RESOURCEUNAVAILABLE_INVALIDIMAGECONTENT = "ResourceUnavailable.InvalidImageContent" // RESOURCEUNAVAILABLE_MODELCALLFAILED = "ResourceUnavailable.ModelCallFailed" // The resources have been sold out. RESOURCESSOLDOUT = "ResourcesSoldOut" // The operation is unauthorized. UNAUTHORIZEDOPERATION = "UnauthorizedOperation" // Operation not authorized/No valid package/The account is overdue UNAUTHORIZEDOPERATION_UNAUTHORIZED = "UnauthorizedOperation.Unauthorized" // The parameter is unknown. UNKNOWNPARAMETER = "UnknownParameter" // The operation is not supported. UNSUPPORTEDOPERATION = "UnsupportedOperation" )
const APIVersion = "2020-12-29"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
func NewClient ¶
func NewClient(credential common.CredentialIface, region string, clientProfile *profile.ClientProfile) (client *Client, err error)
func NewClientWithSecretId ¶
Deprecated
func (*Client) ImageModeration ¶
func (c *Client) ImageModeration(request *ImageModerationRequest) (response *ImageModerationResponse, err error)
ImageModeration This API is used to submit an image for smart moderation. Before using it, you need to log in to the console with the Tencent Cloud root account [to activate IMS](https://console.cloud.tencent.com/cms/image/package) and adjust the business configuration.
### API use instructions
- Go to the "[CMS console - IMS](https://console.cloud.tencent.com/cms/image/package)" to activate IMS.
- This API is a paid API. For its billing mode, see [IMS Pricing](https://intl.cloud.tencent.com/product/ims/pricing?from_cn_redirect=1).
### API feature description
- It can detect images or links and recognize content that may be offensive, unsafe, or inappropriate based on the deep learning technology;
- It can capture frames from or split GIF/long images for detection;
- It can recognize various non-compliant scenarios, including vulgarity, law or regulation violations, pornography, and advertising;
- It can detect multiple types of objects (such as object, advertising logo, and QR code) and recognize text in images based on OCR;
- It allows you to customize moderation policies based on different business scenarios;
- You can select image risk libraries to filter non-compliant images of custom types (currently, only blocklist configuration is supported);
- You can associate account or device information when moderating an image to recognize the account or device involved.
### API call description
- Supported image file size: **< 5 MB**
- Supported image file resolution: **a resolution of 256x256 or higher** is recommended; otherwise, the recognition effect may be affected.
- Supported image file formats: PNG, JPG, JPEG, BMP, GIF, and WEBP.
- Supported image URL transfer protocols: HTTP and HTTPS.
- If you pass in the access URL of an image, you need to **limit the image download time to 3 seconds**. To ensure the stability and reliability of the image to be detected, we recommend you use Tencent Cloud COS for storage or CDN for caching.
- Default API request rate limit: **100 requests/sec**. If this limit is exceeded, an error will be reported.
<div class="rno-api-explorer" style="margin-bottom:20px">
<div class="rno-api-explorer-inner"> <div class="rno-api-explorer-hd"> <div class="rno-api-explorer-title"> Version iteration description </div> </div> <div class="rno-api-explorer-body"> <div class="rno-api-explorer-cont"> <p>The version described on this page is 2020. The IMS APIs connected to before November 3, 2020 are on v2019, and you can directly access the following URL to perform maintenance operations: <a href="https://intl.cloud.tencent.com/document/product/1125/38206?from_cn_redirect=1" target="_blank">IMS APIs v2019</a></p> <p>v2020 is an upgrade to v2019 to support more flexible multi-scenario business policy configuration and richer recognition callback information, meeting the recognition requirements of different businesses. We recommend you upgrade the APIs according to the v2020 connection guide. Meanwhile, we will continue to maintain v2019 until users no longer use it.</p> </div> </div> </div>
</div>
error code that may be returned:
DRYRUNOPERATION = "DryRunOperation" FAILEDOPERATION = "FailedOperation" INTERNALERROR = "InternalError" INTERNALERROR_INTERNALERROR = "InternalError.InternalError" INVALIDPARAMETER = "InvalidParameter" INVALIDPARAMETER_IMAGEASPECTRATIOTOOLARGE = "InvalidParameter.ImageAspectRatioTooLarge" INVALIDPARAMETER_IMAGEDATATOOSMALL = "InvalidParameter.ImageDataTooSmall" INVALIDPARAMETER_IMAGESIZETOOSMALL = "InvalidParameter.ImageSizeTooSmall" INVALIDPARAMETER_INVALIDIMAGECONTENT = "InvalidParameter.InvalidImageContent" INVALIDPARAMETER_INVALIDPARAMETER = "InvalidParameter.InvalidParameter" INVALIDPARAMETERVALUE = "InvalidParameterValue" INVALIDPARAMETERVALUE_EMPTYIMAGECONTENT = "InvalidParameterValue.EmptyImageContent" INVALIDPARAMETERVALUE_IMAGESIZETOOSMALL = "InvalidParameterValue.ImageSizeTooSmall" INVALIDPARAMETERVALUE_INVALIDCONTENT = "InvalidParameterValue.InvalidContent" INVALIDPARAMETERVALUE_INVALIDDATAID = "InvalidParameterValue.InvalidDataId" INVALIDPARAMETERVALUE_INVALIDFILECONTENTSIZE = "InvalidParameterValue.InvalidFileContentSize" INVALIDPARAMETERVALUE_INVALIDIMAGECONTENT = "InvalidParameterValue.InvalidImageContent" INVALIDPARAMETERVALUE_INVALIDPARAMETER = "InvalidParameterValue.InvalidParameter" LIMITEXCEEDED = "LimitExceeded" MISSINGPARAMETER = "MissingParameter" OPERATIONDENIED = "OperationDenied" REQUESTLIMITEXCEEDED = "RequestLimitExceeded" RESOURCEINUSE = "ResourceInUse" RESOURCEINSUFFICIENT = "ResourceInsufficient" RESOURCENOTFOUND = "ResourceNotFound" RESOURCEUNAVAILABLE = "ResourceUnavailable" RESOURCEUNAVAILABLE_IMAGEDOWNLOADERROR = "ResourceUnavailable.ImageDownloadError" RESOURCEUNAVAILABLE_INVALIDIMAGECONTENT = "ResourceUnavailable.InvalidImageContent" RESOURCEUNAVAILABLE_MODELCALLFAILED = "ResourceUnavailable.ModelCallFailed" RESOURCESSOLDOUT = "ResourcesSoldOut" UNAUTHORIZEDOPERATION = "UnauthorizedOperation" UNAUTHORIZEDOPERATION_UNAUTHORIZED = "UnauthorizedOperation.Unauthorized" UNKNOWNPARAMETER = "UnknownParameter" UNSUPPORTEDOPERATION = "UnsupportedOperation"
func (*Client) ImageModerationWithContext ¶
func (c *Client) ImageModerationWithContext(ctx context.Context, request *ImageModerationRequest) (response *ImageModerationResponse, err error)
ImageModeration This API is used to submit an image for smart moderation. Before using it, you need to log in to the console with the Tencent Cloud root account [to activate IMS](https://console.cloud.tencent.com/cms/image/package) and adjust the business configuration.
### API use instructions
- Go to the "[CMS console - IMS](https://console.cloud.tencent.com/cms/image/package)" to activate IMS.
- This API is a paid API. For its billing mode, see [IMS Pricing](https://intl.cloud.tencent.com/product/ims/pricing?from_cn_redirect=1).
### API feature description
- It can detect images or links and recognize content that may be offensive, unsafe, or inappropriate based on the deep learning technology;
- It can capture frames from or split GIF/long images for detection;
- It can recognize various non-compliant scenarios, including vulgarity, law or regulation violations, pornography, and advertising;
- It can detect multiple types of objects (such as object, advertising logo, and QR code) and recognize text in images based on OCR;
- It allows you to customize moderation policies based on different business scenarios;
- You can select image risk libraries to filter non-compliant images of custom types (currently, only blocklist configuration is supported);
- You can associate account or device information when moderating an image to recognize the account or device involved.
### API call description
- Supported image file size: **< 5 MB**
- Supported image file resolution: **a resolution of 256x256 or higher** is recommended; otherwise, the recognition effect may be affected.
- Supported image file formats: PNG, JPG, JPEG, BMP, GIF, and WEBP.
- Supported image URL transfer protocols: HTTP and HTTPS.
- If you pass in the access URL of an image, you need to **limit the image download time to 3 seconds**. To ensure the stability and reliability of the image to be detected, we recommend you use Tencent Cloud COS for storage or CDN for caching.
- Default API request rate limit: **100 requests/sec**. If this limit is exceeded, an error will be reported.
<div class="rno-api-explorer" style="margin-bottom:20px">
<div class="rno-api-explorer-inner"> <div class="rno-api-explorer-hd"> <div class="rno-api-explorer-title"> Version iteration description </div> </div> <div class="rno-api-explorer-body"> <div class="rno-api-explorer-cont"> <p>The version described on this page is 2020. The IMS APIs connected to before November 3, 2020 are on v2019, and you can directly access the following URL to perform maintenance operations: <a href="https://intl.cloud.tencent.com/document/product/1125/38206?from_cn_redirect=1" target="_blank">IMS APIs v2019</a></p> <p>v2020 is an upgrade to v2019 to support more flexible multi-scenario business policy configuration and richer recognition callback information, meeting the recognition requirements of different businesses. We recommend you upgrade the APIs according to the v2020 connection guide. Meanwhile, we will continue to maintain v2019 until users no longer use it.</p> </div> </div> </div>
</div>
error code that may be returned:
DRYRUNOPERATION = "DryRunOperation" FAILEDOPERATION = "FailedOperation" INTERNALERROR = "InternalError" INTERNALERROR_INTERNALERROR = "InternalError.InternalError" INVALIDPARAMETER = "InvalidParameter" INVALIDPARAMETER_IMAGEASPECTRATIOTOOLARGE = "InvalidParameter.ImageAspectRatioTooLarge" INVALIDPARAMETER_IMAGEDATATOOSMALL = "InvalidParameter.ImageDataTooSmall" INVALIDPARAMETER_IMAGESIZETOOSMALL = "InvalidParameter.ImageSizeTooSmall" INVALIDPARAMETER_INVALIDIMAGECONTENT = "InvalidParameter.InvalidImageContent" INVALIDPARAMETER_INVALIDPARAMETER = "InvalidParameter.InvalidParameter" INVALIDPARAMETERVALUE = "InvalidParameterValue" INVALIDPARAMETERVALUE_EMPTYIMAGECONTENT = "InvalidParameterValue.EmptyImageContent" INVALIDPARAMETERVALUE_IMAGESIZETOOSMALL = "InvalidParameterValue.ImageSizeTooSmall" INVALIDPARAMETERVALUE_INVALIDCONTENT = "InvalidParameterValue.InvalidContent" INVALIDPARAMETERVALUE_INVALIDDATAID = "InvalidParameterValue.InvalidDataId" INVALIDPARAMETERVALUE_INVALIDFILECONTENTSIZE = "InvalidParameterValue.InvalidFileContentSize" INVALIDPARAMETERVALUE_INVALIDIMAGECONTENT = "InvalidParameterValue.InvalidImageContent" INVALIDPARAMETERVALUE_INVALIDPARAMETER = "InvalidParameterValue.InvalidParameter" LIMITEXCEEDED = "LimitExceeded" MISSINGPARAMETER = "MissingParameter" OPERATIONDENIED = "OperationDenied" REQUESTLIMITEXCEEDED = "RequestLimitExceeded" RESOURCEINUSE = "ResourceInUse" RESOURCEINSUFFICIENT = "ResourceInsufficient" RESOURCENOTFOUND = "ResourceNotFound" RESOURCEUNAVAILABLE = "ResourceUnavailable" RESOURCEUNAVAILABLE_IMAGEDOWNLOADERROR = "ResourceUnavailable.ImageDownloadError" RESOURCEUNAVAILABLE_INVALIDIMAGECONTENT = "ResourceUnavailable.InvalidImageContent" RESOURCEUNAVAILABLE_MODELCALLFAILED = "ResourceUnavailable.ModelCallFailed" RESOURCESSOLDOUT = "ResourcesSoldOut" UNAUTHORIZEDOPERATION = "UnauthorizedOperation" UNAUTHORIZEDOPERATION_UNAUTHORIZED = "UnauthorizedOperation.Unauthorized" UNKNOWNPARAMETER = "UnknownParameter" UNSUPPORTEDOPERATION = "UnsupportedOperation"
type Device ¶
type Device struct { // This field indicates the IP address of the business user's device and supports recording both **IPv4 and IPv6** addresses. It needs to be used together with the `IpType` parameter. Ip *string `json:"Ip,omitnil,omitempty" name:"Ip"` // This field indicates the MAC address of the business user, which makes it easier to identify and manage devices. Its format and value are the same as those of a standard MAC address. Mac *string `json:"Mac,omitnil,omitempty" name:"Mac"` // *In beta test. Stay tuned.* TokenId *string `json:"TokenId,omitnil,omitempty" name:"TokenId"` // *In beta test. Stay tuned.* DeviceId *string `json:"DeviceId,omitnil,omitempty" name:"DeviceId"` // This field indicates the international mobile equipment identity **(IMEI)** number of the business user's device, which can be used to identify each mobile communication device such as mobile phone for easier device identification and management.<br>Note: the format is **15–17 digits**. IMEI *string `json:"IMEI,omitnil,omitempty" name:"IMEI"` // **For iOS devices**: this field indicates the identifier for advertisers **(IDFA)** of the business user, which is provided by Apple to identify the user and contains a hexadecimal string of 32 digits and letters.<br> // Note: as iOS 14 has been updated by Apple to allow users to manually enable or disable IDFA since 2021, the validity of this string may be reduced. IDFA *string `json:"IDFA,omitnil,omitempty" name:"IDFA"` // **For iOS devices**: this field indicates the identifier for vendors **(IDFV)** of the business user, which is provided by Apple to identify the app vendor and contains a hexadecimal string of 32 digits and letters. It can be used to uniquely identify a device. IDFV *string `json:"IDFV,omitnil,omitempty" name:"IDFV"` // This field indicates the type of the recorded IP address. Valid values: **0** (IPv4 address), **1** (IPv6 address). It needs to be used together with the `IpType` parameter. IpType *uint64 `json:"IpType,omitnil,omitempty" name:"IpType"` }
type ImageModerationRequest ¶
type ImageModerationRequest struct { *tchttp.BaseRequest // This field indicates the specific number of the policy, which is used for API scheduling and can be configured in the CMS console. If the `Biztype` parameter is passed in, a moderation policy will be used based on the business scenario; otherwise, the default moderation policy will be used.<br>Note: `Biztype` can contain 3-32 digits, letters, and underscores; different `Biztype` values are associated with different business scenarios and moderation policies, so you need to verify the `Biztype` before calling this API. BizType *string `json:"BizType,omitnil,omitempty" name:"BizType"` // This field indicates the data ID assigned by you to the object to be detected for easier file identification and management.<br>It **can contain up to 64 letters, digits, and special symbols (_-@#)**. DataId *string `json:"DataId,omitnil,omitempty" name:"DataId"` // This field indicates the Base64 encoding of the image to be detected. The image **size cannot exceed 5 MB**. **A resolution of 256x256 or higher is recommended**; otherwise, the recognition effect may be affected.<br>Note: **you must enter a value for either this field or `FileUrl`**. FileContent *string `json:"FileContent,omitnil,omitempty" name:"FileContent"` // URL of the image to moderate. It supports PNG, JPG, JPEG, BMP, GIF AND WEBP files. The file **cannot exceed 5 MB** and the resolution should not below **256*246**. The default timeout period is 3 seconds. Note that **redirection URLs may be blocked by security policies**. In this case, an error message will return. For example, if an HTTP request gets the 302 code, the error `ResourceUnavailable.ImageDownloadError` is returned. <br>**Either `FileUrl` or `FileContent` must be specified. FileUrl *string `json:"FileUrl,omitnil,omitempty" name:"FileUrl"` // **For GIF/long image detection only**. This field indicates the GIF frame capturing frequency (the image interval for capturing a frame for detection). For long images, you should round the width:height ratio as the total number of images to be split. The default value is 0, where only the first frame of the GIF image will be detected, and the long image will not be split.<br>Note: the `Interval` and `MaxFrames` parameters need to be used in combination; for example, if `Interval` is `3` and `MaxFrames` is `400`, the GIF/long image will be detected once every two frames for up to 400 frames. Interval *int64 `json:"Interval,omitnil,omitempty" name:"Interval"` // **For GIF/long image detection only**. This field indicates the maximum number of frames that can be captured. The default value is 1, where only the first frame of the input GIF image will be detected, and the long image will not be split (which may cause a processing timeout).<br>Note: the `Interval` and `MaxFrames` parameters need to be used in combination; for example, if `Interval` is `3` and `MaxFrames` is `400`, the GIF/long image will be detected once every two frames for up to 400 frames. MaxFrames *int64 `json:"MaxFrames,omitnil,omitempty" name:"MaxFrames"` // This field indicates the information of the user that corresponds to the object to be detected. It can be passed in to identify the user involved in the violation. User *User `json:"User,omitnil,omitempty" name:"User"` // This field indicates the information of the device that corresponds to the object to be detected. It can be passed in to identify the device involved in the violation. Device *Device `json:"Device,omitnil,omitempty" name:"Device"` }
func NewImageModerationRequest ¶
func NewImageModerationRequest() (request *ImageModerationRequest)
func (*ImageModerationRequest) FromJsonString ¶
func (r *ImageModerationRequest) FromJsonString(s string) error
FromJsonString It is highly **NOT** recommended to use this function because it has no param check, nor strict type check
func (*ImageModerationRequest) ToJsonString ¶
func (r *ImageModerationRequest) ToJsonString() string
type ImageModerationRequestParams ¶
type ImageModerationRequestParams struct { // This field indicates the specific number of the policy, which is used for API scheduling and can be configured in the CMS console. If the `Biztype` parameter is passed in, a moderation policy will be used based on the business scenario; otherwise, the default moderation policy will be used.<br>Note: `Biztype` can contain 3-32 digits, letters, and underscores; different `Biztype` values are associated with different business scenarios and moderation policies, so you need to verify the `Biztype` before calling this API. BizType *string `json:"BizType,omitnil,omitempty" name:"BizType"` // This field indicates the data ID assigned by you to the object to be detected for easier file identification and management.<br>It **can contain up to 64 letters, digits, and special symbols (_-@#)**. DataId *string `json:"DataId,omitnil,omitempty" name:"DataId"` // This field indicates the Base64 encoding of the image to be detected. The image **size cannot exceed 5 MB**. **A resolution of 256x256 or higher is recommended**; otherwise, the recognition effect may be affected.<br>Note: **you must enter a value for either this field or `FileUrl`**. FileContent *string `json:"FileContent,omitnil,omitempty" name:"FileContent"` // URL of the image to moderate. It supports PNG, JPG, JPEG, BMP, GIF AND WEBP files. The file **cannot exceed 5 MB** and the resolution should not below **256*246**. The default timeout period is 3 seconds. Note that **redirection URLs may be blocked by security policies**. In this case, an error message will return. For example, if an HTTP request gets the 302 code, the error `ResourceUnavailable.ImageDownloadError` is returned. <br>**Either `FileUrl` or `FileContent` must be specified. FileUrl *string `json:"FileUrl,omitnil,omitempty" name:"FileUrl"` // **For GIF/long image detection only**. This field indicates the GIF frame capturing frequency (the image interval for capturing a frame for detection). For long images, you should round the width:height ratio as the total number of images to be split. The default value is 0, where only the first frame of the GIF image will be detected, and the long image will not be split.<br>Note: the `Interval` and `MaxFrames` parameters need to be used in combination; for example, if `Interval` is `3` and `MaxFrames` is `400`, the GIF/long image will be detected once every two frames for up to 400 frames. Interval *int64 `json:"Interval,omitnil,omitempty" name:"Interval"` // **For GIF/long image detection only**. This field indicates the maximum number of frames that can be captured. The default value is 1, where only the first frame of the input GIF image will be detected, and the long image will not be split (which may cause a processing timeout).<br>Note: the `Interval` and `MaxFrames` parameters need to be used in combination; for example, if `Interval` is `3` and `MaxFrames` is `400`, the GIF/long image will be detected once every two frames for up to 400 frames. MaxFrames *int64 `json:"MaxFrames,omitnil,omitempty" name:"MaxFrames"` // This field indicates the information of the user that corresponds to the object to be detected. It can be passed in to identify the user involved in the violation. User *User `json:"User,omitnil,omitempty" name:"User"` // This field indicates the information of the device that corresponds to the object to be detected. It can be passed in to identify the device involved in the violation. Device *Device `json:"Device,omitnil,omitempty" name:"Device"` }
Predefined struct for user
type ImageModerationResponse ¶
type ImageModerationResponse struct { *tchttp.BaseResponse Response *ImageModerationResponseParams `json:"Response"` }
func NewImageModerationResponse ¶
func NewImageModerationResponse() (response *ImageModerationResponse)
func (*ImageModerationResponse) FromJsonString ¶
func (r *ImageModerationResponse) FromJsonString(s string) error
FromJsonString It is highly **NOT** recommended to use this function because it has no param check, nor strict type check
func (*ImageModerationResponse) ToJsonString ¶
func (r *ImageModerationResponse) ToJsonString() string
type ImageModerationResponseParams ¶
type ImageModerationResponseParams struct { // This field is used to return the operation suggestion for the `Label` tag. When you get the determination result, the returned value indicates the operation suggested by the system. We recommend you handle different types of violations and suggestions according to your business needs. <br>Returned values: **Block**, **Review**, **Pass**. Suggestion *string `json:"Suggestion,omitnil,omitempty" name:"Suggestion"` // This field is used to return the **maliciousness tag with the highest priority** in the detection result (LabelResults), which represents the moderation result suggested by the model. We recommend you handle different types of violations and suggestions according to your business needs. <br>Returned values: **Normal**: normal; **Porn**: pornographic; **Abuse**: abusive; **Ad**: advertising; **Custom**: custom type of non-compliant content and other offensive, unsafe, or inappropriate types of content. Label *string `json:"Label,omitnil,omitempty" name:"Label"` // This field is used to return the subtag name under the maliciousness tag with the highest priority hit by the detection result, such as *Porn-SexBehavior*. If no subtag is hit, an empty string will be returned. SubLabel *string `json:"SubLabel,omitnil,omitempty" name:"SubLabel"` // Confidence score of the under the current label. Value range: 0 (**the lowest confidence**) to 100 (**the highest confidence**). For example, *Porn 99* indicates that the image is highly likely to be pornographic, while *Porn 0* indicates that the image is not pornographic. Score *int64 `json:"Score,omitnil,omitempty" name:"Score"` // This field is used to return the detailed recognition result for the maliciousness tag hit by the categorization model, such as porn, advertising, or any other offensive, unsafe, or inappropriate type of content. // Note: this field may return null, indicating that no valid values can be obtained. LabelResults []*LabelResult `json:"LabelResults,omitnil,omitempty" name:"LabelResults"` // This field is used to return the detailed detection result of the object detection model, including the tag name hit by the content such as object, advertising logo, or QR code, tag score, coordinate information, scenario recognition result, and operation suggestion. For more information on the returned value, see the description of the `ObjectResults` data structure. // Note: this field may return null, indicating that no valid values can be obtained. ObjectResults []*ObjectResult `json:"ObjectResults,omitnil,omitempty" name:"ObjectResults"` // This field is used to return the detailed text OCR result, including the text coordinate information, text recognition result, and operation suggestion. For more information on the returned value, see the description of the `OcrResults` data structure. // Note: this field may return null, indicating that no valid values can be obtained. OcrResults []*OcrResult `json:"OcrResults,omitnil,omitempty" name:"OcrResults"` // This field is used to return the result of recognition based on image risk libraries (blocklist and allowlist). For more information on the returned value, see the description of the `LibResults` data structure.<br>Note: currently, **you cannot customize image risk libraries**. // Note: this field may return null, indicating that no valid values can be obtained. LibResults []*LibResult `json:"LibResults,omitnil,omitempty" name:"LibResults"` // This field is used to return the `DataId` in the request parameters that correspond to the detected object. DataId *string `json:"DataId,omitnil,omitempty" name:"DataId"` // This field is used to return the `BizType` in the request parameters that correspond to the detected object. BizType *string `json:"BizType,omitnil,omitempty" name:"BizType"` // This field is used to return the additional information (Extra) configured based on your needs. If it is not configured, an empty value will be returned by default.<br>Note: the returned information varies by customer or `Biztype`. If you need to configure this field, submit a ticket or contact the aftersales service for assistance. // Note: this field may return null, indicating that no valid values can be obtained. Extra *string `json:"Extra,omitnil,omitempty" name:"Extra"` // This field is used to return the MD5 checksum of the detected object for easier verification of the file integrity. FileMD5 *string `json:"FileMD5,omitnil,omitempty" name:"FileMD5"` // Image recognition result, including the hit tags, confidence and location. // Note: This field may return `null`, indicating that no valid values can be obtained. RecognitionResults []*RecognitionResult `json:"RecognitionResults,omitnil,omitempty" name:"RecognitionResults"` // The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem. RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` }
Predefined struct for user
type LabelDetailItem ¶
type LabelDetailItem struct { // This field is used to return the ID of the recognized object for easier recognition and distinction. // Note: this field may return null, indicating that no valid values can be obtained. Id *int64 `json:"Id,omitnil,omitempty" name:"Id"` // This field is used to return the hit subtag name. // Note: this field may return null, indicating that no valid values can be obtained. Name *string `json:"Name,omitnil,omitempty" name:"Name"` // This field is used to return the hit score of the subtag. Value range: **0–100**; for example, *Porn-SexBehavior 99* indicates that the hit score of the *Porn-SexBehavior* tag for the recognized content is 99. // Note: this field may return null, indicating that no valid values can be obtained. Score *uint64 `json:"Score,omitnil,omitempty" name:"Score"` }
type LabelResult ¶
type LabelResult struct { // This field is used to return the scenario result recognized by the model, such as advertising, pornographic, and harmful. Scene *string `json:"Scene,omitnil,omitempty" name:"Scene"` // This field is used to return the operation suggestion for the current maliciousness tag. When you get the determination result, the returned value indicates the operation suggested by the system. We recommend you handle different types of violations and suggestions according to your business needs. <br>Returned values: **Block**, **Review**, **Pass**. Suggestion *string `json:"Suggestion,omitnil,omitempty" name:"Suggestion"` // This field is used to return the maliciousness tag in the detection result.<br>Returned values: **Normal**: normal; **Porn**: pornographic; **Abuse**: abusive; **Ad**: advertising; **Custom**: custom type of non-compliant content and other offensive, unsafe, or inappropriate types of content. Label *string `json:"Label,omitnil,omitempty" name:"Label"` // This field is used to return the detection result for a subtag under the maliciousness tag, such as *Porn-SexBehavior*. SubLabel *string `json:"SubLabel,omitnil,omitempty" name:"SubLabel"` // Confidence score of the under the current label. Value range: 0 (**the lowest confidence**) to 100 (**the highest confidence**). For example, *Porn 99* indicates that the image is highly likely to be pornographic, while *Porn 0* indicates that the image is not pornographic. Score *uint64 `json:"Score,omitnil,omitempty" name:"Score"` // This field is used to return the details of the subtag hit by the categorization model, such as number, hit tag name, and score. // Note: this field may return null, indicating that no valid values can be obtained. Details []*LabelDetailItem `json:"Details,omitnil,omitempty" name:"Details"` }
type LibDetail ¶
type LibDetail struct { // This field is used to return the ID of the recognized object for easier recognition and distinction. Id *int64 `json:"Id,omitnil,omitempty" name:"Id"` // This field is **valid only when `Label` is `Custom` (custom keyword)**. It is used to return the ID of the custom library for easier custom library management and configuration. LibId *string `json:"LibId,omitnil,omitempty" name:"LibId"` // This field is **valid only when `Label` is `Custom` (custom keyword)**. It is used to return the name of the custom library for easier custom library management and configuration. // Note: this field may return null, indicating that no valid values can be obtained. LibName *string `json:"LibName,omitnil,omitempty" name:"LibName"` // This field is used to return the ID of the recognized image object for easier file management. ImageId *string `json:"ImageId,omitnil,omitempty" name:"ImageId"` // This field is used to return the maliciousness tag in the detection result.<br>Returned values: **Normal**: normal; **Porn**: pornographic; **Abuse**: abusive; **Ad**: advertising; **Custom**: custom type of non-compliant content and other offensive, unsafe, or inappropriate types of content. Label *string `json:"Label,omitnil,omitempty" name:"Label"` // This field is used to return other custom tags to meet the needs in your customized scenarios. It can be skipped if you have no custom needs. // Note: this field may return null, indicating that no valid values can be obtained. Tag *string `json:"Tag,omitnil,omitempty" name:"Tag"` // This field is used to return the hit score of the model. Value range: **0–100**; for example, *Porn 99* indicates that the hit score of the porn tag for the recognized content is 99. Score *int64 `json:"Score,omitnil,omitempty" name:"Score"` }
type LibResult ¶
type LibResult struct { // This field indicates the scenario recognition result of the model. Default value: Similar. Scene *string `json:"Scene,omitnil,omitempty" name:"Scene"` // This field is used to return the operation suggestion. When you get the determination result, the returned value indicates the operation suggested by the system. We recommend you handle different types of violations and suggestions according to your business needs. <br>Returned values: **Block**, **Review**, **Pass**. Suggestion *string `json:"Suggestion,omitnil,omitempty" name:"Suggestion"` // This field is used to return the maliciousness tag in the detection result.<br>Returned values: **Normal**: normal; **Porn**: pornographic; **Abuse**: abusive; **Ad**: advertising; **Custom**: custom type of non-compliant content and other offensive, unsafe, or inappropriate types of content. Label *string `json:"Label,omitnil,omitempty" name:"Label"` // This field is used to return the detection result for a subtag under the maliciousness tag, such as *Porn-SexBehavior*. // Note: this field may return null, indicating that no valid values can be obtained. SubLabel *string `json:"SubLabel,omitnil,omitempty" name:"SubLabel"` // This field is used to return the recognition score of the image search model. Value range: **0–100**. It indicates the score for the similarity between the moderated image **and the samples in the library**. A higher score indicates that the content is more likely to hit a sample in the library of similar images. Score *int64 `json:"Score,omitnil,omitempty" name:"Score"` // This field is used to return the detailed result of the comparison with the blocklist/allowlist, such as number, library name, and maliciousness tag. For more information on the returned value, see the description of the [LibDetail](https://intl.cloud.tencent.com/document/product/1125/53274?from_cn_redirect=1#LibDetail) data structure. // Note: this field may return null, indicating that no valid values can be obtained. Details []*LibDetail `json:"Details,omitnil,omitempty" name:"Details"` }
type Location ¶
type Location struct { // 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. X *float64 `json:"X,omitnil,omitempty" name:"X"` // 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. Y *float64 `json:"Y,omitnil,omitempty" name:"Y"` // 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. Width *float64 `json:"Width,omitnil,omitempty" name:"Width"` // 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. Height *float64 `json:"Height,omitnil,omitempty" name:"Height"` // 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. Rotate *float64 `json:"Rotate,omitnil,omitempty" name:"Rotate"` }
type ObjectDetail ¶
type ObjectDetail struct { // This parameter is used to return the ID of the recognized object for easier recognition and distinction. Id *uint64 `json:"Id,omitnil,omitempty" name:"Id"` // This parameter is used to return the hit object tag. Name *string `json:"Name,omitnil,omitempty" name:"Name"` // This parameter is used to return the value or content of the object tag; for example, when the tag is *QR code (QrCode)*, this field will be the URL of the recognized QR code. Value *string `json:"Value,omitnil,omitempty" name:"Value"` // This parameter is used to return the hit score of the object tag. Valid values: **0–100**; for example, *QrCode 99* indicates that it is highly likely that the recognized content will hit the QR code tag. Score *uint64 `json:"Score,omitnil,omitempty" name:"Score"` // This field is used to return the coordinate position (X and Y coordinates of the top-left corner, length, width, and rotation angle) of the object detection frame for quick location of the object information. Location *Location `json:"Location,omitnil,omitempty" name:"Location"` // This parameter is used to return the hit object subtag. SubLabel *string `json:"SubLabel,omitnil,omitempty" name:"SubLabel"` }
type ObjectResult ¶
type ObjectResult struct { // This field is used to return the recognized object scenario result, such as QR code, logo, and image OCR. Scene *string `json:"Scene,omitnil,omitempty" name:"Scene"` // This field is used to return the operation suggestion for the current maliciousness tag. When you get the determination result, the returned value indicates the operation suggested by the system. We recommend you handle different types of violations and suggestions according to your business needs. <br>Returned values: **Block**, **Review**, **Pass**. Suggestion *string `json:"Suggestion,omitnil,omitempty" name:"Suggestion"` // This field is used to return the maliciousness tag in the detection result, which represents the moderation result suggested by the model. We recommend you handle different types of violations and suggestions according to your business needs. <br>Returned values: **Normal**: normal; **Porn**: pornographic; **Abuse**: abusive; **Ad**: advertising; **Custom**: custom type of non-compliant content and other offensive, unsafe, or inappropriate types of content. Label *string `json:"Label,omitnil,omitempty" name:"Label"` // This field is used to return the detection result for a subtag under the current maliciousness tag, such as *Porn-SexBehavior*. SubLabel *string `json:"SubLabel,omitnil,omitempty" name:"SubLabel"` // This field is used to return the hit score of a subtag under the current maliciousness tag. Value range: **0–100**; for example, *Porn-SexBehavior 99* indicates that the hit score of the *Porn-SexBehavior* tag for the recognized content is 99. Score *uint64 `json:"Score,omitnil,omitempty" name:"Score"` // This field is used to return the name of the recognized object. // Note: this field may return null, indicating that no valid values can be obtained. Names []*string `json:"Names,omitnil,omitempty" name:"Names"` // This field is used to return the details of the recognized object, such as number, hit tag name, and position coordinates. For more information on the returned value, see the description of the [ObjectDetail](https://intl.cloud.tencent.com/document/api/1125/53274?from_cn_redirect=1#ObjectDetail) data structure. // // Note: this field may return null, indicating that no valid values can be obtained. Details []*ObjectDetail `json:"Details,omitnil,omitempty" name:"Details"` }
type OcrResult ¶
type OcrResult struct { // This field indicates the recognition scenario. Default value: OCR (image OCR). Scene *string `json:"Scene,omitnil,omitempty" name:"Scene"` // This field is used to return the operation suggestion for the maliciousness tag with the highest priority. When you get the determination result, the returned value indicates the operation suggested by the system. We recommend you handle different types of violations and suggestions according to your business needs. <br>Returned values: **Block**, **Review**, **Pass**. Suggestion *string `json:"Suggestion,omitnil,omitempty" name:"Suggestion"` // This field is used to return the maliciousness tag with the highest priority in the OCR detection result, which represents the moderation result suggested by the model. We recommend you handle different types of violations and suggestions according to your business needs. <br>Returned values: **Normal**: normal; **Porn**: pornographic; **Abuse**: abusive; **Ad**: advertising; **Custom**: custom type of non-compliant content and other offensive, unsafe, or inappropriate types of content. Label *string `json:"Label,omitnil,omitempty" name:"Label"` // This field is used to return the detection result for a subtag under the current tag (Label), such as *Porn-SexBehavior*. SubLabel *string `json:"SubLabel,omitnil,omitempty" name:"SubLabel"` // This field is used to return the confidence under the current tag (Label). Value range: 0 (**the lowest confidence**)–100 (**the highest confidence**), where a higher value indicates that the text is more likely to fall into the category of the current returned tag; for example, *Porn 99* indicates that the text is highly likely to be pornographic, while *Porn 0* indicates that the text is not pornographic. Score *uint64 `json:"Score,omitnil,omitempty" name:"Score"` // This field is used to return the details of the OCR recognition result, such as text content, tag, and recognition frame position. // Note: this field may return null, indicating that no valid values can be obtained. Details []*OcrTextDetail `json:"Details,omitnil,omitempty" name:"Details"` // This field is used to return the text information recognized by OCR. Text *string `json:"Text,omitnil,omitempty" name:"Text"` }
type OcrTextDetail ¶
type OcrTextDetail struct { // This field is used to return the text content recognized by OCR.<br>Note: OCR can recognize text of **up to 5,000 bytes**. Text *string `json:"Text,omitnil,omitempty" name:"Text"` // This field is used to return the maliciousness tag in the detection result.<br>Returned values: **Normal**: normal; **Porn**: pornographic; **Abuse**: abusive; **Ad**: advertising; **Custom**: custom type of non-compliant content and other offensive, unsafe, or inappropriate types of content. Label *string `json:"Label,omitnil,omitempty" name:"Label"` // This field is **valid only when `Label` is `Custom` (custom keyword)**. It is used to return the ID of the custom library for easier custom library management and configuration. LibId *string `json:"LibId,omitnil,omitempty" name:"LibId"` // This field is **valid only when `Label` is `Custom` (custom keyword)**. It is used to return the name of the custom library for easier custom library management and configuration. LibName *string `json:"LibName,omitnil,omitempty" name:"LibName"` // This parameter is used to return the hit keyword under the current tag (label). Keywords []*string `json:"Keywords,omitnil,omitempty" name:"Keywords"` // This parameter is used to return the model hit score of the current maliciousness tag. Value range: **0–100**, where a higher value indicates that the current scenario agrees more with the scenario represented by the maliciousness tag. Score *uint64 `json:"Score,omitnil,omitempty" name:"Score"` // 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 *Location `json:"Location,omitnil,omitempty" name:"Location"` // This parameter is used to return the confidence of the text OCR result. Valid values: **0** (**the lowest confidence**)–**100** (**the highest confidence**), where a higher value indicates that it is more likely that the image contains the recognized text; for example, *Hello 99* indicates that it is highly likely that the text in the OCR recognition frame is "Hello". Rate *uint64 `json:"Rate,omitnil,omitempty" name:"Rate"` // This field is used to return the maliciousness subtag that corresponds to the detection result. SubLabel *string `json:"SubLabel,omitnil,omitempty" name:"SubLabel"` }
type RecognitionResult ¶
type RecognitionResult struct { // Value: `Scene` // Note: This field may return `null`, indicating that no valid values can be obtained. Label *string `json:"Label,omitnil,omitempty" name:"Label"` // Hit tags under the `Label` // Note: This field may return `null`, indicating that no valid values can be obtained. Tags []*RecognitionTag `json:"Tags,omitnil,omitempty" name:"Tags"` }
type RecognitionTag ¶
type RecognitionTag struct { // Tag name // Note: This field may return `null`, indicating that no valid values can be obtained. Name *string `json:"Name,omitnil,omitempty" name:"Name"` // Confidence score. Value: 1 to 100. // Note: This field may return `null`, indicating that no valid values can be obtained. Score *int64 `json:"Score,omitnil,omitempty" name:"Score"` // Location information. It returns 0 if there is not location information. // Note: This field may return `null`, indicating that no valid values can be obtained. Location *Location `json:"Location,omitnil,omitempty" name:"Location"` }
type User ¶
type User struct { // This field indicates the business user ID. After it is specified, the system can optimize the moderation result according to the violation history to facilitate determination when a suspicious violation risk exists. UserId *string `json:"UserId,omitnil,omitempty" name:"UserId"` // This field indicates the nickname of the business user's account. Nickname *string `json:"Nickname,omitnil,omitempty" name:"Nickname"` // This field indicates the account type of the business user ID.<br> // This field can be used together with the ID parameter (UserId) to uniquely identify the account. AccountType *string `json:"AccountType,omitnil,omitempty" name:"AccountType"` // This field indicates the gender of the business user's account.<br> // Valid values: **0** (default value): unknown; **1** (male); **2** (female). Gender *uint64 `json:"Gender,omitnil,omitempty" name:"Gender"` // This field indicates the age of the business user's account.<br> // Valid values: integers between **0** (default value, which indicates unknown) and **custom age limit**. Age *uint64 `json:"Age,omitnil,omitempty" name:"Age"` // This field indicates the level of the business user's account.<br> // Valid values: **0** (default value): unknown; **1**: low level; **2**: medium level; **3**: high level. Currently, **the level is not customizable**. Level *uint64 `json:"Level,omitnil,omitempty" name:"Level"` // This field indicates the mobile number of the business user's account. It supports recording mobile numbers across the world.<br> // Note: you need to use a consistent mobile number format, such as area code format (086/+86). Phone *string `json:"Phone,omitnil,omitempty" name:"Phone"` // This field indicates the profile of the business user. It can contain **up to 5,000 letters and special symbols**. Desc *string `json:"Desc,omitnil,omitempty" name:"Desc"` // This field indicates the access URL of the business user's profile photo in PNG, JPG, JPEG, BMP, GIF, or WEBP format.<br>Note: the profile photo **cannot exceed 5 MB in size**. **A resolution of 256x256 or higher** is recommended. The image download time should be limited to 3 seconds; otherwise, a download timeout will be returned. HeadUrl *string `json:"HeadUrl,omitnil,omitempty" name:"HeadUrl"` }