Глубокий анализ - тестовые скрипты для переработки изображенийPython

Программы на Python
Ответить Пред. темаСлед. тема
Anonymous
 Глубокий анализ - тестовые скрипты для переработки изображений

Сообщение Anonymous »

У меня возникают проблемы с привлечением обработки партии анализа изображений на работу. Я хотел бы отправить список изображений в Deepface, чтобы получить список расовых, полов и возрастных прогнозов. Я вызываю функции тестирования из DeepFaceMaster/tests/test_analyze.py, и пакетные специфические функции не сняты.

Код: Выделить всё

Python 3.11.9

Package                      Version
----------------------------  - - - - - - - - - < b r   / > a b s l - p y                                             2 . 1 . 0 < b r   / > a l b u c o r e                                           0 . 0 . 2 3 < b r   / > a l b u m e n t a t i o n s                               2 . 0 . 5 < b r   / > a n n o t a t e d - t y p e s                             0 . 7 . 0 < b r   / > a s t u n p a r s e                                       1 . 6 . 3 < b r   / > a t t r s                                                 2 5 . 1 . 0 < b r   / > b e a u t i f u l s o u p 4                              4.13.3
blinker                      1.6.2
certifi                      2025.1.31
cffi                         1.17.1
charset-normalizer           3.4.1
click                        8.1.6
cmake                        3.31.6
colorama                     0.4.6
coloredlogs                  15.0.1
contourpy                    1.3.1
cycler                       0.12.1
Cython                       3.0.12
deepface                     0.0.93
dlib                         19.24.6
easydict                     1.13
et-xmlfile                   1.1.0
exif                         1.6.1
extensions                   0.4
filelock                     3.17.0
fire                         0.7.0
Flask                        2.3.2
flask-cors                   5.0.1
flatbuffers                  25.2.10
fonttools                    4.56.0
fsspec                       2025.3.0
gast                         0.6.0
gdown                        5.2.0
google-pasta                 0.2.0
grpcio                       1.70.0
gunicorn                     23.0.0
h5py                         3.13.0
humanfriendly                10.0
idna                         3.10
imageio                      2.37.0
insightface                  0.7.3
itsdangerous                 2.1.2
jax                          0.5.2
jaxlib                       0.5.1
Jinja2                       3.1.2
joblib                       1.4.2
keras                        3.8.0
kiwisolver                   1.4.8
lazy_loader                  0.4
libclang                     18.1.1
lz4                          4.4.3
Markdown                     3.7
markdown-it-py               3.0.0
MarkupSafe                   2.1.3
matplotlib                   3.10.1
mdurl                        0.1.2
mediapipe                    0.10.21
ml-dtypes                    0.4.1
mpmath                       1.3.0
mtcnn                        1.0.0
names                        0.3.0
namex                        0.0.8
networkx                     3.4.2
numpy                        1.26.4
onnx                         1.17.0
onnxruntime                  1.21.0
opencv-contrib-python        4.11.0.86
opencv-python                4.11.0.86
opencv-python-headless       4.11.0.86
openpyxl                     3.1.2
opt_einsum                   3.4.0
optree                       0.14.1
packaging                    24.2
pandas                       2.2.3
Pillow                       10.1.0
pip                          25.0.1
plum-py                      0.8.7
prettytable                  3.15.1
protobuf                     4.25.6
psutil                       7.0.0
py-cpuinfo                   9.0.0
pycparser                    2.22
pydantic                     2.10.6
pydantic_core                2.27.2
Pygments                     2.19.1
pyparsing                    3.2.1
pyreadline3                  3.5.4
PySocks                      1.7.1
python-dateutil              2.8.2
pytz                         2023.3
PyYAML                       6.0.2
requests                     2.32.3
retina-face                  0.0.17
rich                         13.9.4
scikit-image                 0.25.2
scikit-learn                 1.6.1
scipy                        1.15.2
seaborn                      0.13.2
sentencepiece                0.2.0
setuptools                   65.5.0
simsimd                      6.2.1
six                          1.16.0
sounddevice                  0.5.1
soupsieve                    2.6
stringzilla                  3.12.3
sympy                        1.13.1
tensorboard                  2.18.0
tensorboard-data-server      0.7.2
tensorflow                   2.18.0
tensorflow_intel             2.18.0
tensorflow-io-gcs-filesystem 0.31.0
termcolor                    2.5.0
tf_keras                     2.18.0
threadpoolctl                3.5.0
tifffile                     2025.2.18
torch                        2.6.0
torchvision                  0.21.0
tqdm                         4.67.1
typing                       3.7.4.3
typing_extensions            4.12.2
tzdata                       2023.3
ultralytics                  8.3.86
ultralytics-thop             2.0.14
urllib3                      2.3.0
wcwidth                      0.2.13
Werkzeug                     2.3.6
wheel                        0.45.1
wrapt                        1.17.2
wsq                          0.5

