tencent cloud

Cloud Object Storage

동향 및 공지
릴리스 노트
제품 공지
제품 소개
제품 개요
기능 개요
적용 시나리오
제품 장점
기본 개념
리전 및 액세스 도메인
규격 및 제한
제품 요금
과금 개요
과금 방식
과금 항목
프리 티어
과금 예시
청구서 보기 및 다운로드
연체 안내
FAQ
빠른 시작
콘솔 시작하기
COSBrowser 시작하기
사용자 가이드
요청 생성
버킷
객체
데이터 관리
일괄 프로세스
글로벌 가속
모니터링 및 알람
운영 센터
데이터 처리
스마트 툴 박스 사용 가이드
데이터 워크플로
애플리케이션 통합
툴 가이드
툴 개요
환경 설치 및 설정
COSBrowser 툴
COSCLI 툴
COSCMD 툴
COS Migration 툴
FTP Server 툴
Hadoop 툴
COSDistCp 툴
HDFS TO COS 툴
온라인 도구 (Onrain Dogu)
자가 진단 도구
실습 튜토리얼
개요
액세스 제어 및 권한 관리
성능 최적화
AWS S3 SDK를 사용하여 COS에 액세스하기
데이터 재해 복구 백업
도메인 관리 사례
이미지 처리 사례
COS 오디오/비디오 플레이어 사례
데이터 다이렉트 업로드
데이터 보안
데이터 검증
빅 데이터 사례
COS 비용 최적화 솔루션
3rd party 애플리케이션에서 COS 사용
마이그레이션 가이드
로컬 데이터 COS로 마이그레이션
타사 클라우드 스토리지 데이터를 COS로 마이그레이션
URL이 소스 주소인 데이터를 COS로 마이그레이션
COS 간 데이터 마이그레이션
Hadoop 파일 시스템과 COS 간 데이터 마이그레이션
데이터 레이크 스토리지
클라우드 네이티브 데이터 레이크
메타데이터 가속
데이터 레이크 가속기 GooseFS
데이터 처리
데이터 처리 개요
이미지 처리
미디어 처리
콘텐츠 조정
파일 처리
문서 미리보기
장애 처리
RequestId 가져오기
공용 네트워크로 COS에 파일 업로드 시 속도가 느린 문제
COS 액세스 시 403 에러 코드 반환
리소스 액세스 오류
POST Object 자주 발생하는 오류
보안 및 컴플라이언스
데이터 재해 복구
데이터 보안
액세스 관리
자주 묻는 질문
인기 질문
일반 문제
과금
도메인 규정 준수 문제
버킷 설정 문제
도메인 및 CDN 문제
파일 작업 문제
로그 모니터링 문제
권한 관리
데이터 처리 문제
데이터 보안 문제
사전 서명 URL 관련 문제
SDK FAQ
툴 관련 문제
API 관련 문제
Agreements
Service Level Agreement
개인 정보 보호 정책
데이터 처리 및 보안 계약
연락처
용어집
문서Cloud Object Storage

Image Moderation

포커스 모드
폰트 크기
마지막 업데이트 시간: 2024-02-02 12:12:58

Overview

This document describes how to use the content moderation feature provided by Cloud Infinite (CI). CI fully integrates the processing capabilities with the COS SDK.
Note:
To use the content moderation service, you need to have the permission to use CI:
For root accounts, click here for role authorization.
This document provides an overview of APIs and SDK code samples for image moderation.
API
Description
Scans existing data stored in COS for porn, illegal, and advertising images.
Moderates multiple images in batches.
Queries the result of specified image moderation job.

Single Image Moderation

Feature description

The existing data scan feature of image moderation leverages CI's persistent processing API to scan existing data stored in COS for porn, illegal, and advertising images.

Method prototype

CosResult GetImageAuditing(const GetImageAuditingReq& req, GetImageAuditingResp* resp);

Sample request

qcloud_cos::CosConfig config("./config.json");
qcloud_cos::CosAPI cos(config);
std::string bucket_name = "examplebucket-1250000000";
std::string object_name = "test.jpg";

GetImageAuditingReq req(bucket_name);
GetImageAuditingResp resp;

// Add request parameters as detailed in the API documentation
req.SetObjectKey(object_name);
req.SetBizType("b81d45f94b91a683255e9a9506f45a11");
// req.SetDetectType("Porn,Ads");

// Call the API to get the job response object
CosResult result = cos.GetImageAuditing(req, &resp);
if (result.IsSucc()) {
// If the moderation job is created successfully, you can call the member functions of `GetImageAuditingResp`.
} else {
// If the moderation job failed to be created, you can call the member functions of `CosResult` to output the error message.
}

