我在google collab中安装了EmoPy
pip install EmoPy
并尝试执行以下代码。你知道吗
显示imread中的错误命令。请帮帮我
from EmoPy.src.fermodel import FERModel
from pkg_resources import resource_filename
target_emotions = ['calm', 'anger', 'happiness']
model = FERModel(target_emotions, verbose=True)
print('Predicting on happy image...')
model.predict(resource_filename('EmoPy.examples','image_data/sample_happy_image.png'))
print('Predicting on disgust image...')
model.predict(resource_filename('EmoPy.examples','image_data/sample_disgust_image.png'))
print('Predicting on anger image...')
model.predict(resource_filename('EmoPy.examples','image_data/sample_anger_image2.png'))
AttributeError: module 'scipy.misc' has no attribute 'imread'
imread
在scipy1.0.0中被弃用,并将在1.2.0中删除。我认为您使用的是1.2版或更高版本。有两种方法可以解决这个问题:imread
fromm scipy,而是使用imageio
(imageio.imread
而不是scipy.misc.imread
)from documentation中提到的。当然,您需要将imageio
导入到您的环境中我建议使用第一个选项,因为我没有看到您在代码中显式地使用
scipy.misc.imread
,所以您必须在调用它的任何地方对其进行内部更改。第一个解决方案非常简洁明了,只要将版本降级就可以了。你知道吗希望这有帮助!你知道吗
或者,您也可以从OpenCV2、cv2.imread使用imread
相关问题 更多 >
编程相关推荐