با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
API تقسیمبندی سلفی کیت ML به توسعهدهندگان این امکان را میدهد تا به راحتی پسزمینه را از کاربران درون یک صحنه جدا کرده و روی موارد مهم تمرکز کنند. افزودن جلوههای جالب به سلفیها یا قرار دادن کاربران در محیطهای پسزمینه جالب هرگز آسانتر نبوده است.
API تقسیمبندی سلفی یک تصویر ورودی میگیرد و یک ماسک خروجی تولید میکند. به طور پیش فرض، اندازه ماسک به اندازه تصویر ورودی خواهد بود. به هر پیکسل ماسک یک عدد شناور اختصاص داده می شود که محدوده ای بین [0.0، 1.0] دارد. هرچه این عدد به 1.0 نزدیکتر باشد، اطمینان بیشتری وجود دارد که پیکسل نشان دهنده یک شخص است و بالعکس.
API با تصاویر ثابت و موارد استفاده از ویدیوی زنده کار می کند. در طول ویدیوی زنده، API از خروجی فریمهای قبلی استفاده میکند تا نتایج تقسیمبندی نرمتری را ارائه دهد.
پشتیبانی از چند پلتفرم از تجربه یکسانی در اندروید و iOS لذت ببرید.
پشتیبانی از یک یا چند کاربر به راحتی چندین نفر یا فقط یک نفر را بدون تغییر تنظیمات تقسیم کنید.
پشتیبانی از تمام بدن و نیم تنه API می تواند پرتره ها و ویدئوهای تمام بدن و بالاتنه را تقسیم بندی کند.
نتایج بلادرنگ API مبتنی بر CPU است و در اکثر تلفنهای هوشمند مدرن (20 FPS+) بهصورت بلادرنگ اجرا میشود و هم با تصویر ثابت و هم با پخش جریانی ویدیوی زنده به خوبی کار میکند.
پشتیبانی از ماسک اندازه خام خروجی ماسک تقسیم بندی به طور پیش فرض به اندازه تصویر ورودی است. API همچنین از گزینه ای پشتیبانی می کند که در عوض ماسکی با اندازه خروجی مدل تولید می کند (مثلاً 256x256). این گزینه اعمال منطق تغییر مقیاس سفارشی شده را آسانتر میکند یا تأخیر را کاهش میدهد، اگر تغییر مقیاس به اندازه تصویر ورودی برای مورد استفاده شما مورد نیاز نباشد.
نتایج نمونه
تصویر ورودی
خروجی تصویر + ماسک
در زیر کاپوت
برای اطلاعات بیشتر در مورد نحوه آموزش مدل و شیوه های عادلانه ML ما، کارت مدل ما را بررسی کنید.
تاریخ آخرین بهروزرسانی 2025-07-24 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-07-24 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003eThe Selfie Segmentation API generates a mask identifying people in images and videos, with pixel values indicating confidence levels.\u003c/p\u003e\n"],["\u003cp\u003eThis API is cross-platform, supports single or multiple users, handles full and half body portraits, and provides real-time results.\u003c/p\u003e\n"],["\u003cp\u003eThe API is in beta and subject to change.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can access platform-specific implementation details via provided links for iOS and Android.\u003c/p\u003e\n"]]],[],null,["# Selfie 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 selfie segmentation API allows developers to easily separate the background from users within a scene and focus on what matters. Adding cool effects to selfies or inserting your users into interesting background environments has never been easier.\n\nThe selfie segmentation API takes an input image and produces an output mask. By\ndefault, the mask will be the same size as the input image. Each pixel of the\nmask is assigned a float number that has a range between \\[0.0, 1.0\\].\nThe closer the number is to 1.0, the higher the confidence that the pixel\nrepresents a person, and vice versa.\n\nThe API works with static images and live video use cases. During live video,\nthe API will leverage output from previous frames to return smoother\nsegmentation results. \n\n[iOS](/ml-kit/vision/selfie-segmentation/ios)\n[Android](/ml-kit/vision/selfie-segmentation/android)\n\n**Key capabilities:**\n\n- **Cross-platform support** Enjoy the same experience on both Android and iOS.\n- **Single or multiple user support** Easily segment multiple people or just a single person without changing any settings.\n- **Full and half body support** The API can segment both full body and upper body portraits and video.\n- **Real time results** The API is CPU-based and runs in real time on most modern smartphones (20 FPS+) and works well with both still image and live video streams.\n- **Raw size mask support** The segmentation mask output is the same size as the input image by default. The API also supports an option that produces a mask with the model output size instead (e.g. 256x256). This option makes it easier to apply customized rescaling logic or reduces latency if rescaling to the input image size is not needed for your use case.\n\nExample results\n---------------\n\n| Input Image | Output Image + Mask |\n|-------------|---------------------|\n| | |\n| | |\n| | |\n\nUnder the hood\n--------------\n\nFor more information on how the model was trained and our ML fairness practices, check out our [Model Card](/static/ml-kit/images/vision/selfie-segmentation/selfie-model-card.pdf)."]]