tensorflow - 如何在 Tensorflow 对象检测 API 上评估我训练有素的模型?
问题描述
我使用 Tensorflow 的对象检测 API 训练了一个模型,我在 Tensorboard 上看到了评估结果。
现在我需要使用新的测试数据运行另一个仅评估运行。
我确实搜索了文档和其他 stackoverflow 问题,但我找不到正确的方法,只有旧模式,这对我不起作用。
这样做的正确方法是什么?
解决方案
您还可以使用model_main.py来评估您的模型。
如果您想在验证数据上评估您的模型,您应该使用:
python models/research/object_detection/model_main.py --pipeline_config_path=/path/to/pipeline_file --model_dir=/path/to/output_results --checkpoint_dir=/path/to/directory_holding_checkpoint --run_once=True
如果你想在训练数据上评估你的模型,你应该将 'eval_training_data' 设置为 True,即:
python models/research/object_detection/model_main.py --pipeline_config_path=/path/to/pipeline_file --model_dir=/path/to/output_results --eval_training_data=True --checkpoint_dir=/path/to/directory_holding_checkpoint --run_once=True
我还添加了注释以澄清以前的一些选项:
--pipeline_config_path:用于训练检测模型的“pipeline.config”文件的路径。此文件应包含您要评估的 TFRecords 文件(训练和测试文件)的路径,即:
...
train_input_reader: {
tf_record_input_reader {
#path to the training TFRecord
input_path: "/path/to/train.record"
}
#path to the label map
label_map_path: "/path/to/label_map.pbtxt"
}
...
eval_input_reader: {
tf_record_input_reader {
#path to the testing TFRecord
input_path: "/path/to/test.record"
}
#path to the label map
label_map_path: "/path/to/label_map.pbtxt"
}
...
--model_dir:将写入结果指标的输出目录,特别是 tensorboard 可以读取的“events.*”文件。
--checkpoint_dir:保存检查点的目录。这是在训练过程中或在使用“export_inference_graph.py”导出后写入检查点文件(“model.ckpt.*”)的模型目录。
--run_once : True 只运行一轮评估。
推荐阅读
- laravel - Laravel 通过 Envoyer 部署到 Cpanel
- r - 访问 R 中的因子组件
- angular - 如何在 Angular 中对实时数据进行动态 API 调用
- python - 在 Raspbian Buster 上将 Python 3.7 降级到 3.5
- javascript - 使用 Javascript 和其他几个问题将输出添加到 DIV
- c++ - 如何构建具有捆绑依赖项的静态库 - CMake
- javascript - 比较两个数组中元素的相等性
- javascript - 当父级固定高度时,如何在其父级顶部覆盖 div
- c++ - `const` 作为移动构造函数的模板参数的效果
- java - 创建一个 `Copyable` 类型的接口而不是使用 `Cloneable` 有意义吗?