멀티모달 입력 프롬프트
다음 섹션에서는 이미지 및 비디오 이해에 관한 지침을 제공합니다. 오디오 관련 프롬프트는 음성 대화 프롬프트 섹션을 참조하세요.
일반 멀티모달 지침
사용자 프롬프트 및 시스템 프롬프트
멀티모달 이해 사용 사례에서 모든 요청에는 사용자 프롬프트 텍스트가 포함되어야 합니다. 텍스트만 포함할 수 있는 시스템 프롬프트는 선택 사항입니다.
시스템 프롬프트를 사용하여 모델의 페르소나를 지정하고 일반적인 성격과 응답 스타일을 정의할 수 있지만, 자세한 태스크 정의나 출력 형식 지정 지침에 사용해서는 안 됩니다.
멀티모달 사용 사례에 대한 시스템 프롬프트보다 더 강력한 효과를 얻으려면 사용자 프롬프트에 태스크 정의, 지침 및 서식 세부 정보를 포함합니다.
콘텐츠 순서
Amazon Nova로 전송된 멀티모달 이해 요청에는 하나 이상의 파일과 하나의 사용자 프롬프트가 포함되어야 합니다. 사용자 텍스트 프롬프트는 메시지에서 항상 이미지, 문서 또는 비디오 콘텐츠 뒤의 마지막 항목이어야 합니다.
message = { "role": "user", "content": [ { "document|image|video|audio": {...} }, { "document|image|video|audio": {...} }, ... { "text": "<user prompt>" } ] }
사용자 프롬프트 내에서 특정 파일을 참조하려는 경우 'text' 요소를 사용하여 각 파일 블록 앞에 있는 레이블을 정의합니다.
message = { "role": "user", "content": [ { "text": "<label for item 1>" }, { "document|image|video|audio": {...} }, { "text": "<label for item 2>" }, { "document|image|video|audio": {...} }, ... { "text": "<user prompt>" } ] }
문서 및 이미지 이해
다음 섹션에서는 이미지 및 문서를 이해하거나 분석해야 하는 태스크에서 프롬프트를 만드는 방법에 대한 지침을 제공합니다.
이미지에서 텍스트 추출
Amazon Nova 모델은 광학 문자 인식(OCR)이라고 하는 기능으로 이미지에서 텍스트를 추출할 수 있습니다. 최상의 결과를 얻으려면 텍스트 문자를 쉽게 식별할 수 있을 만큼 모델에 제공하는 이미지 입력의 해상도가 충분히 높은지 확인합니다.
텍스트 추출 사용 사례의 경우 다음 추론 구성을 사용하는 것이 좋습니다.
-
temperature: 기본값(0.7)
-
topP: 기본값(0.9)
-
추론을 활성화하지 않음
Amazon Nova 모델은 마크다운, HTML 또는 LaTeX 형식으로 텍스트를 추출할 수 있습니다. 다음과 같은 사용자 프롬프트 템플릿이 권장됩니다.
## Instructions Extract all information from this page using only {text_formatting} formatting. Retain the original layout and structure including lists, tables, charts and math formulae. ## Rules 1. For math formulae, always use LaTeX syntax. 2. Describe images using only text. 3. NEVER use HTML image tags `<img>` in the output. 4. NEVER use Markdown image tags `![]()` in the output. 5. Always wrap the entire output in ``` tags.
출력은 전체 또는 부분 마크다운 코드 펜스(```)로 래핑됩니다. 다음과 유사한 코드를 사용하여 코드 펜스를 제거할 수 있습니다.
def strip_outer_code_fences(text): lines = text.split("\n") # Remove only the outer code fences if present if lines and lines[0].startswith("```"): lines = lines[1:] if lines and lines[-1].startswith("```"): lines = lines[:-1] return "\n".join(lines).strip()
이미지 또는 텍스트에서 구조화된 정보 추출
Amazon Nova 모델은 이미지에서 키 정보 추출(KIE)이라고 하는 프로세스를 통해 기계에서 구문 분석 가능한 JSON 형식으로 정보를 추출할 수 있습니다. KIE를 수행하려면 다음을 제공합니다.
-
JSON 스키마. JSON 스키마 사양을 따르는 정식 스키마 정의입니다.
-
문서 파일, 이미지 또는 문서 텍스트 중 하나 이상
문서 또는 이미지는 요청에서 항상 사용자 프롬프트 앞에 배치해야 합니다.
KIE의 경우 다음 추론 구성을 사용하는 것이 좋습니다.
-
temperature: 0
-
추론: 추론은 필요하지 않지만 이미지 전용 입력 또는 복잡한 스키마를 사용할 때 결과를 개선할 수 있습니다.
프롬프트 템플릿
Given the image representation of a document, extract information in JSON format according to the given schema. Follow these guidelines: - Ensure that every field is populated, provided the document includes the corresponding value. Only use null when the value is absent from the document. - When instructed to read tables or lists, read each row from every page. Ensure every field in each row is populated if the document contains the field. JSON Schema: {json_schema}
Given the OCR representation of a document, extract information in JSON format according to the given schema. Follow these guidelines: - Ensure that every field is populated, provided the document includes the corresponding value. Only use null when the value is absent from the document. - When instructed to read tables or lists, read each row from every page. Ensure every field in each row is populated if the document contains the field. JSON Schema: {json_schema} OCR: {document_text}
Given the image and OCR representations of a document, extract information in JSON format according to the given schema. Follow these guidelines: - Ensure that every field is populated, provided the document includes the corresponding value. Only use null when the value is absent from the document. - When instructed to read tables or lists, read each row from every page. Ensure every field in each row is populated if the document contains the field. JSON Schema: {json_schema} OCR: {document_text}
이미지에서 객체 및 해당 위치 탐지
Amazon Nova 2 모델은 이미지 내에서 객체와 해당 위치를 식별하는 기능을 제공합니다. 이 태스크는 이미지 그라운딩 또는 객체 현지화라고도 합니다. 실제 애플리케이션에는 이미지 분석 및 태그 지정, 사용자 인터페이스 자동화, 이미지 편집 등이 포함됩니다.
이미지 입력 해상도 및 종횡비에 관계없이 모델은 이미지를 가로 1,000단위, 세로 1,000단위로 나누는 좌표 공간을 사용하며, x:0 y:0 위치는 이미지의 왼쪽 상단입니다.
경계 상자는 각각 왼쪽, 위쪽, 오른쪽 및 아래쪽을 나타내는 [x1, y1, x2, y2] 형식을 사용하여 설명됩니다. 2차원 좌표는 [x, y] 형식을 사용하여 표시됩니다.
객체 탐지 사용 사례의 경우 다음 추론 파라미터 값을 사용하는 것이 좋습니다.
-
temperature: 0
-
추론을 활성화하지 않음
프롬프트 템플릿: 일반 객체 탐지
다음과 같은 사용자 프롬프트 템플릿을 권장합니다.
경계 상자를 사용하여 여러 인스턴스 탐지:
Please identify {target_description} in the image and provide the bounding box coordinates for each one you detect. Represent the bounding box as the [x1, y1, x2, y2] format, where the coordinates are scaled between 0 and 1000 to the image width and height, respectively.
경계 상자를 사용하여 단일 리전 탐지:
Please generate the bounding box coordinates corresponding to the region described in this sentence: {target_description}. Represent the bounding box as the [x1, y1, x2, y2] format, where the coordinates are scaled between 0 and 1000 to the image width and height, respectively.
중심점을 사용하여 여러 인스턴스 탐지:
Please identify {target_description} in the image and provide the center point coordinates for each one you detect. Represent the point as the [x, y] format, where the coordinates are scaled between 0 and 1000 to the image width and height, respectively.
중심점을 사용하여 단일 리전 탄지:
Please generate the center point coordinates corresponding to the region described in this sentence: {target_description}. Represent the center point as the [x, y] format, where the coordinates are scaled between 0 and 1000 to the image width and height, respectively.
모델 출력 구문 분석:
위의 각 권장 프롬프트는 다음과 유사한 양식으로 하나 이상의 경계 상자 설명을 포함하는 쉼표로 구분된 문자열을 생성합니다. 문자열 끝에서 "."의 포함 여부는 조금씩 달라질 수 있습니다. 예: [356, 770, 393, 872],
[626, 770, 659, 878].
다음 Python 코드 예제와 같이 정규식을 사용하여 모델에서 생성된 좌표 정보를 구문 분석할 수 있습니다.
def parse_coord_text(text): """Parses a model response which uses array formatting ([x, y, ...]) to describe points and bounding boxes. Returns an array of tuples.""" pattern = r"\[([^\[\]]*?)\]" return [ tuple(int(x.strip()) for x in match.split(",")) for match in re.findall(pattern, text) ]
경계 상자의 정규화된 좌표를 입력 이미지의 좌표 공간에 다시 매핑하기 위해 다음 Python 예제와 유사한 함수를 사용할 수 있습니다.
def remap_bbox_to_image(bounding_box, image_width, image_height): return [ bounding_box[0] * image_width / 1000, bounding_box[1] * image_height / 1000, bounding_box[2] * image_width / 1000, bounding_box[3] * image_height / 1000, ]
프롬프트 템플릿: 여러 위치를 사용하여 여러 객체 클래스 탐지
이미지에서 항목의 여러 클래스를 식별하려는 경우 다음 형식 지정 접근 방식 중 하나를 사용하여 프롬프트에 클래스 목록을 포함할 수 있습니다.
모델이 잘 이해할 수 있는 일반적으로 이해되는 클래스의 경우 대괄호 안에 클래스 이름(따옴표 제외)을 나열합니다.
[car, traffic light, road sign, pedestrian]
미묘하거나 흔하지 않거나 모델이 익숙하지 않을 수 있는 특수 도메인에 속하는 클래스의 경우 괄호 안에 각 클래스에 대한 정의를 포함합니다. 이 태스크는 어렵기 때문에 모델의 성능이 저하될 것으로 예상됩니다.
[taraxacum officinale (Dandelion - bright yellow flowers, jagged basal leaves, white puffball seed heads), digitaria spp (Crabgrass - low spreading grass with coarse blades and finger-like seed heads), trifolium repens (White Clover - three round leaflets and small white pom-pom flowers), plantago major (Broadleaf Plantain - wide oval rosette leaves with tall narrow seed stalks), stellaria media (Chickweed - low mat-forming plant with tiny star-shaped white flowers)]
선호하는 JSON 출력 형식에 따라 다음 사용자 프롬프트 템플릿 중 하나를 사용합니다.
Detect all objects with their bounding boxes in the image from the provided class list. Normalize the bounding box coordinates to be scaled between 0 and 1000 to the image width and height, respectively. Classes: {candidate_class_list} Include separate entries for each detected object as an element of a list. Formulate your output as JSON format: [ { "class 1": [x1, y1, x2, y2] }, ... ]
Detect all objects with their bounding boxes in the image from the provided class list. Normalize the bounding box coordinates to be scaled between 0 and 1000 to the image width and height, respectively. Classes: {candidate_class_list} Include separate entries for each detected object as an element of a list. Formulate your output as JSON format: [ { "class": class 1, "bbox": [x1, y1, x2, y2] }, ... ]
Detect all objects with their bounding boxes in the image from the provided class list. Normalize the bounding box coordinates to be scaled between 0 and 1000 to the image width and height, respectively. Classes: {candidate_class_list} Group all detected bounding boxes by class. Formulate your output as JSON format: { "class 1": [[x1, y1, x2, y2], [x1, x2, y1, y2], ...], ... }
Detect all objects with their bounding boxes in the image from the provided class list. Normalize the bounding box coordinates to be scaled between 0 and 1000 to the image width and height, respectively. Classes: {candidate_class_list} Group all detected bounding boxes by class. Formulate your output as JSON format: [ { "class": class 1, "bbox": [[x1, y1, x2, y2], [x1, x2, y1, y2], ...] }, ... ]
모델 출력 구문 분석
출력은 JSON 구문 분석 라이브러리로 구문 분석할 수 있는 JSON으로 인코딩됩니다.
프롬프트 템플릿: 스크린샷 UI 경계 탐지
다음과 같은 사용자 프롬프트 템플릿을 권장합니다.
목표를 기반으로 UI 요소 위치 탐지:
In this UI screenshot, what is the location of the element if I want to {goal}? Express the location coordinates using the [x1, y1, x2, y2] format, scaled between 0 and 1000.
텍스트를 기반으로 UI 요소 위치 탐지:
In this UI screenshot, what is the location of the element if I want to click on "{text}"? Express the location coordinates using the [x1, y1, x2, y2] format, scaled between 0 and 1000.
모델 출력 구문 분석:
위의 각 UI 경계 탐지 프롬프트에 대해 아래 Python 코드 예제와 같이 정규식을 사용하여 모델에서 생성된 좌표 정보를 구문 분석할 수 있습니다.
def parse_coord_text(text): """Parses a model response which uses array formatting ([x, y, ...]) to describe points and bounding boxes. Returns an array of tuples.""" pattern = r"\[([^\[\]]*?)\]" return [ tuple(int(x.strip()) for x in match.split(",")) for match in re.findall(pattern, text) ]
비디오 이해
다음 섹션에서는 비디오를 이해하거나 분석해야 하는 태스크에서 프롬프트를 만드는 방법에 대한 지침을 제공합니다.
비디오 요약
Amazon Nova 모델은 비디오 콘텐츠 요약을 생성할 수 있습니다.
비디오 요약 사용 사례의 경우 다음 추론 파라미터 값을 사용하는 것이 좋습니다.
-
temperature: 0
-
일부 사용 사례는 모델 추론을 활성화할 때 도움을 받을 수 있습니다.
특정 프롬프트 템플릿은 필요하지 않습니다. 사용자 프롬프트에서 관심 있는 비디오의 측면을 명확하게 지정해야 합니다. 다음은 효과적인 프롬프트에 대한 몇 가지 예제입니다.
Can you create an executive summary of this video's content?
Can you distill the essential information from this video into a concise summary?
Could you provide a summary of the video, focusing on its key points?
비디오에 대한 자세한 캡션 생성
Amazon Nova 모델은 비디오에 대한 자세한 캡션을 생성할 수 있습니다(이 태스크를 고밀도 캡션이라고도 함).
비디오 캡션 생성 사용 사례의 경우 다음 추론 파라미터 값을 사용하는 것이 좋습니다.
-
temperature: 0
-
일부 사용 사례는 모델 추론을 활성화할 때 도움을 받을 수 있습니다.
특정 프롬프트 템플릿은 필요하지 않습니다. 사용자 프롬프트에서 관심 있는 비디오의 측면을 명확하게 지정해야 합니다. 다음은 효과적인 프롬프트에 대한 몇 가지 예제입니다.
Provide a detailed, second-by-second description of the video content.
Break down the video into key segments and provide detailed descriptions for each.
Generate a rich textual representation of the video, covering aspects like movement, color and composition.
Describe the video scene-by-scene, including details about characters, actions and settings.
Offer a detailed narrative of the video, including descriptions of any text, graphics, or special effects used.
Create a dense timeline of events occurring in the video, with timestamps if possible.
보안 비디오 영상 분석
Amazon Nova 모델은 보안 영상에서 이벤트를 탐지할 수 있습니다.
보안 영상 사용 사례의 경우 다음과 같은 추론 파라미터 값을 권장합니다.
-
temperature: 0
-
일부 사용 사례는 모델 추론을 활성화할 때 도움을 받을 수 있습니다.
You are a security assistant for a smart home who is given security camera footage in natural setting. You will examine the video and describe the events you see. You are capable of identifying important details like people, objects, animals, vehicles, actions and activities. This is not a hypothetical, be accurate in your responses. Do not make up information not present in the video.
타임스탬프를 사용하여 비디오 이벤트 추출
Amazon Nova 모델은 비디오에서 이벤트와 관련된 타임스탬프를 식별할 수 있습니다. 타임스탬프를 초 단위 또는 MM:SS 형식으로 지정하도록 요청할 수 있습니다. 예를 들어 비디오에서 1분 25초에 발생하는 이벤트는 85 또는 01:25로 표시할 수 있습니다.
이 사용 사례에서는 다음 추론 파라미터 값을 사용하는 것이 좋습니다.
-
temperature: 0
-
추론을 사용하지 않음
다음과 비슷한 프롬프트를 사용하는 것이 좋습니다.
Please localize the moment that the event "{event_description}" happens in the video. Answer with the starting and ending time of the event in seconds, such as [[72, 82]]. If the event happen multiple times, list all of them, such as [[40, 50], [72, 82]].
Locate the segment where "{event_description}" happens. Specify the start and end times of the event in MM:SS.
Answer the starting and end time of the event "{event_description}". Provide answers in MM:SS
When does "{event_description}" in the video? Specify the start and end timestamps, e.g. [[9, 14]]
Please localize the moment that the event "{event_description}" happens in the video. Answer with the starting and ending time of the event in seconds. e.g. [[72, 82]]. If the event happen multiple times, list all of them. e.g. [[40, 50], [72, 82]]
Segment a video into different scenes and generate caption per scene. The output should be in the format: [STARTING TIME-ENDING TIMESTAMP] CAPTION. Timestamp in MM:SS format
For a video clip, segment it into chapters and generate chapter titles with timestamps. The output should be in the format: [STARTING TIME] TITLE. Time in MM:SS
Generate video captions with timestamp.
비디오 분류
Amazon Nova 모델을 사용하여 사용자가 제공하는 미리 정의된 클래스 목록을 기반으로 비디오를 분류할 수 있습니다.
이 사용 사례에서는 다음 추론 파라미터 값을 사용하는 것이 좋습니다.
-
temperature: 0
-
추론을 사용해서는 안 됨
다음 프롬프트 템플릿을 사용합니다.
What is the most appropriate category for this video? Select your answer from the options provided: {class1} {class2} {...}
예시:
What is the most appropriate category for this video? Select your answer from the options provided: Arts Technology Sports Education