I've built a convolutional neural network in keras that looks like this:
model = Sequential()
model.add(Convolution2D(nb_filters, nb_conv, nb_conv,
border_mode='valid',
input_shape=(img_cols, img_rows, 3)))
convout1 = Activation('relu')
model.add(convout1)
model.add(Convolution2D(nb_filters, nb_conv, nb_conv))
convout2 = Activation('relu')
model.add(MaxPooling2D(pool_size=(nb_pool, nb_pool)))
model.add(convout2)
model.add(MaxPooling2D(pool_size=(nb_pool, nb_pool)))
model.add(Dropout(0.5))
model.add(Flatten())
model.add(Dense(128))
model.add(Activation('relu'))
model.add(Dropout(0.5))
model.add(Dense(nb_classes))
model.add(Activation('softmax'))
model.compile(loss='categorical_crossentropy', optimizer='adadelta', metrics=['accuracy'])
I'm attempting to save the weights of my model after training using this:
fname = "weights-Test-CNN.hdf5"
model.load_weights(fname)
The program runs, and creates a file but once i've opened the file this is what is displayed:
Error! C://Users/NAME/weights-Test-CNN.hdf5 is not UTF-8 encoded. Saving Disabled. See Console for more Details.
How do I fix this error so that the weights are correctly saved?