تشخیص چهره
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.

با API تشخیص چهره کیت ML، میتوانید چهرهها را در یک تصویر شناسایی کنید، ویژگیهای کلیدی چهره را شناسایی کنید و خطوط چهرههای شناساییشده را دریافت کنید. توجه داشته باشید که API چهره ها را شناسایی می کند ، افراد را نمی شناسد .
با تشخیص چهره، میتوانید اطلاعاتی را که برای انجام کارهایی مانند تزئین عکسهای سلفی و پرتره یا تولید آواتار از عکس کاربر نیاز دارید، دریافت کنید. از آنجایی که ML Kit میتواند تشخیص چهره را در زمان واقعی انجام دهد، میتوانید از آن در برنامههایی مانند چت ویدیویی یا بازیهایی که به عبارات پخشکننده پاسخ میدهند استفاده کنید.
iOS اندروید
قابلیت های کلیدی
- ویژگی های صورت را شناسایی و تعیین کنید مختصات چشم ها، گوش ها، گونه ها، بینی و دهان هر چهره شناسایی شده را دریافت کنید.
- خطوط خطوط صورت را دریافت کنید خطوط چهره های شناسایی شده و چشم ها، ابروها، لب ها و بینی آنها را دریافت کنید.
- حالات چهره را بشناسید تعیین کنید که آیا فرد لبخند می زند یا چشمانش بسته است.
- ردیابی چهرهها در فریمهای ویدیویی برای هر چهره شناساییشده منحصربهفرد یک شناسه دریافت کنید. شناسه در سراسر فراخوانها ثابت است، بنابراین میتوانید تصویر را روی یک شخص خاص در یک جریان ویدیویی دستکاری کنید.
- فریمهای ویدیویی را در زمان واقعی پردازش کنید تشخیص چهره روی دستگاه انجام میشود و به اندازهای سریع است که در برنامههای بلادرنگ، مانند دستکاری ویدیو، استفاده شود.
نتایج نمونه
مثال 1

برای هر چهره شناسایی شده:
صورت 1 از 3 |
---|
چند ضلعی محدود کننده | (884.880004882812، 149.546676635742)، (1030.77197265625، 149.546676635742)، (1030.77197265625، 327197265625، 327197265625، 3271972635625، 32719726635742)، 812, 329.660278320312) |
زوایای چرخش | Y: -14.054030418395996، Z: -55.007488250732422 |
شناسه پیگیری | 2 |
نشانه های چهره | چشم چپ | (945.869323730469, 211.867126464844) | چشم راست | (971.579467773438, 247.257247924805) | پایین دهان | (907.756591796875, 259.714477539062) |
... و غیره. |
احتمالات ویژگی | خندان | 0.88979166746139526 | چشم چپ باز | 0.98635888937860727 | چشم راست باز | 0.99258323386311531 |
|
مثال 2 (تشخیص کانتور صورت)
هنگامی که تشخیص کانتور صورت را فعال کرده اید، لیستی از نقاط را برای هر ویژگی صورت شناسایی شده دریافت می کنید. این نقاط نمایانگر شکل ویژگی هستند. تصویر زیر نشان می دهد که چگونه این نقاط به یک چهره نگاشت می شوند. بر روی عکس کلیک کنید تا بزرگتر نمایش داده شود:

