Original code:
from keras.preprocessing import image
img = image.load_img(img_path,target_size=(224,224))
x = image.img_to_array(img)
report errors:
AttributeError: module 'keras.preprocessing.image' has no attribute 'load_img'
Reason: The keras version has been updated.
Solution:
from keras.utils import image_utils
img = image_utils.load_img(img_path,target_size=(224,224))
x = image_utils.img_to_array(img)
Read More:
- [Jeston Xavier NX Compile librealsense Error] AttributeError: module ‘pyrealsense2‘ has no attribute ‘pipeline‘
- [Solved] OpenCV Error: AttributeError: module ‘cv2‘ has no attribute ‘data‘
- TensorFlow error: AttributeError: module ‘tensorflow_core._api.v2.train’ has no attribute ‘Optimizer‘
- [Solved] Raspberry Pi Error: AttributeError: module ‘serial‘ has no attribute ‘Serial‘
- Tensorflow error: attributeerror: module ‘tensorflow_ API. V1. Train ‘has no attribute’ summarywriter ‘
- [Solved] AttributeError: ‘depthai.node.ObjectTracker‘ object has no attribute ‘setTrackerIdAssigmentPolicy‘
- [Solved] redis Error: AttributeError: ‘list‘ object has no attribute ‘decode‘
- Pyqt5 Error: AttributeError: ‘QWidget‘ object has no attribute ‘setCentralWidget‘
- PySpark error: AttributeError: ‘NoneType‘ object has no attribute ‘_jvm‘
- [Solved] AttributeError : ‘GridSearchCV‘ object has no attribute ‘grid_scores_‘
- ROS package executes rosrun error: attributeerror: ‘thread’ object has no attribute ‘isalive‘
- [Solved] AttributeError: ‘openvino.inference_engine.ie_api.IENetwork‘ object has no attribute ‘input_info‘
- [Solved] AttributeError: ‘Upsample‘ object has no attribute ‘recompute_scale_factor‘
- module ‘networkx’ has no attribute ‘from_pandas_dataframe’
- mainfest Image Error: (img/icons/andriod-chrome-192×192.png)Download error or resource isn’t a vaild image
- Yolox_s.pth Convert to tensorRT Error: AttributeError: ‘tensorrt.tensorrt.Builder‘ object has no attribute ‘max_workspace_size‘
- [How to Solve] Tesorflow: module ‘pandas.core.computation’ has no attribute ‘expressions’
- Pytorch error: `module ‘torch‘ has no attribute ‘__version___‘`
- Attributeerror encountered when using ceilometer and gnocchi to execute commands related to gnocchi metric list: _Environ instance has no attribute ‘
- [Solved] Module ‘scipy.misc‘ has no attribute ‘imread‘