Open jiangjiangjianggx opened 4 years ago
I have the same issue with keras=1.3.1
It is metrics instead of metrics_tensors. I'm using Tensorflow 1.14.0 and Keras 2.3.0. Updating the model.py (2190 - 2199) worked for me.
for name in loss_names:
if name in self.keras_model.metrics_names:
continue
layer = self.keras_model.get_layer(name)
self.keras_model.metrics_names.append(name)
loss = (
tf.reduce_mean(layer.output, keepdims=True)
* self.config.LOSS_WEIGHTS.get(name, 1.))
self.keras_model.metrics.append(loss)
It is metrics instead of metrics_tensors. I'm using Tensorflow 1.14.0 and Keras 2.3.0. Updating the model.py (2190 - 2199) worked for me.
Add metrics for losses
for name in loss_names: if name in self.keras_model.metrics_names: continue layer = self.keras_model.get_layer(name) self.keras_model.metrics_names.append(name) loss = ( tf.reduce_mean(layer.output, keepdims=True) * self.config.LOSS_WEIGHTS.get(name, 1.)) self.keras_model.metrics.append(loss)
Hi, firstly, thanks for your reply, this works for me. But there is one problem, in tf.1.12, I use metrics_tensor, which can print loc_loss, class_loss except the total loss. When i change metrics_tensor to metrics in tf1.14, only total loss can be printed in training process. How can I solve this problem?
It is metrics instead of metrics_tensors. I'm using Tensorflow 1.14.0 and Keras 2.3.0. Updating the model.py (2190 - 2199) worked for me.
Add metrics for losses
for name in loss_names: if name in self.keras_model.metrics_names: continue layer = self.keras_model.get_layer(name) self.keras_model.metrics_names.append(name) loss = ( tf.reduce_mean(layer.output, keepdims=True) * self.config.LOSS_WEIGHTS.get(name, 1.)) self.keras_model.metrics.append(loss)
Hi, firstly, thanks for your reply, this works for me. But there is one problem, in tf.1.12, I use metrics_tensor, which can print loc_loss, class_loss except the total loss. When i change metrics_tensor to metrics in tf1.14, only total loss can be printed in training process. How can I solve this problem?
hi excuse me @dlllll-q how to edit model.py inside egg file? i can open it by rename the .egg into .zip and modify all file inside that egg, but unfortunately i don't know package it back as a python egg file after my modification. thank you
It is metrics instead of metrics_tensors. I'm using Tensorflow 1.14.0 and Keras 2.3.0. Updating the model.py (2190 - 2199) worked for me.
Add metrics for losses
for name in loss_names: if name in self.keras_model.metrics_names: continue layer = self.keras_model.get_layer(name) self.keras_model.metrics_names.append(name) loss = ( tf.reduce_mean(layer.output, keepdims=True) * self.config.LOSS_WEIGHTS.get(name, 1.)) self.keras_model.metrics.append(loss)
do we have a pull request for this so it can be fixed for everyone running keras 2.3.x?
It is metrics instead of metrics_tensors. I'm using Tensorflow 1.14.0 and Keras 2.3.0. Updating the model.py (2190 - 2199) worked for me.
Add metrics for losses
for name in loss_names: if name in self.keras_model.metrics_names: continue layer = self.keras_model.get_layer(name) self.keras_model.metrics_names.append(name) loss = ( tf.reduce_mean(layer.output, keepdims=True) * self.config.LOSS_WEIGHTS.get(name, 1.)) self.keras_model.metrics.append(loss)
I am getting AttributeError: 'NoneType' object has no attribute 'append' for self.keras_model.metrics.append(loss)
It is metrics instead of metrics_tensors. I'm using Tensorflow 1.14.0 and Keras 2.3.0. Updating the model.py (2190 - 2199) worked for me.
Add metrics for losses
for name in loss_names: if name in self.keras_model.metrics_names: continue layer = self.keras_model.get_layer(name) self.keras_model.metrics_names.append(name) loss = ( tf.reduce_mean(layer.output, keepdims=True) * self.config.LOSS_WEIGHTS.get(name, 1.)) self.keras_model.metrics.append(loss)
I am getting AttributeError: 'NoneType' object has no attribute 'append' for self.keras_model.metrics.append(loss)
Try to restart all over again to run the script. It should be ok.
Hi, I am trying to run a mask r-cnn code for dental segmentation images training based on the coco and Mask_RCNN, the code should work perfectly, but since my Keras is 2.3.0 and it seems not having the attribute metrics_tensor.
Training - Stage 2
Finetune layers from ResNet stage 4 and up
print("Fine tune Resnet stage 4 and up") model.train(dataset_train, dataset_train, learning_rate=config_train.LEARNING_RATE, epochs=50, layers='4+')
Training - Stage 3
Fine tune all layers
print("Fine tune all layers") model.train(dataset_train, dataset_train, learning_rate=config_train.LEARNING_RATE / 10, epochs=100, layers='all'