Debug | AttributeError: module ‘keras.backend‘ has no attribute ‘image_dim_ordering‘

Error message
AttributeError: module 'keras.backend' has no attribute 'image_dim_ordering'

Analysis is
generally caused by the different version codes of Keras. Finding the error line is generally if K.image_dim_ordering() == ...orK.image_data_format() == ...

Solution
If the latest keras is used here, the code is if K.image_dim_ordering() == "th"changed K.image_data_format() == "channels_first". In the same way, if it is an older keras, the other way around.

This error is relatively common, and there are many solutions on the Internet. You can always find it by looking through it.

Guess you like

Origin blog.csdn.net/weixin_43360896/article/details/111223944