Skip to content

Commit 861f8b7

Browse files
author
Elvis Dowson
committed
scripts/training.py: Use keras.backend.image_data_format() to support newer keras version.
If you want to support newer Keras, then according to [keras-team/keras#12649](keras-team/keras#12649) the image_dim_ordering method has to be renamed to keras.backend.image_data_format() This is the way to use the new Keras API: setting: K.set_image_dim_ordering('tf') --> K.set_image_data_format('channels_last') K.set_image_dim_ordering('th') --> K.set_image_data_format('channels_first') checking: K.image_dim_ordering() == 'tf' --> K.image_data_format() == 'channels_last' K.image_dim_ordering() == 'th' --> K.image_data_format() == 'channels_first' Signed-off-by: Elvis Dowson <elvis.dowson@gmail.com>
1 parent e3826c7 commit 861f8b7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

scripts/training.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def getResnetModel(d):
150150
activation = d.act
151151
advanced_act = d.aact
152152
drop_prob = d.dropout
153-
inputShape = (3, 32, 32) if K.image_dim_ordering() == "th" else (32, 32, 3)
153+
inputShape = (3, 32, 32) if K.image_data_format() == "channels_first" else (32, 32, 3)
154154
channelAxis = 1 if K.image_data_format() == 'channels_first' else -1
155155
filsize = (3, 3)
156156
convArgs = {

0 commit comments

Comments
 (0)