CheXNet-Keras
CheXNet-Keras copied to clipboard
Problem with ModelFactory class while loading ChexNet-keras.h5 pretrained file
ValueError: You are trying to load a weight file containing 242 layers into a model with 241 layers.
You need to load model weights after adding one Dense layer. Try this -
densenet = tf.keras.applications.DenseNet121( include_top=False, weights=None, pooling='max',input_shape=(128,128,3) ) input_shape = (128,128,3) x = densenet.output predictions = Dense(16, activation="sigmoid", name="predictions")(x) model = tf.keras.Model(inputs=densenet.inputs, outputs=predictions) model.load_weights(weights_path,by_name=True, skip_mismatch=True)