가상 테스트를 사용하면 의류 제품을 모델링하는 사람의 이미지를 생성할 수 있습니다. 사람 이미지와 샘플 의류 제품을 제공한 다음 가상 테스트를 사용하여 사람이 제품을 착용한 이미지를 생성합니다.
지원되는 모델 버전
가상 테스트는 다음 모델을 지원합니다.
virtual-try-on-preview-08-04
모델에서 지원하는 기능에 대한 자세한 내용은 Imagen 모델을 참조하세요.
HTTP 요청
curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/publishers/google/models/MODEL_ID:predict \
-d '{
"instances": [
{
"personImage": {
"image": {
// Union field can be only one of the following:
"bytesBase64Encoded": string,
"gcsUri": string,
}
},
"productImages": [
{
"image": {
// Union field can be only one of the following:
"bytesBase64Encoded": string,
"gcsUri": string,
}
}
]
}
],
"parameters": {
"addWatermark": boolean,
"baseSteps": integer,
"personGeneration": string,
"safetySetting": string,
"sampleCount": integer,
"seed": integer,
"storageUri": string,
"outputOptions": {
"mimeType": string,
"compressionQuality": integer
}
}
}'
인스턴스 | |
---|---|
|
필수 항목입니다. 의류 제품을 가상으로 착용해 볼 수 있는 사람의 이미지이며, 다음 중 하나일 수 있습니다.
|
|
필수 항목입니다. 사람이 착용해 볼 수 있는 제품의 이미지이며, 다음 중 하나일 수 있습니다.
|
파라미터 | |
---|---|
addWatermark |
선택사항입니다. 보이지 않는 워터마크를 생성된 이미지에 추가합니다.
기본값은 |
|
필수 항목입니다. 이미지 생성을 제어하는 정수입니다. 단계가 높을수록 지연 시간이 증가하는 대신 품질이 높아집니다.
|
personGeneration |
선택사항입니다. 모델에서 사람을 생성합니다. 다음과 같은 값이 지원됩니다.
기본값은 |
safetySetting |
선택사항입니다. 필터 수준을 안전 필터링에 추가합니다. 다음과 같은 값이 지원됩니다.
기본값은 |
|
필수 항목입니다. 생성할 이미지 수입니다.
|
seed |
선택사항입니다. 이미지 생성에 사용되는 무작위 시드입니다. |
storageUri |
선택사항입니다. 생성된 이미지를 저장할 Cloud Storage 버킷 위치의 문자열 URI입니다. |
outputOptions |
선택사항입니다. |
출력 옵션 객체
outputOptions
객체는 이미지 출력을 설명합니다.
파라미터 | |
---|---|
outputOptions.mimeType |
선택사항: 이미지 출력 형식입니다. 다음과 같은 값이 지원됩니다.
기본값은 |
outputOptions.compressionQuality |
(선택사항)
출력 유형이 |
샘플 요청
REST
요청 데이터를 사용하기 전에 다음을 바꿉니다.
- REGION: 프로젝트가 있는 리전. 지원되는 리전에 대한 자세한 내용은 Vertex AI의 생성형 AI 위치를 참조하세요.
- PROJECT_ID: Google Cloud 프로젝트 ID
- BASE64_PERSON_IMAGE: 사람 이미지의 Base64 인코딩 이미지
- BASE64_PRODUCT_IMAGE: 제품 이미지의 Base64 인코딩 이미지
-
IMAGE_COUNT: 생성할 이미지 수. 허용되는 값의 범위는
1
~4
입니다. - GCS_OUTPUT_PATH: 가상 테스트 출력을 저장할 Cloud Storage 경로
HTTP 메서드 및 URL:
POST https://REGION-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/publishers/google/models/virtual-try-on-preview-08-04:predict
JSON 요청 본문:
{ "instances": [ { "personImage": { "image": { "bytesBase64Encoded": "BASE64_PERSON_IMAGE" } }, "productImages": [ { "image": { "bytesBase64Encoded": "BASE64_PRODUCT_IMAGE" } } ] } ], "parameters": { "sampleCount": IMAGE_COUNT, "storageUri": "GCS_OUTPUT_PATH" } }
요청을 보내려면 다음 옵션 중 하나를 선택합니다.
curl
요청 본문을 request.json
파일에 저장하고 다음 명령어를 실행합니다.
curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://REGION-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/publishers/google/models/virtual-try-on-preview-08-04:predict"
PowerShell
요청 본문을 request.json
파일에 저장하고 다음 명령어를 실행합니다.
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://REGION-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/publishers/google/models/virtual-try-on-preview-08-04:predict" | Select-Object -Expand Content
{ "predictions": [ { "mimeType": "image/png", "bytesBase64Encoded": "BASE64_IMG_BYTES" }, { "bytesBase64Encoded": "BASE64_IMG_BYTES", "mimeType": "image/png" } ] }