当我尝试使用TensorFlow模型分析库为我的自定义对象检测模型获取一些模型指标时,我得到了这个错误。我按照文档中提供的说明安装库,但我不确定问题是什么。
这是我的代码:
import tensorflow_model_analysis as tfma
from google.protobuf import text_format
eval_config = tfma.EvalConfig(
model_specs = [tfma.ModelSpec(signature_name = "serving_default")],
slicing_specs = [tfma.SlicingSpec()],
metrics_specs = [tfma.MetricsSpec(metrics =
[
tfma.MetricConfig(class_name = "ExampleCount"),
tfma.MetricConfig(class_name = "SparseCategoricalCrossentropy"),
tfma.MetricConfig(class_name = "SparseCategoricalAccuracy"),
tfma.MetricConfig(class_name = "Precision"),
tfma.MetricConfig(class_name = "Recall"),
tfma.MetricConfig(class_name = "AUC"),
tfma.MetricConfig(class_name = "F1Score"),
tfma.MetricConfig(class_name = "MultiClassConfusionMatrixPlot")
]
)
]
)
我尝试使用导入
from tfx.components.evaluator.component import Evaluator
但是我总是得到错误
没有名为'proto'的模块
有人知道如何解决这个问题吗?
使用tensorflow_model_analysis v0.39.0
,我可以使用EvalConfig()
!pip install tensorflow_model_analysis
import tensorflow_model_analysis as tfma
print(tfma.__version__)
eval_config = tfma.EvalConfig()
0.39.0