API | Description |
Scans existing data stored in COS for pornographic, illegal, and advertising images. | |
Moderates multiple images in batches. | |
Queries the result of the specified image moderation job. |
QCloudSyncImageRecognitionRequest
) is used to submit an image moderation job. You can receive the moderation result by setting the callback address or querying by JobId
.QCloudSyncImageRecognitionRequest * request = [[QCloudSyncImageRecognitionRequest alloc]init];// Bucket name in the format of BucketName-APPIDrequest.bucket = @"bucket";// File regionrequest.regionName = @"regionName";// Object key, i.e., the full path of a COS object. If the object is in a directory, the path should be "dir1/object1".request.object = @"***.jpg";// Moderation type, such as `porn` (pornography) and `ads` (advertising).// You can select multiple types; for example, `detect-type=porn,ads` indicates to moderate the image for pornographic and advertising information.// You can use multiple parameters together, such as `QCloudRecognitionPorn | QCloudRecognitionTerrorist`.request.detectType = QCloudRecognitionPorn | QCloudRecognitionTerrorist | QCloudRecognitionPolitics | QCloudRecognitionAds;[request setFinishBlock:^(QCloudImageRecognitionResult * _Nullable result, NSError * _Nullable error) {// `outputObject` is the moderation result. For detailed fields, see the API documentation or SDK source code.// `QCloudImageRecognitionResult` class}];[[QCloudCOSXMLService defaultCOSXML] SyncImageRecognition:request];
let request : QCloudSyncImageRecognitionRequest = QCloudSyncImageRecognitionRequest();// Bucket name in the format of BucketName-APPIDrequest.bucket = "bucket";// File regionrequest.regionName = "regionName";// Object key, i.e., the full path of a COS object. If the object is in a directory, the path should be "dir1/object1".request.object = "***.jpg";// Moderation type, such as `porn` (pornography) and `ads` (advertising).// You can select multiple types; for example, `detect-type=porn,ads` indicates to moderate the image for pornographic and advertising information.// You can use multiple parameters together, such as `QCloudRecognitionPorn | QCloudRecognitionTerrorist`.request.detectType = QCloudRecognitionEnum(rawValue: QCloudRecognitionEnum.porn.rawValue | QCloudRecognitionEnum.ads.rawValue)!request.finishBlock = { (result, error) in// `outputObject` is the moderation result. For detailed fields, see the API documentation or SDK source code.// `QCloudImageRecognitionResult` class}QCloudCOSXMLService.defaultCOSXML().syncImageRecognition(request);
QCloudBatchimageRecognitionRequest * request = [[QCloudBatchimageRecognitionRequest alloc]init];request.bucket = @"bucket";// File regionrequest.regionName = @"regionName";NSMutableArray * input = [NSMutableArray new];// The image object to be moderatedQCloudBatchRecognitionImageInfo * input1 = [QCloudBatchRecognitionImageInfo new];input1.Object = @"***.jpg";[input addObject:input1];QCloudBatchRecognitionImageInfo * input2 = [QCloudBatchRecognitionImageInfo new];input2.Object = @"***.jpg";[input addObject:input2];// The array of image objects to be moderatedrequest.input = input;request.detectType = QCloudRecognitionPorn | QCloudRecognitionTerrorist | QCloudRecognitionPolitics | QCloudRecognitionAds;[request setFinishBlock:^(QCloudBatchImageRecognitionResult * _Nullable result, NSError * _Nullable error) {// `outputObject` is the moderation result. For detailed fields, see the API documentation or SDK source code.// `QCloudBatchImageRecognitionResult` class}];[[QCloudCOSXMLService defaultCOSXML] BatchImageRecognition:request];
let request = QCloudBatchimageRecognitionRequest();request.bucket = "bucket";// File regionrequest.regionName = "regionName";// The image object to be moderatedlet input1 = QCloudBatchRecognitionImageInfo();input1.object = "***.jpg";let input2 = QCloudBatchRecognitionImageInfo();input2.object = "***.jpg";// The array of image objects to be moderatedrequest.input = [input1,input2];request.detectType = QCloudRecognitionEnum(rawValue: QCloudRecognitionEnum.porn.rawValue | QCloudRecognitionEnum.ads.rawValue)!request.setFinish { outputObject, error in// `outputObject` is the moderation result. For detailed fields, see the API documentation or SDK source code.// `QCloudBatchImageRecognitionResult` class}QCloudCOSXMLService.defaultCOSXML().batchImageRecognition(request);
QCloudGetImageRecognitionRequest
) is used to query the result of the specified sync or batch image moderation job by JobId
.QCloudGetImageRecognitionRequest * request = [[QCloudGetImageRecognitionRequest alloc]init];// Bucket name in the format of BucketName-APPIDrequest.bucket = @"examplebucket-1250000000";// File regionrequest.regionName = @"regionName";// The `jobid` of the sync or batch moderation jobrequest.jobId = @"jobid";request.finishBlock = ^(QCloudImageRecognitionResult * outputObject, NSError *error) {// The moderation result `outputObject` contains the job ID used for query. For detailed fields, see the API documentation or SDK source code.// `QCloudImageRecognitionResult` class};[[QCloudCOSXMLService defaultCOSXML] GetImageRecognition:request];
let request = QCloudGetImageRecognitionRequest();// Bucket name in the format of BucketName-APPIDrequest.bucket = "examplebucket-1250000000";request.regionName = "regionName";// The `jobid` of the sync or batch moderation jobrequest.jobId = "jobid";request.setFinish { outputObject, error in// The moderation result `outputObject` contains the job ID used for query. For detailed fields, see the API documentation or SDK source code.// `QCloudWebRecognitionResult` class};QCloudCOSXMLService.defaultCOSXML().getImageRecognition(request);
Was this page helpful?