This document describes how to use the Content Moderation API SDK of Alibaba Cloud Content Security service. Before using the SDK, you need to read the Content Moderation API documentation to learn about each interface’s functions.
Follow the procedure in Alibaba Cloud SDK to prepare Alibaba Cloud SDK dependency environment for further development.
- We provide an interface in the SDK, the Image Moderation SDK API, to implement the smart pornography identification function. The API can be called by either of the following methods:
- Synchronous Image Moderation API: One image can be called at a time to ensure high moderation performance. The image moderation result is returned in real time.
- Asynchronous Image Moderation API: It can check multiple images in a batch and return a unique taskId for each image. You can obtain the moderation result of a certain image based on its taskId after 1 minute.
- The Image Moderation API supports multiple scenes simultaneously. For example, for the smart pornography identification purpose, you can set two or more values for the “scenes” parameter when calling the API to apply this API to the corresponding scenes simultaneously.
- The image link protocol can be either HTTP or HTTPS.
- The image format can be PNG, JPG, JPEG, BMP, or GIF.
- The maximum image size for synchronous calls is 5 MB and that for asynchronous calls is 20 MB. The download time-out period is 3 seconds.
- The recommended image pixel is not smaller than 256 x 256. If the pixel is excessively small, the identification performance may be adversely affected.
- The response period of the Image Moderation API is determined by the image download period. Make sure that the storage service of the images is stable. It is recommended to store the images in OSS or cache them in CDN.