TensorFlow 2 has 'build in' Keras model saving support:
It looks like there are some format differences between this and the standard Keras model saving.
Until this has been resolved, using the "standard" (non-TF) Keras - which is well tested - is one workaround.
Detail of #8338
Code of model define:
def __gen__rcnn_model(): """ RCNN, ref: https://github.com/JimLee4530/RCNN :return: """ input_img = Input(shape=(INPUT_IMG_HEIGHT, INPUT_IMG_WIDTH, 3), name="input") conv1 = Conv2D(filters=192, kernel_size=[5, 5], strides=(1, 1), padding='same', activation='relu')(input_img) rconv1 = OcrModel.__rcl_block(192, conv1) dropout1 = Dropout(0.2)(rconv1) rconv2 = OcrModel.__rcl_block(192, dropout1) maxpooling_1 = MaxPooling2D((2, 2), strides=(2, 2), padding='same')(rconv2) dropout2 = Dropout(0.2)(maxpooling_1) rconv3 = OcrModel.__rcl_block(192, dropout2) dropout3 = Dropout(0.2)(rconv3) rconv4 = OcrModel.__rcl_block(192, dropout3) out = MaxPool2D((16, 16), strides=(16, 16), padding='same')(rconv4) flatten = Flatten()(out) prediction = Dense(11, activation='softmax')(flatten) model = Model(inputs=input_img, outputs=prediction) adam = optimizers.Adam(lr=0.0005, beta_1=0.9, beta_2=0.999, epsilon=1e-08) model.compile(optimizer=adam, loss='categorical_crossentropy', metrics=['accuracy'])
@victoriest ok, so this is pretty much what I expected, and mentioned in the other issue: keras must be adding some implicit padding here.
In the mean time, here's 2 ways that are more correct architectures:
Either of those should import fine.
I'll open a separate issue for this Keras edge case, it's unrelated to tf.keras support for DL4J Keras import