< /code>
Когда я запускаю:  < /p>
from test_analyze import test_standard_analyze, test_analyze_for_preloaded_image, test_analyze_for_batched_image_as_list_of_string, test_analyze_for_batched_image_as_list_of_numpy, test_analyze_for_numpy_batched_image

test_standard_analyze()

test_analyze_for_preloaded_image()

test_analyze_for_batched_image_as_list_of_string()

print(logger)
Первые 2 не обработанные функции работают, а затем test_analyze_for_batched_image_as_list_of_string () сбой с:

Код: Выделить всё

2025-03-11 10:01:44.538586: 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-03-11 10:01:48.371800: 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`.
WARNING:tensorflow:From C:\Users\mvernick\AppData\Local\Programs\Python\Python311\Lib\site-packages\tf_keras\src\losses.py:2976: The name tf.losses.sparse_softmax_cross_entropy is deprecated. Please use tf.compat.v1.losses.sparse_softmax_cross_entropy instead.

2025-03-11 10:02:07.645567: 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 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
25-03-11 10:02:16 - ✅ test standard analyze done
25-03-11 10:02:21 - ✅ test analyze for pre-loaded image done
Traceback (most recent call last):
File "c:\Users\mvernick\Documents\deepface-master\deepface-master\tests\tests.py", line 9, in 
test_analyze_for_batched_image_as_list_of_string()
File "c:\Users\mvernick\Documents\deepface-master\deepface-master\tests\test_analyze.py", line 162, in test_analyze_for_batched_image_as_list_of_string
demography_batch = DeepFace.analyze(img_path=img_paths, silent=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\mvernick\AppData\Local\Programs\Python\Python311\Lib\site-packages\deepface\DeepFace.py", line 253, in analyze
return demography.analyze(
^^^^^^^^^^^^^^^^^^^
File "C:\Users\mvernick\AppData\Local\Programs\Python\Python311\Lib\site-packages\deepface\modules\demography.py", line 123, in analyze
img_objs = detection.extract_faces(
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\mvernick\AppData\Local\Programs\Python\Python311\Lib\site-packages\deepface\modules\detection.py", line 83, in extract_faces
img, img_name = image_utils.load_image(img_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\mvernick\AppData\Local\Programs\Python\Python311\Lib\site-packages\deepface\commons\image_utils.py", line 81, in load_image
raise ValueError(f"img must be numpy array or str but it is {type(img)}")
ValueError: img must be numpy array or str but it is 
Следующий тест IS TEST_ANALIZE_FOR_BATHED_IMAGE_AS_LIST_OF_NUPPY () , который не удастся с:

Код: Выделить всё

from test_analyze import test_standard_analyze, test_analyze_for_preloaded_image, test_analyze_for_batched_image_as_list_of_string, test_analyze_for_batched_image_as_list_of_numpy, test_analyze_for_numpy_batched_image

test_analyze_for_batched_image_as_list_of_numpy()

print(logger)

2025-03-11 10:07:14.324483: 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-03-11 10:07:16.999841: 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`.
WARNING:tensorflow:From C:\Users\mvernick\AppData\Local\Programs\Python\Python311\Lib\site-packages\tf_keras\src\losses.py:2976: The name tf.losses.sparse_softmax_cross_entropy is deprecated.  Please use tf.compat.v1.losses.sparse_softmax_cross_entropy instead.

