---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-14-1f6cde7dea50> in <module>
5 from keras.utils import np_utils
6 from keras import backend as K
----> 7 K.tensorflow_backend.set_image_dim_ordering('th')
8 import numpy as np
9 import os
AttributeError: module 'keras.backend.tensorflow_backend' has no attribute 'set_image_dim_ordering'
I'm using keras version 2.3.1.
I am aware of a previous post about this problem, but the original post's problem was caused by mixing tensorflow and keras in the importing section. However, I didn't use tensorflow in my program.
Instead of:
from keras import backend as K
Use:
import tensorflow.keras.backend as K
Or keep it the same and use:
K.set_image_dim_ordering('th')
Or use:
pip3 uninstall keras
pip3 install keras --upgrade
To set the image order as proposed by some here try:
K.set_image_data_format()
or
K.common.set_image_dim_ordering('th')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.