Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What to do if we can't find imsave after import scipy.misc?

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article editor for you detailed introduction "import scipy.misc can not find imsave how to solve", the content is detailed, the steps are clear, the details are handled properly, I hope this "after import scipy.misc can not find imsave how to solve" article can help you solve doubts, following the editor's ideas slowly in-depth, together to learn new knowledge.

Case analysis

You need to use imsave () when you want to convert CIFAR-10 hexadecimal data into images, but it shows that there is no imsave () in the library after import scipy.misc.

Later, it was found that the package Pillow also needed to be installed.

Resolution: pip install Pillow cause Analysis:

Before installing Pillow, you can check the package through dir (scipy.misc) and find that the imsave () function cannot be found.

After installing Pillow, you can see that there are many more functions, including imsave (), imread ()

Pillow is a very powerful image processing library of python. Image processing functions such as imsave should belong to the Pillow library.

You need to enter import PIL when you import, but you cannot find the call to imsave at this time

This is the first time that this installation package will also import new functions into other libraries.

Add: solution to module scipy.misc has no attribute imsave error report

When we want to open the image in the scipy.misc.imsave () package, what should we do if there is an error like this?

From scipy import miscimport matplotlib.pyplot as pltf = misc.face () misc.imsave ('face.png', f) # uses the Image module (PIL) plt.imshow (f) plt.show () Traceback (most recent call last): File "D:/pycharm/pycharm_project/Numpy Matplotlib scipy/scipy image processing .py", line 4, in misc.imsave (' face.png', f) # uses the Image module (PIL) AttributeError: module 'scipy.misc' has no attribute' imsave' processing method:

Here is another way to open it:

Import imageioimageio.imsave () # cases from scipy import miscimport imageioimport matplotlib.pyplot as pltf = misc.face () imageio.imsave ('face.png', f) plt.imshow (f) plt.show () read here, this article "how to solve imsave cannot be found after import scipy.misc" has been introduced. If you want to master the knowledge points of this article, you still need to practice and use it before you can understand it. If you want to know more about related articles, Welcome to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report