ML Kit의 주제 세분화 API를 사용하면 개발자가 사진의 배경에서 여러 피사체를 쉽게 분리할 수 있으므로 스티커 만들기, 배경 바꾸기 또는 피사체에 멋진 효과 추가와 같은 사용 사례가 가능합니다.
피사체는 이미지 포그라운드에서 가장 눈에 띄는 사람, 반려동물 또는 사물로 정의됩니다. 두 대상이 서로 매우 가까이 있거나 서로 닿으면 단일 대상으로 간주됩니다.
주체 세분화 API는 입력 이미지를 가져와 포그라운드의 출력 마스크 또는 비트맵을 생성합니다. 또한 감지된 각 피사체에 마스크와 비트맵을 제공합니다 (포그라운드는 모든 피사체를 합친 것과 같음).
기본적으로 포그라운드 마스크와 포그라운드 비트맵은 입력 이미지와 크기가 같습니다 (각 개별 대상의 마스크 및 비트맵 크기는 입력 이미지 크기와 다를 수 있음). 마스크의 각 픽셀에는 0.0~1.0 범위의 부동 소수점 숫자가 할당됩니다. 숫자가 1.0에 가까울수록 픽셀이 피사체를 나타낸다는 신뢰도가 높아지며 그 반대의 경우도 마찬가지입니다.
Pixel 7 Pro에서 측정된 지연 시간은 평균적으로 약 200ms입니다. 이 API는 현재 정적 이미지만 지원합니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-07-25(UTC)"],[[["\u003cp\u003eThe ML Kit subject segmentation API enables developers to isolate subjects (people, pets, objects) from the background in images for various applications like sticker creation and background replacement.\u003c/p\u003e\n"],["\u003cp\u003eThis API provides individual masks and bitmaps for each detected subject, allowing for granular manipulation and effects.\u003c/p\u003e\n"],["\u003cp\u003eAll processing happens on-device, ensuring user privacy and eliminating the need for internet connectivity.\u003c/p\u003e\n"],["\u003cp\u003eThis API is currently in beta and might undergo changes that could affect backward compatibility.\u003c/p\u003e\n"]]],[],null,["# Subject Segmentation\n\n| This API is offered in beta, and is not subject to any SLA or deprecation policy. Changes may be made to this API that break backward compatibility.\n\nML Kit's subject segmentation API allows developers to easily separate multiple\nsubjects from the background in a picture, enabling use cases such as sticker\ncreation, background swap, or adding cool effects to subjects.\n\nSubjects are defined as the most prominent people, pets, or objects in the\nforeground of the image. If 2 subjects are very close or touching each other,\nthey are considered a single subject.\n\nThe subject segmentation API takes an input image and generates an output mask\nor bitmap for the foreground. It also provides a mask and bitmap for each one of\nthe subjects detected (the foreground is equal to all subjects combined).\n\nBy default, the foreground mask and foreground bitmap are the same size as the\ninput image (the size of each individual subject's mask and bitmap will likely\ndiffer from input image size). Each pixel of the mask is assigned a float number\nthat has a range between `0.0` and `1.0`. The closer the number is to `1.0`, the\nhigher the confidence that the pixel represents a subject, and vice versa.\n\nOn average the latency measured on Pixel 7 Pro is around 200 ms. This API\ncurrently only supports static images.\n\n[Android](/ml-kit/vision/subject-segmentation/android)\n\n### Key capabilities\n\n- **Multi-subject segmentation:** provides masks and bitmaps for each individual subject, rather than a single mask and bitmap for all subjects combined.\n- **Subject recognition:** subjects recognized are objects, pets, and humans.\n- **On-device processing:** all processing is performed on the device, preserving user privacy and requiring no network connectivity.\n\n### Example results\n\n| Input Image | Output Image + Mask |\n|-------------|---------------------|\n| | |\n| | |\n| | |"]]