AttributeError: scipy.misc is deprecated and has no attribute imresize.
时间: 2023-10-30 16:59:17 浏览: 325
引用中提到了一个错误信息:AttributeError: module 'scipy.misc' has no attribute 'imresize',这意味着在scipy.misc模块中没有imresize属性。引用和进一步解释了这个问题:imresize函数在SciPy 1.0.0版本中已经被弃用,并且将在1.3.0版本中移除。取而代之的是使用Pillow库中的Image对象的resize方法来实现相同的功能。你可以使用以下代码来替代imresize函数的使用:
import numpy as np
from PIL import Image
my_image = np.array(Image.fromarray(image).resize((64, 64)))
这样就可以避免使用已弃用的imresize函数并解决AttributeError错误。123
引用[.reference_title]
- 1 2 AttributeError: module 'scipy.misc' has no attribute 'imresize'等问题解决[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2
allinsert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - 3 scipy.misc is deprecated and has no attribute imresize[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2
allinsert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]