MoyanZitto / keras-cn

Chinese keras documents with more examples, explanations and tips.
1.57k stars 280 forks source link

AttributeError: 'module' object has no attribute 'image_data_format' #81

Closed liutingxi closed 7 years ago

liutingxi commented 7 years ago

在使用Keras中deep-learning-models里的ResNet50模型时,出现了这样的错误

Using TensorFlow backend. Loading data... Traceback (most recent call last): x_train shape: (830, 256, 512) File "/home/liutingxi/Research/VED/Experiment/soccer_resnet.py", line 35, in Build model... model = ResNet50(weights='imagenet',input_shape=(256,512)) File "/home/liutingxi/Research/VED/Experiment/resnet50.py", line 192, in ResNet50 data_format=K.image_data_format(), AttributeError: 'module' object has no attribute 'image_data_format'

后端用的是TensorFlow 0.9.0,但是

https://github.com/fchollet/deep-learning-models/issues/45

中用的1.0.0版本出现了同样的问题,换成Theano也是,各位大神有没有什么看法呢?感激不尽

liutingxi commented 7 years ago

https://github.com/fchollet/deep-learning-models/issues/45 已解决

Keras版本问题,版本为1.x的用这里面提供的模型 https://github.com/fchollet/deep-learning-models/tree/8d8f54a9e1482c3642a55a694c2cde8f26562a06

alyato commented 6 years ago

我将keras升级到了2.1.5最新的,出现了这种问题,怎么解决

alyato commented 6 years ago

谢谢,已经解决.只需要按照https://keras.io/backend/,中的json配置写就OK