the problem of calling set_image_dim_ordering

712 views
Skip to first unread message

Huaiyang Gongzi

unread,
Nov 18, 2016, 1:10:34 PM11/18/16
to Keras-users
Hello,

I am trying to follow an online tutorial for using Keras

When experimenting with the following code segment, which are just some "import module" part, I get the following error message. It is related to set_image_dim_ordering.  Would you like to share any insight on walking around this? Thanks.

(tfw) bash-4.1$ python train.py
Using TensorFlow backend.
Traceback (most recent call last):
  File "train.py", line 16, in <module>
    K.set_image_dim_ordering('tf')
AttributeError: 'module' object has no attribute 'set_image_dim_ordering'


# the following is the code 

from __future__ import print_function

from PIL import Image
from skimage import io
io.use_plugin('pil')
from skimage import img_as_uint
import numpy as np
from keras.models import Model
from keras.layers import Input, merge, Convolution2D, MaxPooling2D, UpSampling2D
from keras.optimizers import Adam
from keras.callbacks import ModelCheckpoint, LearningRateScheduler
from keras import backend as K

from data import load_train_data, load_test_data

K.set_image_dim_ordering('tf')  

img_rows = 64
img_cols = 80

Trancept

unread,
Nov 23, 2016, 6:04:51 AM11/23/16
to Keras-users
Hello,

You could try to comment this line and specify dim_ordering in your file ~/.keras/keras.json
Or when adding each layer :
model.add(MaxPooling2D(pool_size=(2, 2), dim_ordering="tf"))

Daπid

unread,
Nov 23, 2016, 7:08:59 AM11/23/16
to Huaiyang Gongzi, Keras-users

Do you have an updated version of keras?


--
You received this message because you are subscribed to the Google Groups "Keras-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to keras-users+unsubscribe@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/keras-users/29d4d375-081a-4e72-8581-474b5d5cf8a7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages