def make_fcn_resnet(input_shape, nb_labels, use_pretraining, freeze_base):
nb_rows, nb_cols, _ = input_shape
input_tensor = Input(shape=input_shape)
weights = 'imagenet' if use_pretraining else None
model =ResnetBuilder.build(num_outputs=2,repetitions2=3, weights='present', input_shape=(1, 500, 500, 5))
if freeze_base:
for layer in model.layers:
layer.trainable = False
x32 = model.get_layer('act2').output
print("x32", x32._keras_shape)
x16 = model.get_layer('act3').output
print("x16", x16._keras_shape)
x8 = model.get_layer('act4').output
print("x8", x8._keras_shape)
c32 = Conv3D(nb_labels, (1, 1,5), name='conv_labels_32', padding='valid')(x32)
c32=Reshape((500,500,2))(c32)
print("c32", c32._keras_shape)
c16 = Conv3D(nb_labels, (1, 1,5), name='conv_labels_16', padding='valid')(x16)
c16=Reshape((250,250,2))(c16)
print("c16", c16._keras_shape)
c8 = Conv3D(nb_labels, (1, 1,5), name='conv_labels_8', padding='valid')(x8)
c8=Reshape((125,125,2))(c8)
print("c8", c8._keras_shape)
def resize_bilinear(images):
return tf.image.resize_bilinear(images, [nb_rows, nb_cols])
r32 = Lambda(resize_bilinear, name='resize_labels_32')(c32)
r16 = Lambda(resize_bilinear, name='resize_labels_16')(c16)
r8 = Lambda(resize_bilinear, name='resize_labels_8')(c8)
m = Add(name='merge_labels')([r32, r16, r8])
x = Reshape((nb_rows * nb_cols, nb_labels))(m)
x = Activation('softmax')(x)
x = Reshape((nb_rows, nb_cols, nb_labels))(x)
model = Model(inputs=input_tensor, outputs=x)
#print model.summary()
return model
В функции ResnetBuilder.build
я написал модель для Resnet, используя слои conv3d.здесь я беру слои Resnet моей собственной модели и проектирую новую модель.Я получаю сообщение об ошибке, как отключение графика при вызове новой модели.