无法初始化py-feat中Detector类的对象

我尝试根据以下说明从视频中检测FEX:https://py-feat.org/content/detector.html#detecting-fex-from-videos

但我无法初始化Detector类的对象。我使用的代码如下:

from feat import Detectorface_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:  retinafaceUsing downloaded and verified file: C:\Users\User\AppData\Roaming\Python\Python39\site-packages\feat\resources\mobilenet0.25_Final.pthUsing downloaded and verified file: C:\Users\User\AppData\Roaming\Python\Python39\site-packages\feat\resources\mobilenet_224_model_best_gdconv_external.pth.tarUsing downloaded and verified file: C:\Users\User\AppData\Roaming\Python\Python39\site-packages\feat\resources\hog_pca_all_emotio.joblibUsing downloaded and verified file: C:\Users\User\AppData\Roaming\Python\Python39\site-packages\feat\resources\hog_pca_all_emotio.joblibUsing downloaded and verified file: C:\Users\User\AppData\Roaming\Python\Python39\site-packages\feat\resources\hog_scalar_aus.joblibUsing downloaded and verified file: C:\Users\User\AppData\Roaming\Python\Python39\site-packages\feat\resources\RF_568.joblibUsing downloaded and verified file: C:\Users\User\AppData\Roaming\Python\Python39\site-packages\feat\resources\hog_pca_all_emotio.joblibUsing downloaded and verified file: C:\Users\User\AppData\Roaming\Python\Python39\site-packages\feat\resources\hog_scalar_aus.joblibUsing downloaded and verified file: C:\Users\User\AppData\Roaming\Python\Python39\site-packages\feat\resources\ResMaskNet_Z_resmasking_dropout1_rot30.pthLoading Face Landmark model:  mobilenetLoading au model:  rfLoading emotion model:  resmasknetTraceback (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. 还有人知道如何解决前两行的错误吗?


回答:

看起来你的一个文件可能已经损坏了。

你可以尝试通过打开目录C:\Users\User\AppData\Roaming\Python\Python39\site-packages\feat\resources\并删除文件ResMaskNet_Z_resmasking_dropout1_rot30.pth来解决这个问题。

然后再次运行代码,它应该会重新下载被删除的文件。

前两行的警告只是一个警告,它表示库nilearn中的一些代码已被弃用。大多数情况下你可以忽略这一行,这可能会在nilearn的未来补丁中由开发者修复。

Related Posts

使用LSTM在Python中预测未来值

这段代码可以预测指定股票的当前日期之前的值,但不能预测…

如何在gensim的word2vec模型中查找双词组的相似性

我有一个word2vec模型,假设我使用的是googl…

dask_xgboost.predict 可以工作但无法显示 – 数据必须是一维的

我试图使用 XGBoost 创建模型。 看起来我成功地…

ML Tuning – Cross Validation in Spark

我在https://spark.apache.org/…

如何在React JS中使用fetch从REST API获取预测

我正在开发一个应用程序,其中Flask REST AP…

如何分析ML.NET中多类分类预测得分数组?

我在ML.NET中创建了一个多类分类项目。该项目可以对…

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注