我试着从视频中检测FEX,按照下面的说明:https://py-feat.org/content/detector.html#detecting-fex-from-videos
但是我不能初始化检测器类的对象。我使用的代码:
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新手,这就是为什么我没有在对象初始化中更改任何参数的原因。不明白每一个都意味着什么。
也许有人知道,如何解决前两排的问题?
发布于 2022-03-19 20:34:31
看上去你的一个文件被破坏了。
您可以尝试通过打开目录C:\Users\User\AppData\Roaming\Python\Python39\site-packages\feat\resources\和删除文件ResMaskNet_Z_resmasking_dropout1_rot30.pth来解决这个问题。
然后再次运行代码,它应该重新下载已删除的文件。
前两行中的警告只是一个警告,这意味着库nilearn中的一些代码是不推荐的。大多数情况下,您只是忽略这一行,这很可能是由nilearn的程序员在未来的补丁中修复的。
https://stackoverflow.com/questions/71541634
复制相似问题