مفاهیم تشخیص چهره
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
تشخیص چهره چهره های انسان را در رسانه های بصری مانند تصاویر دیجیتال یا ویدئو تعیین می کند. هنگامی که چهره ای شناسایی می شود، دارای موقعیت، اندازه و جهت مرتبط است. و می توان آن را برای نشانه هایی مانند چشم و بینی جستجو کرد.
در اینجا برخی از اصطلاحاتی که در مورد ویژگی تشخیص چهره کیت ML استفاده می کنیم آورده شده است:
ردیابی چهره تشخیص چهره را به دنبالههای ویدیویی گسترش میدهد. هر چهره ای که برای مدت زمان طولانی در یک ویدیو ظاهر می شود را می توان از فریم به فریم ردیابی کرد. این بدان معنی است که چهره ای که در فریم های ویدیویی متوالی شناسایی می شود می تواند به عنوان همان شخص شناسایی شود. توجه داشته باشید که این یک نوع تشخیص چهره نیست. ردیابی چهره فقط بر اساس موقعیت و حرکت چهره ها در یک دنباله ویدیو استنباط می کند.
یک نقطه عطف ، یک نقطه مورد علاقه در یک چهره است. چشم چپ، چشم راست و پایه بینی همگی نمونه هایی از نشانه ها هستند. کیت ML امکان یافتن نقاط عطف در چهره شناسایی شده را فراهم می کند.
کانتور مجموعه ای از نقاط است که از شکل یک ویژگی صورت پیروی می کنند. کیت ML توانایی پیدا کردن خطوط صورت را فراهم می کند.
طبقه بندی مشخص می کند که آیا یک ویژگی چهره خاص وجود دارد یا خیر. به عنوان مثال، صورت را می توان بر اساس باز یا بسته بودن چشمانش یا خندان بودن یا نبودن صورت طبقه بندی کرد.
جهت گیری صورت
عبارات زیر زاویه ای را که یک چهره نسبت به دوربین جهت گیری می کند توصیف می کند:
- اویلر X : صورت با زاویه اویلر X مثبت رو به بالا است.
- اویلر Y : چهره ای با زاویه اویلر Y مثبت به سمت راست دوربین یا در صورت منفی به سمت چپ نگاه می کند.
- اویلر Z : چهره ای با زاویه مثبت اویلر Z نسبت به دوربین در خلاف جهت عقربه های ساعت می چرخد.
وقتی LANDMARK_MODE_NONE
، CONTOUR_MODE_ALL
، CLASSIFICATION_MODE_NONE
و PERFORMANCE_MODE_FAST
با هم تنظیم شدهاند، کیت ML زاویه اویلر X، اویلر Y یا اویلر Z یک چهره شناساییشده را گزارش نمیکند.
نقاط دیدنی
یک نقطه عطف، یک نقطه مورد علاقه در یک چهره است. چشم چپ، چشم راست و پایه بینی همگی نمونه هایی از نشانه ها هستند.
کیت ML چهره ها را بدون جستجوی نشانه ها تشخیص می دهد. تشخیص نشانه یک مرحله اختیاری است که به طور پیش فرض غیرفعال است.
جدول زیر تمام نشانه هایی را که می توان با توجه به زاویه اویلر Y یک چهره مرتبط تشخیص داد، خلاصه می کند:
زاویه اویلر Y | نقاط دیدنی قابل تشخیص |
---|
< -36 درجه | چشم چپ، دهان چپ، گوش چپ، پایه بینی، گونه چپ |
-36 درجه تا -12 درجه | دهان چپ، پایه بینی، پایین دهان، چشم راست، چشم چپ، گونه چپ، نوک گوش چپ |
-12 درجه تا 12 درجه | چشم راست، چشم چپ، پایه بینی، گونه چپ، گونه راست، دهان چپ، دهان راست، دهان پایین |
12 درجه تا 36 درجه | دهان راست، پایه بینی، پایین دهان، چشم چپ، چشم راست، گونه راست، نوک گوش راست |
> 36 درجه | چشم راست، دهان راست، گوش راست، پایه بینی، گونه راست |
هر نقطه عطف شناسایی شده شامل موقعیت مرتبط خود در تصویر است.
خطوط
کانتور مجموعه ای از نقاط است که شکل یک ویژگی صورت را نشان می دهد. تصویر زیر نشان می دهد که چگونه این نقاط به یک چهره نگاشت می شوند. بر روی عکس کلیک کنید تا بزرگتر نمایش داده شود:

هر کانتور ویژگی که ML Kit تشخیص می دهد با تعداد ثابتی از نقاط نشان داده می شود:
صورت بیضی شکل | 36 امتیاز | لب بالا (بالا) | 11 امتیاز |
---|
ابروی چپ (بالا) | 5 امتیاز | لب بالا (پایین) | 9 امتیاز |
---|
ابروی چپ (پایین) | 5 امتیاز | لب پایین (بالا) | 9 امتیاز |
---|
ابروی راست (بالا) | 5 امتیاز | لب پایین (پایین) | 9 امتیاز |
---|
ابروی راست (پایین) | 5 امتیاز | پل بینی | 2 امتیاز |
---|
چشم چپ | 16 امتیاز | پایین بینی | 3 امتیاز |
---|
چشم راست | 16 امتیاز |
---|
گونه چپ (مرکز) | 1 امتیاز |
---|
گونه راست (مرکز) | 1 امتیاز |
---|
هنگامی که تمام خطوط یک چهره را به طور همزمان دریافت می کنید، آرایه ای از 133 نقطه به دست می آورید که مطابق شکل زیر، خطوط را نشان می دهد:
شاخص خطوط مشخصه |
---|
0-35 | صورت بیضی شکل |
36-40 | ابروی چپ (بالا) |
41-45 | ابروی چپ (پایین) |
46-50 | ابروی راست (بالا) |
51-55 | ابروی راست (پایین) |
56-71 | چشم چپ |
72-87 | چشم راست |
88-96 | لب بالا (پایین) |
97-105 | لب پایین (بالا) |
106-116 | لب بالا (بالا) |
117-125 | لب پایین (پایین) |
126، 127 | پل بینی |
128-130 | پایین بینی (توجه داشته باشید که نقطه مرکزی در شاخص 128 است) |
131 | گونه چپ (مرکز) |
132 | گونه راست (مرکز) |
طبقه بندی
طبقه بندی مشخص می کند که آیا یک ویژگی چهره خاص وجود دارد یا خیر. کیت ML در حال حاضر از دو طبقه بندی پشتیبانی می کند: چشمان باز و خندان .
طبقه بندی یک ارزش قطعی است. این نشان دهنده اطمینان از وجود یک ویژگی چهره است. به عنوان مثال، مقدار 0.7 یا بیشتر برای طبقهبندی خندان نشان میدهد که احتمالاً فردی در حال لبخند زدن است.
هر دوی این طبقه بندی ها بر تشخیص نقطه عطف متکی هستند.
همچنین توجه داشته باشید که طبقه بندی "چشم باز" و "خندان" فقط برای صورت های جلویی کار می کند، یعنی چهره هایی با زاویه اویلر Y کوچک (بین -18 تا 18 درجه).
حداقل اندازه صورت
حداقل اندازه صورت، اندازه صورت مورد نظر است که به صورت نسبت عرض سر به عرض تصویر بیان می شود. به عنوان مثال، مقدار 0.1 به این معنی است که کوچکترین چهره برای جستجو تقریباً 10٪ از عرض تصویر مورد جستجو است.
حداقل اندازه چهره یک مبادله عملکرد در مقابل دقت است: تنظیم حداقل اندازه کوچکتر به آشکارساز اجازه میدهد تا چهرههای کوچکتر را پیدا کند، اما تشخیص بیشتر طول میکشد. بزرگتر کردن آن ممکن است چهرههای کوچکتر را حذف کند، اما سریعتر اجرا میشود.
حداقل اندازه صورت یک محدودیت سخت نیست. آشکارساز ممکن است چهره هایی را کمی کوچکتر از آنچه مشخص شده است بیابد.
مراحل بعدی
از تشخیص چهره در برنامه iOS یا Android خود استفاده کنید:
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-09-04 بهوقت ساعت هماهنگ جهانی.
[[["درک آسان","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-09-04 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003eML Kit's face detection feature locates and analyzes human faces in images and videos, identifying position, size, orientation, and facial landmarks like eyes and nose.\u003c/p\u003e\n"],["\u003cp\u003eFace tracking in ML Kit follows faces across video frames, enabling the identification of the same person without using facial recognition.\u003c/p\u003e\n"],["\u003cp\u003eOptional features include landmark detection (identifying points like eyes, nose, mouth), contour detection (outlining facial features), and classification (detecting smiles or open eyes).\u003c/p\u003e\n"],["\u003cp\u003ePerformance can be adjusted by setting the minimum face size, balancing speed and accuracy of detection.\u003c/p\u003e\n"]]],[],null,["Face detection locates human faces in visual media such as digital images or\nvideo. When a face is detected it has an associated position, size, and\norientation; and it can be searched for landmarks such as the eyes and nose.\n\nHere are some of the terms that we use regarding the face detection feature\nof ML Kit:\n\n- **Face tracking** extends face detection to video sequences. Any face that\n appears in a video for any length of time can be tracked from frame to frame.\n This means a face detected in consecutive video frames can be identified as\n being the same person. Note that this isn't a form of *face recognition*; face\n tracking only makes inferences based on the position and motion of the faces in\n a video sequence.\n\n- A **landmark** is a point of interest within a face. The left eye, right eye,\n and base of the nose are all examples of landmarks. ML Kit provides the\n ability to find landmarks on a detected face.\n\n- A **contour** is a set of points that follow the shape of a facial feature.\n ML Kit provides the ability to find the contours of a face.\n\n- **Classification** determines whether a certain facial\n characteristic is present. For example, a face can be classified by\n whether its eyes are open or closed, or if the face is smiling or not.\n\nFace orientation\n\nThe following terms describe the angle a face is oriented with respect to the\ncamera:\n\n- **Euler X**: A face with a positive Euler X angle is facing upward.\n- **Euler Y**: A face with a positive Euler Y angle is looking to the right of the camera, or looking to the left if negative.\n- **Euler Z**: A face with a positive Euler Z angle is rotated counter-clockwise relative to the camera.\n\nML Kit doesn't report the Euler X, Euler Y or Euler Z angle of a detected face when\n`LANDMARK_MODE_NONE`, `CONTOUR_MODE_ALL`, `CLASSIFICATION_MODE_NONE` and\n`PERFORMANCE_MODE_FAST`are set together.\n\nLandmarks\n\nA landmark is a point of interest within a face. The left eye, right eye, and\nnose base are all examples of landmarks.\n\nML Kit detects faces without looking for landmarks.\nLandmark detection is an optional step that is disabled by default.\n\nThe following table summarizes all of the landmarks that can be detected given\nthe Euler Y angle of an associated face:\n\n| Euler Y angle | Detectable landmarks |\n|----------------------------|------------------------------------------------------------------------------------------------|\n| \\\u003c -36 degrees | left eye, left mouth, left ear, nose base, left cheek |\n| -36 degrees to -12 degrees | left mouth, nose base, bottom mouth, right eye, left eye, left cheek, left ear tip |\n| -12 degrees to 12 degrees | right eye, left eye, nose base, left cheek, right cheek, left mouth, right mouth, bottom mouth |\n| 12 degrees to 36 degrees | right mouth, nose base, bottom mouth, left eye, right eye, right cheek, right ear tip |\n| \\\u003e 36 degrees | right eye, right mouth, right ear, nose base, right cheek |\n\nEach detected landmark includes its associated position in the image.\n\nContours\n\nA contour is a set of points that represent the shape of a facial feature. The\nfollowing image illustrates how these points map to a face. Click the image to\nenlarge it:\n\n[](/static/ml-kit/vision/face-detection/images/face_contours.svg)\n\nEach feature contour that ML Kit detects is represented by a fixed number of\npoints:\n\n| Face oval | 36 points | Upper lip (top) | 11 points |\n| Left eyebrow (top) | 5 points | Upper lip (bottom) | 9 points |\n| Left eyebrow (bottom) | 5 points | Lower lip (top) | 9 points |\n| Right eyebrow (top) | 5 points | Lower lip (bottom) | 9 points |\n| Right eyebrow (bottom) | 5 points | Nose bridge | 2 points |\n| Left eye | 16 points | Nose bottom | 3 points |\n| Right eye | 16 points |\n| Left cheek (center) | 1 point |\n| Right cheek (center) | 1 points |\n|------------------------|-----------|--------------------|-----------|\n\nWhen you get all of a face's contours at once, you get an array of 133 points,\nwhich map to feature contours as shown below:\n\n| Indexes of feature contours ||\n|----------|----------------------------------------------------------|\n| 0-35 | Face oval |\n| 36-40 | Left eyebrow (top) |\n| 41-45 | Left eyebrow (bottom) |\n| 46-50 | Right eyebrow (top) |\n| 51-55 | Right eyebrow (bottom) |\n| 56-71 | Left eye |\n| 72-87 | Right eye |\n| 88-96 | Upper lip (bottom) |\n| 97-105 | Lower lip (top) |\n| 106-116 | Upper lip (top) |\n| 117-125 | Lower lip (bottom) |\n| 126, 127 | Nose bridge |\n| 128-130 | Nose bottom (note that the center point is at index 128) |\n| 131 | Left cheek (center) |\n| 132 | Right cheek (center) |\n\nClassification\n\nClassification determines whether a certain facial characteristic is present.\nML Kit currently supports two classifications: **eyes open** and **smiling**.\n\nClassification is a certainty value. It indicates the confidence\nthat a facial characteristic is present. For example, a value of 0.7 or more\nfor the smiling classification indicates that it's likely that a person is\nsmiling.\n\nBoth of these classifications rely upon landmark detection.\n\nAlso note that the classifications \"eyes open\" and \"smiling\" only work for\nfrontal faces, i.e., faces with a small Euler Y angle (between -18 and 18\ndegrees).\n\nMinimum Face Size\n\nThe minimum face size is the desired face size, expressed as the ratio of the width of\nthe head to the width of the image. For example, the value of 0.1 means that\nthe smallest face to search for is roughly 10% of the width of the image being\nsearched.\n\nThe minimum face size is a performance vs. accuracy trade-off: setting the\nminimum size smaller lets the detector find smaller faces but detection\nwill take longer; setting it larger might exclude smaller faces but\nwill run faster.\n\nThe minimum face size is not a hard limit; the detector may find faces slightly\nsmaller than specified.\n\nNext Steps\n\nUse face detection in your iOS or Android app:\n\n- [iOS](/ml-kit/vision/face-detection/ios)\n- [Android](/ml-kit/vision/face-detection/android)"]]