Parameter description

Parameter
Description
Type
Required
req
GetImageAuditing operation request
GetImageAuditingReq
Yes
resp
GetImageAuditing operation response
GetImageAuditingResp
Yes
GetImageAuditingReq provides the following member functions:
// Set the bucket for performing the operation
void SetBucketName(const std::string& bucket_name);
// Name of the image file to be moderated in the COS bucket
void SetObjectKey(const std::string& object_name);
// Unique identifier of the moderation policy. You can configure the scenes you want to moderate on the moderation policy page in the console, such as porn, adverting, and illegal information. For configuration guides, see [Setting Moderation Policy](https://www.tencentcloud.com/document/product/436/52095).
// You can get `BizType` in the console. If `BizType` is specified, the moderation request will perform moderation based on the scenes configured in the moderation policy.
void SetBizType(const std::string& biz_type);
// The scene to be moderated, such as `Porn` (pornography) and `Ads` (advertising). You can pass in multiple types and separate them by comma, such as `Porn,Ads`. If you need to moderate more scenes, use the `BizType` parameter.
void SetDetectType(const std::string& detect_type);
// URL of the image to be moderated, which can be a URL of any image accessible over the public network.
// If `detect-url` is set, moderation will be conducted by `detect-url` by default, and there will be no need to enter `ObjectKey`.
// If `detect-url` is not set, moderation will be conducted by `ObjectKey` by default.
void SetDetectUrl(const std::string& detect_url);
// For GIF image moderation, you can use this parameter to configure the frame capturing interval. The default value is `5`, indicating to capture a frame every five frames starting from the first frame (included).
void SetInterval(int interval);
// Maximum number of frames to be captured for animated image moderation. Default value: `5`.
void SetMaxFrames(int max_frames);
// Whether to compress the image that exceeds the size limit before moderation. Valid values: `0` (no), `1` (yes). Default value: `0`.
void SetLargeImageDetect(int large_image_detect);
// Image ID. This field will return the original content, which can contain up to 512 bytes.
void SetDataId(const std::string& data_id);
GetImageAuditingResp provides the following member functions:
// Get the job details returned by the API request
ImageAuditingJobsDetail GetJobsDetail();
// Get the `RequestId` returned by the API
std::string GetRequestId();

Response description

Success: The moderation job result in the XML content returned by the API will be parsed into the ImageAuditingJobsDetail structure. For specific response parameters, see Single Image Moderation.
Failure: If an error (for example, the bucket does not exist) occurs, the error message will be parsed into the CosResult structure. For more information, see Troubleshooting.

Batch Image Moderation

Feature description

The batch image moderation API adopts a sync POST request method. You can use this API to perform content moderation on multiple image files.

Method prototype

CosResult CosAPI::BatchImageAuditing(const BatchImageAuditingReq& req, BatchImageAuditingResp* resp);

Sample request

qcloud_cos::CosConfig config("./config.json");
qcloud_cos::CosAPI cos(config);
std::string bucket_name = "examplebucket-1250000000";
std::string object_name_a = "test1.jpg";
std::string object_name_b = "test2.jpg";

BatchImageAuditingReq req(bucket_name);
BatchImageAuditingResp resp;

// input 1
AuditingInput input_a = AuditingInput();
input_a.SetObject(object_name_a);
req.AddInput(input_a);

// input2
AuditingInput input_b = AuditingInput();
input_a.SetObject(object_name_b);
req.AddInput(input_b);

// Moderation configuration
req.SetBizType("b81d45f94b91a683255e9a9506f45a11");
// req.SetDetectType("Porn,Ads");

// Call the API to get the job response object
CosResult result = cos.BatchImageAuditing(req, &resp);
if (result.IsSucc()) {
// If the moderation job is created successfully, you can call the member functions of `BatchImageAuditingResp`.
} else {
// If the moderation job failed to be created, you can call the member functions of `CosResult` to output the error message.
}

Parameter description

