The problem of io loading .mat data and imread reading pictures under Scipy
When we need to load MATLAB’s .mat file, if we use:
import scipy.misc
import scipy.io
import os
cwd = os.getcwd()
data = scipy.io.loadmat(cwd + "/data/imagenet-vgg-verydeep-19.mat")
Will report an error:
AttributeError: module’scipy’ has no attribute’io’
The reason for this may be that the submodules under scipy cannot be imported directly.
from scipy import io
Finally changed to:
import scipy.misc
from scipy import io
import os
cwd = os.getcwd()
data = io.loadmat(cwd + "/data/imagenet-vgg-verydeep-19.mat")
problem solved.
Also use the imread function under Scipy.misc,
import scipy.misc
cwd = os.getcwd()
VGG_PATH = cwd + "/data/imagenet-vgg-verydeep-19.mat"
IMG_PATH = cwd + "/data/cat.jpg"
input_image = imread(IMG_PATH)
appear:
AttributeError : ‘module’ object has no attribute’imread ‘
This is sometimes because you do not have pillow dependency packages
pip install pillow
This is how I solved it.
Read More:
- [Perfectly Solved] attributeerror: module ‘SciPy. Misc’ has no attribute ‘toimage’ error
- [How to Solve]AttributeError: module ‘scipy’ has no attribute ‘stats’
- [Solved] AttributeError: module ‘PIL.Image‘ has no attribute ‘open‘
- AttributeError: module ‘time‘ has no attribute ‘clock‘ [How to Solve]
- [Solved] AttributeError: module ‘selenium.webdriver‘ has no attribute ‘Chrome‘
- AttributeError: module ‘enum‘ has no attribute ‘IntFlag‘ [How to Solve]
- [Solved] AttributeError: module ‘setuptools._distutils‘ has no attribute ‘version‘
- [Solved]AttributeError: module ‘urllib’ has no attribute ‘quote’
- [Solved] AttributeError: module ‘logging‘ has no attribute ‘Handler‘
- [Solved] AttributeError: partially initialized module ‘xlwings’ has no attribute ‘App’
- [Solved] AttributeError: module ‘distutils‘ has no attribute ‘version‘
- [Solved] AttributeError: module ‘pandas‘ has no attribute ‘rolling_count‘
- [Solved] Python Error: AttributeError: partially initialized module ‘keyword‘ has no attribute ‘kwlist‘
- [Solved] AttributeError: module ‘tensorflow‘ has no attribute ‘distributions‘
- Python AttributeError: module ‘tensorflow‘ has no attribute ‘InteractiveSession‘
- [Solved] AttributeError: module ‘time‘ has no attribute ‘clock‘
- Python3.7 AttributeError: module ‘time‘ has no attribute ‘clock‘
- [Solved] AttributeError: module ‘dlib‘ has no attribute ‘get_face_chip‘
- BlazingSQL Error: AttributeError: module ‘cio‘ has no attribute ‘RunQueryError‘
- How to Solve Python AttributeError: ‘module’ object has no attribute ‘xxx’