顔検出のコンセプト
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
顔検出は、デジタル画像や動画などのビジュアル メディアから人の顔を検出します。顔が検出されると、位置、サイズ、向きが関連付けられ、目や鼻などのランドマークを検索できます。
ML Kit の顔検出機能に関する用語は次のとおりです。
顔トラッキングは、顔検出を動画シーケンスに拡張します。動画に現れる時間に関係なく、すべての顔をフレーム間で追跡できます。つまり、連続する動画フレームで検出された顔を同じ人物と識別できます。これは顔認識の形式ではありません。顔トラッキングは、動画シーケンス内の顔の位置と動きに基づいて推論のみを行います。
ランドマークは顔内のスポットです。左目、右目、鼻底はすべてランドマークの例です。ML Kit には、検出された顔のランドマークを見つける機能があります。
輪郭は、顔の特徴の形状に沿った点の集合です。ML Kit には、顔の輪郭を検出する機能が用意されています。
分類は、顔の特定の特徴が存在するかどうかを判断します。たとえば、顔は、目が開いているか閉じているか、あるいは笑っているかどうかによって分類できます。
顔の向き
以下の用語は、カメラを基準として顔が向く角度を表します。
- オイラー X: オイラー X の角度が正の顔は上を向いています。
- オイラー Y: オイラー Y の角度が正の顔は、カメラの右を向いています。負の場合は左を向いています。
- オイラー Z: オイラー Z の角度が正の面は、カメラに対して反時計回りに回転します。
ML Kit は、LANDMARK_MODE_NONE
、CONTOUR_MODE_ALL
、CLASSIFICATION_MODE_NONE
、PERFORMANCE_MODE_FAST
が設定されているときに、検出された顔のオイラー X、オイラー Y、オイラー Z の角度を報告しません。
ランドマーク
ランドマークは、顔内のスポットです。左目、右目、鼻底はすべてランドマークの例です。
ML Kit は、ランドマークを検索せずに顔を検出します。ランドマーク検出はオプションの手順であり、デフォルトでは無効になっています。
次の表は、関連付けられた顔のオイラー 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 Kit は現在、目を開くと笑顔の 2 つの分類をサポートしています。
分類は確実性の値です。これは、顔の特徴が存在する信頼度を示します。たとえば、笑顔の分類の値が 0.7 以上の場合は、人物が笑顔である可能性が高いことを示します。
これらの分類はどちらもランドマーク検出に基づいています。
また、「目を開いて」と「笑顔」の分類は、正面顔、つまりオイラー Y 角度が小さい(-18 ~ 18 度)顔に対してのみ機能します。
最小顔サイズ
最小顔サイズは目的の顔サイズであり、画像の幅に対する頭の幅の比率で表されます。たとえば、値を 0.1 に設定すると、検索対象の最小の顔が検索対象の画像の幅の約 10% になります。
最小顔サイズは、パフォーマンスと精度のトレードオフです。最小サイズを小さく設定すると、検出機能で小さい顔が検出されますが、検出に時間がかかります。大きい顔を設定すると、小さい顔を除外できますが、実行速度は速くなります。
顔の最小サイズはハードリミットではありません。検出機能では、指定したものより若干小さい顔が検出されることがあります。
次のステップ
iOS アプリまたは Android アプリで顔検出を使用します。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-08-29 UTC。
[null,null,["最終更新日 2025-08-29 UTC。"],[[["\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)"]]