Traceback (most recent call last):
File "c:\Users\mvernick\Documents\deepface-master\deepface-master\tests\tests.py", line 11, in 
test_analyze_for_batched_image_as_list_of_numpy()
File "c:\Users\mvernick\Documents\deepface-master\deepface-master\tests\test_analyze.py", line 190, in test_analyze_for_batched_image_as_list_of_numpy
demography_batch = DeepFace.analyze(img_path=imgs, silent=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\mvernick\AppData\Local\Programs\Python\Python311\Lib\site-packages\deepface\DeepFace.py", line 253, in analyze
return demography.analyze(
^^^^^^^^^^^^^^^^^^^
File "C:\Users\mvernick\AppData\Local\Programs\Python\Python311\Lib\site-packages\deepface\modules\demography.py", line 123, in analyze
img_objs = detection.extract_faces(
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\mvernick\AppData\Local\Programs\Python\Python311\Lib\site-packages\deepface\modules\detection.py", line 83, in extract_faces
img, img_name = image_utils.load_image(img_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\mvernick\AppData\Local\Programs\Python\Python311\Lib\site-packages\deepface\commons\image_utils.py", line 81, in load_image
raise ValueError(f"img must be numpy array or str but it is {type(img)}")
ValueError: img must be numpy array or str but it is 
Наконец, последний тест-test_analyze_for_numpy_batched_image () , что дает мне слишком много значений, чтобы распаковывать .

Код: Выделить всё

from test_analyze import test_standard_analyze, test_analyze_for_preloaded_image, test_analyze_for_batched_image_as_list_of_string, test_analyze_for_batched_image_as_list_of_numpy, test_analyze_for_numpy_batched_image

test_analyze_for_numpy_batched_image()

print(logger)

2025-03-11 10:08:44.611222: 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-03-11 10:08:46.439427: 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`.
WARNING:tensorflow:From C:\Users\mvernick\AppData\Local\Programs\Python\Python311\Lib\site-packages\tf_keras\src\losses.py:2976: The name tf.losses.sparse_softmax_cross_entropy is deprecated. Please use tf.compat.v1.losses.sparse_softmax_cross_entropy instead.

Traceback (most recent call last):
File "c:\Users\mvernick\Documents\deepface-master\deepface-master\tests\tests.py", line 13, in 
test_analyze_for_numpy_batched_image()
File "c:\Users\mvernick\Documents\deepface-master\deepface-master\tests\test_analyze.py", line 226, in test_analyze_for_numpy_batched_image
demography_batch = DeepFace.analyze(img, silent=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\mvernick\AppData\Local\Programs\Python\Python311\Lib\site-packages\deepface\DeepFace.py", line 253, in analyze
return demography.analyze(
^^^^^^^^^^^^^^^^^^^
File "C:\Users\mvernick\AppData\Local\Programs\Python\Python311\Lib\site-packages\deepface\modules\demography.py", line 123, in analyze
img_objs = detection.extract_faces(
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\mvernick\AppData\Local\Programs\Python\Python311\Lib\site-packages\deepface\modules\detection.py", line 88, in extract_faces
height, width, _ = img.shape
^^^^^^^^^^^^^^^^
ValueError: too many values to unpack (expected 3)
Что я делаю не так и как я могу исправить эти ошибки?


Подробнее здесь: https://stackoverflow.com/questions/795 ... processing
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

Вернуться в «Python»