تتيح لك مهمة "مُعترِف الوجوه" من MediaPipe رصد الوجوه في صورة أو فيديو. يمكنك استخدام
هذه المهمة لتحديد موقع الوجوه وملامح الوجه في إطار معيّن. تستخدِم هذه المهمة نموذجًا
لتعلُّم الآلة يعمل مع صور فردية أو مجرى
متواصل من الصور. تُخرج المهمة مواقع الوجوه، بالإضافة إلى
النقاط الرئيسية التالية للوجه: العين اليسرى والعين اليمنى وطرف الأنف والفم ونقطة تراجيديون للعين اليسرى
ونقطة تراجيديون للعين اليمنى.
ابدأ استخدام هذه المهمة باتّباع أحد أدلة التنفيذ هذه ل منصّتك المستهدفة. ترشدك هذه الأدلة الخاصة بالنظام الأساسي إلى تنفيذ أساسي
لهذه المهمة، بما في ذلك نموذج مقترَح ومثال على الرمز المبرمَج
مع خيارات الإعداد المقترَحة:
يصف هذا القسم ميزات هذه المهمة ومدخلاتها ومخرجاتها وخيارات الضبط.
الميزات
معالجة الصور المُدخلة: تشمل المعالجة تدوير الصور وتغيير حجمها
وتسويتها وتحويل مساحة الألوان.
الحدّ الأدنى للنتيجة: فلترة النتائج استنادًا إلى نتائج التوقّعات
مدخلات المهام
نتائج المهام
يقبل "مُعترِف الوجوه" إدخال أحد أنواع البيانات التالية:
الصور الثابتة
إطارات الفيديو التي تم فك ترميزها
خلاصة فيديو مباشر
يعرض "مُعترِف الوجوه" النتائج التالية:
مربّعات محيطة بالوجوه التي تم رصدها في إطار الصورة
إحداثيات 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، وهو عبارة عن أداة خفيفة الوزن و
دقيقة لرصد الوجوه ومحسَّنة للاستخدام مع وحدات معالجة الرسومات في الأجهزة الجوّالة. نماذج BlazeFace مناسبة
لتطبيقات مثل تقدير نقاط الوجه الثلاثية الأبعاد وتصنيف تعابير
الوجه وتقسيم مناطق الوجه. يستخدم BlazeFace شبكة خفيفة الوزن
لاستخراج الخصائص تشبه
MobileNetV1/V2.
BlazeFace (قصيرة المدى)
نموذج خفيف لرصد وجوه فردية أو متعددة في
صور تشبه صور السيلفي من كاميرا هاتف ذكي أو كاميرا ويب تم تحسين النموذج لمعالجة
الصور التي تلتقطها كاميرا الهاتف الأمامية من مسافة قصيرة. تستخدِم بنية النموذج تقنية شبكة تحويلية لنظام "كاشف اللقطة الواحدة" (SSD) مع ملف رمز مخصّص لتشفير البيانات. لمزيد من المعلومات، يُرجى الاطّلاع على الورقة البحثية حول
Single Shot MultiBox Detector.
نموذج خفيف نسبيًا لرصد وجوه فردية أو متعددة في
الصور من كاميرا هاتف ذكي أو كاميرا ويب تم تحسين النموذج للتعامل مع كاميرا الهاتف المزوّدة بكاميرا خلفية لالتقاط صور
بجودة عالية. تستخدِم بنية النموذج
تقنية مشابهة لشبكة CenterNet التدرّجية مع
برنامج ترميز مخصّص.
اسم الطراز
شكل الإدخال
نوع التقريب
بطاقة النموذج
الإصدارات
BlazeFace (النطاق الكامل)
128 × 128
float 16
معلومات
قريبًا
BlazeFace Sparse (النطاق الكامل)
نسخة أخف من نموذج BlazeFace العادي الكامل النطاق، أصغر حجمًا بنسبة 60% تقريبًا
تم تحسين النموذج للصور ذات النطاق الكامل، مثل الصور التي تم التقاطها باستخدام
كاميرا الهاتف الخلفية. تستخدِم بنية النموذج تقنية مشابهة
لشبكة CenterNet التفافية مع
برنامج ترميز مخصّص.
اسم الطراز
شكل الإدخال
نوع التقريب
بطاقة النموذج
الإصدارات
BlazeFace Sparse (النطاق الكامل)
128 × 128
float 16
معلومات
قريبًا
مقاييس أداء المهام
في ما يلي مقاييس أداء المهام لعملية المعالجة بأكملها استنادًا إلى نماذج pretrained
المدرَّبة مسبقًا أعلاه. نتيجة وقت الاستجابة هي متوسط وقت الاستجابة على هاتف Pixel 6 باستخدام
وحدة المعالجة المركزية / وحدة معالجة الرسومات.
تاريخ التعديل الأخير: 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 |"]]