

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

# 콘텐츠 조절
<a name="moderation"></a>

Amazon Rekognition을 사용하여 부적절하거나 원치 않거나 불쾌감을 주는 콘텐츠를 탐지할 수 있습니다. 소셜 미디어, 방송 미디어, 광고 및 전자 상거래 현장에서 Rekognition 조절 API를 사용하여 보다 안전한 사용자 경험을 제공하고, 광고주에게 브랜드 안전을 보증하고, 현지 및 글로벌 규정을 준수할 수 있습니다.

오늘날 많은 회사가 제3자 또는 사용자 제작 콘텐츠를 검토할 때 전적으로 인간 모더레이터의 도움을 받기도 하지만 어떤 회사들은 단순히 사용자 불만에 대응하여 불쾌하거나 부적절한 이미지, 광고 또는 동영상을 삭제하기도 합니다. 그러나 인간 모더레이터만으로는 이러한 요구를 충분한 품질 또는 속도로 충족할 수 있도록 규모를 확장할 수 없기 때문에 사용자 경험이 열악해지고 규모 조절에 많은 비용이 들거나 심지어 브랜드 평판이 손상될 수도 있습니다. 이미지 및 동영상 조절에 Rekognition을 사용하면 인간 모더레이터는 기계 학습에 의해 이미 표시된 훨씬 적은 양의 콘텐츠(일반적으로 전체 양의 1\$15%)를 검토할 수 있습니다. 이를 통해 보다 가치 있는 활동에 집중하면서도 기존보다 훨씬 적은 비용으로 폭넓은 조절 범위를 확보할 수 있습니다. 작업 인력을 구축하고 인적 검토 작업을 수행하기 위해 Rekognition과 이미 통합된 Amazon Augmented AI를 사용할 수 있습니다.

사용자 지정 조절 기능을 사용하여 딥 러닝 조절 모델의 정확도를 향상시킬 수 있습니다. 사용자 지정 조절을 사용하여 이미지를 업로드하고 주석을 달아 사용자 지정 조절 어댑터를 훈련시키게 됩니다. 그런 다음 훈련된 어댑터를 [DetectModerationLabels](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_DetectModerationLabels.html) 작업에 제공하여 이미지에서의 성능을 향상시킬 수 있습니다. 자세한 정보는 [사용자 지정 조절을 통한 정확도 향상](moderation-custom-moderation.md)을 참조하세요.

**Rekognition 콘텐츠 조절 작업에서 지원하는 레이블**
+ 조절 레이블 목록을 다운로드하려면 [여기](samples/rekognition-moderation-labels.zip)를 클릭합니다.

**Topics**
+ [이미지 및 비디오 조절 API 사용](moderation-api.md)
+ [콘텐츠 조절 버전 7 테스트 및 API 응답 변환](moderation-response-transform.md)
+ [부적절한 이미지 감지](procedure-moderate-images.md)
+ [부적절한 저장된 동영상 탐지](procedure-moderate-videos.md)
+ [사용자 지정 조절을 통한 정확도 향상](moderation-custom-moderation.md)
+ [Amazon Augmented AI를 사용한 부적절한 콘텐츠 검토](a2i-rekognition.md)

다음 다이어그램은 콘텐츠 조절의 이미지 또는 비디오 구성 요소 사용 목표에 따른 직접 호출 작업 순서를 보여줍니다.

