小编Bal*_*sha的帖子

AttributeError:模块“tensorflow.keras.metrics”没有属性“F1Score”

<< 当我运行下面的代码时,我已经导入了 import tensorflow_addons as tfa

    densenetmodelupdated.compile(loss ='categorical_crossentropy', optimizer=sgd_optimizer, metrics= 
      ['accuracy', tf.keras.metrics.Recall(),
                        tf.keras.metrics.Precision(),   
                        tf.keras.metrics.AUC(),
                        tfa.metrics.F1Score(num_classes=25, average="macro")]) 
Run Code Online (Sandbox Code Playgroud)

<<显示错误

AttributeError                            Traceback (most recent call last)
<ipython-input-25-5f3ab8b4cc77> in <module>()
     16                         tf.keras.metrics.Precision(),
     17                         tf.keras.metrics.AUC(),
---> 18                         tfa.metrics.F1Score(num_classes=25, average="macro")])                        

AttributeError: module 'tensorflow.keras.metrics' has no attribute 'F1Score'
Run Code Online (Sandbox Code Playgroud)

metrics deep-learning keras tensorflow

3
推荐指数
1
解决办法
6752
查看次数

标签 统计

deep-learning ×1

keras ×1

metrics ×1

tensorflow ×1