Parameter
Description
Type
Required
req
BatchImageAuditing operation request
BatchImageAuditingReq
Yes
resp
BatchImageAuditing operation response
BatchImageAuditingResp
Yes
input
Input parameter of the BatchImageAuditing operation request
AuditingInput
Yes
BatchImageAuditingReq provides the following member functions:
// Set the bucket for performing the operation
void SetBucketName(const std::string& bucket_name);
// Set the moderation configuration
void SetConf(const Conf& conf);
// Unique identifier of the moderation policy. You can configure the scenes you want to moderate on the moderation policy page in the console, such as porn, adverting, and illegal information. For configuration guides, see [Setting Moderation Policy](https://www.tencentcloud.com/document/product/436/52095).
// You can get `BizType` in the console. If `BizType` is specified, the moderation request will perform moderation based on the scenes configured in the moderation policy.
void SetBizType(const std::string& biz_type);
// The scene to be moderated, such as `Porn` (pornography) and `Ads` (advertising). You can pass in multiple types and separate them by comma, such as `Porn,Ads`. If you need to moderate more scenes, use the `BizType` parameter.
void SetDetectType(const std::string& detect_type);
// Add the input for single image moderation
void AddInput(const AuditingInput& input);
// Set the input array for batch moderation
void SetInputs(const std::vector<AuditingInput>& inputs);
AuditingInput provides the following member functions:
// Name of the image file to be moderated in the COS bucket
void SetObject(const std::string& object);
// Full URL of the image file, such as `http://a-1250000.cos.ap-shanghai.myqcloud.com/image.jpg`. Either `Object` or `Url` can be selected at a time.
void SetUrl(const std::string& url);
// Frame capturing frequency, which takes effect for GIF images only. The default value is `5`, indicating to capture a frame every five frames starting from the first frame (included).
void SetInterval(const int interval);
// The maximum number of frames to be captured, which takes effect for GIF images only. The default value is `5`, indicating to capture only five frames of the GIF image for moderation. The parameter value must be greater than 0.
void SetMaxFrames(const int max_frames);
// Image ID. This field will return the original content in the result, which can contain up to 512 bytes.
void SetDataId(const std::string& data_id);
// Whether to compress the image that exceeds the size limit before moderation. Valid values: `0` (no), `1` (yes). Default value: `0`.
void SetLargeImageDetect(const int large_image_detect);
// Business field.
void SetUserInfo(const UserInfo& user_info);
BatchImageAuditingResp provides the following member functions:
// Get the job details returned by the API request
std::vector<ImageAuditingJobsDetail> GetJobsDetails();
// Get the `RequestId` returned by the API
std::string GetRequestId();

Response description

Success: The moderation job result in the XML content returned by the API will be parsed into the ImageAuditingJobsDetail structure array. For specific response parameters, see Batch Image Moderation.
Failure: If an error (for example, the bucket does not exist) occurs, the error message will be parsed into the CosResult structure. For more information, see Troubleshooting.

Querying Image Moderation Job Result

Feature description

This API is used to submit an image moderation job.

Method prototype

CosResult DescribeImageAuditingJob(const DescribeImageAuditingJobReq &req, DescribeImageAuditingJobResp *resp);

Sample request

qcloud_cos::CosConfig config("./config.json");
qcloud_cos::CosAPI cos(config);
std::string bucket_name = "examplebucket-1250000000";

DescribeImageAuditingJobReq req(bucket_name);
DescribeImageAuditingJobResp resp;

// Add request parameters as detailed in the API documentation
req.SetJobId("vab1ca9fc8a3ed11ea834c525400863904");

// Call the API to get the job response object
CosResult result = cos.DescribeImageAuditingJob(req, &resp);
if (result.IsSucc()) {
// If the moderation job is created successfully, you can call the member functions of `DescribeImageAuditingJobResp`.
} else {
// If the moderation job failed to be created, you can call the member functions of `CosResult` to output the error message.
}

Parameter description

Parameter
Description
Type
Required
req
DescribeImageAuditingJob operation request
DescribeImageAuditingJobReq
Yes
resp
DescribeImageAuditingJob operation response
DescribeImageAuditingJobResp
Yes
DescribeVideoAuditingJobReq provides the following member functions:
// Set the bucket for performing the operation
void SetBucketName(const std::string& bucket_name);
// Set the ID of the moderation job to be queried
void SetJobId(const std::string& job_id);
DescribeVideoAuditingJobResp provides the following member functions:
// Get the job details returned by the API request
ImageAuditingJobsDetail GetJobsDetail();
// Get the `RequestId` returned by the API
std::string GetRequestId();


Response description

Success: The moderation job result in the XML content returned by the API will be parsed into the ImageAuditingJobsDetail structure. For specific response parameters, see Querying Image Moderation Job Result.
Failure: If an error (for example, the bucket does not exist) occurs, the error message will be parsed into the CosResult structure. For more information, see Troubleshooting.

도움말 및 지원

문제 해결에 도움이 되었나요?

피드백