Varto
Хочете будувати кар’єру в Data Science та AI? Vodafone Big Data Lab відкриває новий набір —>

An easy solution for face detection on CPU: how a Senior Python Engineer found an alternative to heavy AI models

Senior Python Engineer Vladyslav Bashtannyk has developed a solution for face detection that proves that the most powerful model is not always the best. Looking for a simple tool for identifying faces in photos, the developer found a simple solution without GPUs, paid services, and unnecessary infrastructure.

1 comment
An easy solution for face detection on CPU: how a Senior Python Engineer found an alternative to heavy AI models

Senior Python Engineer Vladyslav Bashtannyk has developed a solution for face detection that proves that the most powerful model is not always the best. Looking for a simple tool for identifying faces in photos, the developer found a simple solution without GPUs, paid services, and unnecessary infrastructure.

For the developer, it all started with finding a tool for a specific and, at first glance, simple task.

“I was recently looking for a tool for a seemingly simple task: to understand whether there is a human face in an image,” Vladislav said on LinkedIn. “I could have taken the first popular model and closed the task. But I wanted to find a solution that wouldn’t require a GPU, a separate ML service, or a paid API.”

Additionally, it seems like it was important for the team to clearly delineate functionality:

“We needed face detection, not face recognition,” the Senior Python Engineer emphasizes. “That is, the model only answers whether there is a face and where it is located. It does not try to determine who this person is and does not store any biometric data.”

To choose the best option, Vladyslav tested several popular approaches: standard OpenCV detectors, MTCNN, YOLO, and YuNet. For an objective evaluation, he prepared a special test dataset.

“I prepared a script that analyzed the effectiveness of the data. Just before that, I created a script that downloaded 10k images for analysis, 5k with faces and 5k without,” the developer notes.

According to the benchmark results, the best performance was demonstrated by the YuNet model, a compact solution that can be easily run via OpenCV directly on the CPU.

On a sample of 10,000 images and a threshold of 0.5, the following metrics were obtained:

  • Accuracy — 97.54%;

  • Accuracy — 99.19%;

  • Recall — 95.64%;

  • F1 score — 97.40%;

  • FP (False Positives) — 0.73%;

  • FN (False Negatives) — 4.33%.

Thanks to this experiment, the developer received a solution that fully solves the business problem without unnecessarily complicating the architecture.

"As a result, we got a simple solution without GPUs, paid services, and unnecessary infrastructure," Vladyslav Bashtannyk concludes. "And this is exactly the case when the most powerful model is not necessarily the best. Sometimes it is much more important that the tool properly solves a specific task and does not complicate the system."

“Today, a test task can cost you a lot.” The developer urged not to launch unfamiliar repositories without analysis after discovering suspicious code
“Today, a test task can cost you a lot.” The developer urged not to launch unfamiliar repositories without analysis after discovering suspicious code
On the topic
“Today, a test task can cost you a lot.” The developer urged not to launch unfamiliar repositories without analysis after discovering suspicious code
Read the country's main IT news in our Telegram
Read the country's main IT news in our Telegram
On the topic
Read the country's main IT news in our Telegram
Also Read
Roosh запускає нову освітню платформу AI HOUSE CLUB для ML/AI-спеціалістів та дата сайнтистів. Розповідаємо, як подати заявку та чому навчатимуть
Roosh запускає нову освітню платформу AI HOUSE CLUB для ML/AI-спеціалістів та дата сайнтистів. Розповідаємо, як подати заявку та чому навчатимуть
Roosh запускає нову освітню платформу AI HOUSE CLUB для ML/AI-спеціалістів та дата сайнтистів. Розповідаємо, як подати заявку та чому навчатимуть
Як нейромережі бачать вільну та незалежну Україну? Тест dev.ua
Як нейромережі бачать вільну та незалежну Україну? Тест dev.ua
Як нейромережі бачать вільну та незалежну Україну? Тест dev.ua
Нейронні мережі для генерації зображень бачать світ по-своєму, їхню логіку зрозуміти часом зовсім неможливо. Але таки хочеться. На честь Дня Незалежності України редакція dev.ua вирішила провести невеликий експеримент. Ми задали чотирьом різним нейронним мережам п’ять однакових запитів: «прапор України», «День Незалежності України», «український Крим», «перемога України» та «українці». Отриманими результатами ми ділимося з вами нижче.
У TikTok тепер можна генерувати фон за допомогою нейромережі. Ми протестували її та ділимося результатами
У TikTok тепер можна генерувати фон за допомогою нейромережі. Ми протестували її та ділимося результатами
У TikTok тепер можна генерувати фон за допомогою нейромережі. Ми протестували її та ділимося результатами
У TikTok з’явилася нова функція «Розумний фон». З її допомогою як фон для тіктоків можна підставляти згенеровані нейромережею зображення. Редакція dev.ua протестувала цю технологію і ділиться своїми враженнями.
1 comment
Які IT-спеціальності будуть потрібні в найближчі п'ять років? Ми з'ясували у голови американського стартапу ADAM Дениса Гурака
Які IT-спеціальності будуть потрібні в найближчі п'ять років? Ми з'ясували у голови американського стартапу ADAM Дениса Гурака
Які IT-спеціальності будуть потрібні в найближчі п'ять років? Ми з'ясували у голови американського стартапу ADAM Дениса Гурака

Have important news to share? Message our Telegram bot

Key events and useful links in our Telegram channel

Discussion
0

https://en.wikipedia.org/wiki/Viola%E2%80%93Jones_object_detection_framework

https://pub.towardsai.net/the-magic-behind-face-detection-a-deep-dive-into-the-viola-jones-algorithm-51f323f16cd2?gi=02d3a3fc8175

Система Віоли — Джонса виявляння об'єктів використовувалась ще старими цифровими камерами для детекту облич (тобто там cpu майже нема для таких задач). Достатньо просто глянути як вирішували ці задачі в недалекому минулому