AttributeError: module 'scipy.misc' has no attribute 'imresize'
时间: 2023-10-27 17:07:51 浏览: 223
This error occurs when you are trying to use the 'imresize' function from the 'scipy.misc' module, but the function is not available in the specified version of SciPy.
The 'imresize' function was deprecated in SciPy version 1.3.0 and removed in version 1.4.0. If you are using a version of SciPy older than 1.3.0, you can upgrade to a newer version to access the 'imresize' function.
Alternatively, you can use other functions to resize images, such as 'skimage.transform.resize' from the scikit-image library or 'cv2.resize' from the OpenCV library.
相关问题
attributeerror: module 'scipy.misc' has no attribute 'imresize'
这个错误消息表示在使用scipy库中的misc模块时,没有找到imresize这个属性/函数。这可能是因为imresize函数已经在新版本的scipy库中被移除了。建议您查找其他的图像缩放函数来代替imresize。
AttributeError: scipy.misc is deprecated and has no attribute imresize.
引用中提到了一个错误信息:AttributeError: module 'scipy.misc' has no attribute 'imresize',这意味着在scipy.misc模块中没有imresize属性。引用和进一步解释了这个问题:imresize函数在SciPy 1.0.0版本中已经被弃用,并且将在1.3.0版本中移除。取而代之的是使用Pillow库中的Image对象的resize方法来实现相同的功能。你可以使用以下代码来替代imresize函数的使用:
```python
import numpy as np
from PIL import Image
my_image = np.array(Image.fromarray(image).resize((64, 64)))
```
这样就可以避免使用已弃用的imresize函数并解决AttributeError错误。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [AttributeError: module 'scipy.misc' has no attribute 'imresize'等问题解决](https://blog.csdn.net/lly1122334/article/details/102383111)[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~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *3* [scipy.misc is deprecated and has no attribute imresize](https://blog.csdn.net/weixin_45766582/article/details/131573556)[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~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文