Anonymous
Insightface не может распознавать лица
Сообщение
Anonymous » 21 янв 2025, 04:23
Я использовал Insightface для обнаружения лица на изображении, но результатом обнаружения оказался пустой список (не удалось обнаружить лица). Не могли бы вы помочь определить, какая часть могла пойти не так? Вот код и ввод/вывод:
import cv2
from insightface.app import FaceAnalysis
from insightface.data import get_image
app = FaceAnalysis(providers=['CUDAExecutionProvider', 'CPUExecutionProvider'])
app.prepare(ctx_id=0, det_size=(640, 640))
img = cv2.imread("face.jpg")
faces = app.get(img)
print("============================================================")
print(faces)
print("============================================================")
Входное изображение:
вот мое изображение
Вывод
Applied providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'], with options: {'CUDAExecutionProvider': {'device_id': '0', 'has_user_compute_stream': '0', 'cudnn_conv1d_pad_to_nc1d': '0', 'user_compute_stream': '0', 'gpu_external_alloc': '0', 'gpu_mem_limit': '18446744073709551615', 'enable_cuda_graph': '0', 'gpu_external_free': '0', 'gpu_external_empty_cache': '0', 'arena_extend_strategy': 'kNextPowerOfTwo', 'cudnn_conv_algo_search': 'EXHAUSTIVE', 'do_copy_in_default_stream': '1', 'cudnn_conv_use_max_workspace': '1', 'tunable_op_enable': '0', 'tunable_op_tuning_enable': '0', 'tunable_op_max_tuning_duration_ms': '0', 'enable_skip_layer_norm_strict_mode': '0', 'prefer_nhwc': '0', 'use_ep_level_unified_stream': '0', 'use_tf32': '1', 'sdpa_kernel': '0'}, 'CPUExecutionProvider': {}}
find model: C:\Users\iii_a/.insightface\models\buffalo_l\1k3d68.onnx landmark_3d_68 ['None', 3, 192, 192] 0.0 1.0
Applied providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'], with options: {'CUDAExecutionProvider': {'device_id': '0', 'has_user_compute_stream': '0', 'cudnn_conv1d_pad_to_nc1d': '0', 'user_compute_stream': '0', 'gpu_external_alloc': '0', 'gpu_mem_limit': '18446744073709551615', 'enable_cuda_graph': '0', 'gpu_external_free': '0', 'gpu_external_empty_cache': '0', 'arena_extend_strategy': 'kNextPowerOfTwo', 'cudnn_conv_algo_search': 'EXHAUSTIVE', 'do_copy_in_default_stream': '1', 'cudnn_conv_use_max_workspace': '1', 'tunable_op_enable': '0', 'tunable_op_tuning_enable': '0', 'tunable_op_max_tuning_duration_ms': '0', 'enable_skip_layer_norm_strict_mode': '0', 'prefer_nhwc': '0', 'use_ep_level_unified_stream': '0', 'use_tf32': '1', 'sdpa_kernel': '0'}, 'CPUExecutionProvider': {}}
find model: C:\Users\iii_a/.insightface\models\buffalo_l\2d106det.onnx landmark_2d_106 ['None', 3, 192, 192] 0.0 1.0
Applied providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'], with options: {'CUDAExecutionProvider': {'device_id': '0', 'has_user_compute_stream': '0', 'cudnn_conv1d_pad_to_nc1d': '0', 'user_compute_stream': '0', 'gpu_external_alloc': '0', 'gpu_mem_limit': '18446744073709551615', 'enable_cuda_graph': '0', 'gpu_external_free': '0', 'gpu_external_empty_cache': '0', 'arena_extend_strategy': 'kNextPowerOfTwo', 'cudnn_conv_algo_search': 'EXHAUSTIVE', 'do_copy_in_default_stream': '1', 'cudnn_conv_use_max_workspace': '1', 'tunable_op_enable': '0', 'tunable_op_tuning_enable': '0', 'tunable_op_max_tuning_duration_ms': '0', 'enable_skip_layer_norm_strict_mode': '0', 'prefer_nhwc': '0', 'use_ep_level_unified_stream': '0', 'use_tf32': '1', 'sdpa_kernel': '0'}, 'CPUExecutionProvider': {}}
find model: C:\Users\iii_a/.insightface\models\buffalo_l\det_10g.onnx detection [1, 3, '?', '?'] 127.5 128.0
Applied providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'], with options: {'CUDAExecutionProvider': {'device_id': '0', 'has_user_compute_stream': '0', 'cudnn_conv1d_pad_to_nc1d': '0', 'user_compute_stream': '0', 'gpu_external_alloc': '0', 'gpu_mem_limit': '18446744073709551615', 'enable_cuda_graph': '0', 'gpu_external_free': '0', 'gpu_external_empty_cache': '0', 'arena_extend_strategy': 'kNextPowerOfTwo', 'cudnn_conv_algo_search': 'EXHAUSTIVE', 'do_copy_in_default_stream': '1', 'cudnn_conv_use_max_workspace': '1', 'tunable_op_enable': '0', 'tunable_op_tuning_enable': '0', 'tunable_op_max_tuning_duration_ms': '0', 'enable_skip_layer_norm_strict_mode': '0', 'prefer_nhwc': '0', 'use_ep_level_unified_stream': '0', 'use_tf32': '1', 'sdpa_kernel': '0'}, 'CPUExecutionProvider': {}}
find model: C:\Users\iii_a/.insightface\models\buffalo_l\genderage.onnx genderage ['None', 3, 96, 96] 0.0 1.0
Applied providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'], with options: {'CUDAExecutionProvider': {'device_id': '0', 'has_user_compute_stream': '0', 'cudnn_conv1d_pad_to_nc1d': '0', 'user_compute_stream': '0', 'gpu_external_alloc': '0', 'gpu_mem_limit': '18446744073709551615', 'enable_cuda_graph': '0', 'gpu_external_free': '0', 'gpu_external_empty_cache': '0', 'arena_extend_strategy': 'kNextPowerOfTwo', 'cudnn_conv_algo_search': 'EXHAUSTIVE', 'do_copy_in_default_stream': '1', 'cudnn_conv_use_max_workspace': '1', 'tunable_op_enable': '0', 'tunable_op_tuning_enable': '0', 'tunable_op_max_tuning_duration_ms': '0', 'enable_skip_layer_norm_strict_mode': '0', 'prefer_nhwc': '0', 'use_ep_level_unified_stream': '0', 'use_tf32': '1', 'sdpa_kernel': '0'}, 'CPUExecutionProvider': {}}
find model: C:\Users\iii_a/.insightface\models\buffalo_l\w600k_r50.onnx recognition ['None', 3, 112, 112] 127.5 127.5
set det-size: (640, 640)
============================================================
[]
============================================================
Вот мои версии Python и пакеты Python
ОС: Windows 10
Графический процессор: RTX 4090 24G
Python: 3.9.21
Пакеты Python
Package Version
---------------------- -----------
albucore 0.0.23
albumentations 2.0.0
annotated-types 0.7.0
antlr4-python3-runtime 4.9.3
certifi 2024.12.14
charset-normalizer 3.4.1
colorama 0.4.6
coloredlogs 15.0.1
contourpy 1.3.0
cycler 0.12.1
Cython 3.0.11
easydict 1.13
eval_type_backport 0.2.2
filelock 3.16.1
flatbuffers 24.12.23
fonttools 4.55.3
fsspec 2024.12.0
humanfriendly 10.0
idna 3.10
imageio 2.37.0
importlib_resources 6.5.2
insightface 0.7.3
Jinja2 3.1.5
joblib 1.4.2
kiwisolver 1.4.7
lap 0.5.12
lazy_loader 0.4
MarkupSafe 3.0.2
matplotlib 3.9.4
mpmath 1.3.0
networkx 3.2.1
numpy 2.0.2
omegaconf 2.3.0
onnx 1.17.0
onnxruntime-gpu 1.19.2
opencv-python 4.11.0.86
opencv-python-headless 4.11.0.86
packaging 24.2
pandas 2.2.3
pillow 11.1.0
pip 24.2
prettytable 3.12.0
protobuf 5.29.3
psutil 6.1.1
py-cpuinfo 9.0.0
pydantic 2.10.5
pydantic_core 2.27.2
pyparsing 3.2.1
pyreadline3 3.5.4
python-dateutil 2.9.0.post0
pytz 2024.2
PyYAML 6.0.2
requests 2.32.3
scikit-image 0.24.0
scikit-learn 1.6.1
scipy 1.13.1
seaborn 0.13.2
setuptools 75.1.0
simsimd 6.2.1
six 1.17.0
stringzilla 3.11.3
sympy 1.13.1
threadpoolctl 3.5.0
tifffile 2024.8.30
torch 2.5.1
torchvision 0.20.1
tqdm 4.67.1
typing_extensions 4.12.2
tzdata 2024.2
ultralytics 8.3.64
ultralytics-thop 2.0.14
urllib3 2.3.0
wcwidth 0.2.13
wheel 0.44.0
zipp 3.21.0
Подробнее здесь:
https://stackoverflow.com/questions/793 ... nize-faces
1737422618
Anonymous
Я использовал Insightface для обнаружения лица на изображении, но результатом обнаружения оказался пустой список (не удалось обнаружить лица). Не могли бы вы помочь определить, какая часть могла пойти не так? Вот код и ввод/вывод: [list] [*]Мой код [/list] import cv2 from insightface.app import FaceAnalysis from insightface.data import get_image app = FaceAnalysis(providers=['CUDAExecutionProvider', 'CPUExecutionProvider']) app.prepare(ctx_id=0, det_size=(640, 640)) img = cv2.imread("face.jpg") faces = app.get(img) print("============================================================") print(faces) print("============================================================") [list] [*]Входное изображение: вот мое изображение [*]Вывод Applied providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'], with options: {'CUDAExecutionProvider': {'device_id': '0', 'has_user_compute_stream': '0', 'cudnn_conv1d_pad_to_nc1d': '0', 'user_compute_stream': '0', 'gpu_external_alloc': '0', 'gpu_mem_limit': '18446744073709551615', 'enable_cuda_graph': '0', 'gpu_external_free': '0', 'gpu_external_empty_cache': '0', 'arena_extend_strategy': 'kNextPowerOfTwo', 'cudnn_conv_algo_search': 'EXHAUSTIVE', 'do_copy_in_default_stream': '1', 'cudnn_conv_use_max_workspace': '1', 'tunable_op_enable': '0', 'tunable_op_tuning_enable': '0', 'tunable_op_max_tuning_duration_ms': '0', 'enable_skip_layer_norm_strict_mode': '0', 'prefer_nhwc': '0', 'use_ep_level_unified_stream': '0', 'use_tf32': '1', 'sdpa_kernel': '0'}, 'CPUExecutionProvider': {}} find model: C:\Users\iii_a/.insightface\models\buffalo_l\1k3d68.onnx landmark_3d_68 ['None', 3, 192, 192] 0.0 1.0 Applied providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'], with options: {'CUDAExecutionProvider': {'device_id': '0', 'has_user_compute_stream': '0', 'cudnn_conv1d_pad_to_nc1d': '0', 'user_compute_stream': '0', 'gpu_external_alloc': '0', 'gpu_mem_limit': '18446744073709551615', 'enable_cuda_graph': '0', 'gpu_external_free': '0', 'gpu_external_empty_cache': '0', 'arena_extend_strategy': 'kNextPowerOfTwo', 'cudnn_conv_algo_search': 'EXHAUSTIVE', 'do_copy_in_default_stream': '1', 'cudnn_conv_use_max_workspace': '1', 'tunable_op_enable': '0', 'tunable_op_tuning_enable': '0', 'tunable_op_max_tuning_duration_ms': '0', 'enable_skip_layer_norm_strict_mode': '0', 'prefer_nhwc': '0', 'use_ep_level_unified_stream': '0', 'use_tf32': '1', 'sdpa_kernel': '0'}, 'CPUExecutionProvider': {}} find model: C:\Users\iii_a/.insightface\models\buffalo_l\2d106det.onnx landmark_2d_106 ['None', 3, 192, 192] 0.0 1.0 Applied providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'], with options: {'CUDAExecutionProvider': {'device_id': '0', 'has_user_compute_stream': '0', 'cudnn_conv1d_pad_to_nc1d': '0', 'user_compute_stream': '0', 'gpu_external_alloc': '0', 'gpu_mem_limit': '18446744073709551615', 'enable_cuda_graph': '0', 'gpu_external_free': '0', 'gpu_external_empty_cache': '0', 'arena_extend_strategy': 'kNextPowerOfTwo', 'cudnn_conv_algo_search': 'EXHAUSTIVE', 'do_copy_in_default_stream': '1', 'cudnn_conv_use_max_workspace': '1', 'tunable_op_enable': '0', 'tunable_op_tuning_enable': '0', 'tunable_op_max_tuning_duration_ms': '0', 'enable_skip_layer_norm_strict_mode': '0', 'prefer_nhwc': '0', 'use_ep_level_unified_stream': '0', 'use_tf32': '1', 'sdpa_kernel': '0'}, 'CPUExecutionProvider': {}} find model: C:\Users\iii_a/.insightface\models\buffalo_l\det_10g.onnx detection [1, 3, '?', '?'] 127.5 128.0 Applied providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'], with options: {'CUDAExecutionProvider': {'device_id': '0', 'has_user_compute_stream': '0', 'cudnn_conv1d_pad_to_nc1d': '0', 'user_compute_stream': '0', 'gpu_external_alloc': '0', 'gpu_mem_limit': '18446744073709551615', 'enable_cuda_graph': '0', 'gpu_external_free': '0', 'gpu_external_empty_cache': '0', 'arena_extend_strategy': 'kNextPowerOfTwo', 'cudnn_conv_algo_search': 'EXHAUSTIVE', 'do_copy_in_default_stream': '1', 'cudnn_conv_use_max_workspace': '1', 'tunable_op_enable': '0', 'tunable_op_tuning_enable': '0', 'tunable_op_max_tuning_duration_ms': '0', 'enable_skip_layer_norm_strict_mode': '0', 'prefer_nhwc': '0', 'use_ep_level_unified_stream': '0', 'use_tf32': '1', 'sdpa_kernel': '0'}, 'CPUExecutionProvider': {}} find model: C:\Users\iii_a/.insightface\models\buffalo_l\genderage.onnx genderage ['None', 3, 96, 96] 0.0 1.0 Applied providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'], with options: {'CUDAExecutionProvider': {'device_id': '0', 'has_user_compute_stream': '0', 'cudnn_conv1d_pad_to_nc1d': '0', 'user_compute_stream': '0', 'gpu_external_alloc': '0', 'gpu_mem_limit': '18446744073709551615', 'enable_cuda_graph': '0', 'gpu_external_free': '0', 'gpu_external_empty_cache': '0', 'arena_extend_strategy': 'kNextPowerOfTwo', 'cudnn_conv_algo_search': 'EXHAUSTIVE', 'do_copy_in_default_stream': '1', 'cudnn_conv_use_max_workspace': '1', 'tunable_op_enable': '0', 'tunable_op_tuning_enable': '0', 'tunable_op_max_tuning_duration_ms': '0', 'enable_skip_layer_norm_strict_mode': '0', 'prefer_nhwc': '0', 'use_ep_level_unified_stream': '0', 'use_tf32': '1', 'sdpa_kernel': '0'}, 'CPUExecutionProvider': {}} find model: C:\Users\iii_a/.insightface\models\buffalo_l\w600k_r50.onnx recognition ['None', 3, 112, 112] 127.5 127.5 set det-size: (640, 640) ============================================================ [] ============================================================ Вот мои версии Python и пакеты Python [*]ОС: Windows 10 [*]Графический процессор: RTX 4090 24G [*]Python: 3.9.21 [*]Пакеты Python [/list] Package Version ---------------------- ----------- albucore 0.0.23 albumentations 2.0.0 annotated-types 0.7.0 antlr4-python3-runtime 4.9.3 certifi 2024.12.14 charset-normalizer 3.4.1 colorama 0.4.6 coloredlogs 15.0.1 contourpy 1.3.0 cycler 0.12.1 Cython 3.0.11 easydict 1.13 eval_type_backport 0.2.2 filelock 3.16.1 flatbuffers 24.12.23 fonttools 4.55.3 fsspec 2024.12.0 humanfriendly 10.0 idna 3.10 imageio 2.37.0 importlib_resources 6.5.2 insightface 0.7.3 Jinja2 3.1.5 joblib 1.4.2 kiwisolver 1.4.7 lap 0.5.12 lazy_loader 0.4 MarkupSafe 3.0.2 matplotlib 3.9.4 mpmath 1.3.0 networkx 3.2.1 numpy 2.0.2 omegaconf 2.3.0 onnx 1.17.0 onnxruntime-gpu 1.19.2 opencv-python 4.11.0.86 opencv-python-headless 4.11.0.86 packaging 24.2 pandas 2.2.3 pillow 11.1.0 pip 24.2 prettytable 3.12.0 protobuf 5.29.3 psutil 6.1.1 py-cpuinfo 9.0.0 pydantic 2.10.5 pydantic_core 2.27.2 pyparsing 3.2.1 pyreadline3 3.5.4 python-dateutil 2.9.0.post0 pytz 2024.2 PyYAML 6.0.2 requests 2.32.3 scikit-image 0.24.0 scikit-learn 1.6.1 scipy 1.13.1 seaborn 0.13.2 setuptools 75.1.0 simsimd 6.2.1 six 1.17.0 stringzilla 3.11.3 sympy 1.13.1 threadpoolctl 3.5.0 tifffile 2024.8.30 torch 2.5.1 torchvision 0.20.1 tqdm 4.67.1 typing_extensions 4.12.2 tzdata 2024.2 ultralytics 8.3.64 ultralytics-thop 2.0.14 urllib3 2.3.0 wcwidth 0.2.13 wheel 0.44.0 zipp 3.21.0 Подробнее здесь: [url]https://stackoverflow.com/questions/79372567/insightface-cannot-recognize-faces[/url]