Skip to content

Commit fa42573

Browse files
update to tf api method of tensor.shape)
1 parent b05d9dc commit fa42573

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

model_tf2.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ def Deeplabv3(weights='pascal_voc', input_tensor=None, input_shape=(512, 512, 3)
373373
b4 = BatchNormalization(name='image_pooling_BN', epsilon=1e-5)(b4)
374374
b4 = Activation('elu')(b4)
375375
# upsample. have to use compat because of the option align_corners
376-
size_before = K.int_shape(x)
376+
size_before = x.shape
377377

378378
b4 = Lambda(lambda x: tf.image.resize_with_pad(x, target_height=size_before[1], target_width=size_before[2]))(b4)
379379
# b4 = UpSampling2D(size=(size_before[1],size_before[2]),interpolation='bilinear')(b4)
@@ -435,8 +435,7 @@ def Deeplabv3(weights='pascal_voc', input_tensor=None, input_shape=(512, 512, 3)
435435
# size_in = K.int_shape(x)
436436
# size_out = K.int_shape(img_input)
437437
# x = UpSampling2D(size=(size_out[1] // size_in[1], size_out[2] // size_in[2]), interpolation='bilinear')(x)
438-
size_before3 = K.int_shape(img_input)
439-
x = Lambda(lambda xx: tf.image.resize_with_pad(xx, target_height=size_before3[1], target_width=size_before3[2]))(x)
438+
x = Lambda(lambda xx: tf.image.resize_with_pad(xx, target_height=img_input.shape[1], target_width=img_input.shape[2]))(x)
440439
# Ensure that the model takes into account
441440
# any potential predecessors of `input_tensor`.
442441
if input_tensor is not None:

0 commit comments

Comments
 (0)