def extract_features(self, img_data):
features = self.cnn.evaluate(img_data)
return features
# class ROCCallback(Callback):
#
# def __init__(self, training_data, validation_data):
# super(Roc).__init__
# self.x = training_data[0]
# self.y = training_data[1]
# self.x_val = validation_data[0]
# self.y_val = validation_data[1]
#
# def on_train_begin(self, logs={}):
# return
#
# def on_train_end(self, logs={}):
# return
#
# def on_epoch_begin(self, epoch, logs={}):
# return
#
# def on_epoch_end(self, epoch, logs={}):
# y_pred = self.model.predict(self.x)
# roc = roc_auc_score(self.y, y_pred)
#
# y_pred_val = self.model.predict(self.x_val)
# roc_val = roc_auc_score(self.y_val, y_pred_val)
#
# print(
# '\rroc-auc: %s - roc-auc_val: %s' % (str(round(roc, 4)), str(round(roc_val, 4))), end=100 * ' ' + '\n')
# return
#
# def on_batch_begin(self, batch, logs={}):
# return
#
# def on_batch_end(self, batch, logs={}):
# return
评论列表
文章目录