![\[이미지 및 비디오 조절 단계를 보여주는 흐름도입니다.\]](http://docs.aws.amazon.com/ko_kr/rekognition/latest/dg/images/Moderation workflow.png)


# 이미지 및 비디오 조절 API 사용
<a name="moderation-api"></a>

Amazon Rekognition Image API에서 [DetectModerationLabels](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_DetectModerationLabels.html)를 사용하여 부적절하거나 원치 않거나 불쾌감을 주는 콘텐츠를 동기적으로 감지하고 [StartMediaAnalysisJob](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_StartMediaAnalysisJob.html) 및 [GetMediaAnalysisJob](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_GetMediaAnalysisJob.html) 작업을 사용하여 비동기적으로 감지할 수 있습니다. Amazon Rekognition Video API를 사용하면 [StartContentModeration](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_StartContentModeration.html) 및 [GetContentModeration](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_GetContentModeration.html) 작업을 사용하여 이러한 콘텐츠를 비동기적으로 탐지할 수 있습니다.

## 레이블 카테고리
<a name="moderation-api-categories"></a>

Amazon Rekognition은 3단계 계층적 분류법을 사용하여 부적절하거나 원치 않거나 불쾌감을 주는 콘텐츠의 카테고리에 레이블을 지정합니다. 분류 수준 1(L1)이 있는 각 레이블에는 여러 분류 수준 2 레이블(L2)이 있으며, 일부 분류 수준 2 레이블에는 분류 수준 3 레이블(L3)이 있을 수 있습니다. 이렇게 하면 콘텐츠의 계층적 분류가 가능합니다.

감지된 각 조절 레이블에 대해 API는 레이블이 속한 수준(1, 2 또는 3)이 포함된 `TaxonomyLevel`도 반환합니다. 예를 들어 이미지는 다음 카테고리에 따라 레이블이 지정될 수 있습니다.

L1: 은밀한 부분의 비노골적 누드 및 키스, L2: 비노골적 누드, L3: 암시적 누드.

**참고**  
 L1 또는 L2 카테고리를 사용하여 콘텐츠를 조절하고, L3 카테고리를 사용하여 조절하지 않으려는 특정 개념을 제거하는 것이 좋습니다(즉, 조절 정책에 따라 부적절하거나 원치 않거나 불쾌감을 주는 콘텐츠로 분류하지 않으려는 콘텐츠 감지).

 다음 표에는 카테고리 수준과 각 수준에 대해 가능한 레이블 간의 관계가 나와 있습니다. 조절 레이블 목록을 다운로드하려면 [여기](samples/rekognition-moderation-labels.zip)를 클릭합니다.


| 
| 
| 최상위 카테고리(L1) | 2단계 카테고리(L2) | 3단계 카테고리(L3) | 정의 | 
| --- |--- |--- |--- |
| Explicit | Explicit Nudity | Exposed Male Genitalia | Human male genitalia, including the penis (whether erect or flaccid), the scrotum, and any discernible pubic hair. This term is applicable in contexts involving sexual activity or any visual content where male genitals are displayed either completely or partially. | 
| Exposed Female Genitalia | External parts of the female reproductive system, encompassing the vulva, vagina, and any observable pubic hair. This term is applicable in scenarios involving sexual activity or any visual content where these aspects of female anatomy are displayed either completely or partially. | 
| Exposed Buttocks or Anus | Human buttocks or anus, including instances where the buttocks are nude or when they are discernible through sheer clothing. The definition specifically applies to situations where the buttocks or anus are directly and completely visible, excluding scenarios where any form of underwear or clothing provides complete or partial coverage. | 
| Exposed Female Nipple | Human female nipples, including fully visible and partially visible aerola (area surrounding the nipples) and nipples. | 
| Explicit Sexual Activity | N/A | Depiction of actual or simulated sexual acts which encompasses human sexual intercourse, oral sex, as well as male genital stimulation and female genital stimulation by other body parts and objects. The term also includes ejaculation or vaginal fluids on body parts and erotic practices or roleplaying involving bondage, discipline, dominance and submission, and sadomasochism. | 
| Sex Toys | N/A | Objects or devices used for sexual stimulation or pleasure, e.g., dildo, vibrator, butt plug, beats, etc. | 
| Non-Explicit Nudity of Intimate parts and Kissing | Non-Explicit Nudity | Bare Back | Human posterior part where the majority of the skin is visible from the neck to the end of the spine. This term does not apply when the individual's back is partially or fully occluded. | 
| Exposed Male Nipple | Human male nipples, including partially visible nipples.  | 
| Partially Exposed Buttocks | Partially exposed human buttocks. This term includes a partially visible region of the buttocks or butt cheeks due to short clothes, or partially visible top portion of the anal cleft. The term does not apply to cases where the buttocks is fully nude. | 
| Partially Exposed Female Breast | Partially exposed human female breast where one a portion of the female's breast is visible or uncovered while not revealing the entire breast. This term applies when the region of the inner breast fold is visible or when the lower breast crease is visible with nipple fully covered or occluded. | 
| Implied Nudity | An individual who is nude, either topless or bottomless, but with intimate parts such as buttocks, nipples, or genitalia covered, occluded, or not fully visible. | 
| Obstructed Intimate Parts | Obstructed Female Nipple | Visual depiction of a situation in which a female's nipples is covered by opaque clothing or coverings, but their shapes are clearly visible.  | 
| Obstructed Male Genitalia | Visual depiction of a situation in which a male's genitalia or penis is covered by opaque clothing or coverings, but its shape is clearly visible. This term applies when the obstructed genitalia in the image is in close-up. | 
| Kissing on the Lips | N/A | Depiction of one person's lips making contact with another person's lips. | 
| Swimwear or Underwear | Female Swimwear or Underwear | N/A | Human clothing for female swimwear (e.g., one-piece swimsuits, bikinis, tankinis, etc.) and female underwear (e.g., bras, panties, briefs, lingerie, thongs, etc.) | 
| Male Swimwear or Underwear | N/A | Human clothing for male swimwear (e.g., swim trunks, boardshorts, swim briefs, etc.) and male underwear (e.g., briefs, boxers, etc.) | 
| Violence | Weapons | N/A | Instruments or devices used to cause harm or damage to living beings, structures, or systems. This includes firearms (e.g., guns, rifles, machine gunes, etc.), sharp weapons (e.g., swords, knives, etc.), explosives and ammunition (e.g., missile, bombs, bullets, etc.). | 
| Graphic Violence | Weapon Violence | The use of weapons to cause harm, damage, injury, or death to oneself, other individuals, or properties. | 
| Physical Violence | The act of causing harm to other individuals or property (e.g., hitting, fighting, pulling hair, etc.) or other act of violence involving crowd or multiple individuals. | 
| Self-Harm | The act of causing harm to oneself, often by cutting body parts such as arms or legs, where cuts are typically visible. | 
| Blood & Gore | Visual representation of violence on a person, a group of individuals, or animals, involving open wounds, bloodshed, and mutilated body parts. | 
| Explosions and Blasts | Depiction of a violent and destructive burst of intense flames with thick smoke or dust and smoke erupting from the ground. | 
| Visually Disturbing | Death and Emaciation | Emaciated Bodies | Human bodies that are extremely thin and undernourished with severe physical wasting and depletion of muscle and fat tissue. | 
| Corpses | Human corpses in the form of mutilated bodies, hanging corpses, or skeletons. | 
| Crashes | Air Crash | Incidents of air vehicles, such as airplanes, helicopters, or other flying vehicles, resulting in damage, injury, or death. This term applies when parts of the air vehicles are visible. | 
| Drugs & Tobacco | Products | Pills | Small, solid, often round or oval-shaped tables or capsules. This term applies to pills presented as standalones, in a bottle, or a transparent packet and does not apply to a visual depiction of a person taking pills. | 
| Drugs & Tobacco Paraphernalia & Use | Smoking | The act of inhaling, exhaling, and lighting up burning substances including cigarettes, cigars, e-cigarettes, hookah, or joint. | 
| Alcohol | Alcohol Use | Drinking | The act of drinking alcoholic beverages from bottles or glasses of alcohol or liquor. | 
| Alcoholic Beverages | N/A | Close up of one or multiple bottles of alcohol or liquor, glasses or mugs with alcohol or liquor, and glasses or mugs with alcohol or liquor held by an individual. This term does not apply to an individual drinking from bottles or glasses of alcohol or liquor. | 
| Rude Gestures | Middle Finger | N/A | Visual depiction of a hand gesture with middle finger is extended upward while the other fingers are folded down. | 
| Gambling | N/A | N/A | The act of participating in games of chance for a chance to win a prize in casinos, e.g., playing cards, blackjacks, roulette, slot machines at casinos, etc. | 
| Hate Symbols | Nazi Party | N/A | Visual depiction of symbols, flags, or gestures associated with Nazi Party. | 
| White Supremacy | N/A | Visual depiction of symbols or clothings associated with Ku Klux Klan (KKK) and images with confederate flags. | 
| Extremist | N/A | Images containing extremist and terrorist group flags. | 

L3 카테고리에서 지원되는 레이블이 L2 카테고리의 모든 레이블에 있는 것은 아닙니다. 또한 ‘제품’ 및 ‘약물 및 담배 관련 용품 및 사용’ L2 레이블 아래의 L3 레이블은 전체가 아닙니다. 이러한 L2 레이블은 언급된 L3 레이블 이외의 개념을 다루며, 이러한 경우 API 응답에는 L2 레이블만 반환됩니다.

애플리케이션에 대한 콘텐츠 적합성을 결정합니다. 예를 들어 선정적인 성격의 이미지는 허용하되 누드가 포함된 이미지는 허용하지 않을 수 있습니다. 이미지를 필터링하려면 `DetectModerationLabels`(이미지) 및 `GetContentModeration`(비디오)에서 반환하는 [ModerationLabel](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_ModerationLabel.html) 레이블 배열을 사용합니다.

## 콘텐츠 유형
<a name="moderation-api-content-type"></a>

API는 애니메이션 또는 일러스트 콘텐츠 유형을 식별할 수도 있으며, 해당 콘텐츠 유형은 응답의 일부로 반환됩니다.
+ 애니메이션 콘텐츠에는 비디오 게임 및 애니메이션(예: 카툰, 만화, 망가, 애니메이션)이 포함됩니다.
+ 일러스트 콘텐츠에는 그림, 페인팅, 스케치가 포함됩니다.

## 신뢰도
<a name="moderation-api-confidence"></a>

`MinConfidence` 입력 파라미터를 지정하여 부적절한 콘텐츠를 감지하기 위해 Amazon Rekognition에서 사용하는 신뢰도 임계값을 설정할 수 있습니다. `MinConfidence`보다 신뢰도가 낮은 것으로 감지된 부적절한 콘텐츠의 레이블은 반환되지 않습니다.

50% 미만인 `MinConfidence`의 값을 지정할 경우 수많은 오탐 결과를 반환할 가능성이 있습니다(즉, 높은 재현률, 낮은 정밀도). 반면, 50%를 초과하는 `MinConfidence`를 지정하면 더 적은 수의 오탐 결과를 반환할 가능성이 높습니다(즉, 낮은 재현률, 높은 정밀도). `MinConfidence` 값을 지정하지 않은 경우 Amazon Rekognition에서 신뢰도 50% 이상으로 감지된 부적절한 콘텐츠의 레이블을 반환합니다.

`ModerationLabel` 배열에는 이전 범주의 레이블 및 인식된 콘텐츠의 정확성에 대한 추정된 신뢰도가 포함되어 있습니다. 식별된 모든 2단계 레이블과 함께 최상위 레이블이 반환됩니다. 예를 들어 Amazon Rekognition에서 신뢰도 점수가 높은 “노골적 나체”를 최상위 레이블로 반환할 수 있습니다. 이는 사용자의 필터링 요건을 충족시키는데 충분할 수 있습니다. 이것으로 필터링에 충분할 수 있지만, 필요하다면 "부분적 누드" 같은 2단계 레이블의 신뢰도 점수를 사용하여 더 세분화된 필터링을 할 수도 있습니다. 예제는 [부적절한 이미지 감지](procedure-moderate-images.md) 섹션을 참조하세요.

## 버전 관리
<a name="moderation-api-versioning"></a>

Amazon Rekognition Image와 Amazon Rekognition Video는 모두 부적절한 콘텐츠를 탐지하는 데 사용되는 조절 탐지 모델 버전(`ModerationModelVersion`)을 반환합니다.

## 정렬 및 집계
<a name="moderation-api-sorting-aggregating"></a>

GetContentModeration을 사용하여 결과를 검색할 때 결과를 정렬하고 집계할 수 있습니다.

**Sort order** - 반환된 레이블의 배열은 시간별로 정렬됩니다. 레이블별로 정렬하려면, `GetContentModeration`에서 `SortBy` 입력 파라미터에 `NAME`를 지정하십시오. 레이블이 비디오에 여러 번 나오는 경우 `ModerationLabel` 요소의 인스턴스가 여러 개 있습니다.

**Label information** - ModerationLabels 배열 요소에는 `ModerationLabel` 객체가 포함되어 있는데 이는 감지된 레이블 이름과 Amazon Rekognition이 그에 대해 가지는 정확성 신뢰도를 포함합니다. 타임스탬프는 `ModerationLabel`이 감지된 시간으로, 비디오 시작 이후 경과된 밀리초 단위의 시간으로 정의됩니다. 비디오 `SEGMENTS`별로 집계된 결과의 경우 세그먼트의 시작 시간, 종료 시간, 지속 시간을 각각 정의하는 `StartTimestampMillis`, `EndTimestampMillis`, `DurationMillis` 구조가 반환됩니다.

 **Aggregation** - 결과가 반환될 때 집계되는 방식을 지정합니다. 기본값은 `TIMESTAMPS` 기준 집계입니다. 일정 기간 동안의 결과를 집계하는 `SEGMENTS` 집계 기준을 선택할 수도 있습니다. 세그먼트 내에서 감지된 레이블만 반환됩니다.

## 사용자 지정 조절 어댑터 상태
<a name="moderation-api-statuses"></a>

사용자 지정 조정 어댑터는 TRAINING\$1IN\$1PROGRESS, TRAINING\$1COMPLETED, TRAINING\$1FAILED, DELETING, DEPRECATED 또는 EXPIRED 상태 중 하나일 수 있습니다. 이러한 어댑터 상태에 대한 자세한 설명은 [어댑터 관리](https://docs.aws.amazon.com/rekognition/latest/dg/managing-adapters.html)를 참조하세요.

**참고**  
Amazon Rekognition은 부적절하거나 불쾌감을 주는 콘텐츠에 대해 공신력이 없으며, 어떤 식으로든 그러한 콘텐츠의 철저한 필터라고 주장하지 않습니다. 추가로 이미지 및 비디오 조절 API는 CSAM과 같은 불법 콘텐츠가 이미지에 포함되어 있는지 여부를 감지하지 않습니다.

# 콘텐츠 조절 버전 7 테스트 및 API 응답 변환
<a name="moderation-response-transform"></a>

Rekognition은 콘텐츠 조절 레이블 감지 기능의 이미지 비디오 구성 요소에 대한 기계 학습 모델을 버전 6.1에서 7로 업데이트했습니다. 이 업데이트는 전반적인 정확도를 향상시켰으며 다른 카테고리 수정과 함께 몇 가지 새로운 카테고리를 도입했습니다.

현재 버전 6.1의 비디오 사용자인 경우 버전 7로 원활하게 전환하려면 다음 작업을 수행하는 것이 좋습니다.

1.  AWS 프라이빗 SDK([AWS 콘텐츠 조절 버전 7용 SDK 및 사용 설명서](moderation-labels-update-sdk.md) 참조)를 다운로드하고 사용하여 StartContentModeration API를 직접 호출합니다.

1. API 응답 또는 콘솔에 반환된 레이블 및 신뢰도 점수의 업데이트된 목록을 검토합니다. 필요에 따라 애플리케이션 사후 처리 로직을 조정합니다.

1.  계정은 2024년 5월 13일까지 버전 6.1로 유지됩니다. 2024년 5월 13일 이후 버전 6.1을 사용하려면 2024년 4월 30일까지 [AWS Support 팀](https://aws.amazon.com/support)에 문의하여 연장을 요청하세요. 2024년 6월 10일까지 버전 6.1을 유지하도록 계정을 확장할 수 있습니다. 2024년 4월 30일까지 사용자가 연락하지 않으면 2024년 5월 13일부터 계정이 버전 7.0으로 자동으로 마이그레이션됩니다.

# AWS 콘텐츠 조절 버전 7용 SDK 및 사용 설명서
<a name="moderation-labels-update-sdk"></a>

 선택한 개발 언어에 해당하는 SDK를 다운로드하고 해당 사용 설명서를 참조하세요.




| 
| 
| SDK 링크 | 설치 / 사용 설명서 | 
| --- |--- |
| [Java-1.X](https://d1m67pwji3rslw.cloudfront.net/sdk/aws_rekognition_java_v1.jar) | [가이드 - Java 1.pdf](https://d1m67pwji3rslw.cloudfront.net/guide/Guide_Java1.x.pdf) | 
| [Java-2.X](https://d1m67pwji3rslw.cloudfront.net/sdk/aws_rekognition_java_v2.jar) | [가이드 - Java 2.pdf](https://d1m67pwji3rslw.cloudfront.net/guide/Guide_Java2.x.pdf) | 
| [JavaScript v2](https://d1m67pwji3rslw.cloudfront.net/sdk/aws_rekognition_js_v2.tgz) | [가이드 - JavaScript v2.pdf](https://d1m67pwji3rslw.cloudfront.net/guide/Guide_JavaScriptV2.pdf) | 
|  [JavaScript v3](https://d1m67pwji3rslw.cloudfront.net/sdk/aws_rekognition_js_v3.zip) |  [가이드 - JavaScript v3.pdf](https://d1m67pwji3rslw.cloudfront.net/guide/Guide_JavaScriptV3.pdf) | 
| [Python](https://d1m67pwji3rslw.cloudfront.net/sdk/aws_rekognition_python.zip) | [가이드 - Python & AWS CLI.pdf](https://d1m67pwji3rslw.cloudfront.net/guide/Guide_Python.pdf) | 
| [Ruby](https://d1m67pwji3rslw.cloudfront.net/sdk/aws_rekognition_ruby.zip) | [가이드 - RubyV3.pdf](https://d1m67pwji3rslw.cloudfront.net/guide/Guide_RubyV3.pdf) | 
| [go\$1v1](https://d1m67pwji3rslw.cloudfront.net/sdk/aws_rekognition_go_v1.zip) | [가이드 - GO V1.pdf](https://d1m67pwji3rslw.cloudfront.net/guide/Guide_GoV1.pdf) | 
| [go\$1v2](https://d1m67pwji3rslw.cloudfront.net/sdk/aws_rekognition_go_v2.zip) | [가이드 - GO V2.pdf](https://d1m67pwji3rslw.cloudfront.net/guide/Guide_GoV2.pdf) | 
| [DotNet](https://d1m67pwji3rslw.cloudfront.net/sdk/aws_rekognition_dotnet.zip) | [가이드 - .NET.pdf](https://d1m67pwji3rslw.cloudfront.net/guide/Guide_DotNET.pdf) | 
| [php](https://d1m67pwji3rslw.cloudfront.net/sdk/aws_rekognition_php.zip) | [가이드 - PHP.pdf](https://d1m67pwji3rslw.cloudfront.net/guide/Guide_PHP.pdf) | 

## 버전 6.1에서 7로 레이블 매핑
<a name="moderation-labels-transform-schema"></a>

콘텐츠 조절 버전 7은 새 레이블 카테고리를 추가하고 이전의 레이블 이름을 수정했습니다. 6.1 레이블을 7 레이블에 매핑하는 방법을 결정할 때는 [레이블 카테고리](moderation-api.md#moderation-api-categories)의 분류표를 참조하세요.

일부 레이블 매핑 예제는 다음 섹션에서 확인할 수 있습니다. 애플리케이션의 사후 처리 로직을 기반으로 필요한 업데이트를 수행하기 전에 이러한 매핑과 레이블 정의를 검토하는 것이 좋습니다.

**L1 매핑 스키마**

최상위 카테고리(L1)(예: `Explicit Nudity`, `Suggestive` `Violence` 등)에서만 필터링하는 사후 처리 로직을 사용하는 경우 아래 표를 참조하여 코드를 업데이트하세요.


| 
| 
| V6.1 L1 | V7 L1 | 
| --- |--- |
| Explicit Nudity | Explicit | 
| Suggestive | Non-Explicit Nudity of Intimate parts and Kissing | 
| Swimwear or Underwear | 
| Violence | Violence | 
| Visually Disturbing | Visually Disturbing | 
| Rude Gestures | Rude Gestures | 
| Drugs | Drugs & Tobacco | 
| Tobacco | Drugs & Tobacco | 
| Alcohol | Alcohol | 
| Gambling | Gambling | 
| Hate Symbols | Hate Symbols | 

**L2 매핑 스키마**

L1 및 L2 카테고리(예: `Explicit Nudity / Nudity, Suggestive / Female Swimwear Or Underwear`, `Violence / Weapon Violence` 등)를 모두 필터링하는 사후 처리 로직을 사용하는 경우 아래 표를 참조하여 코드를 업데이트하세요.


| 
| 
| V6.1 L1 | V6.1 L2 | V7 L1 | V7 L2 | V7 L3 | V7 ContentTypes | 
| --- |--- |--- |--- |--- |--- |
| Explicit Nudity | Nudity | Explicit | Explicit Nudity | 여성 유두 노출 둔부 또는 항문 노출 | 
| Graphic Male Nudity | Explicit | Explicit Nudity | Exposed Male Genitalia | 
| Graphic Female Nudity | Explicit | Explicit Nudity | Exposed Female Genitalia | 
| Sexual Activity | Explicit | Explicit Sexual Activity |  |  | 
| Illustrated Explicit Nudity | Explicit | Explicit Nudity |  | Map to "Animated" and "Illustrated" | 
| Illustrated Explicit Nudity | Explicit | Explicit Sexual Activity |  | Map to "Animated" and "Illustrated" | 
| Adult Toys | Explicit | Sex Toys |  | 
| Suggestive | Female Swimwear Or Underwear | Swimwear or Underwear | Female Swimwear or Underwear |  | 
| Male Swimwear Or Underwear | Swimwear or Underwear | Male Swimwear or Underwear |  | 
| Partial Nudity | Non-Explicit Nudity of Intimate parts and Kissing | Non-Explicit Nudity | Implied Nudity | 
| Barechested Male | Non-Explicit Nudity of Intimate parts and Kissing | Non-Explicit Nudity | Exposed Male Nipple | 
| Revealing Clothes | Non-Explicit Nudity of Intimate parts and Kissing | Non-Explicit Nudity |  | 
| Non-Explicit Nudity of Intimate parts and Kissing | Obstructed Intimate Parts |  | 
| Sexual Situations | Non-Explicit Nudity of Intimate parts and Kissing | Kissing on the Lips |  | 
| Violence | Graphic Violence Or Gore | Violence | Graphic Violence | Blood & Gore | 
| Physical Violence | Violence | Graphic Violence | Physical Violence | 
| Weapon Violence | Violence | Graphic Violence | Weapon Violence | 
| Weapons | Violence | Weapons |  | 
| Self Injury | Violence | Graphic Violence | Self-Harm | 
| Visually Disturbing | Emaciated Bodies | Visually Disturbing | Death and Emaciation | Emaciated Bodies | 
| Corpses | Visually Disturbing | Death and Emaciation | Corpses | 
| Hanging | Visually Disturbing | Death and Emaciation | Corpses | 
| Air Crash | Visually Disturbing | Crashes | Air Crash | 
| Explosions And Blasts | Violence | Graphic Violence | Explosions and Blasts | 
| Rude Gestures | Middle Finger | Rude Gestures | Middle Finger |  | 
| Drugs | Drug Products | Drugs & Tobacco | Products |  | 
| Drug Use | Drugs & Tobacco | Drugs & Tobacco Paraphernalia & Use |  | 
| Pills | Drugs & Tobacco | Products | Pills | 
| Drug Paraphernalia | Drugs & Tobacco | Drugs & Tobacco Paraphernalia & Use |  | 
| Tobacco | Tobacco Products | Drugs & Tobacco | Products |  | 
| Smoking | Drugs & Tobacco | Drugs & Tobacco Paraphernalia & Use | Smoking | 
| Alcohol | Drinking | Alcohol | Alcohol Use | Drinking | 
| Alcoholic Beverages | Alcohol | Alcoholic Beverages |  | 
| Gambling | Gambling | Gambling |  |  | 
| Hate Symbols | Nazi Party | Hate Symbols | Nazi Party |  | 
| White Supremacy | Hate Symbols | White Supremacy |  | 
| Extremist | Hate Symbols | Extremist |  | 

# 부적절한 이미지 감지
<a name="procedure-moderate-images"></a>

[DetectModerationLabels](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_DetectModerationLabels.html) 작업을 사용하여 이미지에 부적절하거나 불쾌감을 주는 콘텐츠가 포함되어 있는지 확인할 수 있습니다. Amazon Rekognition의 조절 레이블 목록은 [이미지 및 비디오 조절 API 사용](https://docs.aws.amazon.com/rekognition/latest/dg/moderation.html#moderation-api)을 참조하세요.



## 이미지에서 부적절한 콘텐츠 감지
<a name="moderate-images-sdk"></a>

이미지는 .jpg 또는 .png 형식이어야 합니다. 입력 이미지를 이미지 바이트 배열(base64 인코딩 이미지 바이트)로 제공하거나 Amazon S3 객체를 지정할 수 있습니다. 이 절차에서는 이미지(.jpg 또는 .png)를 S3 버킷에 업로드합니다.

이러한 절차를 실행하려면 AWS CLI 또는 적절한 AWS SDK가 설치되어 있어야 합니다. 자세한 내용은 [Amazon Rekognition 시작](getting-started.md) 단원을 참조하십시오. 사용할 AWS 계정은 Amazon Rekognition API에 대한 액세스 권한을 가지고 있어야 합니다. 자세한 내용은 [Amazon Rekognition에서 정의한 작업](https://docs.aws.amazon.com/IAM/latest/UserGuide/list_amazonrekognition.html#amazonrekognition-actions-as-permissions)을 참조하세요.

**이미지에서 조정 레이블(SDK)을 감지하려면**

1. 아직 설정하지 않았다면 다음과 같이 하세요.

   1. `AmazonRekognitionFullAccess` 권한과 `AmazonS3ReadOnlyAccess` 권한을 가진 사용자를 생성하거나 업데이트합니다. 자세한 내용은 [1단계: AWS 계정 설정 및 사용자 생성](setting-up.md#setting-up-iam) 단원을 참조하십시오.

   1.  AWS CLI 및 AWS SDKs를 설치하고 구성합니다. 자세한 내용은 [2단계: AWS CLI 및 AWS SDKs 설정](setup-awscli-sdk.md) 단원을 참조하십시오.

1. S3 버킷에 이미지를 업로드합니다.

   이에 관한 지침은 *Amazon Simple Storage Service 사용 설명서*에서 [Amazon S3에 객체 업로드](https://docs.aws.amazon.com/AmazonS3/latest/userguide/UploadingObjectsintoAmazonS3.html)를 참조하세요.

1. 다음 예제를 사용하여 `DetectModerationLabels` 작업을 호출합니다.

------
#### [ Java ]

   이 예제는 감지된 부적절한 콘텐츠의 레이블 이름, 신뢰도 수준 및 감지된 조절 레이블의 상위 레이블을 출력합니다.

   `amzn-s3-demo-bucket` 및 `photo` 값을 2단계에서 사용한 S3 버킷 이름과 이미지 파일 이름으로 바꿉니다.

   ```
   //Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
   //PDX-License-Identifier: MIT-0 (For details, see https://github.com/awsdocs/amazon-rekognition-developer-guide/blob/master/LICENSE-SAMPLECODE.)
   
   package aws.example.rekognition.image;
   import com.amazonaws.services.rekognition.AmazonRekognition;
   import com.amazonaws.services.rekognition.AmazonRekognitionClientBuilder;
   import com.amazonaws.services.rekognition.model.AmazonRekognitionException;
   import com.amazonaws.services.rekognition.model.DetectModerationLabelsRequest;
   import com.amazonaws.services.rekognition.model.DetectModerationLabelsResult;
   import com.amazonaws.services.rekognition.model.Image;
   import com.amazonaws.services.rekognition.model.ModerationLabel;
   import com.amazonaws.services.rekognition.model.S3Object;
   
   import java.util.List;
   
   public class DetectModerationLabels
   {
      public static void main(String[] args) throws Exception
      {
         String photo = "input.jpg";
         String bucket = "bucket";
         
         AmazonRekognition rekognitionClient = AmazonRekognitionClientBuilder.defaultClient();
         
         DetectModerationLabelsRequest request = new DetectModerationLabelsRequest()
           .withImage(new Image().withS3Object(new S3Object().withName(photo).withBucket(bucket)))
           .withMinConfidence(60F);
         try
         {
              DetectModerationLabelsResult result = rekognitionClient.detectModerationLabels(request);
              List<ModerationLabel> labels = result.getModerationLabels();
              System.out.println("Detected labels for " + photo);
              for (ModerationLabel label : labels)
              {
                 System.out.println("Label: " + label.getName()
                  + "\n Confidence: " + label.getConfidence().toString() + "%"
                  + "\n Parent:" + label.getParentName());
             }
          }
          catch (AmazonRekognitionException e)
          {
            e.printStackTrace();
          }
       }
   }
   ```

------
#### [ Java V2 ]

   이 코드는 AWS 설명서 SDK 예제 GitHub 리포지토리에서 가져온 것입니다. 전체 예제는 [여기](https://github.com/awsdocs/aws-doc-sdk-examples/blob/master/javav2/example_code/rekognition/src/main/java/com/example/rekognition/DetectModerationLabels.java)에서 확인하세요.

   ```
   //snippet-start:[rekognition.java2.recognize_video_text.import]
   //snippet-start:[rekognition.java2.detect_mod_labels.import]
   import software.amazon.awssdk.auth.credentials.ProfileCredentialsProvider;
   import software.amazon.awssdk.core.SdkBytes;
   import software.amazon.awssdk.regions.Region;
   import software.amazon.awssdk.services.rekognition.RekognitionClient;
   import software.amazon.awssdk.services.rekognition.model.RekognitionException;
   import software.amazon.awssdk.services.rekognition.model.Image;
   import software.amazon.awssdk.services.rekognition.model.DetectModerationLabelsRequest;
   import software.amazon.awssdk.services.rekognition.model.DetectModerationLabelsResponse;
   import software.amazon.awssdk.services.rekognition.model.ModerationLabel;
   import java.io.FileInputStream;
   import java.io.FileNotFoundException;
   import java.io.InputStream;
   import java.util.List;
   //snippet-end:[rekognition.java2.detect_mod_labels.import]
   
   /**
   * Before running this Java V2 code example, set up your development environment, including your credentials.
   *
   * For more information, see the following documentation topic:
   *
   * https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/get-started.html
   */
   public class ModerateLabels {
   
    public static void main(String[] args) {
   
        final String usage = "\n" +
            "Usage: " +
            "   <sourceImage>\n\n" +
            "Where:\n" +
            "   sourceImage - The path to the image (for example, C:\\AWS\\pic1.png). \n\n";
   
        if (args.length < 1) {
            System.out.println(usage);
            System.exit(1);
        }
   
        String sourceImage = args[0];
        Region region = Region.US_WEST_2;
        RekognitionClient rekClient = RekognitionClient.builder()
            .region(region)
            .credentialsProvider(ProfileCredentialsProvider.create("profile-name"))
            .build();
   
        detectModLabels(rekClient, sourceImage);
        rekClient.close();
    }
   
    // snippet-start:[rekognition.java2.detect_mod_labels.main]
    public static void detectModLabels(RekognitionClient rekClient, String sourceImage) {
   
        try {
            InputStream sourceStream = new FileInputStream(sourceImage);
            SdkBytes sourceBytes = SdkBytes.fromInputStream(sourceStream);
            Image souImage = Image.builder()
                .bytes(sourceBytes)
                .build();
   
            DetectModerationLabelsRequest moderationLabelsRequest = DetectModerationLabelsRequest.builder()
                .image(souImage)
                .minConfidence(60F)
                .build();
   
            DetectModerationLabelsResponse moderationLabelsResponse = rekClient.detectModerationLabels(moderationLabelsRequest);
            List<ModerationLabel> labels = moderationLabelsResponse.moderationLabels();
            System.out.println("Detected labels for image");
   
            for (ModerationLabel label : labels) {
                System.out.println("Label: " + label.name()
                    + "\n Confidence: " + label.confidence().toString() + "%"
                    + "\n Parent:" + label.parentName());
            }
   
        } catch (RekognitionException | FileNotFoundException e) {
            e.printStackTrace();
            System.exit(1);
        }
    }
    // snippet-end:[rekognition.java2.detect_mod_labels.main]
   ```

------
#### [ AWS CLI ]

   이 AWS CLI 명령은 `detect-moderation-labels` CLI 작업에 대한 JSON 출력을 표시합니다.

   `amzn-s3-demo-bucket` 및 `input.jpg`을 2단계에서 사용한 S3 버킷 이름과 이미지 파일 이름으로 바꿉니다. `profile_name`의 값을 개발자 프로필 이름으로 바꿉니다. 어댑터를 사용하려면 프로젝트 버전의 ARN을 `project-version` 파라미터에 제공하세요.

   ```
   aws rekognition detect-moderation-labels --image "{S3Object:{Bucket:<amzn-s3-demo-bucket>,Name:<image-name>}}" \ 
   --profile profile-name \
   --project-version "ARN"
   ```

   Windows 디바이스에서 CLI에 액세스하는 경우 작은따옴표 대신 큰따옴표를 사용하고 내부 큰따옴표는 백슬래시(즉 \$1)로 이스케이프 처리하여 발생할 수 있는 구문 분석 오류를 해결합니다. 예를 들어 다음을 참조하세요.

   ```
   aws rekognition detect-moderation-labels --image "{\"S3Object\":{\"Bucket\":\"amzn-s3-demo-bucket\",\"Name\":\"image-name\"}}" \
   --profile profile-name
   ```

------
#### [ Python ]

   이 예제는 감지된 부적절하거나 불쾌감을 주는 콘텐츠의 레이블 이름, 신뢰도 수준 및 감지된 부적절한 콘텐츠 레이블의 상위 레이블을 출력합니다.

   `main` 함수에서, `amzn-s3-demo-bucket` 및 `photo` 값을 2단계에서 사용한 S3 버킷과 이미지의 이름으로 바꿉니다. Rekognition 세션을 생성하는 라인에서 `profile_name`의 값을 개발자 프로필의 이름으로 대체합니다.

   ```
   #Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
   #PDX-License-Identifier: MIT-0 (For details, see https://github.com/awsdocs/amazon-rekognition-developer-guide/blob/master/LICENSE-SAMPLECODE.)
   
   import boto3
   
   def moderate_image(photo, bucket):
       
       session = boto3.Session(profile_name='profile-name')
       client = session.client('rekognition')
   
       response = client.detect_moderation_labels(Image={'S3Object':{'Bucket':bucket,'Name':photo}})
   
       print('Detected labels for ' + photo)
       for label in response['ModerationLabels']:
           print (label['Name'] + ' : ' + str(label['Confidence']))
           print (label['ParentName'])
       return len(response['ModerationLabels'])
   
   def main():
   
       photo='image-name'
       bucket='amzn-s3-demo-bucket'
       label_count=moderate_image(photo, bucket)
       print("Labels detected: " + str(label_count))
   
   if __name__ == "__main__":
       main()
   ```

------
#### [ .NET ]

   이 예제는 감지된 부적절하거나 불쾌감을 주는 콘텐츠의 레이블 이름, 신뢰도 수준 및 감지된 조절 레이블의 상위 레이블을 출력합니다.

   `amzn-s3-demo-bucket` 및 `photo` 값을 2단계에서 사용한 S3 버킷 이름과 이미지 파일 이름으로 바꿉니다.

   ```
   //Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
   //PDX-License-Identifier: MIT-0 (For details, see https://github.com/awsdocs/amazon-rekognition-developer-guide/blob/master/LICENSE-SAMPLECODE.)
   
   using System;
   using Amazon.Rekognition;
   using Amazon.Rekognition.Model;
   
   public class DetectModerationLabels
   {
       public static void Example()
       {
           String photo = "input.jpg";
           String bucket = "amzn-s3-demo-bucket";
   
           AmazonRekognitionClient rekognitionClient = new AmazonRekognitionClient();
   
           DetectModerationLabelsRequest detectModerationLabelsRequest = new DetectModerationLabelsRequest()
           {
               Image = new Image()
               {
                   S3Object = new S3Object()
                   {
                       Name = photo,
                       Bucket = bucket
                   },
               },
               MinConfidence = 60F
           };
   
           try
           {
               DetectModerationLabelsResponse detectModerationLabelsResponse = rekognitionClient.DetectModerationLabels(detectModerationLabelsRequest);
               Console.WriteLine("Detected labels for " + photo);
               foreach (ModerationLabel label in detectModerationLabelsResponse.ModerationLabels)
                   Console.WriteLine("Label: {0}\n Confidence: {1}\n Parent: {2}", 
                       label.Name, label.Confidence, label.ParentName);
           }
           catch (Exception e)
           {
               Console.WriteLine(e.Message);
           }
       }
   }
   ```

------

## DetectModerationLabels 작업 요청
<a name="detectmoderation-labels-operation-request"></a>

`DetectModerationLabels`에 대한 입력은 이미지입니다. 이 예제 JSON 입력에서는 Amazon S3 버킷에서 소스 이미지를 불러옵니다. `MinConfidence`는 Amazon Rekognition Image가 응답에 반환하기 위해 충족해야 할 감지된 레이블의 최소 정확성 신뢰도 수준입니다.

```
{
    "Image": {
        "S3Object": {
            "Bucket": "amzn-s3-demo-bucket",
            "Name": "input.jpg"
        }
    },
    "MinConfidence": 60
}
```

## DetectModerationLabels 작업 응답
<a name="detectmoderationlabels-operation-response"></a>

 `DetectModerationLabels`가 S3 버킷의 입력 이미지를 감지하거나, 이미지를 이미지 바이트로 직접 제공할 수 있습니다. 다음 예제는 `DetectModerationLabels` 호출로부터의 응답입니다.

다음 JSON 응답 예제에서 다음에 유의하십시오.
+ **부적절한 이미지 감지 정보** - 이 예제에서는 이미지에서 발견된 부적절하거나 불쾌감을 주는 콘텐츠의 레이블 목록을 보여줍니다. 이 목록에는 이미지에서 감지되는 최상위 레이블과 각각의 2수준 레이블이 포함됩니다.

  **레이블** – 각 레이블에는 이름, 해당 레이블이 정확한지에 대한 Amazon Rekognition의 신뢰도 추정, 상위 레이블의 이름이 있습니다. 최상위 레이블의 상위 이름은 `""`입니다.

  **레이블 신뢰도** – 각 레이블에는 레이블이 올바른지에 대해 Amazon Rekognition이 가지고 있는 백분율 신뢰도를 나타내는 0에서 100 사이의 신뢰도 값이 있습니다. API 작업 요청에서 응답으로 반환될 레이블에 필요한 신뢰도 수준을 지정합니다.

```
{
    "ModerationLabels": [
        {
            "Confidence": 99.44782257080078,
            "Name": "Smoking",
            "ParentName": "Drugs & Tobacco Paraphernalia & Use",
            "TaxonomyLevel": 3
        },
        {
            "Confidence": 99.44782257080078,
            "Name": "Drugs & Tobacco Paraphernalia & Use",
            "ParentName": "Drugs & Tobacco",
            "TaxonomyLevel": 2
        },
        {
            "Confidence": 99.44782257080078,
            "Name": "Drugs & Tobacco",
            "ParentName": "",
            "TaxonomyLevel": 1
        }
    ],
    "ModerationModelVersion": "7.0",
    "ContentTypes": [
        {
            "Confidence": 99.9999008178711,
            "Name": "Illustrated"
        }
    ]
}
```

# 부적절한 저장된 동영상 탐지
<a name="procedure-moderate-videos"></a>

Amazon Rekognition Video의 저장된 비디오 속 부적절하거나 불쾌감을 주는 콘텐츠 탐지는 비동기 작업입니다. 부적절하거나 불쾌감을 주는 콘텐츠 탐지를 시작하려면 [StartContentModeration](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_StartContentModeration.html)을 직접 호출하세요. Amazon Rekognition Video는 비디오 분석의 완료 상태를 Amazon Simple Notification Service 주제에 게시합니다. 비디오 분석이 성공적으로 완료되면, [GetContentModeration](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_GetContentModeration.html) 직접 호출을 통해 분석 결과를 가져옵니다. 비디오 분석 시작 및 결과 가져오기에 대한 자세한 내용은 [Amazon Rekognition Video 작업 직접 호출](api-video.md) 단원을 참조하십시오. Amazon Rekognition의 조절 레이블 목록은 [이미지 및 비디오 조절 API 사용](https://docs.aws.amazon.com/rekognition/latest/dg/moderation.html#moderation-api)을 참조하세요.

 이 절차는 동영상 분석 요청의 완료 상태를 가져오기 위해 Amazon Simple Queue Service 대기열을 사용하는 [Java 또는 Python으로 Amazon S3 버킷에 저장된 비디오 분석(SDK)](video-analyzing-with-sqs.md)의 코드를 확장합니다.

**Amazon S3 버킷(SDK)에 저장된 비디오에서 부적절하거나 불쾌감을 주는 콘텐츠를 탐지하려면**

1. [Java 또는 Python으로 Amazon S3 버킷에 저장된 비디오 분석(SDK)](video-analyzing-with-sqs.md)을 수행합니다.

1. 1단계에서 만든 클래스 `VideoDetect`에 다음 코드를 추가합니다.

------
#### [ Java ]

   ```
       //Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
       //PDX-License-Identifier: MIT-0 (For details, see https://github.com/awsdocs/amazon-rekognition-developer-guide/blob/master/LICENSE-SAMPLECODE.)
   
           //Content moderation ==================================================================
           private static void StartUnsafeContentDetection(String bucket, String video) throws Exception{
           
               NotificationChannel channel= new NotificationChannel()
                       .withSNSTopicArn(snsTopicArn)
                       .withRoleArn(roleArn);
               
               StartContentModerationRequest req = new StartContentModerationRequest()
                       .withVideo(new Video()
                               .withS3Object(new S3Object()
                                   .withBucket(bucket)
                                   .withName(video)))
                       .withNotificationChannel(channel);
                                    
                                    
                
                StartContentModerationResult startModerationLabelDetectionResult = rek.startContentModeration(req);
                startJobId=startModerationLabelDetectionResult.getJobId();
                
            } 
            
            private static void GetUnsafeContentDetectionResults() throws Exception{
                
                int maxResults=10;
                String paginationToken=null;
                GetContentModerationResult moderationLabelDetectionResult =null;
                
                do{
                    if (moderationLabelDetectionResult !=null){
                        paginationToken = moderationLabelDetectionResult.getNextToken();
                    }
                    
                    moderationLabelDetectionResult = rek.getContentModeration(
                            new GetContentModerationRequest()
                                .withJobId(startJobId)
                                .withNextToken(paginationToken)
                                .withSortBy(ContentModerationSortBy.TIMESTAMP)
                                .withMaxResults(maxResults));
                            
                    
           
                    VideoMetadata videoMetaData=moderationLabelDetectionResult.getVideoMetadata();
                        
                    System.out.println("Format: " + videoMetaData.getFormat());
                    System.out.println("Codec: " + videoMetaData.getCodec());
                    System.out.println("Duration: " + videoMetaData.getDurationMillis());
                    System.out.println("FrameRate: " + videoMetaData.getFrameRate());
                        
                        
                    //Show moderated content labels, confidence and detection times
                    List<ContentModerationDetection> moderationLabelsInFrames= 
                            moderationLabelDetectionResult.getModerationLabels();
                 
                    for (ContentModerationDetection label: moderationLabelsInFrames) { 
                        long seconds=label.getTimestamp()/1000;
                        System.out.print("Sec: " + Long.toString(seconds));
                        System.out.println(label.getModerationLabel().toString());
                        System.out.println();           
                    }  
                } while (moderationLabelDetectionResult !=null && moderationLabelDetectionResult.getNextToken() != null);
                
            }
   ```

   `main` 함수에서 다음 줄을 바꿉니다.

   ```
           StartLabelDetection(amzn-s3-demo-bucket, video);
   
           if (GetSQSMessageSuccess()==true)
           	GetLabelDetectionResults();
   ```

   다음으로 바꿉니다.

   ```
           StartUnsafeContentDetection(amzn-s3-demo-bucket, video);
   
           if (GetSQSMessageSuccess()==true)
           	GetUnsafeContentDetectionResults();
   ```

------
#### [ Java V2 ]

   이 코드는 AWS 설명서 SDK 예제 GitHub 리포지토리에서 가져온 것입니다. 전체 예제는 [여기](https://github.com/awsdocs/aws-doc-sdk-examples/blob/master/javav2/example_code/rekognition/src/main/java/com/example/rekognition/VideoDetectInappropriate.java)에서 확인하세요.

   ```
   import software.amazon.awssdk.regions.Region;
   import software.amazon.awssdk.services.rekognition.RekognitionClient;
   import software.amazon.awssdk.services.rekognition.model.NotificationChannel;
   import software.amazon.awssdk.services.rekognition.model.S3Object;
   import software.amazon.awssdk.services.rekognition.model.Video;
   import software.amazon.awssdk.services.rekognition.model.StartContentModerationRequest;
   import software.amazon.awssdk.services.rekognition.model.StartContentModerationResponse;
   import software.amazon.awssdk.services.rekognition.model.RekognitionException;
   import software.amazon.awssdk.services.rekognition.model.GetContentModerationResponse;
   import software.amazon.awssdk.services.rekognition.model.GetContentModerationRequest;
   import software.amazon.awssdk.services.rekognition.model.VideoMetadata;
   import software.amazon.awssdk.services.rekognition.model.ContentModerationDetection;
   import java.util.List;
   
   /**
    * Before running this Java V2 code example, set up your development
    * environment, including your credentials.
    *
    * For more information, see the following documentation topic:
    *
    * https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/get-started.html
    */
   public class VideoDetectInappropriate {
       private static String startJobId = "";
   
       public static void main(String[] args) {
   
           final String usage = """
   
                   Usage:    <bucket> <video> <topicArn> <roleArn>
   
                   Where:
                      bucket - The name of the bucket in which the video is located (for example, (for example, myBucket).\s
                      video - The name of video (for example, people.mp4).\s
                      topicArn - The ARN of the Amazon Simple Notification Service (Amazon SNS) topic.\s
                      roleArn - The ARN of the AWS Identity and Access Management (IAM) role to use.\s
                   """;
   
           if (args.length != 4) {
               System.out.println(usage);
               System.exit(1);
           }
   
           String bucket = args[0];
           String video = args[1];
           String topicArn = args[2];
           String roleArn = args[3];
           Region region = Region.US_EAST_1;
           RekognitionClient rekClient = RekognitionClient.builder()
                   .region(region)
                   .build();
   
           NotificationChannel channel = NotificationChannel.builder()
                   .snsTopicArn(topicArn)
                   .roleArn(roleArn)
                   .build();
   
           startModerationDetection(rekClient, channel, bucket, video);
           getModResults(rekClient);
           System.out.println("This example is done!");
           rekClient.close();
       }
   
       public static void startModerationDetection(RekognitionClient rekClient,
               NotificationChannel channel,
               String bucket,
               String video) {
   
           try {
               S3Object s3Obj = S3Object.builder()
                       .bucket(bucket)
                       .name(video)
                       .build();
   
               Video vidOb = Video.builder()
                       .s3Object(s3Obj)
                       .build();
   
               StartContentModerationRequest modDetectionRequest = StartContentModerationRequest.builder()
                       .jobTag("Moderation")
                       .notificationChannel(channel)
                       .video(vidOb)
                       .build();
   
               StartContentModerationResponse startModDetectionResult = rekClient
                       .startContentModeration(modDetectionRequest);
               startJobId = startModDetectionResult.jobId();
   
           } catch (RekognitionException e) {
               System.out.println(e.getMessage());
               System.exit(1);
           }
       }
   
       public static void getModResults(RekognitionClient rekClient) {
           try {
               String paginationToken = null;
               GetContentModerationResponse modDetectionResponse = null;
               boolean finished = false;
               String status;
               int yy = 0;
   
               do {
                   if (modDetectionResponse != null)
                       paginationToken = modDetectionResponse.nextToken();
   
                   GetContentModerationRequest modRequest = GetContentModerationRequest.builder()
                           .jobId(startJobId)
                           .nextToken(paginationToken)
                           .maxResults(10)
                           .build();
   
                   // Wait until the job succeeds.
                   while (!finished) {
                       modDetectionResponse = rekClient.getContentModeration(modRequest);
                       status = modDetectionResponse.jobStatusAsString();
   
                       if (status.compareTo("SUCCEEDED") == 0)
                           finished = true;
                       else {
                           System.out.println(yy + " status is: " + status);
                           Thread.sleep(1000);
                       }
                       yy++;
                   }
   
                   finished = false;
   
                   // Proceed when the job is done - otherwise VideoMetadata is null.
                   VideoMetadata videoMetaData = modDetectionResponse.videoMetadata();
                   System.out.println("Format: " + videoMetaData.format());
                   System.out.println("Codec: " + videoMetaData.codec());
                   System.out.println("Duration: " + videoMetaData.durationMillis());
                   System.out.println("FrameRate: " + videoMetaData.frameRate());
                   System.out.println("Job");
   
                   List<ContentModerationDetection> mods = modDetectionResponse.moderationLabels();
                   for (ContentModerationDetection mod : mods) {
                       long seconds = mod.timestamp() / 1000;
                       System.out.print("Mod label: " + seconds + " ");
                       System.out.println(mod.moderationLabel().toString());
                       System.out.println();
                   }
   
               } while (modDetectionResponse != null && modDetectionResponse.nextToken() != null);
   
           } catch (RekognitionException | InterruptedException e) {
               System.out.println(e.getMessage());
               System.exit(1);
           }
       }
   }
   ```

------
#### [ Python ]

   ```
   #Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
   #PDX-License-Identifier: MIT-0 (For details, see https://github.com/awsdocs/amazon-rekognition-developer-guide/blob/master/LICENSE-SAMPLECODE.)
   
       # ============== Unsafe content =============== 
       def StartUnsafeContent(self):
           response=self.rek.start_content_moderation(Video={'S3Object': {'Bucket': self.bucket, 'Name': self.video}},
               NotificationChannel={'RoleArn': self.roleArn, 'SNSTopicArn': self.snsTopicArn})
   
           self.startJobId=response['JobId']
           print('Start Job Id: ' + self.startJobId)
   
       def GetUnsafeContentResults(self):
           maxResults = 10
           paginationToken = ''
           finished = False
   
           while finished == False:
               response = self.rek.get_content_moderation(JobId=self.startJobId,
                                                   MaxResults=maxResults,
                                                   NextToken=paginationToken,
                                                   SortBy="NAME",
                                                   AggregateBy="TIMESTAMPS")
   
               print('Codec: ' + response['VideoMetadata']['Codec'])
               print('Duration: ' + str(response['VideoMetadata']['DurationMillis']))
               print('Format: ' + response['VideoMetadata']['Format'])
               print('Frame rate: ' + str(response['VideoMetadata']['FrameRate']))
               print()
   
               for contentModerationDetection in response['ModerationLabels']:
                   print('Label: ' +
                       str(contentModerationDetection['ModerationLabel']['Name']))
                   print('Confidence: ' +
                       str(contentModerationDetection['ModerationLabel']['Confidence']))
                   print('Parent category: ' +
                       str(contentModerationDetection['ModerationLabel']['ParentName']))
                   print('Timestamp: ' + str(contentModerationDetection['Timestamp']))
                   print()
   
               if 'NextToken' in response:
                   paginationToken = response['NextToken']
               else:
                   finished = True
   ```

   `main` 함수에서 다음 줄을 바꿉니다.

   ```
       analyzer.StartLabelDetection()
       if analyzer.GetSQSMessageSuccess()==True:
           analyzer.GetLabelDetectionResults()
   ```

   다음으로 바꿉니다.

   ```
       analyzer.StartUnsafeContent()
       if analyzer.GetSQSMessageSuccess()==True:
           analyzer.GetUnsafeContentResults()
   ```

------
**참고**  
[Java 또는 Python으로 Amazon S3 버킷에 저장된 비디오 분석(SDK)](video-analyzing-with-sqs.md) 이외에 비디오 예제를 이미 실행한 경우, 바꿀 코드가 다를 수 있습니다.

1. 코드를 실행합니다. 비디오에서 감지된 부적절한 콘텐츠 레이블 목록이 표시됩니다.

## GetContentModeration 작업 응답
<a name="getcontentmoderation-operationresponse"></a>

`GetContentModeration`의 응답은 [ContentModerationDetection](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_ContentModerationDetection.html) 객체로 구성된 `ModerationLabels` 배열입니다. 부적절한 콘텐츠 레이블이 감지될 때마다 배열에 요소가 포함됩니다. `ContentModerationDetectionObject` 객체 내에 있는 [ModerationLabel](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_ModerationLabel.html)에는 부적절하거나 불쾌감을 주는 콘텐츠가 감지된 항목에 대한 정보가 포함되어 있습니다. `Timestamp`는 비디오 시작부터 레이블이 감지된 때까지 지난 시간(밀리초 단위)입니다. 레이블은 부적절한 콘텐츠 이미지 분석을 통해 감지된 레이블과 동일한 방식의 계층적 구조로 구성됩니다. 자세한 내용은 [콘텐츠 조절](moderation.md) 단원을 참조하십시오.

다음은 `NAME` 기준으로 정렬하고 `TIMESTAMPS` 기준으로 집계한 `GetContentModeration`로부터의 예제 응답입니다.

```
{
    "JobStatus": "SUCCEEDED",
    "VideoMetadata": {
        "Codec": "h264",
        "DurationMillis": 54100,
        "Format": "QuickTime / MOV",
        "FrameRate": 30.0,
        "FrameHeight": 462,
        "FrameWidth": 884,
        "ColorRange": "LIMITED"
    },
    "ModerationLabels": [
        {
            "Timestamp": 36000,
            "ModerationLabel": {
                "Confidence": 52.451576232910156,
                "Name": "Alcohol",
                "ParentName": "",
                "TaxonomyLevel": 1
            },
            "ContentTypes": [
                {
                    "Confidence": 99.9999008178711,
                    "Name": "Animated"
                }
            ]
        },
        {
            "Timestamp": 36000,
            "ModerationLabel": {
                "Confidence": 52.451576232910156,
                "Name": "Alcoholic Beverages",
                "ParentName": "Alcohol",
                "TaxonomyLevel": 2
            },
            "ContentTypes": [
                {
                    "Confidence": 99.9999008178711,
                    "Name": "Animated"
                }
            ]
        }
    ],
    "ModerationModelVersion": "7.0",
    "JobId": "a1b2c3d4...",
    "Video": {
        "S3Object": {
            "Bucket": "amzn-s3-demo-bucket",
            "Name": "video-name.mp4"
        }
    },
    "GetRequestMetadata": {
        "SortBy": "TIMESTAMP",
        "AggregateBy": "TIMESTAMPS"
    }
}
```

 다음은 `NAME` 기준으로 정렬하고 `SEGMENTS` 기준으로 집계한 `GetContentModeration`로부터의 예제 응답입니다.

```
{
    "JobStatus": "SUCCEEDED",
    "VideoMetadata": {
        "Codec": "h264",
        "DurationMillis": 54100,
        "Format": "QuickTime / MOV",
        "FrameRate": 30.0,
        "FrameHeight": 462,
        "FrameWidth": 884,
        "ColorRange": "LIMITED"
    },
    "ModerationLabels": [
        {
            "Timestamp": 0,
            "ModerationLabel": {
                "Confidence": 0.0003000000142492354,
                "Name": "Alcohol Use",
                "ParentName": "Alcohol",
                "TaxonomyLevel": 2
            },
            "StartTimestampMillis": 0,
            "EndTimestampMillis": 29520,
            "DurationMillis": 29520,
            "ContentTypes": [
                {
                    "Confidence": 99.9999008178711,
                    "Name": "Illustrated"
                },
                {
                    "Confidence": 99.9999008178711,
                    "Name": "Animated"
                }
            ]
        }
    ],
    "ModerationModelVersion": "7.0",
    "JobId": "a1b2c3d4...",
    "Video": {
        "S3Object": {
            "Bucket": "amzn-s3-demo-bucket",
            "Name": "video-name.mp4"
        }
    },
    "GetRequestMetadata": {
        "SortBy": "TIMESTAMP",
        "AggregateBy": "SEGMENTS"
    }
}
```

# 사용자 지정 조절을 통한 정확도 향상
<a name="moderation-custom-moderation"></a>

 Amazon Rekognition의 [DetectModerationLabels](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_DetectModerationLabels.html) API를 사용하여 부적절하거나 원치 않거나 불쾌감을 주는 콘텐츠를 탐지할 수 있습니다. Rekognition 사용자 지정 조절 기능을 사용하면 어댑터를 사용하여 [DetectModerationLabels](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_DetectModerationLabels.html)의 정확도를 높일 수 있습니다. 어댑터는 기존 Rekognition 딥 러닝 모델에 추가할 수 있는 모듈식 구성 요소로, 훈련 대상 작업에 맞게 기능을 확장합니다. 어댑터를 만들어 [DetectModerationLabels](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_DetectModerationLabels.html) 작업에 제공하면 특정 사용 사례와 관련된 콘텐츠 조절 작업의 정확도를 높일 수 있습니다.

Rekognition의 콘텐츠 조절 모델을 특정 조절 레이블에 맞게 사용자 지정할 때는 프로젝트를 만들고 제공하는 이미지 세트를 기반으로 어댑터를 훈련시켜야 합니다. 그런 다음 어댑터의 성능을 반복적으로 확인하고 어댑터를 원하는 정확도 수준이 되도록 다시 훈련시킬 수 있습니다. 프로젝트는 다양한 버전의 어댑터를 저장하는 데 사용됩니다.

Rekognition 콘솔을 사용하여 프로젝트 및 어댑터를 생성할 수 있습니다. 또는 AWS SDK 및 연결된 APIs를 사용하여 프로젝트를 생성하고, 어댑터를 훈련하고, 어댑터를 관리할 수 있습니다.



# 어댑터 생성 및 사용
<a name="creating-and-using-adapters"></a>

어댑터는 기존 Rekognition 딥 러닝 모델에 추가할 수 있는 모듈식 구성 요소로, 훈련 대상 작업에 맞게 기능을 확장합니다. 어댑터로 딥 러닝 모델을 훈련시키면 특정 사용 사례와 관련된 이미지 분석 작업의 정확도를 높일 수 있습니다.

어댑터를 만들고 사용하려면 Rekognition에 훈련 및 테스트 데이터를 제공해야 합니다. 다음 두 가지 중 하나의 방법으로 이 작업을 수행할 수 있습니다.
+ 대량 분석 및 검증 - Rekognition에서 분석하고 레이블을 할당할 이미지를 대량으로 분석하여 훈련 데이터 세트를 생성할 수 있습니다. 그런 다음 이미지에 대해 생성된 주석을 검토하고 예측을 확인하거나 수정할 수 있습니다. 이미지 대량 분석 작동 방식에 대한 자세한 내용은 [대량 분석](https://docs.aws.amazon.com/rekognition/latest/dg/bulk-analysis.html)을 참조하세요.
+ 수동 주석 - 이 접근 방식을 사용하면 이미지를 업로드하고 주석을 달아 훈련 데이터를 만들 수 있습니다. 이미지를 업로드하고 주석을 달거나 자동 분할하여 테스트 데이터를 생성합니다.

자세히 알아보려면 다음 주제 중 하나를 선택하세요.

**Topics**
+ [대량 분석 및 검증](adapters-bulk-analysis.md)
+ [수동 주석](adapters-manual-annotation.md)

# 대량 분석 및 검증
<a name="adapters-bulk-analysis"></a>

이 방법을 사용하면 훈련 데이터로 사용할 이미지를 대량으로 업로드한 다음 이미지에 레이블을 자동으로 할당하는 Rekognition을 사용하여 이미지에 대한 예측을 가져옵니다. 이러한 예측을 어댑터의 시작점으로 사용할 수 있습니다. 예측의 정확성을 확인한 다음 검증된 예측을 기반으로 어댑터를 훈련시킬 수 있습니다. 콘솔을 사용하여이 작업을 수행할 수 있습니다 AWS .



 다음 동영상에서는 Rekognition의 대량 분석 기능을 사용하여 대량의 이미지에 대한 예측을 얻고 확인한 다음 이러한 예측으로 어댑터를 훈련하는 방법을 보여줍니다.

[![AWS Videos](http://img.youtube.com/vi/https://www.youtube.com/embed/IGGMHPnPZLs?si=5eoidzFPbL6i5FfY/0.jpg)](http://www.youtube.com/watch?v=https://www.youtube.com/embed/IGGMHPnPZLs?si=5eoidzFPbL6i5FfY)


## 대량 분석을 위한 이미지 업로드
<a name="adapters-bulk-analysis-upload-images"></a>

어댑터용 훈련 데이터 세트를 생성하려면 Rekognition에서 레이블을 예측할 이미지를 대량으로 업로드하세요. 최상의 결과를 얻으려면 최대 한도인 10,000개까지 훈련용 이미지를 최대한 많이 제공하고 이미지가 여러분의 사용 사례의 모든 면을 반영하는지 확인하세요.

 AWS 콘솔을 사용하는 경우 컴퓨터에서 직접 이미지를 업로드하거나 이미지를 저장하는 Amazon Simple Storage Service 버킷을 제공할 수 있습니다. 하지만 Rekognition API를 SDK와 함께 사용하는 경우 Amazon Simple Storage Service 버킷에 저장된 이미지를 참조하는 매니페스트 파일을 제공해야 합니다. 자세한 내용은 [대량 분석](https://docs.aws.amazon.com/rekognition/latest/dg/bulk-analysis.html)을 참조하세요.

## 예측 검토
<a name="adapters-bulk-analysis-review-predictions"></a>

Rekognition 콘솔에 이미지 업로드를 완료하면 Rekognition에서 이미지에 대한 레이블을 생성합니다. 그런 다음 예측을 true positive, false positive, true negative, false negative의 카테고리 중 하나로 검증할 수 있습니다. 예측을 검증한 후 이 피드백을 기반으로 어댑터를 훈련시킬 수 있습니다.

## 어댑터 훈련
<a name="adapters-bulk-analysis-train-adapter"></a>

대량 분석에서 반환된 예측의 검증을 마치면 어댑터 훈련 프로세스를 시작할 수 있습니다.

## AdapterId 가져오기
<a name="adapters-bulk-analysis-get-adapter"></a>

어댑터 훈련이 완료되면 Rekognition의 이미지 분석 API와 함께 사용할 어댑터의 고유 ID를 얻을 수 있습니다.

## API 작업 직접 호출
<a name="adapters-bulk-analysis-call-operation"></a>

사용자 지정 어댑터를 적용하려면 어댑터를 지원하는 이미지 분석 API 중 하나를 직접 호출할 때 해당 ID를 제공하세요. 이렇게 하면 이미지에 대한 예측의 정확도가 향상됩니다.

# 수동 주석
<a name="adapters-manual-annotation"></a>

이 접근 방식에서는 수동으로 이미지를 업로드하고 주석을 달아 훈련 데이터를 만듭니다. 테스트 이미지를 업로드하고 주석을 달거나 Rekognition이 자동으로 훈련 데이터의 일부를 테스트 이미지로 사용하도록 자동 분할하여 테스트 데이터를 생성합니다.

## 이미지 업로드 및 주석 달기
<a name="adapters-upload-sample-images"></a>

어댑터를 훈련시키려면 사용 사례를 반영하는 샘플 이미지 세트를 업로드해야 합니다. 최상의 결과를 얻으려면 최대 한도인 10,000개까지 훈련용 이미지를 최대한 많이 제공하고 이미지가 여러분의 사용 사례의 모든 면을 반영하는지 확인하세요.

![\[매니페스트 파일을 가져오거나, S3 버킷에서 가져오거나, 컴퓨터에서 이미지를 업로드하는 옵션과 함께 훈련 이미지를 가져오는 옵션을 보여주는 인터페이스입니다. S3 URI 필드와 읽기/쓰기 권한 보장에 대한 참고 사항이 포함되어 있습니다.\]](http://docs.aws.amazon.com/ko_kr/rekognition/latest/dg/images/adapters-11-traiing-dataset.png)


 AWS 콘솔을 사용할 때 컴퓨터에서 직접 이미지를 업로드하거나, 매니페스트 파일을 제공하거나, 이미지를 저장하는 Amazon S3 버킷을 제공할 수 있습니다.

 하지만 Rekognition API를 SDK와 함께 사용하는 경우 Amazon S3 버킷에 저장된 이미지를 참조하는 매니페스트 파일을 제공해야 합니다.

[Rekognition 콘솔](https://console.aws.amazon.com/rekognition)의 주석 인터페이스를 사용하여 이미지에 주석을 달 수 있습니다. 이미지에 레이블로 태그를 지정해 주석을 달면 훈련에 필요한 “실측 정보”가 확립됩니다. 또한 어댑터를 훈련시키기 전에 반드시 훈련 및 테스트 세트를 지정하거나 자동 분할 기능을 사용해야 합니다. 데이터 세트를 지정하고 이미지에 주석 달기를 완료했다면 테스트 세트의 주석이 달린 이미지를 기반으로 어댑터를 생성할 수 있습니다. 그 후 어댑터의 성능을 평가할 수 있습니다.

## 테스트 세트 생성
<a name="adapters-training-testing"></a>

주석이 달린 테스트 세트를 제공하거나 자동 분할 기능을 사용해야 합니다. 훈련 세트는 어댑터를 실제로 훈련시키는 데 사용됩니다. 어댑터는 주석이 달린 이미지에 포함된 패턴을 학습합니다. 테스트 세트는 어댑터를 최종 완성하기 전에 모델의 성능을 평가하는 데 사용됩니다.

## 어댑터 훈련
<a name="adapters-train-adapter"></a>

 훈련 데이터에 주석을 달거나 매니페스트 파일을 제공한 후에는 어댑터에 대한 훈련 프로세스를 시작할 수 있습니다.

## 어댑터 ID 가져오기
<a name="adapter-get-adapter"></a>

어댑터 훈련이 완료되면 Rekognition의 이미지 분석 API와 함께 사용할 어댑터의 고유 ID를 얻을 수 있습니다.

## API 작업 직접 호출
<a name="adapter-call-operation"></a>

사용자 지정 어댑터를 적용하려면 어댑터를 지원하는 이미지 분석 API 중 하나를 직접 호출할 때 해당 ID를 제공하세요. 이렇게 하면 이미지에 대한 예측의 정확도가 향상됩니다.

# 데이터 세트 준비
<a name="preparing-datasets-adapters"></a>

어댑터를 만들려면 Rekognition에 교육 데이터 세트와 테스트 데이터 세트, 두 개의 데이터 세트를 제공해야 합니다. 각 데이터 세트는 이미지와 주석 또는 레이블이라는 두 가지 요소로 구성됩니다. 다음 섹션에서는 레이블과 이미지의 용도와 이들을 결합하여 데이터 세트를 생성하는 방법을 설명합니다.

## 이미지
<a name="preparing-datasets-adapters-images"></a>

이미지의 대표적인 샘플을 기반으로 어댑터를 훈련시켜야 합니다. 훈련용 이미지를 선택할 때는 어댑터로 얻고자 하는 각 레이블의 예상 응답을 보여주는 이미지를 최소한 몇 개 포함시키세요.

훈련 데이터 세트를 만들려면 다음 두 이미지 유형 중 하나를 제공해야 합니다.
+ False Positive 예측이 포함된 이미지. 기본 모델이 이미지 안에 술이 있다고 예측했지만 실제로는 그렇지 않은 경우를 예로 들 수 있습니다.
+ False Negative 예측이 포함된 이미지. 기본 모델이 이미지 안에 술이 없다고 예측했지만 실제로는 술이 있는 경우를 예로 들 수 있습니다.

균형 잡힌 데이터 세트를 만들려면 다음 두 이미지 유형 중 하나를 제공하는 것이 좋습니다.
+ True Positive 예측이 포함된 이미지. 기본 모델이 이미지 안에 술이 있다고 올바르게 예측한 경우를 예로 들 수 있습니다. False Positive 이미지를 제공하는 경우 이러한 이미지도 제공하는 것이 좋습니다.
+ True Negative 예측이 포함된 이미지. 기본 모델이 이미지 안에 술이 없다고 올바르게 예측한 경우를 예로 들 수 있습니다. False Negative 이미지를 제공하는 경우 이러한 이미지도 제공하는 것이 좋습니다.

## 레이블
<a name="preparing-datasets-adapters-labels"></a>

레이블은 객체, 이벤트, 개념 또는 활동을 가리킵니다. 콘텐츠 조절에서 레이블은 부적절하거나, 원치 않거나, 불쾌감을 주는 콘텐츠의 인스턴스입니다.

Rekognition의 기본 모델을 훈련시켜 어댑터를 만드는 상황에서는 이미지에 레이블이 할당되는 것을 주석이라고 합니다. Rekognition 콘솔로 어댑터를 훈련시키는 경우 콘솔을 사용하여 레이블을 선택한 다음 레이블에 해당하는 이미지에 태그를 지정하여 이미지에 주석을 추가합니다. 이 프로세스를 통해 모델은 할당된 레이블을 기반으로 이미지의 요소를 식별하는 법을 배우게 됩니다. 이 연결 프로세스는 어댑터가 생성되고 나면 모델이 가장 관련성이 높은 콘텐츠에 집중할 수 있도록 하므로 이미지 분석의 정확도가 향상됩니다.

또는 이미지에 대한 정보와 함께 제공되는 주석이 포함된 매니페스트 파일을 제공할 수도 있습니다.

## 훈련 데이터 세트 및 테스트 데이터 세트
<a name="preparing-datasets-adapters-datasets"></a>

훈련 데이터 세트는 모델을 미세 조절하고 사용자 지정 어댑터를 만들기 위한 기초가 됩니다. 모델이 학습할 수 있도록 주석이 달린 훈련 데이터 세트를 제공해야 합니다. 모델은 이 데이터 세트를 기반으로 학습하여 사용자가 제공하는 이미지 유형에 대한 성능을 개선합니다.

 정확도를 높이려면 이미지에 주석을 달거나 레이블을 지정하여 훈련 데이터 세트를 만들어야 합니다. 다음 두 가지 방법으로 이 작업을 수행할 수 있습니다.
+  수동 레이블 할당 - 데이터 세트에 포함할 이미지를 업로드한 후 이러한 이미지에 수동으로 레이블을 할당하여 Rekognition 콘솔을 사용한 훈련 데이터 세트를 생성할 수 있습니다.
+  매니페스트 파일 - 매니페스트 파일을 사용하여 어댑터를 훈련할 수 있습니다. 매니페스트 파일에는 훈련 이미지 및 테스트 이미지의 실측 정보 주석과 훈련 이미지의 위치에 대한 정보가 들어 있습니다. Rekognition APIs를 사용하여 어댑터를 훈련하거나 AWS 콘솔을 사용할 때 매니페스트 파일을 제공할 수 있습니다.

테스트 데이터 세트는 훈련 후 어댑터의 성능을 평가하는 데 사용됩니다. 신뢰성 있는 평가를 보장하기 위해 모델이 본 적 없는 원본 훈련 데이터 세트의 일부를 사용하여 테스트 데이터 세트를 만듭니다. 이 프로세스를 통해 새 데이터로 어댑터의 성능을 평가하여 정확한 측정치 및 지표를 생성할 수 있습니다. 최적 정확도 개선에 대해서는 [어댑터 훈련 모범 사례](using-adapters-best-practices.md) 섹션을 참조하세요.

# AWS CLI 및 SDKs를 사용하여 어댑터 관리
<a name="managing-adapters"></a>

 Rekognition을 사용하면 사전 훈련된 컴퓨터 비전 모델을 활용하는 여러 기능을 사용할 수 있습니다. 이러한 모델을 사용하면 레이블 감지 및 콘텐츠 조절과 같은 작업을 수행할 수 있습니다. 어댑터를 사용하여 이러한 특정 모델을 사용자 정의할 수도 있습니다.

Rekognition의 프로젝트 생성 및 프로젝트 관리 API(예: [CreateProject](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_CreateProject.html) 및 [CreateProjectVersion](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_CreateProjectVersion.html))를 사용하여 어댑터를 만들고 교육할 수 있습니다. 다음 페이지에서는 AWS 콘솔, 선택한 AWS SDK 또는 AWS CLI를 사용하여 API 작업을 사용하여 어댑터를 생성, 훈련 및 관리하는 방법을 설명합니다.

어댑터를 훈련시킨 후에는 지원되는 기능을 사용하여 추론을 실행할 때 어댑터를 사용할 수 있습니다. 어댑터는 현재 콘텐츠 조절 기능을 사용할 때 지원됩니다.

 AWS SDK를 사용하여 어댑터를 훈련할 때는 매니페스트 파일 형식으로 실제 레이블(이미지 주석)을 제공해야 합니다. 또는 Rekognition 콘솔을 사용하여 어댑터를 만들고 훈련할 수 있습니다.

**참고**  
 어댑터는 복사할 수 없습니다. Rekognition Custom Labels 프로젝트 버전만 복사할 수 있습니다.

**Topics**
+ [어댑터 상태](#managing-adapters-project-versions-statuses)
+ [프로젝트 생성](managing-adapters-create-project.md)
+ [프로젝트 설명](managing-adapters-describe-projects.md)
+ [프로젝트 삭제](managing-adapters-delete-project.md)
+ [프로젝트 버전 생성](managing-adapters-create-project-version.md)
+ [프로젝트 버전 설명](managing-adapters-describe-project.md)
+ [프로젝트 버전 삭제](managing-adapters-delete-project-version.md)

## 어댑터 상태
<a name="managing-adapters-project-versions-statuses"></a>

사용자 지정 조절 어댑터(프로젝트 버전)는 다음 상태 중 하나일 수 있습니다.
+ TRAINING\$1IN\$1PROGRESS - 어댑터는 사용자가 훈련 문서로 제공한 파일에 대해 훈련 중입니다.
+ TRAINING\$1COMPLETED - 어댑터가 훈련을 성공적으로 완료했으며 성능을 검토할 준비가 되었습니다.
+ TRAINING\$1FAILED - 어댑터가 어떤 이유로 훈련을 완료하지 못했습니다. 장애 원인에 대한 자세한 내용은 출력 매니페스트 파일 및 출력 매니페스트 요약을 검토하세요.
+ DELETING - 어댑터를 삭제 중입니다.
+ DEPRECATED - 어댑터가 이전 버전의 콘텐츠 조절 기본 모델에 대해 훈련되었습니다. 유예 기간 내에 있으며 새 기본 모델 버전 출시 후 60\$190일 이내에 만료됩니다. 유예 기간 동안 어댑터를 사용하여 [DetectModerationLabels](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_DetectModerationLabels.html) 또는 [StartMediaAnalysisJob](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_StartMediaAnalysisJob.html) API 작업을 추론할 수 있습니다. 어댑터의 만료 날짜는 사용자 지정 조절 콘솔을 참조하세요.
+ EXPIRED - 어댑터가 이전 버전의 콘텐츠 조절 기본 모델에 대해 훈련되었으며, 더 이상 DetectModerationLabels 또는 StartMediaAnalysisJob API 작업으로 사용자 지정 결과를 얻는 데 사용할 수 없습니다. 추론 요청에 만료된 어댑터가 지정된 경우 해당 어댑터는 무시되고 대신 최신 버전의 사용자 지정 조절 기본 모델에서 응답이 반환됩니다.

# 프로젝트 생성
<a name="managing-adapters-create-project"></a>

[CreateProject](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_CreateProject.html) 작업을 통해 Rekognition의 레이블 감지 작업을 위한 어댑터를 넣을 프로젝트를 만들 수 있습니다. 프로젝트는 리소스 그룹이며 DetectModerationLabels와 같은 레이블 탐지 작업의 경우 프로젝트를 통해 기본 Rekognition 모델을 사용자 지정하는 데 사용할 수 있는 어댑터를 저장할 수 있습니다. CreateProject를 간접 호출할 때는 만들려는 프로젝트의 이름을 ProjectName 인수에 입력합니다.

 AWS 콘솔을 사용하여 프로젝트를 생성하려면: 
+ Rekognition 콘솔에 로그인합니다.
+ **사용자 지정 조절**을 클릭합니다.
+ **프로젝트 생성**을 선택합니다.
+ **새 프로젝트 생성** 또는 **기존 프로젝트에 추가**를 선택합니다.
+ **프로젝트 이름**을 추가합니다.
+ **어댑터 이름**을 추가합니다.
+ 필요한 경우 설명을 추가합니다.
+ 훈련 이미지를 가져오는 방법(매니페스트 파일, S3 버킷 또는 컴퓨터)을 선택합니다.
+ 훈련 데이터를 자동 분할할지 아니면 매니페스트 파일을 가져올지 선택합니다.
+ 프로젝트를 자동으로 업데이트할지 여부를 선택합니다.
+ **프로젝트 생성**을 클릭합니다.

 AWS CLI 및 SDK를 사용하여 프로젝트를 생성하려면:

1. 아직 설치하지 않은 경우 AWS CLI 및 AWS SDKs를 설치하고 구성합니다. 자세한 정보는 [2단계: AWS CLI 및 AWS SDKs 설정](setup-awscli-sdk.md)을 참조하십시오.

1. 다음 코드를 사용하여 프로젝트를 생성합니다.

------
#### [ CLI ]

```
# Request
# Creating Content Moderation Project
aws rekognition create-project \
    --project-name "project-name" \
    --feature CONTENT_MODERATION \
    --auto-update ENABLED
    --profile profile-name
```

------

# 프로젝트 설명
<a name="managing-adapters-describe-projects"></a>

[DescribeProjects](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_DescribeProjects.html) API를 사용하여 프로젝트에 연결된 모든 어댑터에 대한 정보를 포함하여 프로젝트에 대한 정보를 가져올 수 있습니다.

 AWS CLI 및 SDK를 사용하여 프로젝트를 설명하는 방법:

1. 아직 설치하지 않은 경우 AWS CLI 및 AWS SDKs를 설치하고 구성합니다. 자세한 정보는 [2단계: AWS CLI 및 AWS SDKs 설정](setup-awscli-sdk.md)을 참조하십시오.

1. 다음 코드를 사용하여 프로젝트를 설명합니다.

------
#### [ CLI ]

```
# Request
# Getting CONTENT_MODERATION project details 
aws rekognition describe-projects \
    --features CONTENT_MODERATION
    --profile profile-name
```

------

# 프로젝트 삭제
<a name="managing-adapters-delete-project"></a>

Rekognition 콘솔을 사용하거나 [DeleteProject](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_DeleteProject.html) API를 직접 호출하여 프로젝트를 삭제할 수 있습니다. 프로젝트를 삭제하려면 먼저 연결된 어댑터를 모두 삭제해야 합니다. 삭제된 프로젝트 또는 모델은 복구할 수 없습니다.

 AWS 콘솔을 사용하여 프로젝트를 삭제하려면: 
+ Rekognition 콘솔에 로그인합니다.
+ **사용자 지정 조절**을 클릭합니다.
+ 프로젝트와 연결된 모든 어댑터를 삭제해야 프로젝트 자체를 삭제할 수 있습니다. 어댑터를 선택한 다음 **삭제**를 선택하여 프로젝트와 연결된 어댑터를 모두 삭제합니다.
+ 프로젝트를 선택한 다음 **삭제** 버튼을 선택합니다.

 AWS CLI 및 SDK를 사용하여 프로젝트를 삭제하려면:

1. 아직 설치하지 않은 경우 AWS CLI 및 AWS SDKs를 설치하고 구성합니다. 자세한 정보는 [2단계: AWS CLI 및 AWS SDKs 설정](setup-awscli-sdk.md)을 참조하십시오.

1. 다음 코드를 사용하여 프로젝트를 삭제합니다.

------
#### [ CLI ]

```
aws rekognition delete-project 
  --project-arn project_arn \
  --profile profile-name
```

------

# 프로젝트 버전 생성
<a name="managing-adapters-create-project-version"></a>

[CreateProjectVersion](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_CreateProjectVersion.html) 작업을 사용하여 배포할 어댑터를 훈련시킬 수 있습니다. CreateProjectVersion은 먼저 프로젝트와 연결된 어댑터의 새 버전을 생성한 다음 어댑터 훈련을 시작합니다. CreateProjectVersion에서 보내는 응답은 모델 버전에 대한 Amazon 리소스 이름(ARN)입니다. 훈련을 완료하는 데 다소 시간이 걸립니다. DescribeProjectVersions를 직접 호출하여 현재 상태를 가져올 수 있습니다. 모델을 훈련할 때 Rekognition은 프로젝트와 연결된 훈련 및 테스트 데이터 세트를 사용합니다. 콘솔을 사용하여 데이터 세트를 생성합니다. 자세한 내용은 데이터 세트에 관한 섹션을 참조하세요.

 Rekognition 콘솔을 사용하여 프로젝트 버전을 생성하려면 
+  AWS Rekognition 콘솔에 로그인합니다.
+  사용자 지정 조절을 클릭합니다.
+  프로젝트를 선택합니다.
+  “프로젝트 세부 정보” 페이지에서 **어댑터 생성**을 선택합니다.
+  “프로젝트 생성” 페이지에서 프로젝트 세부 정보, 교육 이미지, 테스트 이미지에 필요한 세부 정보를 입력한 다음 **프로젝트 생성**을 선택합니다.
+  “이미지에 레이블 할당” 페이지에서 이미지에 레이블을 추가하고 완료되면 **훈련 시작**을 선택합니다.

 AWS CLI 및 SDK를 사용하여 프로젝트 버전을 생성하려면:

1. 아직 설치하지 않은 경우 AWS CLI 및 AWS SDKs를 설치하고 구성합니다. 자세한 정보는 [2단계: AWS CLI 및 AWS SDKs 설정](setup-awscli-sdk.md)을 참조하십시오.

1. 다음 코드를 사용하여 프로젝트 버전을 생성합니다.

------
#### [ CLI ]

```
# Request
aws rekognition create-project-version \
 --project-arn project-arn \
 --training-data '{Assets=[GroundTruthManifest={S3Object="amzn-s3-demo-source-bucket",Name="manifest.json"}]}' \
 --output-config S3Bucket=amzn-s3-demo-destination-bucket,S3KeyPrefix=my-results \
 --feature-config "ContentModeration={ConfidenceThreshold=70}"
 --profile profile-name
```

------

# 프로젝트 버전 설명
<a name="managing-adapters-describe-project"></a>

[DescribeProjectVersions](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_DescribeProjectVersions.html) 작업을 사용하여 프로젝트와 연결된 어댑터를 나열하고 설명할 수 있습니다. ProjectVersionArns에서 최대 10개의 모델 버전을 지정할 수 있습니다. 값을 지정하지 않으면 프로젝트의 모든 모델 버전에 대한 설명을 반환합니다.

 AWS CLI 및 SDK를 사용하여 프로젝트 버전을 설명하는 방법:

1. 아직 설치하지 않은 경우 AWS CLI 및 AWS SDKs를 설치하고 구성합니다. 자세한 정보는 [2단계: AWS CLI 및 AWS SDKs 설정](setup-awscli-sdk.md)을 참조하십시오.

1. 다음 코드를 사용하여 프로젝트 버전을 설명합니다.

------
#### [ CLI ]

```
aws rekognition describe-project-versions 
  --project-arn project_arn \
  --version-names [versions]
```

------

# 프로젝트 버전 삭제
<a name="managing-adapters-delete-project-version"></a>

[DeleteProjectVersion](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_DeleteProjectVersion.html) 작업을 사용하여 프로젝트와 연결된 Rekognition 어댑터를 삭제할 수 있습니다. 실행 중이거나 훈련 중인 어댑터는 삭제할 수 없습니다. 어댑터의 상태를 확인하려면 DescribeProjectVersions 작업을 직접 호출하고 해당 작업이 반환한 상태 필드를 확인합니다. 실행 중인 어댑터를 중지하려면 StopProjectVersion을 직접 호출하세요. 모델이 훈련 중인 경우 훈련이 완료될 때까지 기다렸다가 삭제하세요. 프로젝트와 연결된 모든 어댑터를 삭제해야 프로젝트 자체를 삭제할 수 있습니다.

 Rekognition 콘솔을 사용하여 프로젝트 버전을 삭제하려면 
+ Rekognition 콘솔에 로그인합니다.
+ 사용자 지정 조절을 클릭합니다.
+ 프로젝트 탭에서 모든 프로젝트와 연결된 어댑터를 볼 수 있습니다. 어댑터를 선택한 다음 **삭제**를 선택합니다.

 AWS CLI 및 SDK를 사용하여 프로젝트 버전을 삭제하려면:

1. 아직 설치하지 않은 경우 AWS CLI 및 AWS SDKs를 설치하고 구성합니다. 자세한 정보는 [2단계: AWS CLI 및 AWS SDKs 설정](setup-awscli-sdk.md)을 참조하십시오.

1. 다음 코드를 사용하여 프로젝트 버전을 삭제합니다.

------
#### [ CLI ]

```
# Request
aws rekognition delete-project-version 
  --project-version-arn model_arn \
  --profile profile-name
```

------

# 사용자 지정 조절 어댑터 자습서
<a name="using-adapters-tutorial"></a>

이 자습서에서는 Rekognition 콘솔을 사용하여 어댑터를 생성, 훈련, 평가, 사용 및 관리하는 방법을 보여줍니다. AWS SDK를 사용하여 어댑터를 생성, 사용 및 관리하려면 섹션을 참조하세요[AWS CLI 및 SDKs를 사용하여 어댑터 관리](managing-adapters.md).

어댑터를 사용하면 여러분의 필요와 사용 사례에 맞게 모델 행동을 사용자 지정하여 Rekognition API 작업의 정확성을 높일 수 있습니다. 이 자습서를 통해 어댑터를 생성한 후에는 [DetectModerationLabels와](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_DetectModerationLabels.html) 같은 작업을 통해 자체 이미지를 분석하고 향후 개선을 위해 어댑터를 재훈련할 때 이를 사용할 수 있습니다.

이 자습서에서는 다음을 수행하는 방법을 알아봅니다.
+ Rekognition 콘솔을 사용하여 프로젝트 생성
+ 훈련 데이터에 주석 달기
+ 훈련 데이터 세트를 기반으로 어댑터 훈련
+ 어댑터 성능 검토
+ 어댑터를 사용하여 이미지 분석

## 사전 조건
<a name="using-adapters-tutorial-prereqs"></a>

이 튜토리얼을 완료하기 전에 [어댑터 생성 및 사용](creating-and-using-adapters.md)를 끝까지 읽어보는 것을 권장합니다.

어댑터를 만들려면 Rekognition 콘솔 도구를 사용하여 프로젝트를 만들고 자체 이미지를 업로드하고 주석을 추가한 다음 이러한 이미지를 기반으로 어댑터를 학습시킬 수 있습니다. 시작하려면 [프로젝트 생성 및 어댑터 훈련](#using-adapters-tutorial-annotation) 섹션을 참조하세요.

또는 Rekognition의 콘솔 또는 API를 사용하여 이미지에 대한 예측을 검색한 다음 예측을 검증하고 이러한 예측에 대해 어댑터를 훈련할 수 있습니다. 시작하려면 [대량 분석, 예측 검증, 어댑터 훈련](#using-adapters-tuorial-annotation-bulk-analysis) 섹션을 참조하세요.

## 이미지 주석
<a name="using-adapters-tutorial-image-annotation"></a>

Rekognition 콘솔로 이미지에 레이블을 지정하여 이미지에 직접 주석을 달거나 Rekognition 대량 분석을 사용하여 이미지에 주석을 추가한 다음 레이블이 올바르게 지정되었는지 확인할 수 있습니다. 시작하려면 아래 주제 중 하나를 선택하세요.

**Topics**
+ [프로젝트 생성 및 어댑터 훈련](#using-adapters-tutorial-annotation)
+ [대량 분석, 예측 검증, 어댑터 훈련](#using-adapters-tuorial-annotation-bulk-analysis)

### 프로젝트 생성 및 어댑터 훈련
<a name="using-adapters-tutorial-annotation"></a>

Rekognition 콘솔을 사용하여 이미지에 주석을 추가함으로써 어댑터를 훈련시키려면 다음 단계를 수행합니다.

**프로젝트 만들기**

어댑터를 훈련시키거나 사용하려면 먼저 어댑터를 넣을 프로젝트를 만들어야 합니다. 어댑터 훈련에 사용되는 이미지도 제공해야 합니다. 프로젝트, 어댑터, 이미지 데이터 세트를 생성하려면 

1.  AWS Management Console에 로그인하고 https://console.aws.amazon.com/rekognition/ Rekognition 콘솔을 엽니다.

1. 왼쪽 창에서 **사용자 지정 조절**을 선택합니다. Rekognition 사용자 지정 조절 랜딩 페이지가 표시됩니다.  
![\[새 프로젝트 또는 검색을 생성하는 기존 미세 조정 어댑터 및 옵션이 표시되지 않는 Rekognition 사용자 지정 조절 인터페이스입니다.\]](http://docs.aws.amazon.com/ko_kr/rekognition/latest/dg/images/adapters-1-landing-page.png)

1. 사용자 지정 조절 랜딩 페이지에는 모든 프로젝트 및 어댑터 목록이 표시되며 어댑터를 만들 수 있는 버튼도 있습니다. 새 프로젝트와 어댑터를 생성하려면 **프로젝트 생성**을 선택합니다.

1. 어댑터를 처음 생성하는 경우 프로젝트 및 어댑터와 관련된 파일을 저장할 Amazon S3 버킷을 생성하라는 메시지가 표시됩니다. **Amazon S3 버킷 생성**을 선택합니다.

1. 다음 페이지에서 **어댑터 이름**과 **프로젝트 이름**을 입력합니다. 원하는 경우 어댑터 설명을 제공하세요.  
![\[프로젝트 이름, 어댑터 이름 및 선택적 어댑터 설명을 포함한 프로젝트 세부 정보를 입력하는 양식입니다. 매니페스트 파일 또는 S3 버킷에서 훈련 이미지 데이터 세트를 가져오는 옵션입니다.\]](http://docs.aws.amazon.com/ko_kr/rekognition/latest/dg/images/adapters-2-project-details.png)

1. 어댑터의 이미지도 이 단계에서 제공합니다. **컴퓨터에서 이미지 가져오기**, **매니페스트 파일 가져오기**, 또는 **Amazon S3 버킷에서 이미지 가져오기** 중에서 선택할 수 있습니다. Amazon S3 버킷에서 이미지를 가져오려는 경우 훈련 이미지가 포함된 버킷과 폴더의 경로를 제공하세요. 컴퓨터에서 직접 이미지를 업로드하는 경우 한 번에 최대 30개의 이미지만 업로드할 수 있다는 점에 유의하세요. 주석이 포함된 매니페스트 파일을 사용하는 경우 이미지 주석 달기에 관련된 아래 단계를 건너뛰고 [어댑터 성능 검토](#using-adapters-tutorial-performance)에 관한 다음 섹션으로 진행해도 됩니다.

1. **테스트 데이터 세트 세부 정보** 섹션에서 **자동 분할**을 선택하여 Rekognition에서 테스트 데이터로 적절한 비율의 이미지를 자동으로 선택하도록 하거나 **수동으로 매니페스트 파일 가져오기**를 선택할 수 있습니다.

1. 이 정보를 입력한 후 **프로젝트 생성**을 선택합니다.

**어댑터 훈련**

주석이 없는 자체 이미지로 어댑터를 훈련시키려면

1. 어댑터가 포함된 프로젝트를 선택한 다음 **이미지에 레이블 할당** 옵션을 선택합니다.

1. **이미지에 레이블 할당** 페이지에서 훈련 이미지로 업로드된 모든 이미지를 볼 수 있습니다. 왼쪽에 있는 두 개의 속성 선택 패널을 사용하여 레이블이 지정되거나 레이블이 지정되지 않은 상태 및 레이블 카테고리별로 이미지를 필터링할 수 있습니다. **이미지 추가** 버튼을 선택하여 훈련 데이터 세트에 이미지를 더 추가할 수 있습니다.  
![\[지침, 어댑터 세부 정보 및 빈 이미지 패널이 포함된 이미지 레이블 지정 인터페이스입니다.\]](http://docs.aws.amazon.com/ko_kr/rekognition/latest/dg/images/adapters-4-assign-labels-to-images.png)

1. 훈련 데이터 세트에 이미지를 추가한 후에는 이미지에 레이블을 주석으로 달아야 합니다. 이미지를 업로드하면 업로드한 이미지가 표시되도록 “이미지에 레이블 할당” 페이지가 업데이트됩니다. Rekognition Moderation에서 지원하는 레이블의 드롭다운 목록에서 이미지에 적합한 레이블을 선택하라는 메시지가 표시됩니다. 레이블을 두 개 이상 선택할 수 있습니다.

1. 훈련 데이터의 모든 이미지에 레이블을 추가할 때까지 이 프로세스를 계속하세요.

1. 모든 데이터에 레이블을 지정한 후 **훈련 시작**을 선택하여 모델 훈련을 시작하면 어댑터가 생성됩니다.  
![\[노골적인 누드, 선정적인 콘텐츠, 폭력적, 증오의 상징, 알코올, 약물, 담배 등과 같은 카테고리의 레이블을 할당하는 옵션이 있는 2개의 이미지를 보여주는 인터페이스입니다.\]](http://docs.aws.amazon.com/ko_kr/rekognition/latest/dg/images/adapters-5-labels-images-blurred.png)

1. 훈련 프로세스를 시작하기 전에 원하는 **태그**를 어댑터에 추가할 수 있습니다. 어댑터에 사용자 지정 암호화 키를 제공하거나 AWS KMS 키를 사용할 수도 있습니다. 원하는 태그를 추가하고 원하는 대로 암호화를 사용자 지정한 후 **어댑터 훈련**을 선택하여 어댑터에 대한 훈련 프로세스를 시작하세요.

1. 어댑터가 훈련을 마칠 때까지 기다리세요. 훈련이 완료되면 어댑터 생성이 완료되었다는 알림을 받게 됩니다.

어댑터 상태가 “교육 완료”가 되면 어댑터 지표를 검토할 수 있습니다.

### 대량 분석, 예측 검증, 어댑터 훈련
<a name="using-adapters-tuorial-annotation-bulk-analysis"></a>

Rekognition의 콘텐츠 조절 모델에서 대량 분석 예측을 검증하여 어댑터를 훈련시키려면 다음 단계를 완료하세요.

 Rekognition의 콘텐츠 조절 모델에서 예측을 검증하여 어댑터를 훈련시키려면 다음을 수행해야 합니다.

1.  이미지에 대한 대량 분석 수행 

1.  이미지에 대해 반환된 예측 결과를 확인하세요.

Rekognition의 기본 모델 또는 이미 만든 어댑터를 사용해 대량 분석을 수행하여 이미지에 대한 예측을 얻을 수 있습니다.

**이미지에 대한 대량 분석 실행**

검증한 예측에 따라 어댑터를 훈련시키려면 먼저 Rekognition의 기본 모델 또는 선택한 어댑터를 사용하여 이미지 배치를 분석하는 대량 분석 작업을 시작해야 합니다. 대량 분석 작업을 실행하려면 

1. 에 로그인 AWS Management Console 하고 [https://console.aws.amazon.com/rekognition/](https://console.aws.amazon.com/rekognition/) Amazon Rekognition 콘솔을 엽니다.

1. 왼쪽 창에서 **대량 분석**을 선택합니다. 대량 분석 랜딩 페이지가 나타납니다. **대량 분석 시작**을 선택합니다. 대량 분석 기능 개요는 이미지를 업로드하고, 분석을 기다리고, 결과를 검토하며, 선택적으로 모델 예측을 확인하는 단계를 보여줍니다. 기본 모델을 사용하여 콘텐츠 조절에 대한 최근 대량 분석 작업을 나열합니다.  
![\[대량 분석 기능 개요는 기본 모델을 사용하여 콘텐츠 조절에 대한 워크플로 및 최신 대량 분석 작업을 나열합니다.\]](http://docs.aws.amazon.com/ko_kr/rekognition/latest/dg/images/BA-1-create-bulk-analysis.png)

1. 어댑터를 처음 생성하는 경우 프로젝트 및 어댑터와 관련된 파일을 저장할 Amazon Simple Storage Service 버킷을 생성하라는 메시지가 표시됩니다. **Amazon S3 버킷 생성**을 선택합니다.

1. **어댑터 선택** 드롭다운 메뉴를 사용하여 대량 분석에 사용할 어댑터를 선택합니다. 어댑터를 선택하지 않은 경우 기본적으로 기본 모델이 사용됩니다. 본 자습서에서는 어댑터를 선택하지 않습니다.  
![\[드롭다운 메뉴가 있는 대량 분석 인터페이스로, Rekognition 기능, 어댑터를 선택하고 레이블에 대한 작업 이름 및 최소 신뢰도 임곗값을 설정합니다. 일부 필드는 필수 필드입니다.\]](http://docs.aws.amazon.com/ko_kr/rekognition/latest/dg/images/BA-2-bulk-analysis-job.png)

1.  **벌크 분석 작업 이름** 필드에 벌크 분석 작업 이름을 입력합니다.

1. **최소 신뢰도 임계값**에 들어갈 값을 선택합니다. 선택한 신뢰도 임계값보다 작은 값의 레이블 예측은 반환되지 않습니다. 나중에 모델의 성능을 평가할 때 선택한 최소 신뢰도 임계값 아래로 신뢰도 임계값을 조절할 수 없다는 점에 유의하세요.

1. 대량 분석으로 분석하려는 이미지도 이 단계에서 제공합니다. 해당 이미지를 사용하여 어댑터를 훈련할 수도 있습니다. **컴퓨터에서 이미지 업로드** 또는 **Amazon S3 버킷에서 이미지 가져오기**를 선택할 수 있습니다. Amazon S3 버킷에서 문서를 가져오려는 경우 훈련 이미지가 포함된 버킷과 폴더의 경로를 제공하세요. 컴퓨터에서 직접 문서를 업로드하는 경우 한 번에 50개의 이미지만 업로드할 수 있다는 점에 유의하세요.

1. 이 정보를 입력한 후 **분석 시작**을 선택합니다. 그러면 Rekognition의 기본 모델을 사용한 분석 프로세스가 시작됩니다.

1.  대량 분석 메인 페이지에서 작업의 대량 분석 상태를 확인하여 대량 분석 작업의 상태를 확인할 수 있습니다. 대량 분석 상태가 “성공”이 되면 분석 결과를 검토할 준비가 된 것입니다.  
![\[콘텐츠 조절 인식 API 및 기본 모델을 사용하여 상태가 ‘성공’인 ‘평가 01’이라는 작업을 보여주는 대량 분석 작업 테이블입니다.\]](http://docs.aws.amazon.com/ko_kr/rekognition/latest/dg/images/BA-3-bulk-analysis-status.png)

1.  **대량 분석 작업** 목록에서 생성한 분석을 선택합니다.

1. 대량 분석 세부 정보 페이지에서 Rekognition의 기본 모델이 업로드한 이미지에 대해 예측한 결과를 확인할 수 있습니다.

1. 기본 모델의 성능을 검토하세요. 신뢰도 임계값 슬라이더를 사용하여 이미지에 레이블을 할당하기 위해 어댑터가 가져야 하는 신뢰도 임계값을 변경할 수 있습니다. 신뢰도 임계값을 조절함에 따라 플래그 지정 인스턴스와 플래그 미지정 인스턴스의 수가 변경됩니다. 레이블 카테고리 패널에는 Rekognition에서 인식하는 최상위 카테고리가 표시되며 이 목록에서 카테고리를 선택하여 해당 레이블이 할당된 모든 이미지를 표시할 수 있습니다.  
![\[다양한 레이블에 대해 플래그가 지정된 이미지 수를 보여주는 대량 분석 막대 차트입니다.\]](http://docs.aws.amazon.com/ko_kr/rekognition/latest/dg/images/BA-4-bulk-analysis-complete.png)

**예측 검증**

Rekognition의 기본 모델이나 선택한 어댑터의 정확도를 검토한 후 정확도를 높이고 싶다면 검증 워크플로를 활용할 수 있습니다.

1. 기본 모델 성능 검토를 마친 후에는 예측을 검증해야 합니다. 예측을 교정하여 어댑터를 훈련시킬 수 있습니다. 대량 분석 페이지 상단에서 **예측 확인**을 선택합니다.  
![\[false positive 및 false negative 비율을 계산하기 위해 예측을 확인하거나 정확도 향상을 위해 사용자 지정 조절 어댑터를 훈련하라는 메시지가 표시되는 패널입니다.\]](http://docs.aws.amazon.com/ko_kr/rekognition/latest/dg/images/BA-6-start-verification.png)

1. 예측 확인 페이지에서 Rekognition의 기본 모델 또는 선택한 어댑터에 제공한 모든 이미지를 각 이미지의 예측된 레이블과 함께 볼 수 있습니다. 이미지 아래에 있는 버튼을 사용하여 각 예측이 맞는지 틀렸는지를 확인해야 합니다. 예측을 잘못된 것으로 표시하려면 “X” 버튼을 사용하고 예측을 올바른 것으로 표시하려면 체크 표시 버튼을 사용합니다. 어댑터를 훈련시키려면 주어진 레이블에 대해 최소 20개의 false positive 예측과 50개의 false negative 예측을 확인해야 합니다. 더 많은 예측을 검증할수록 어댑터의 성능이 더 좋아집니다.  
![\[알코올 음료를 들고 있는 사람들을 묘사하는 세 개의 이미지로, 이미지 레이블의 '알코올' 카테고리 예측을 설명하는 데 사용됩니다.\]](http://docs.aws.amazon.com/ko_kr/rekognition/latest/dg/images/BA-7-verify-predictions-1.png)

   예측을 검증하면 이미지 아래의 텍스트가 변경되어 검증한 예측의 유형을 보여줍니다. 이미지를 검증한 후에는 **이미지에 레이블 할당** 메뉴를 사용하여 이미지에 다른 레이블을 추가할 수도 있습니다. 선택한 신뢰도 임계값에 대해 모델이 어떤 이미지에 플래그를 지정했는지 또는 플래그를 지정하지 않았는지 확인하거나 카테고리별로 이미지를 필터링할 수 있습니다.  
![\[알코올에 대한 콘텐츠 조절의 세 가지 예와 레이블을 적용하는 메뉴를 보여주는 이미지입니다.\]](http://docs.aws.amazon.com/ko_kr/rekognition/latest/dg/images/BA-8-verify-predictions-2.png)

1. 확인하려는 모든 예측의 검증을 완료하면 검증 페이지의 **레이블당 성능** 섹션에서 검증된 예측에 대한 통계를 볼 수 있습니다. 대량 분석 세부 정보 페이지로 돌아가서 이러한 통계를 볼 수도 있습니다.  
![\[50% 신뢰도 임곗값에서 노골적 누드, 선정적 및 알코올 레이블에 대한 false positive 비율을 보여주는 콘텐츠 조절 확인 페이지입니다.\]](http://docs.aws.amazon.com/ko_kr/rekognition/latest/dg/images/BA-8.5-predictions-stats.png)

1. **레이블당 성능**에 관련된 통계에 만족하면 **예측 확인** 페이지로 다시 이동한 다음 **어댑터 훈련** 버튼을 선택하여 어댑터 훈련을 시작하세요.  
![\[이름, 생성 날짜, 모델 버전, 입력 및 출력 위치를 포함하여 작업 세부 정보를 보여주는 예측 페이지를 확인합니다. 어댑터 훈련 버튼이 있습니다.\]](http://docs.aws.amazon.com/ko_kr/rekognition/latest/dg/images/BA-9-train-adapter.png)

1. 어댑터 훈련 페이지에서는 프로젝트를 만들거나 기존 프로젝트를 선택하라는 메시지가 표시됩니다. 프로젝트와 프로젝트에 포함될 어댑터의 이름을 지정합니다. 테스트 이미지의 소스도 지정해야 합니다. 이미지를 지정할 때 Rekognition에서 자동으로 훈련 데이터의 일부를 테스트 이미지로 사용하도록 자동 분할을 선택하거나 매니페스트 파일을 수동으로 지정할 수 있습니다. 자동 분할을 선택하는 것을 권장합니다.  
![\[프로젝트 이름, 어댑터 이름, 어댑터 설명을 입력하고 테스트 데이터 소스를 지정하며 데이터를 자동 분할하거나 매니페스트 파일을 가져오는 필드가 있는 새 어댑터 프로젝트를 생성하는 인터페이스입니다.\]](http://docs.aws.amazon.com/ko_kr/rekognition/latest/dg/images/BA-10-train-adapter-project.png)

1. 원하는 태그를 지정하고 기본 AWS KMS 키를 사용하지 않으려면 AWS 키를 지정합니다. **자동 업데이트**를 활성화한 상태로 두는 것이 좋습니다.

1. **어댑터 훈련**을 선택하세요.  
![\[태그 추가, 데이터 암호화, 신뢰도 임곗값 및 자동 업데이트 옵션을 포함한 어댑터의 구성 설정입니다. 어댑터는 이 인터페이스에서 훈련할 수 있습니다.\]](http://docs.aws.amazon.com/ko_kr/rekognition/latest/dg/images/BA-11-train-adapter.png)

1. 사용자 지정 조절 랜딩 페이지에서 어댑터 상태가 “훈련 완료”로 표시되면 어댑터의 성능을 검토할 수 있습니다. 자세한 정보는 [어댑터 성능 검토](#using-adapters-tutorial-performance)을 참조하세요.

## 어댑터 성능 검토
<a name="using-adapters-tutorial-performance"></a>

어댑터 성능을 검토하려면

1. 콘솔을 사용해 사용자 지정 조절 랜딩 페이지의 프로젝트 탭에서 프로젝트와 연결된 모든 어댑터의 상태를 확인할 수 있습니다. 사용자 지정 조절 랜딩 페이지로 이동합니다.  
![\[상태, 어댑터 ID, 입력 데이터 위치, 기본 모델 버전, 생성 날짜 및 상태 메시지와 같은 세부 정보가 포함된 조절 프로젝트의 목록을 보여주는 사용자 지정 조절 랜딩 페이지입니다. 프로젝트를 생성, 삭제 또는 재개할 수 있습니다.\]](http://docs.aws.amazon.com/ko_kr/rekognition/latest/dg/images/adapters-7-status-alt.png)

1. 이 목록에서 검토하려는 어댑터를 선택합니다. 다음 어댑터 세부 정보 페이지에서 어댑터에 대한 다양한 지표를 볼 수 있습니다.  
![\[선정적 및 알코올과 같은 다양한 레이블 카테고리에 대해 25%의 false positive 개선 및 24%의 false negative 감소를 보여주는 어댑터 성능 지표와 실제 true positive, 기본 모델 및 어댑터 false negative에 대한 데이터입니다.\]](http://docs.aws.amazon.com/ko_kr/rekognition/latest/dg/images/adapters-8.5-new-performance-review.png)

1. **임계값** 패널을 사용해서 이미지에 레이블을 할당하기 위해 어댑터가 가져야 하는 신뢰도 임계값을 변경할 수 있습니다. 신뢰도 임계값을 조절함에 따라 플래그 지정 인스턴스와 플래그 미지정 인스턴스의 수가 변경됩니다. 레이블 카테고리별로 필터링하여 선택한 카테고리의 지표를 볼 수도 있습니다. 선택한 임계값을 설정합니다.

1. 어댑터 성능 패널에서 지표를 검토하여 테스트 데이터에 대한 어댑터의 성능을 평가할 수 있습니다. 이러한 지표는 어댑터에서 추출한 결과를 테스트 세트의 “실측 정보”와 비교하여 계산됩니다.

어댑터 성능 패널에는 생성한 어댑터에 대한 False Positive 개선 및 False Negative 개선률이 표시됩니다. 레이블당 성능 탭을 사용하여 각 레이블 카테고리의 어댑터 및 기본 모델 성능을 비교할 수 있습니다. 이는 기본 모델 및 어댑터의 false positive 및 false negative 예측 수를 레이블 카테고리별로 계층화하여 보여줍니다. 이러한 지표를 검토하여 어댑터의 개선이 필요한 부분을 파악할 수 있습니다. 이러한 지표에 대한 자세한 내용은 [어댑터 평가 및 개선](using-adapters-evaluating-improving.md) 섹션을 참조하세요.

성능을 향상시키기 위해 더 많은 훈련 이미지를 수집한 다음 프로젝트 내부를 기반으로 새 어댑터를 만들 수 있습니다. 사용자 지정 조절 랜딩 페이지로 돌아가서 프로젝트 내에 새 어댑터를 생성하여 어댑터가 훈련할 수 있도록 더 많은 훈련 이미지를 제공하기만 하면 됩니다. 이번에는 **새 프로젝트 생성** 대신 **기존 프로젝트에 추가** 옵션을 선택하고 **프로젝트 이름** 드롭다운 메뉴에서 새 어댑터를 만들려는 프로젝트를 선택합니다. 이전과 마찬가지로 이미지에 주석을 달거나 주석이 달린 매니페스트 파일을 제공하세요.

![\[어댑터 및 프로젝트의 이름을 지정하는 옵션을 사용하여 새 콘텐츠 조절 어댑터를 생성하거나 기존 프로젝트에 추가하는 인터페이스입니다.\]](http://docs.aws.amazon.com/ko_kr/rekognition/latest/dg/images/adapters-9-create-new-adapter.png)


## 어댑터 사용
<a name="using-adapters-tutorial-using-adapter"></a>

어댑터를 생성한 후에는 [DetectModerationLabels](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_DetectModerationLabels.html)와 같이 지원되는 Rekognition 작업에 어댑터를 제공할 수 있습니다. 어댑터로 추론을 수행하는 데 사용할 수 있는 코드 샘플을 보려면 AWS CLI와 Python 모두에 대한 코드 샘플을 볼 수 있는 “어댑터 사용” 탭을 선택합니다. 설명서에서 어댑터를 생성한 목적인 작업에 대한 섹션을 방문하여 더 많은 코드 샘플, 설정 지침 및 샘플 JSON을 볼 수도 있습니다.

![\[해당 S3 URL 필드가 있는 테스트 데이터, 훈련 데이터 및 출력 데이터의 위치를 보여주는 인터페이스입니다. 어댑터를 사용하고, 훈련 이미지 및 태그를 보고, AWS CLI 및 Python에서 훈련된 어댑터를 사용하기 위한 ID 및 코드 샘플을 포함한 어댑터 세부 정보에 액세스하는 옵션입니다.\]](http://docs.aws.amazon.com/ko_kr/rekognition/latest/dg/images/adapters-12-use-adapter.png)


## 어댑터 및 프로젝트 삭제
<a name="using-adapters-tutorial-deleting-adapter"></a>

개별 어댑터를 삭제하거나 프로젝트를 삭제할 수 있습니다. 프로젝트와 연결된 모든 어댑터를 삭제해야 프로젝트 자체를 삭제할 수 있습니다.

1. 프로젝트와 연결된 어댑터를 삭제하려면 어댑터를 선택한 다음 **삭제**를 선택합니다.

1. 프로젝트를 삭제하려면 삭제할 프로젝트를 선택한 다음 **삭제**를 선택합니다.

# 어댑터 평가 및 개선
<a name="using-adapters-evaluating-improving"></a>

어댑터를 훈련할 때마다 Rekognition 콘솔 도구의 성능 지표를 검토하여 원하는 성능 수준에 어댑터가 얼마나 근접했는지 확인해야 합니다. 그런 다음 새 훈련 이미지를 업로드하고 프로젝트 내에서 새 어댑터를 훈련시켜 이미지에 대한 어댑터의 정확도를 더욱 높일 수 있습니다. 개선된 버전의 어댑터를 만든 후에는 콘솔을 사용하여 더 이상 필요하지 않은 이전 버전의 어댑터를 삭제할 수 있습니다.

[DescribeProjectVersions](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_DescribeProjectVersions.html) API 작업을 사용하여 지표를 검색할 수도 있습니다.

## 성능 지표
<a name="using-adapters-performance-metrics"></a>

훈련 프로세스를 완료하고 어댑터를 만든 후에는 어댑터가 이미지에서 정보를 얼마나 잘 추출하고 있는지 평가하는 것이 중요합니다.

Rekognition 콘솔에는 어댑터 성능 분석에 도움이 되는 두 가지 지표, 즉 false positive 개선과 false negative 개선이 제공됩니다.

콘솔의 어댑터 부분에서 “어댑터 성능” 탭을 선택하여 모든 어댑터에 대해 이러한 지표를 볼 수 있습니다. 어댑터 성능 패널에는 생성한 어댑터에 대한 False Positive 개선 및 False Negative 개선률이 표시됩니다.

False positive 개선은 기본 모델에 비해 어댑터의 false positive 인식률이 얼마나 개선되었는지를 나타냅니다. False positive 개선 값이 25%라면 어댑터가 테스트 데이터 세트에서 false positive에 대한 인식을 25% 개선했다는 의미입니다.

False negative 개선은 기본 모델에 비해 어댑터의 false negative 인식률이 얼마나 개선되었는지를 나타냅니다. False negative 개선 값이 25%라면 어댑터가 테스트 데이터 세트에서 false negative에 대한 인식을 25% 개선했다는 의미입니다.

레이블당 성능 탭을 사용하여 각 레이블 카테고리의 어댑터 및 기본 모델 성능을 비교할 수 있습니다. 이는 기본 모델 및 어댑터의 false positive 및 false negative 예측 수를 레이블 카테고리별로 계층화하여 보여줍니다. 이러한 지표를 검토하여 어댑터의 개선이 필요한 부분을 파악할 수 있습니다.

예를 들어 알코올 레이블 카테고리의 기본 모델 False Negative 비율이 15이고 어댑터의 False Negative 비율이 15 이상이라면 새 어댑터를 만들 때 알코올 레이블이 포함된 이미지를 더 추가하는 데 집중해야 한다는 것을 알 수 있습니다.

Rekognition API 작업을 사용하는 경우 [DescribeProjectVersions](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_DescribeProjectVersions.html) 작업을 직접 호출하면 F1-Score 지표가 반환됩니다.

## 모델 개선
<a name="using-adapters-improving-model"></a>

어댑터 배포는 반복적인 프로세스로, 목표 정확도 수준에 도달하려면 어댑터를 여러 번 훈련해야 할 수 있습니다. 어댑터를 만들고 훈련시킨 후에는 다양한 유형의 레이블에서 어댑터의 성능을 테스트하고 평가해야 합니다.

어댑터의 정확도가 어느 부분에서든 부족한 경우 해당 이미지의 새로운 예시를 추가하여 해당 레이블에 대한 어댑터의 성능을 높이세요. 어댑터가 어려움을 겪는 사례들을 반영해서 다양한 예시를 추가로 제공하세요. 어댑터에 특징적이고 다양한 이미지를 제공하면 다채로운 현실 사례를 처리할 수 있습니다.

훈련 세트에 새 이미지를 추가하고 어댑터를 다시 훈련시킨 다음 테스트 세트와 레이블을 가지고 다시 평가하세요. 어댑터가 원하는 성능 수준에 도달할 때까지 이 프로세스를 반복합니다. 특징적인 이미지와 주석을 더 많이 제공하면 false positive 및 false negative 점수가 반복되는 훈련을 통해 점차 개선될 것입니다.

# 매니페스트 파일 형식
<a name="using-adapters-manifest-files"></a>

다음 섹션에는 입력, 출력 및 평가 파일의 매니페스트 파일 형식 샘플이 나와 있습니다.

## 입력 매니페스트
<a name="using-adapters-manifest-files-input"></a>

매니페스트 파일은 json 줄로 구분된 파일로, 각 줄에는 단일 이미지에 대한 정보가 들어 있는 JSON이 들어 있습니다.

입력 매니페스트의 각 항목은 Amazon S3 버킷에 든 이미지 경로가 있는 `source-ref` 필드를 포함해야 하며, 사용자 지정 조절의 경우 실측 정보 주석이 있는 `content-moderation-groundtruth` 필드를 포함해야 합니다. 한 데이터 세트의 모든 이미지는 동일한 버킷에 있어야 합니다. 이 구조는 훈련 매니페스트 파일과 테스트 매니페스트 파일 모두에 공통으로 적용됩니다.

사용자 지정 조절의 `CreateProjectVersion` 작업은 입력 매니페스트에 제공된 정보를 사용하여 어댑터를 훈련시킵니다.

다음 예제는 안전하지 않은 단일 클래스가 포함된 단일 이미지에 대한 매니페스트 파일의 한 줄입니다.

```
{
   "source-ref": "s3://foo/bar/1.jpg",
   "content-moderation-groundtruth": {
        "ModerationLabels": [
            { 
                "Name": "Rude Gesture"
            }
        ]
   }
}
```

다음 예제는 안전하지 않은 여러 클래스, 특히 나체 및 무례한 제스처를 포함하는 안전하지 않은 단일 이미지에 대한 매니페스트 파일의 한 줄입니다.

```
{
   "source-ref": "s3://foo/bar/1.jpg",
   "content-moderation-groundtruth": {
        "ModerationLabels": [
            { 
                "Name": "Rude Gesture"
            },
            {
                "Name": "Nudity"
            }
        ]
   }
}
```

다음 예제는 안전하지 않은 클래스가 포함되지 않은 단일 이미지에 대한 매니페스트 파일의 한 줄입니다.

```
{
   "source-ref": "s3://foo/bar/1.jpg",
   "content-moderation-groundtruth": {
        "ModerationLabels": []
   }
}
```

지원되는 레이블의 전체 목록은 [콘텐츠 조절](https://docs.aws.amazon.com/rekognition/latest/dg/moderation.html)을 참조하세요.



## 출력 매니페스트
<a name="using-adapters-manifest-files-output"></a>

훈련 작업이 완료되면 출력 매니페스트 파일이 반환됩니다. 출력 매니페스트 파일은 JSON 줄로 구분된 파일로, 각 줄에는 단일 이미지에 대한 정보가 들어 있는 JSON이 들어 있습니다. OutputManifest의 Amazon S3 경로는 `DescribeProjectVersion` 응답에서 확인할 수 있습니다.
+  데이터 세트 훈련용 `TrainingDataResult.Output.Assets[0].GroundTruthManifest.S3Object` 
+  데이터 세트 테스트용 `TestingDataResult.Output.Assets[0].GroundTruthManifest.S3Object` 

출력 매니페스트의 각 항목에 대해 다음 정보가 반환됩니다.


|  |  | 
| --- |--- |
| Key Name | Description | 
|  source-ref  | Reference to an image in s3 that was provided in the input maniefst | 
|  content-moderation-groundtruth  | Ground truth annotations that were provided in the input manifest | 
|  detect-moderation-labels  | Adapter predictions, part of the testing dataset only | 
|  detect-moderation-labels-base-model  | Base model predictions, part of the testing dataset only | 

어댑터 및 기본 모델 예측은 ConfidenceTrehsold 5.0에서 [DetectModerationLabels](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_DetectModerationLabels.html) 응답과 유사한 형식으로 반환됩니다.

다음 예제는 어댑터 및 기본 모델 예측의 구조를 보여줍니다.

```
{
   "ModerationLabels": [ 
      { 
         "Confidence": number,
         "Name": "string",
         "ParentName": "string"
      }
   ],
   "ModerationModelVersion": "string",
   "ProjectVersion": "string"
}
```

반환되는 레이블의 전체 목록은 [콘텐츠 조절](https://docs.aws.amazon.com/rekognition/latest/dg/moderation.html)을 참조하세요.

## 평가 결과 매니페스트
<a name="using-adapters-manifest-files-eval"></a>

훈련 작업이 완료되면 평가 결과 매니페스트 파일이 반환됩니다. 평가 결과 매니페스트는 훈련 작업에서 출력한 JSON 파일이며, 여기에는 테스트 데이터에서 어댑터가 얼마나 좋은 결과를 냈는지에 대한 정보가 들어 있습니다.

평가 결과 매니페스트의 Amazon S3 경로는 DescribeProejctVersion 응답의 `EvaluationResult.Summary.S3Object` 필드에서 확인할 수 있습니다.

다음 예제는 평가 결과 매니페스트 구조를 보여줍니다.

```
{
    "AggregatedEvaluationResults": {
       "F1Score": number
    },

    "EvaluationDetails": {
        "EvaluationEndTimestamp": "datetime",
        "Labels": [
            "string"
        ],
        "NumberOfTestingImages": number,
        "NumberOfTrainingImages": number,
        "ProjectVersionArn": "string"
    },

    "ContentModeration": {
        "InputConfidenceThresholdEvalResults": {
            "ConfidenceThreshold": float,
            "AggregatedEvaluationResults": {
                "BaseModel": {
                    "TruePositive": int,
                    "TrueNegative": int,
                    "FalsePositive": int,
                    "FalseNegative": int
                },
                "Adapter": {
                    "TruePositive": int,
                    "TrueNegative": int,
                    "FalsePositive": int,
                    "FalseNegative": int
                }
            },
            "LabelEvaluationResults": [
                {
                    "Label": "string",
                    "BaseModel": {
                        "TruePositive": int,
                        "TrueNegative": int,
                        "FalsePositive": int,
                        "FalseNegative": int
                    },
                    "Adapter": {
                        "TruePositive": int,
                        "TrueNegative": int,
                        "FalsePositive": int,
                        "FalseNegative": int
                    }
                }
            ]
        }
        "AllConfidenceThresholdsEvalResults": [
            {
                "ConfidenceThreshold": float,
                "AggregatedEvaluationResults": {
                    "BaseModel": {
                        "TruePositive": int,
                        "TrueNegative": int,
                        "FalsePositive": int,
                        "FalseNegative": int
                    },
                    "Adapter": {
                        "TruePositive": int,
                        "TrueNegative": int,
                        "FalsePositive": int,
                        "FalseNegative": int
                    }
                },
                "LabelEvaluationResults": [
                    {
                       "Label": "string",
                        "BaseModel": {
                            "TruePositive": int,
                            "TrueNegative": int,
                            "FalsePositive": int,
                            "FalseNegative": int
                        },
                        "Adapter": {
                            "TruePositive": int,
                            "TrueNegative": int,
                            "FalsePositive": int,
                            "FalseNegative": int
                        }
                    }
                ]
            }
        ]
    }
}
```

평가 매니페스트 파일에는 다음이 포함됩니다.
+ `F1Score`에 정의된 집계 결과 
+ ProjectVersionArn, 훈련 이미지의 수, 테스트 이미지의 수, 어댑터가 훈련된 레이블 등 평가 작업에 대한 세부 정보
+ 기본 모델 및 어댑터 성능 둘 다에 대한 TruePositive, TrueNegative, FalsePositive, FalseNegative 결과 집계치
+ 입력 신뢰도 임계값에서 계산된 기본 모델 및 어댑터 성능 모두에 대한 레이블별 TruePositive, TrueNegative, FalsePositive 및 FalseNegative 결과
+ 서로 다른 신뢰도 임계값에서 기본 모델 및 어댑터 성능 모두에 대한 레이블별 TruePositive, TrueNegative, FalsePositive 및 FalseNegative 결과 집계치 신뢰도 임계값의 범위는 5에서 100까지이며 5씩 조절 가능합니다.

# 어댑터 훈련 모범 사례
<a name="using-adapters-best-practices"></a>

어댑터를 생성, 훈련, 사용할 때 다음 모범 사례를 따르는 것을 권장합니다.



1.  샘플 이미지 데이터는 고객이 억제하려는 전형적인 오류를 담고 있어야 합니다. 모델이 시각적으로 유사한 이미지에서 실수를 반복하는 경우 해당 이미지를 대량으로 훈련해야 합니다.

1.  특정 조절 레이블에 대해 모델이 잘못 인식하는 이미지만 가져오는 대신 모델이 올바른 예측을 하는 이미지도 입력하세요.

1.  훈련용으로는 최소 50개의 False Negative 샘플 또는 20개의 False Positive 샘플을 제공하고 테스트용으로는 최소 20개의 샘플을 제공하세요. 그러나 어댑터 성능을 높이려면 주석이 달린 이미지를 최대한 많이 제공하는 것이 좋습니다.

1.  모든 이미지에 대해 중요한 모든 레이블에 주석 달기 - 이미지에 표시된 레이블에 대해 주석을 달아야 하는 경우, 다른 모든 이미지에서 이 레이블과 일치하는 부분에 주석을 달아야 합니다.

1.  샘플 이미지 데이터에는 프로덕션 환경에서 분석될 이미지의 특징적인 사례에 초점을 맞추어 레이블의 변형을 최대한 많이 포함해야 합니다.

# 자동 업데이트 권한 설정
<a name="using-adapters-autoupdate"></a>

Rekognition은 사용자 지정 어댑터에 대한 자동 업데이트 기능을 지원합니다. 즉, 프로젝트에 AutoUpdate 플래그가 활성화되어 있는 경우 자동 재훈련을 최대한 활용할 수 있다는 것입니다. 이러한 자동 업데이트에는 훈련/테스트 데이터 세트와 고객 어댑터를 훈련시키는 AWS KMS 키에 액세스할 수 있는 권한이 필요합니다. 아래 단계에 따라 이러한 권한을 제공할 수 있습니다.



## Amazon S3 버킷 권한
<a name="using-adapters-autoupdate-s3"></a>

 기본적으로 모든 Amazon S3 버킷 및 객체는 프라이빗입니다. 버킷을 생성한 AWS 계정인 리소스 소유자만 버킷과 버킷에 포함된 모든 객체에 액세스할 수 있습니다. 그러나 리소스 소유자는 버킷 정책을 작성함으로써 다른 리소스 및 사용자에게 액세스 권한을 부여할 수 있습니다.

 사용자 지정 어댑터 훈련에 있어 입력 데이터 세트 및 훈련 결과의 원본으로 사용할 Amazon S3 버킷을 생성하거나 수정하려는 경우 버킷 정책을 추가로 수정해야 합니다. Amazon S3 버킷에서 읽거나 쓰려면 Rekognition에 다음 권한이 있어야 합니다.

**Rekognition에 필요한 Amazon S3 정책**

Rekognition에는 다음과 같은 속성을 가진 권한 정책이 필요합니다.
+ Statement SID
+ 버킷 이름
+ Rekognition의 서비스 보안 주체 이름
+ Rekognition, 버킷 및 이의 모든 콘텐츠에 필요한 리소스
+ Rekognition에서 해야 하는 작업

다음 정책은 Rekognition에서 자동 재훈련 중에 Amazon S3 버킷에 액세스하도록 허용합니다.

```
{
    "Statement": [
        {
            "Effect": "Allow",
            "Sid": "AllowRekognitionAutoUpdateActions",
            "Principal": {
                "Service": "rekognition.amazonaws.com"
            },
            "Action": [
                "s3:ListBucket",
                "s3:GetObject",
                "s3:PutObject",
                "s3:HeadObject",
                "s3:HeadBucket"
            ],
            "Resource": [
                "arn:aws:s3:::amzn-s3-demo-bucket",
                "arn:aws:s3:::amzn-s3-demo-bucket/*"
            ]
        }
    ]
}
```

[이 안내서](https://docs.aws.amazon.com/AmazonS3/latest/userguide/add-bucket-policy.html)에 따라 위의 버킷 정책을 S3 버킷에 추가할 수 있습니다.

버킷 정책에 대한 자세한 내용은 [여기](https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucket-policies.html)를 참조하세요.

## AWS KMS 키 권한
<a name="using-adapters-autoupdate-KMS"></a>

 Rekognition을 사용하면 사용자 지정 어댑터를 훈련하는 동안 KmsKeyId를 선택적으로 제공할 수 있습니다. Rekognition은 이 키를 사용하여 모델 훈련을 위해 서비스에 복사되는 훈련 및 테스트 이미지를 암호화합니다. 이 키는 출력 Amazon S3 버킷(OutputConfig)에 기록된 훈련 결과 및 매니페스트 파일을 암호화하는 데에도 사용됩니다.

 KMS 키를 사용자 지정 어댑터 훈련에 대한 입력으로 제공하기로 선택한 경우(즉 `Rekognition:CreateProjectVersion`) Rekognition 서비스 주체가 향후 자동 재훈련에 이 키를 사용할 수 있도록 KMS 키 정책을 추가로 수정해야 합니다. Rekognition에는 다음 권한이 반드시 필요합니다.

**Rekognition 필수 AWS KMS 키 정책**

Amazon Rekognition에는 다음과 같은 속성을 가진 권한 정책이 필요합니다.
+ Statement SID
+ Amazon Rekognition의 서비스 보안 주체 이름
+ Amazon Rekognition에서 해야 하는 작업

다음 키 정책은 Amazon Rekognition이 자동 재훈련 중에 Amazon KMS 키에 액세스할 수 있도록 허용합니다.

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "KeyPermissions",
            "Effect": "Allow",
            "Principal": {
                "Service": "rekognition.amazonaws.com"
            },
            "Action": [
                "kms:DescribeKey",
                "kms:GenerateDataKey",
                "kms:Decrypt"
            ],
            "Resource": "*"
        }
    ]
}
```

------

[이 가이드](https://docs.aws.amazon.com/kms/latest/APIReference/API_PutKeyPolicy.html)에 따라 AWS KMS 키에 위의 AWS KMS 정책을 추가할 수 있습니다.

 AWS KMS 정책에 대한 자세한 내용은 [여기에서](https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html) 확인하세요.

# AWS Rekognition에 대한 Health Dashboard 인증
<a name="using-adapters-health-notification"></a>

 AWS 상태 대시보드는 Rekognition에서 보내는 알림에 대한 지원을 제공합니다. 이러한 알림은 애플리케이션에 영향을 미칠 수 있는 Rekognition 모델의 예정된 변경 사항에 대한 안내 및 조치를 위한 지침을 제공합니다. 현재는 Rekognition 콘텐츠 조절 기능과 관련된 이벤트만 사용할 수 있습니다.

 AWS 상태 대시보드는 AWS 상태 서비스의 일부입니다. 설정이 필요하지 않으며, 계정에서 인증된 사용자면 누구나 볼 수 있습니다. 자세한 내용은 [AWS Health Dashboard 시작](https://docs.aws.amazon.com/health/latest/ug/getting-started-phd.html)을 참조하세요.

다음 메시지와 유사한 메시지를 받으면 조치를 취하라는 경보로 받아들여야 합니다.

**알림 예시: Rekognition 콘텐츠 조절에 새 모델 버전을 사용할 수 있습니다.**

Rekognition은 AWS 상태 대시보드에 `AWS_MODERATION_MODEL_VERSION_UPDATE_NOTIFICATION` 이벤트를 게시하여 조정 모델의 새 버전이 릴리스되었음을 나타냅니다. DetectModerationLabels API 및 어댑터를 해당 API와 함께 사용하는 경우 이 이벤트는 중요합니다. 새 모델은 사용 사례에 따라 품질에 영향을 미칠 수 있으며 결국에는 이전 모델 버전을 대체하게 될 것이기 때문입니다. 이 알림을 받으면 모델 품질을 검증하고 모델 업데이트의 일정을 파악하는 것이 좋습니다.

모델 버전 업데이트 알림을 받은 경우 조치를 취하라는 경보로 취급해야 합니다. 어댑터를 사용하지 않는 경우 기존 사용 사례를 가지고 업데이트된 모델의 품질을 평가해야 합니다. 어댑터를 사용하는 경우 업데이트된 모델로 새 어댑터를 훈련시키고 품질을 평가해야 합니다. 자동 훈련 세트를 사용하는 경우 새 어댑터가 자동으로 훈련될 것이고 그 후 훈련된 어댑터의 품질을 평가할 수 있습니다.

```
{
   "version": "0",
    "id": "id-number",
    "detail-type": "AWS Health Event",
    "source": "aws.health",
    "account": "123456789012",
    "time": "2023-10-06T06:27:57Z",
    "region": "region",
    "resources": [],
    "detail": {
        "eventArn": "arn:aws:health:us-east-1::event/AWS_MODERATION_MODEL_UPDATE_NOTIFICATION_event-number",
        "service": "Rekognition",
        "eventTypeCode": "AWS_MODERATION_MODEL_VERSION_UPDATE_NOTIFICATION",
        "eventScopeCode": "ACCOUNT_SPECIFIC",
        "communicationId": "communication-id-number",
        "eventTypeCategory": "scheduledChange",
        "startTime": "Fri, 05 Apr 2023 12:00:00 GMT",
        "lastUpdatedTime": "Fri, 05 Apr 2023 12:00:00 GMT",
        "statusCode": "open",
        "eventRegion": "us-east-1",
        "eventDescription": [
            {
                "language": "en_US",
                "latestDescription": "A new model version is available for Rekognition Content Moderation."
            }
        ]
    }
}
```

 [EventBridge하려면 Amazon EventBridge를 사용하여 AWS](https://docs.aws.amazon.com/health/latest/ug/cloudwatch-events-health.html) AWS 상태 이벤트 모니터링을 참조하세요. EventBridge 

# Amazon Augmented AI를 사용한 부적절한 콘텐츠 검토
<a name="a2i-rekognition"></a>

Amazon Augmented AI(Amazon A2I)를 사용하면 기계 학습 예측의 인적 검토에 필요한 워크플로우를 구축할 수 있습니다.

Amazon Rekognition은 Amazon A2I와 직접 통합되어 안전하지 않은 이미지를 감지하는 사용 사례에 대한 인적 검토를 쉽게 구현할 수 있습니다. Amazon A2I는 이미지 조정을 위한 인적 검토 워크플로우를 제공합니다. 이를 통해 Amazon Rekognition의 예측을 쉽게 검토할 수 있습니다. 사용 사례에 대한 신뢰도 임계값을 정의하고 시간이 지남에 따라 조정할 수 있습니다. Amazon A2I를 이용하면 조직 또는 Amazon Mechanical Turk 내에서 검토자 풀을 사용할 수 있습니다. 품질과 보안 절차 준수를 위해 AWS에서 사전 검열을 거친 공급업체 인력도 이용할 수 있습니다.

다음 단계에서는 Amazon Rekognition을 이용해 Amazon A2I를 설정하는 방법을 안내합니다. 먼저, 인적 검토를 트리거하는 조건이 있는 Amazon A2I를 사용해 흐름 정의를 생성합니다. 그런 다음 흐름 정의의 Amazon 리소스 이름(ARN)을 Amazon Rekognition `DetectModerationLabel` 작업에 전달합니다. `DetectModerationLabel` 응답에서 인적 검토가 필요한지 여부를 확인할 수 있습니다. 인적 검토의 결과는 흐름 정의에 의해 설정된 Amazon S3 버킷에서 사용할 수 있습니다.

Amazon Rekognition과 함께 Amazon A2I를 사용하는 방법에 대한 종합적인 데모를 보려면 *Amazon SageMaker AI 개발자 안내서*에서 다음 자습서 중 하나를 참조하세요.
+ [데모: Amazon A2I 콘솔에서 시작](https://docs.aws.amazon.com/sagemaker/latest/dg/a2i-get-started-console.html)
+ [데모: Amazon A2I API를 사용하여 시작](https://docs.aws.amazon.com/sagemaker/latest/dg/a2i-get-started-api.html)

  API 사용을 시작하기 위해 예제 Jupyter Notebook을 실행할 수도 있습니다. SageMaker AI 노트북 인스턴스에서 [Amazon Augmented AI(Amazon A2I)와 Amazon Rekognition 통합 [예제]](https://github.com/aws-samples/amazon-a2i-sample-jupyter-notebooks/blob/master/Amazon%20Augmented%20AI%20(A2I)%20and%20Rekognition%20DetectModerationLabels.ipynb) 노트북을 사용하려면 [Amazon A2I Jupyter Notebook으로 SageMaker 노트북 인스턴스 사용](https://docs.aws.amazon.com/sagemaker/latest/dg/a2i-task-types-general.html#a2i-task-types-notebook-demo)을 참조하세요.

**Amazon A2I에서 DetectModerationLabels 실행**
**참고**  
동일한 AWS 리전에서 모든 Amazon A2I 및 Amazon Rekognition 리소스를 생성합니다.

1. *SageMaker AI 설명서*의 [Amazon Augmented AI 시작하기](https://docs.aws.amazon.com/sagemaker/latest/dg/a2i-getting-started.html)에 나열된 사전 요구 사항을 완료하세요.

   또한 *SageMaker AI 설명서*의 [Amazon Augmented AI에서의 권한 및 보안](https://docs.aws.amazon.com/sagemaker/latest/dg/a2i-permissions-security.html) 페이지에서와 같이 IAM 권한을 설정해야 합니다.

1. *SageMaker AI 설명서*의 [인적 검토 워크플로 생성](https://docs.aws.amazon.com/sagemaker/latest/dg/create-human-review-console.html)에 관한 지침을 따르세요.

   인적 검토 워크플로우는 이미지 처리를 관리합니다. 여기에는 인적 검토를 트리거하는 조건, 이미지가 전송되는 작업 팀, 작업 팀이 사용하는 UI 템플릿 및 작업 팀의 결과가 전송되는 Amazon S3 버킷이 포함됩니다.

   `CreateFlowDefinition` 호출 내에서 `HumanLoopRequestSource`를 "AWS/Rekognition/DetectModerationLabels/Image/V3"으로 설정해야 합니다. 그런 다음 인적 검토를 트리거하는 조건을 설정하는 방법을 결정해야 합니다.

   Amazon Rekognition에서는 `ModerationLabelConfidenceCheck` 및 `Sampling`의 두 가지 `ConditionType` 옵션을 사용할 수 있습니다.

   `ModerationLabelConfidenceCheck` 는 중재 레이블의 신뢰도가 범위 내에 있을 때 인적 루프를 생성합니다. 마지막으로, `Sampling`은 인적 검토를 위해 처리된 문서의 임의의 백분율을 보냅니다. 각 `ConditionType`은 다른 `ConditionParameters` 세트를 사용하여 인적 검토 결과를 설정합니다.

   `ModerationLabelConfidenceCheck` 에는 사람이 검토해야 할 키를 설정하는 `ConditionParameters` `ModerationLableName`이 있습니다. 또한 LessThan, GreaterThan 및 Equals를 사용하여 인적 검토에 보낼 백분율 범위를 설정하는 신뢰도도 있습니다. `Sampling`에는 인적 검토로 보낼 문서의 백분율을 설정하는 `RandomSamplingPercentage`이 있습니다.

   다음 코드 예제는 `CreateFlowDefinition`의 부분 호출입니다. "Suggestive"(외설적 콘텐츠) 레이블에서는 98% 미만, "Female Swimwear or Underwear"(여성 수영복 또는 속옷) 레이블에는 95% 이상으로 평가된 경우 인적 검토를 위해 이미지를 보냅니다. 즉, 이미지가 외설적인 것으로 간주되지는 않지만 수영복이나 속옷을 착용한 여성이 있는 경우 인적 검토를 통해 이미지를 다시 확인할 수 있습니다.

   ```
       def create_flow_definition():
       '''
       Creates a Flow Definition resource
   
       Returns:
       struct: FlowDefinitionArn
       '''
       humanLoopActivationConditions = json.dumps(
           {
               "Conditions": [
                   {
                     "And": [
                       {
                           "ConditionType": "ModerationLabelConfidenceCheck",
                           "ConditionParameters": {
                               "ModerationLabelName": "Suggestive",
                               "ConfidenceLessThan": 98
                           }
                       },
                       {
                           "ConditionType": "ModerationLabelConfidenceCheck",
                           "ConditionParameters": {
                               "ModerationLabelName": "Female Swimwear Or Underwear",
                               "ConfidenceGreaterThan": 95
                           }
                       }
                     ]
                  }
               ]
           }
       )
   ```

   `CreateFlowDefinition`은 `DetectModerationLabels`를 호출할 때 다음 단계에서 사용하는 `FlowDefinitionArn`을 반환합니다.

   자세한 내용은 *SageMaker AI API 참조*의 [CreateFlowDefinition](https://docs.aws.amazon.com/sagemaker/latest/dg/API_CreateFlowDefinition.html)을 참조하세요.

1. [부적절한 이미지 감지](procedure-moderate-images.md)에 나온 것처럼 `DetectModerationLabels`를 호출할 때 `HumanLoopConfig` 파라미터를 설정합니다. `HumanLoopConfig` 세트를 사용하는 `DetectModerationLabels` 직접 호출의 예는 4단계를 참조하세요.

   1. `HumanLoopConfig` 파라미터 내에서 `FlowDefinitionArn`을 2단계에서 생성한 흐름 정의의 ARN으로 설정합니다.

   1. `HumanLoopName`을 설정합니다. 이는 지역 내에서 고유해야 하며 소문자여야 합니다.

   1. (선택 사항) `DataAttributes`를 사용하여 Amazon Rekognition에 전달한 이미지에 개인 식별 정보가 없는지 여부를 설정할 수 있습니다. Amazon Mechanical Turk에 정보를 보내려면 이 파라미터를 설정해야 합니다.

1. `DetectModerationLabels`를 실행합니다.

   다음 예제에서는 AWS CLI 및를 사용하여 `HumanLoopConfig` 세트`DetectModerationLabels`로 AWS SDK for Python (Boto3) 를 실행하는 방법을 보여줍니다.

------
#### [ AWS SDK for Python (Boto3) ]

   다음 요청 예제에서는 SDK for Python(Boto3)을 사용합니다. 자세한 내용은 *AWS SDK for Python(Boto) API 참조*의 [detect\$1moderation\$1labels](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/rekognition.html#Rekognition.Client.detect_moderation_labels)를 참조하세요.

   ```
   import boto3
   
   rekognition = boto3.client("rekognition", aws-region)
   
   response = rekognition.detect_moderation_labels( \
           Image={'S3Object': {'Bucket': bucket_name, 'Name': image_name}}, \
           HumanLoopConfig={ \
               'HumanLoopName': 'human_loop_name', \
               'FlowDefinitionArn': , "arn:aws:sagemaker:aws-region:aws_account_number:flow-definition/flow_def_name" \
               'DataAttributes': {'ContentClassifiers': ['FreeOfPersonallyIdentifiableInformation','FreeOfAdultContent']}
            })
   ```

------
#### [ AWS CLI ]

   다음 요청 예제에서는 AWS CLI를 사용합니다. 자세한 내용은 [AWS CLI 명령 참조](https://docs.aws.amazon.com/cli/latest/reference/)의 [detect-moderation-labels](https://docs.aws.amazon.com/cli/latest/reference/rekognition/detect-moderation-labels.html) 섹션을 참조하세요.**

   ```
   $ aws rekognition detect-moderation-labels \
       --image "S3Object={Bucket='bucket_name',Name='image_name'}" \
       --human-loop-config HumanLoopName="human_loop_name",FlowDefinitionArn="arn:aws:sagemaker:aws-region:aws_account_number:flow-definition/flow_def_name",DataAttributes='{ContentClassifiers=["FreeOfPersonallyIdentifiableInformation", "FreeOfAdultContent"]}'
   ```

   ```
   $ aws rekognition detect-moderation-labels \
       --image "S3Object={Bucket='bucket_name',Name='image_name'}" \
       --human-loop-config \
           '{"HumanLoopName": "human_loop_name", "FlowDefinitionArn": "arn:aws:sagemaker:aws-region:aws_account_number:flow-definition/flow_def_name", "DataAttributes": {"ContentClassifiers": ["FreeOfPersonallyIdentifiableInformation", "FreeOfAdultContent"]}}'
   ```

------

   `HumanLoopConfig`가 활성화된 상태로 `DetectModerationLabels`를 실행하면 Amazon Rekognition이 SageMaker AI API 작업 `StartHumanLoop`를 직접 호출합니다. 이 명령은 `DetectModerationLabels`에서 답변을 받고 예제의 흐름 정의 조건에 대해 확인합니다. 검토 조건을 충족하는 경우 `HumanLoopArn`을 반환합니다. 흐름 정의에서 설정한 작업 팀의 구성원은 이제 이미지를 검토할 수 있게 되었다는 의미입니다. Amazon Augmented AI 런타임 작업을 호출하면 `DescribeHumanLoop`는 루프의 결과에 대한 정보를 제공합니다. 자세한 내용은 *Amazon Augmented AI API 참조 설명서*의 [DescribeHumanLoop](https://docs.aws.amazon.com/augmented-ai/2019-11-07/APIReference/API_DescribeHumanLoop.html)를 참조하세요.

   이미지를 검토한 후에는 흐름 정의의 출력 경로에 지정된 버킷에서 결과를 확인할 수 있습니다. 또한 검토가 완료되면 Amazon A2I는 Amazon CloudWatch Events의 알림을 보냅니다. 어떤 이벤트를 찾아봐야 하는지 알아보려면 *SageMaker AI 설명서*에서 [CloudWatch 이벤트](https://docs.aws.amazon.com/sagemaker/latest/dg/augmented-ai-cloudwatch-events.html)를 참조하세요.

   자세한 내용은 *SageMaker AI 설명서*에서 [Amazon Augmented AI 시작하기](https://docs.aws.amazon.com/sagemaker/latest/dg/a2i-getting-started.html) 참조하세요.