"Необходимо собрать собственный набор данных из **различных** изображений Вашего лица с разных ракурсов, желательно настоящие фотографии из личного архива (20 штук)\\\n",
"Возьмите эталонное изображение (как в паспорте) и при помощи библиотеки [DeepFace](https://github.com/serengil/deepface) проверьте его на соответствие всему датасету. Посчитайте метрику Precision. \\\n",
"\\\n",
"Примените каждую из перечисленных ниже аугментаций (**по-отдельности**) ко всему датасету и измерьте метрику Precision для измененнного датасета:\n",
"* Поворот изображения на 45° и 90°.\n",
"* Добавление шума (Gaussian Noise).\n",
"* Изменение яркости (увеличение и уменьшение на 50%).\n",
"* Размытие с различными параметрами.\n",
"\\\n",
"Реузультаты соберите в таблицу вида:\n",
"\n",
"Метод | Исходный датасет | Поворот на 45° | Поворот на 90° | Изображение с шумом |\n",
"--- | ----|--- | --- | --- |\n",
"VGG-Face | 0 | 0 | 0 | 0 |\n",
"Facenet | 0 | 0 | 0 | 0 |\n",
"Facenet512 | 0 | 0 | 0 | 0 |\n",
"OpenFace | 0 | 0 | 0 | 0 |\n",
"DeepFace | 0 | 0 | 0 | 0 |\n",
"DeepID | 0 | 0 | 0 | 0 |\n",
"ArcFace | 0 | 0 | 0 | 0 |\n",
"Dlib | 0 | 0 | 0 | 0 |\n",
"SFace | 0 | 0 | 0 | 0 |\n",
"GhostFaceNet | 0 | 0 | 0 | 0 |"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "6d82b3d9-2e3c-4726-9bdb-72d340c29e5a",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"2025-02-01 14:08:36.104207: I tensorflow/core/util/port.cc:153] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.\n",
"2025-02-01 14:08:36.113857: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:477] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered\n",
"WARNING: All log messages before absl::InitializeLog() is called are written to STDERR\n",
"E0000 00:00:1738408116.124793 227811 cuda_dnn.cc:8310] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered\n",
"E0000 00:00:1738408116.128118 227811 cuda_blas.cc:1418] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered\n",
"2025-02-01 14:08:36.139691: I tensorflow/core/platform/cpu_feature_guard.cc:210] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.\n",
"To enable the following instructions: AVX2 AVX_VNNI FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.\n",
"W0000 00:00:1738408118.299641 227811 gpu_device.cc:2344] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.\n",
"Skipping registering GPU devices...\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
" Метод Исходный набор Поворот на 45° Поворот на 90° \\\n",
"0 VGG-Face 0.60 0.05 0.00 \n",
"1 Facenet512 0.20 0.00 0.00 \n",
"2 OpenFace 0.00 0.00 0.00 \n",
"3 DeepID 0.15 0.05 0.05 \n",
"4 ArcFace 0.55 0.05 0.00 \n",
"5 Dlib 0.60 0.05 0.00 \n",
"6 SFace 0.45 0.05 0.00 \n",
"7 GhostFaceNet 0.50 0.05 0.00 \n",
"\n",
" Изображение с шумом Увеличенная яркость Уменьшенная яркость Размытие \n",
"В данном задании предлагается рассмотреть задачу распознавания лиц как задачу классификации для оценки точности.\n",
"Вам даны [видео](https://drive.google.com/drive/folders/1z_YCdJF2Rf9WzlNSY3BpNFiakNisq5VB?usp=sharing), для которых представлена разметка в виде тайм-кодов и база фотографий людей с этих видео.\n",
"Необходимо взять каждый 50-й кадр видео (способ разбиения на кадры с учётом разметки - на ваше усмотрение) и для полученного набора изображений оценить метрику Precision на данном наборе изображений для всех лиц, присутствующих на видео и в разметке.\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "3b20127c-94a4-41b9-9971-66f92346ca32",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"2025-02-01 09:08:30.181388: I tensorflow/core/util/port.cc:153] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.\n",
"2025-02-01 09:08:30.191264: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:477] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered\n",
"WARNING: All log messages before absl::InitializeLog() is called are written to STDERR\n",
"E0000 00:00:1738390110.202245 179413 cuda_dnn.cc:8310] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered\n",
"E0000 00:00:1738390110.205594 179413 cuda_blas.cc:1418] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered\n",
"2025-02-01 09:08:30.217277: I tensorflow/core/platform/cpu_feature_guard.cc:210] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.\n",
"To enable the following instructions: AVX2 AVX_VNNI FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.\n",
"W0000 00:00:1738390111.407309 179413 gpu_device.cc:2344] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.\n",
"Skipping registering GPU devices...\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Видео: palmasizade_video.mp4, Recall: 0.1489\n",
"Средний Recall для всех видео: 0.1489\n"
]
}
],
"source": [
"import os\n",
"import cv2\n",
"import pandas as pd\n",
"from deepface import DeepFace\n",
"\n",
"def time_to_frame(time_str, fps):\n",
" \"\"\"Преобразует строку времени формата 'HH:MM:SS' в номер кадра.\"\"\"\n",
Необходимо собрать собственный набор данных из **различных** изображений Вашего лица с разных ракурсов, желательно настоящие фотографии из личного архива (20 штук)\
Возьмите эталонное изображение (как в паспорте) и при помощи библиотеки [DeepFace](https://github.com/serengil/deepface) проверьте его на соответствие всему датасету. Посчитайте метрику Precision. \
\
Примените каждую из перечисленных ниже аугментаций (**по-отдельности**) ко всему датасету и измерьте метрику Precision для измененнного датасета:
* Поворот изображения на 45° и 90°.
* Добавление шума (Gaussian Noise).
* Изменение яркости (увеличение и уменьшение на 50%).
* Размытие с различными параметрами.
\
Реузультаты соберите в таблицу вида:
Метод | Исходный датасет | Поворот на 45° | Поворот на 90° | Изображение с шумом |
2025-02-01 14:08:36.104207: I tensorflow/core/util/port.cc:153] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
2025-02-01 14:08:36.113857: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:477] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
E0000 00:00:1738408116.124793 227811 cuda_dnn.cc:8310] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered
E0000 00:00:1738408116.128118 227811 cuda_blas.cc:1418] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
2025-02-01 14:08:36.139691: I tensorflow/core/platform/cpu_feature_guard.cc:210] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 AVX_VNNI FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
W0000 00:00:1738408118.299641 227811 gpu_device.cc:2344] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.
Skipping registering GPU devices...
Метод Исходный набор Поворот на 45° Поворот на 90° \
0 VGG-Face 0.60 0.05 0.00
1 Facenet512 0.20 0.00 0.00
2 OpenFace 0.00 0.00 0.00
3 DeepID 0.15 0.05 0.05
4 ArcFace 0.55 0.05 0.00
5 Dlib 0.60 0.05 0.00
6 SFace 0.45 0.05 0.00
7 GhostFaceNet 0.50 0.05 0.00
Изображение с шумом Увеличенная яркость Уменьшенная яркость Размытие
В данном задании предлагается рассмотреть задачу распознавания лиц как задачу классификации для оценки точности.
Вам даны [видео](https://drive.google.com/drive/folders/1z_YCdJF2Rf9WzlNSY3BpNFiakNisq5VB?usp=sharing), для которых представлена разметка в виде тайм-кодов и база фотографий людей с этих видео.
Необходимо взять каждый 50-й кадр видео (способ разбиения на кадры с учётом разметки - на ваше усмотрение) и для полученного набора изображений оценить метрику Precision на данном наборе изображений для всех лиц, присутствующих на видео и в разметке.
print(f"Средний Recall для всех видео: {average_recall:.4f}")
videos_dir="task3/videos"
labels_dir="task3/labels"
photos_dir="task3/photos"
main(videos_dir,labels_dir,photos_dir)
```
%% Output
2025-02-01 09:08:30.181388: I tensorflow/core/util/port.cc:153] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
2025-02-01 09:08:30.191264: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:477] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
E0000 00:00:1738390110.202245 179413 cuda_dnn.cc:8310] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered
E0000 00:00:1738390110.205594 179413 cuda_blas.cc:1418] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
2025-02-01 09:08:30.217277: I tensorflow/core/platform/cpu_feature_guard.cc:210] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 AVX_VNNI FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
W0000 00:00:1738390111.407309 179413 gpu_device.cc:2344] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.