Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Phát hiện khuôn mặt
plat_iosplat_android
Nhờ API phát hiện khuôn mặt của Bộ công cụ học máy, bạn có thể phát hiện các khuôn mặt trong một hình ảnh, nhận dạng
các đặc điểm chính trên khuôn mặt và các đường nét của khuôn mặt được phát hiện.
Nhờ tính năng phát hiện khuôn mặt, bạn có thể thu thập thông tin cần thiết để thực hiện những việc như làm
tô điểm ảnh selfie và ảnh chân dung hoặc tạo hình đại diện từ ảnh của người dùng.
Vì Bộ công cụ học máy có thể phát hiện khuôn mặt theo thời gian thực nên bạn có thể sử dụng bộ công cụ này trong
các ứng dụng như trò chuyện video hoặc các trò chơi phản hồi với biểu cảm của người chơi.
Nếu là nhà phát triển Flutter, bạn có thể quan tâm đến FlutterFire, trong đó có một trình bổ trợ cho API thị giác máy học của Firebase.
Các chức năng chính
Nhận dạng và xác định các đặc điểm trên khuôn mặt
Xem toạ độ của mắt, tai, má, mũi và miệng của mọi
đã phát hiện thấy khuôn mặt.
Xem các đường nét của các đặc điểm trên khuôn mặt
Xem các đường viền của khuôn mặt được phát hiện, cũng như mắt, lông mày, môi và
mũi.
Nhận dạng biểu cảm khuôn mặt
Xác định xem một người đang cười hay nhắm mắt.
Theo dõi khuôn mặt trên các khung hình video
Lấy giá trị nhận dạng khuôn mặt của từng người được phát hiện.
Giá trị nhận dạng này nhất quán trên các lệnh gọi, vì vậy, bạn có thể
thao túng hình ảnh của một người cụ thể trong luồng video.
Xử lý khung hình video theo thời gian thực
Tính năng phát hiện khuôn mặt được thực hiện trên thiết bị và đủ nhanh để sử dụng
trong các ứng dụng theo thời gian thực, chẳng hạn như thao tác đối với video.
Khi bật tính năng phát hiện đường viền khuôn mặt, bạn cũng nhận được danh sách các điểm
cho từng đặc điểm khuôn mặt phát hiện được. Những điểm này biểu thị hình dạng của
tính năng này. Hình ảnh sau đây minh hoạ cách các điểm này liên kết với một khuôn mặt (nhấp vào hình ảnh để phóng to):
[null,null,["Cập nhật lần gần đây nhất: 2025-07-25 UTC."],[],[],null,["Face Detection \nplat_ios plat_android \n\nWith ML Kit's face detection API, you can detect faces in an image, identify\nkey facial features, and get the contours of detected faces.\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](/docs/ml-kit/ios/detect-faces)\n[Android](/docs/ml-kit/android/detect-faces)\n\nIf you're a Flutter developer, you might be interested in\n[FlutterFire](https://github.com/FirebaseExtended/flutterfire/tree/master/packages/firebase_ml_vision),\nwhich includes a plugin for Firebase's ML Vision APIs.\n| This is a beta release of ML Kit for Firebase. This API might be changed in backward-incompatible ways and is not subject to any SLA or deprecation policy.\n\nKey capabilities\n\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 individual person's face that is detected. This identifier is consistent across invocations, so you can, for example, 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\n(click the image to enlarge):\n\n[](/static/docs/ml-kit/images/examples/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.) | |"]]