وظیفه تشخیص چهره MediaPipe به شما امکان می دهد چهره ها را در یک تصویر یا ویدیو تشخیص دهید. می توانید از این کار برای تعیین مکان چهره و ویژگی های صورت در یک قاب استفاده کنید. این کار از یک مدل یادگیری ماشینی (ML) استفاده می کند که با تصاویر منفرد یا یک جریان پیوسته از تصاویر کار می کند. این وظیفه مکانهای صورت را همراه با نکات کلیدی صورت زیر نمایش میدهد: چشم چپ، چشم راست، نوک بینی، دهان، تراژیون چشم چپ و تراژیون چشم راست.
استفاده از این کار را با دنبال کردن یکی از این راهنماهای پیاده سازی برای پلتفرم هدف خود شروع کنید. این راهنماهای مخصوص پلتفرم شما را از طریق اجرای اساسی این کار، از جمله یک مدل توصیه شده، و نمونه کد با گزینه های پیکربندی توصیه شده، راهنمایی می کنند:
این بخش قابلیت ها، ورودی ها، خروجی ها و گزینه های پیکربندی این کار را شرح می دهد.
ویژگی ها
پردازش تصویر ورودی - پردازش شامل چرخش تصویر، تغییر اندازه، عادی سازی و تبدیل فضای رنگی است.
آستانه امتیاز - نتایج را بر اساس نمرات پیش بینی فیلتر کنید.
ورودی های وظیفه
خروجی های وظیفه
آشکارساز چهره ورودی یکی از انواع داده های زیر را می پذیرد:
تصاویر ثابت
فریم های ویدئویی رمزگشایی شده
فید ویدیوی زنده
آشکارساز چهره نتایج زیر را خروجی می دهد:
کادرهای محدود کننده برای چهره های شناسایی شده در یک قاب تصویر.
مختصات 6 علامت مشخصه چهره برای هر چهره شناسایی شده.
گزینه های پیکربندی
این کار دارای گزینه های پیکربندی زیر است:
نام گزینه
توضیحات
محدوده ارزش
مقدار پیش فرض
running_mode
حالت اجرا را برای کار تنظیم می کند. سه حالت وجود دارد:
IMAGE: حالت برای ورودی های تک تصویر.
VIDEO: حالت برای فریم های رمزگشایی شده یک ویدیو.
LIVE_STREAM: حالت پخش زنده داده های ورودی، مانند دوربین. در این حالت، resultListener باید فراخوانی شود تا شنونده ای را برای دریافت نتایج به صورت ناهمزمان تنظیم کند.
{ IMAGE, VIDEO, LIVE_STREAM }
IMAGE
min_detection_confidence
حداقل امتیاز اطمینان برای تشخیص چهره موفق در نظر گرفته شود.
Float [0,1]
0.5
min_suppression_threshold
حداقل آستانه غیر حداکثری سرکوب برای تشخیص چهره که باید همپوشانی در نظر گرفته شود.
Float [0,1]
0.3
result_callback
شنونده نتیجه را طوری تنظیم می کند که وقتی آشکارساز چهره در حالت پخش زنده است، نتایج تشخیص را به صورت ناهمزمان دریافت کند. فقط زمانی قابل استفاده است که حالت اجرا روی LIVE_STREAM تنظیم شده باشد.
N/A
Not set
مدل ها
مدلهای تشخیص چهره میتوانند بسته به موارد استفاده مورد نظرشان، مانند تشخیص دوربرد و دوربرد، متفاوت باشند. همچنین مدلها معمولاً بین عملکرد، دقت، وضوح و نیازهای منابع، معاوضههایی ایجاد میکنند و در برخی موارد، ویژگیهای اضافی را نیز شامل میشوند.
مدلهای فهرستشده در این بخش، انواع BlazeFace هستند، یک آشکارساز چهره سبک و دقیق که برای استنتاج GPU موبایل بهینه شده است. مدلهای BlazeFace برای کاربردهایی مانند برآورد نقاط کلیدی صورت سه بعدی، طبقهبندی بیان و تقسیمبندی ناحیه چهره مناسب هستند. BlazeFace از شبکه استخراج ویژگی های سبکی مشابه MobileNetV1/V2 استفاده می کند.
BlazeFace (کوتاه برد)
یک مدل سبک وزن برای تشخیص یک یا چند چهره در تصاویر سلفی مانند از دوربین گوشی هوشمند یا وب کم. این مدل برای تصاویر دوربین گوشی جلو در فاصله کوتاه بهینه شده است. معماری مدل از یک تکنیک شبکه کانولوشنال SSD (Single Shot Detector) با یک رمزگذار سفارشی استفاده می کند. برای اطلاعات بیشتر، مقاله تحقیقاتی در مورد آشکارساز چند جعبه تک شات را ببینید.
یک مدل نسبتا سبک وزن برای تشخیص تک یا چند چهره در تصاویر از دوربین گوشی هوشمند یا وب کم. این مدل برای تصاویر با برد کامل بهینه شده است، مانند تصاویری که با دوربین گوشی پشتی گرفته شده است. معماری مدل از تکنیکی شبیه به یک شبکه کانولوشنال CenterNet با یک رمزگذار سفارشی استفاده می کند.
نام مدل
شکل ورودی
نوع کوانتیزاسیون
مدل کارت
نسخه ها
BlazeFace (تمام برد)
128*128
شناور 16
اطلاعات
به زودی
BlazeFace Sparse (تمام برد)
یک نسخه سبک تر از مدل معمولی کامل BlazeFace، تقریباً 60٪ در اندازه کوچکتر. این مدل برای تصاویر با برد کامل بهینه شده است، مانند تصاویری که با دوربین گوشی پشتی گرفته شده است. معماری مدل از تکنیکی شبیه به یک شبکه کانولوشنال CenterNet با یک رمزگذار سفارشی استفاده می کند.
نام مدل
شکل ورودی
نوع کوانتیزاسیون
مدل کارت
نسخه ها
BlazeFace Sparse (تمام برد)
128*128
شناور 16
اطلاعات
به زودی
معیارهای وظیفه
در اینجا معیارهای کار برای کل خط لوله بر اساس مدل های از پیش آموزش دیده بالا آمده است. نتیجه تأخیر، متوسط تأخیر پیکسل 6 با استفاده از CPU / GPU است.
تاریخ آخرین بهروزرسانی 2025-01-13 بهوقت ساعت هماهنگ جهانی.
[[["درک آسان","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-01-13 بهوقت ساعت هماهنگ جهانی."],[],[],null,["# Face detection guide\n\nThe MediaPipe Face Detector task lets you detect faces in an image or video. You can use\nthis task to locate faces and facial features within a frame. This task uses a\nmachine learning (ML) model that works with single images or a continuous\nstream of images. The task outputs face locations, along with the following\nfacial key points: left eye, right eye, nose tip, mouth, left eye tragion, and\nright eye tragion.\n\n[Try it!arrow_forward](https://mediapipe-studio.webapps.google.com/demo/face_detector)\n\nGet Started\n-----------\n\nStart using this task by following one of these implementation guides for your\ntarget platform. These platform-specific guides walk you through a basic\nimplementation of this task, including a recommended model, and code example\nwith recommended configuration options:\n\n- **Android** - [Code\n example](https://github.com/google-ai-edge/mediapipe-samples/tree/main/examples/face_detector/android) - [Guide](./android)\n- **Python** - [Code\n example](https://colab.sandbox.google.com/github/googlesamples/mediapipe/blob/main/examples/face_detector/python/face_detector.ipynb)- [Guide](./python)\n- **Web** - [Code\n example](https://codepen.io/mediapipe-preview/pen/OJByWQr) - [Guide](./web_js)\n- **iOS** - [Code\n example](https://github.com/google-ai-edge/mediapipe-samples/tree/main/examples/face_detector/ios) - [Guide](./ios)\n\nTask details\n------------\n\nThis section describes the capabilities, inputs, outputs, and configuration\noptions of this task.\n\n### Features\n\n- **Input image processing** - Processing includes image rotation, resizing, normalization, and color space conversion.\n- **Score threshold** - Filter results based on prediction scores.\n\n| Task inputs | Task outputs |\n|--------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| The Face Detector accepts an input of one of the following data types: - Still images \u003c!-- --\u003e - Decoded video frames \u003c!-- --\u003e - Live video feed | The Face Detector outputs the following results: - Bounding boxes for detected faces in an image frame. \u003c!-- --\u003e - Coordinates for 6 face landmarks for each detected face. |\n\n### Configurations options\n\nThis task has the following configuration options:\n\n| Option Name | Description | Value Range | Default Value |\n|-----------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------|---------------|\n| `running_mode` | Sets the running mode for the task. There are three modes: \u003cbr /\u003e IMAGE: The mode for single image inputs. \u003cbr /\u003e VIDEO: The mode for decoded frames of a video. \u003cbr /\u003e LIVE_STREAM: The mode for a livestream of input data, such as from a camera. In this mode, resultListener must be called to set up a listener to receive results asynchronously. | {`IMAGE, VIDEO, LIVE_STREAM`} | `IMAGE` |\n| `min_detection_confidence` | The minimum confidence score for the face detection to be considered successful. | `Float [0,1]` | `0.5` |\n| `min_suppression_threshold` | The minimum non-maximum-suppression threshold for face detection to be considered overlapped. | `Float [0,1]` | `0.3` |\n| `result_callback` | Sets the result listener to receive the detection results asynchronously when the Face Detector is in the live stream mode. Can only be used when running mode is set to `LIVE_STREAM`. | `N/A` | `Not set` |\n\nModels\n------\n\nFace detection models can vary depending on their intended use cases, such as\nshort-range and long-range detection. Models also typically make trade-offs\nbetween performance, accuracy, resolution, and resource requirements, and in\nsome cases, include additional features.\n\nThe models listed in this section are variants of BlazeFace, a lightweight and\naccurate face detector optimized for mobile GPU inference. BlazeFace models are\nsuitable for applications like 3D facial keypoint estimation, expression\nclassification, and face region segmentation. BlazeFace uses a lightweight\nfeature extraction network similar to\n[MobileNetV1/V2](https://arxiv.org/abs/1704.04861).\n| **Attention:** This MediaPipe Solutions Preview is an early release. [Learn more](/edge/mediapipe/solutions/about#notice).\n\n### BlazeFace (short-range)\n\nA lightweight model for detecting single or multiple faces within selfie-like\nimages from a smartphone camera or webcam. The model is optimized for\nfront-facing phone camera images at short range. The model architecture uses a\nSingle Shot Detector (SSD) convolutional network technique with a custom\nencoder. For more information, see the research paper on\n[Single Shot MultiBox Detector](https://arxiv.org/abs/1512.02325).\n\n| Model name | Input shape | Quantization type | Model Card | Versions |\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------|-------------------|--------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------|\n| [BlazeFace (short-range)](https://storage.googleapis.com/mediapipe-models/face_detector/blaze_face_short_range/float16/latest/blaze_face_short_range.tflite) | 128 x 128 | float 16 | [info](https://storage.googleapis.com/mediapipe-assets/MediaPipe%20BlazeFace%20Model%20Card%20(Short%20Range).pdf) | [Latest](https://storage.googleapis.com/mediapipe-models/face_detector/blaze_face_short_range/float16/latest/blaze_face_short_range.tflite) |\n\n### BlazeFace (full-range)\n\nA relatively lightweight model for detecting single or multiple faces within\nimages from a smartphone camera or webcam. The model is optimized for full-range\nimages, like those taken with a back-facing phone camera images. The model\narchitecture uses a technique similar to a\n[CenterNet](https://arxiv.org/abs/1904.08189) convolutional network with a\ncustom encoder.\n\n| Model name | Input shape | Quantization type | Model Card | Versions |\n|------------------------|-------------|-------------------|------------|-------------|\n| BlazeFace (full-range) | 128 x 128 | float 16 | info | Coming soon |\n\n### BlazeFace Sparse (full-range)\n\nA lighter version of the regular full-range BlazeFace model, roughly 60% smaller\nin size. The model is optimized for full-range images, like those taken with a\nback-facing phone camera images. The model architecture uses a technique similar\nto a [CenterNet](https://arxiv.org/abs/1904.08189) convolutional network with a\ncustom encoder.\n\n| Model name | Input shape | Quantization type | Model Card | Versions |\n|-------------------------------|-------------|-------------------|------------|-------------|\n| BlazeFace Sparse (full-range) | 128 x 128 | float 16 | info | Coming soon |\n\nTask benchmarks\n---------------\n\nHere's the task benchmarks for the whole pipeline based on the above\npre-trained models. The latency result is the average latency on Pixel 6 using\nCPU / GPU.\n\n| Model Name | CPU Latency | GPU Latency |\n|-------------------------|-------------|-------------|\n| BlazeFace (short-range) | 2.94ms | 7.41ms |"]]