yu4u/age-gender-estimation

errors with keras image_dim_ordering()

nyck33 opened this issue · 5 comments

When I try to run the second cell in predict.ipynb I get:

/media/nobu/Ubuntu Backup1/1DeepLearning/2pixelation/age-gender-estimation/wide_resnet.py in __init__(self, image_size, depth, k)
     24         self._weight_init = "he_normal"
     25 
---> 26         if K.backend.image_data_format() == "th":
     27             logging.debug("image_dim_ordering = 'th'")
     28             self._channel_axis = 1

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

Tried changing to `K.backend.imaged_data_format()` but error stays the same.  


yu4u commented

What's the Keras and TensorFlow versions?

I'm having the same issue. I think it's because I'm using Keras v2, where the function has been renamed to 'image_data_format()'. Not sure if @nyck33 made a spelling error (you wrote imaged instead of image) when commenting here or if he actually mistyped it.

I've fixed it by switching to keras v2.2.4 instead of 2.2.5.

@AlecVandenbroeck I'll have to check that but thanks!

@yu4u

Changed line 26 of wide_resnet.py to if K.common.image_dim_ordering() == "th":
and it works.