خطوط مشخصه صورت |
---|
پل بینی | (505.149811, 221.201797), (506.987122, 313.285919) |
چشم چپ | (404.642029، 232.854431)، (408.527283، 231.3666623)، (413.565796، 229.427856)، (421.378296، 226.96753244)، (226.96732324)، (226.96732324) 42.953064, 226.089508)، (453.899811، 228.594818)، (461.516418، 232.650467)، (465.069580 ، 235.600845)، (462.170410، 236.316147)، (456.233643، 236.891602)، (446.363922، 237.966888)، (435.6232324.) 237.235168)، (416.037720، 236.012115)، (409.983459، 234.870300) |
بالای لب بالا | (421.662048، 354.520813)، (428.103882، 349.694061)، (440.847595، 348.048737)، (456.549988، 346.2958532)، (456.549988، 346.2958532)، 346.2958532، 346.2958532، 346.2958535، 03.375702, 349.470459), (525.624634, 347.352783), (547.371155, 349.091980), (560.082031) ، 351.693268)، (570.226685، 354.210175)، (575.305420، 359.257751) |
(و غیره.) | |
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-08-29 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-08-29 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003eML Kit's Face Detection API can detect faces and their features in images and videos, but it does not recognize individuals.\u003c/p\u003e\n"],["\u003cp\u003eIt can be used for tasks such as adding effects to photos, creating avatars, and building interactive applications that respond to facial expressions.\u003c/p\u003e\n"],["\u003cp\u003eThe API provides facial feature coordinates, contours, expression detection (like smiling), and face tracking across video frames.\u003c/p\u003e\n"],["\u003cp\u003eFace detection happens on the device and is fast enough for real-time applications.\u003c/p\u003e\n"]]],[],null,["With ML Kit's face detection API, you can detect faces in an image, identify\nkey facial features, and get the contours of detected faces. Note that the API\n*detects faces* , it does not *recognize people* .\n\nWith face detection, you can get the information you need to perform tasks like\nembellishing selfies and portraits, or generating avatars from a user's photo.\nBecause ML Kit can perform face detection in real time, you can use it in\napplications like video chat or games that respond to the player's expressions.\n\n[iOS](/ml-kit/vision/face-detection/ios)\n[Android](/ml-kit/vision/face-detection/android)\n\nKey capabilities\n\n- **Recognize and locate facial features** Get the coordinates of the eyes, ears, cheeks, nose, and mouth of every face detected.\n- **Get the contours of facial features** Get the contours of detected faces and their eyes, eyebrows, lips, and nose.\n- **Recognize facial expressions** Determine whether a person is smiling or has their eyes closed.\n- **Track faces across video frames** Get an identifier for each unique detected face. The identifier is consistent across invocations, so you can perform image manipulation on a particular person in a video stream.\n- **Process video frames in real time** Face detection is performed on the device, and is fast enough to be used in real-time applications, such as video manipulation.\n\nExample results\n\nExample 1\n\nFor each face detected:\n\n| Face 1 of 3 ||\n|---------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| **Bounding polygon** | (884.880004882812, 149.546676635742), (1030.77197265625, 149.546676635742), (1030.77197265625, 329.660278320312), (884.880004882812, 329.660278320312) |\n| **Angles of rotation** | Y: -14.054030418395996, Z: -55.007488250732422 |\n| **Tracking ID** | 2 |\n| **Facial landmarks** | |---------------------|--------------------------------------| | **Left eye** | (945.869323730469, 211.867126464844) | | **Right eye** | (971.579467773438, 247.257247924805) | | **Bottom of mouth** | (907.756591796875, 259.714477539062) | ... etc. |\n| **Feature probabilities** | |--------------------|---------------------| | **Smiling** | 0.88979166746139526 | | **Left eye open** | 0.98635888937860727 | | **Right eye open** | 0.99258323386311531 | |\n\nExample 2 (face contour detection)\n\nWhen you have face contour detection enabled, you also get a list of points\nfor each facial feature that was detected. These points represent the shape of\nthe feature. The following image illustrates how these points map to a face.\nClick the image to enlarge it:\n\n[](/static/ml-kit/vision/face-detection/images/face_contours.svg)\n\n| Facial feature contours ||\n|----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| **Nose bridge** | (505.149811, 221.201797), (506.987122, 313.285919) |\n| **Left eye** | (404.642029, 232.854431), (408.527283, 231.366623), (413.565796, 229.427856), (421.378296, 226.967682), (432.598755, 225.434143), (442.953064, 226.089508), (453.899811, 228.594818), (461.516418, 232.650467), (465.069580, 235.600845), (462.170410, 236.316147), (456.233643, 236.891602), (446.363922, 237.966888), (435.698914, 238.149323), (424.320740, 237.235168), (416.037720, 236.012115), (409.983459, 234.870300) |\n| **Top of upper lip** | (421.662048, 354.520813), (428.103882, 349.694061), (440.847595, 348.048737), (456.549988, 346.295532), (480.526489, 346.089294), (503.375702, 349.470459), (525.624634, 347.352783), (547.371155, 349.091980), (560.082031, 351.693268), (570.226685, 354.210175), (575.305420, 359.257751) |\n| (etc.) | |"]]