Я пытаюсь определить FEX из видео по этой инструкции: https://py-feat.org/content/detector.html#detecting-fex-from-videos
Но я не могу инициализировать объект класса Detector. Код, который я использую:
from feat import Detector
face_model = "retinaface"
landmark_model = "mobilenet"
au_model = "rf"
emotion_model = "resmasknet"
detector = Detector(face_model=face_model, landmark_model=landmark_model, au_model=au_model,
emotion_model=emotion_model)
if __name__ == '__main__':
pass
И я получаю следующие ошибки:
C:\Users\User\AppData\Roaming\Python\Python39\site-packages\nilearn\input_data\__init__.py:27: FutureWarning: The import path 'nilearn.input_data' is deprecated in version 0.9. Importing from 'nilearn.input_data' will be possible at least until release 0.13.0. Please import from 'nilearn.maskers' instead.
warnings.warn(message, FutureWarning)
Loading Face Detection model: retinaface
Using downloaded and verified file: C:\Users\User\AppData\Roaming\Python\Python39\site-packages\feat\resources\mobilenet0.25_Final.pth
Using downloaded and verified file: C:\Users\User\AppData\Roaming\Python\Python39\site-packages\feat\resources\mobilenet_224_model_best_gdconv_external.pth.tar
Using downloaded and verified file: C:\Users\User\AppData\Roaming\Python\Python39\site-packages\feat\resources\hog_pca_all_emotio.joblib
Using downloaded and verified file: C:\Users\User\AppData\Roaming\Python\Python39\site-packages\feat\resources\hog_pca_all_emotio.joblib
Using downloaded and verified file: C:\Users\User\AppData\Roaming\Python\Python39\site-packages\feat\resources\hog_scalar_aus.joblib
Using downloaded and verified file: C:\Users\User\AppData\Roaming\Python\Python39\site-packages\feat\resources\RF_568.joblib
Using downloaded and verified file: C:\Users\User\AppData\Roaming\Python\Python39\site-packages\feat\resources\hog_pca_all_emotio.joblib
Using downloaded and verified file: C:\Users\User\AppData\Roaming\Python\Python39\site-packages\feat\resources\hog_scalar_aus.joblib
Using downloaded and verified file: C:\Users\User\AppData\Roaming\Python\Python39\site-packages\feat\resources\ResMaskNet_Z_resmasking_dropout1_rot30.pth
Loading Face Landmark model: mobilenet
Loading au model: rf
Loading emotion model: resmasknet
Traceback (most recent call last):
File "C:\Users\User\Desktop\DetectFEXFromVideos\main.py", line 7, in <module>
detector = Detector(face_model=face_model, landmark_model=landmark_model, au_model=au_model,
File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\feat\detector.py", line 227, in __init__
self.emotion_model = ResMaskNet()
File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\feat\emo_detectors\ResMaskNet\resmasknet_test.py", line 748, in __init__
torch.load(
File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\torch\serialization.py", line 713, in load
return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\torch\serialization.py", line 938, in _legacy_load
typed_storage._storage._set_from_file(
RuntimeError: unexpected EOF, expected 32606425 more bytes. The file might be corrupted.
Process finished with exit code 1
Я новичок в Python, поэтому не менял никаких аргументов при инициализации объекта. Не понимаю, что каждый означает.
P.S. А может кто знает, как решить проблему в 2-х первых рядах?
Похоже, один из ваших файлов был поврежден.
Вы можете попробовать решить проблему, открыв каталог C:\Users\User\AppData\Roaming\Python\Python39\site-packages\feat\resources\
и удаление файла ResMaskNet_Z_resmasking_dropout1_rot30.pth
.
Затем снова запустите код, и он должен повторно загрузить удаленный файл.
Предупреждение в первых двух строках — это просто предупреждение, оно говорит о том, что часть кода в библиотеке nilearn
устарела. В большинстве случаев вы просто проигнорируете эту строку, вероятно, это будет исправлено кодировщиками nilearn
в будущем патче.
@StanleyKubrik это не ошибка, это предупреждение, предупреждение не критично. Показывает какое-то сообщение, но программа работает: docs.python.org/3/library/warnings.html
Когда возникает это предупреждение, также выдается исключение «произошло исключение» из функции process_frame в классе Detector.
Вы можете опубликовать все сообщение об исключении? если это не связано с исходной проблемой, возможно, стоит открыть новый вопрос
Это все сообщение. Это выглядит так: C:\Users\User\AppData\Roaming\Python\Python39\site-packages\feat\detector.py:437: FutureWarning: ``multichannel`` is a deprecated argument name for ``hog``. It will be removed in version 1.0. Please use ``channel_axis`` instead. hog_output = hog(frame, orientations=orientation, pixels_per_cell=pixels_per_cell, exception occurred exception occurred
Но я получил новую ошибку:
C:\Users\User\AppData\Roaming\Python\Python39\site-packages\feat\detector.py:437: FutureWarning: ``multichannel`` is a deprecated argument name for ``hog``. It will be removed in version 1.0. Please use ``channel_axis`` instead. hog_output = hog(frame, orientations=orientation, pixels_per_cell=pixels_per_cell,