object - 如何检查 tensorflow object_detection 中的训练/评估性能
问题描述
当我检查张量板以观察训练性能时,只显示 eval_0(蓝色)结果。
虽然它应该是一个单独的火车(橙色)和 eval(蓝色)结果,如 tensorboard 网站所示(https://www.tensorflow.org/guide/summaries_and_tensorboard?)。
但是,我想比较模型在训练数据集和评估数据集上的性能。
所以我检查了 models/research/object_detection/model_main.py 并想知道
如果 II 可以通过将model_dir的标志设置为model/eval文件夹并将eval_training_data的标志设置为model/train文件夹来获得基于 train 和 eval 数据集的精度?
flags.DEFINE_string('model_dir', None, 'Path to output model directory '
'where event and checkpoint files will be written.')
flags.DEFINE_boolean('eval_training_data', False,
'If training data should be evaluated for this job. Note '
'that one call only use this in eval-only mode, and '
'`checkpoint_dir` must be supplied.')
我对这句话感到困惑。
请注意,一个调用仅在 eval-only 模式下使用它,并且必须提供 checkpoint_dir。
这是否意味着如果我只想在 eval-only 模式下运行它,那么我必须设置 checkpoint_dir?如果我想同时用train和eval运行它,我不需要设置checkpoint_dir?
解决方案
如果您想在验证数据上评估您的模型,您应该使用:
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 只运行一轮评估。
推荐阅读
- java - 如何在 Rxjava 中的列表更改时通知观察者
- amazon-web-services - 在构建项目“Build container dead”时
- c++ - 即使直接分配给非 NULL 指针,指针也为 NULL
- javascript - 更新一个对象,如果不存在则创建它
- php - $this->request->getPost('email') 在执行 axios POST 请求时没有给出任何值
- python - 如何操作字典的键和值
- javascript - (Discord.JS) 机器人在用户加入时不发送 DM 消息
- css - 在应用服务 ASP Net Core Razor 页面标识服务器 4 中部署后未加载 CSS
- vue.js - 唯一标识 vuejs 中单个 v-card 的按钮单击
- python - 类函数装饰器的正确类型