How can I set up a callback function to output each time the acc -
i want output acc @ end of each training session, don't know how use callback function me
this part of code
testing no problem
def train_model(): img_width, img_height = 150, 150 train_data_dir = 'static/train' validation_data_dir = 'static/validation' nb_train_samples = 875 nb_validation_samples = 375 epochs = 1 batch_size = 35 model = sequential() model.add(conv2d(32, (3, 3), input_shape=input_shape)) model.add(activation('relu')) model.add(maxpooling2d(pool_size=(2, 2))) model.add(conv2d(64, (3, 3))) model.add(activation('relu')) model.add(maxpooling2d(pool_size=(2, 2))) model.add(flatten()) model.add(dense(64)) model.add(activation('relu')) model.add(dropout(0.5)) model.add(dense(1)) model.add(activation('sigmoid')) model.compile(loss='binary_crossentropy', optimizer='rmsprop', metrics=['accuracy']) model.fit_generator( train_generator, steps_per_epoch=nb_train_samples // batch_size, epochs=epochs, validation_data=validation_generator, validation_steps=nb_validation_samples // batch_size, verbose=1) model.save_weights('my_model_weights.h5')
Comments
Post a Comment