当我检查张量板以观察训练效果时,仅显示eval_0(蓝色)结果。
虽然它应该是单独的火车(橙色)和评估(蓝色)结果,如张量板网站(https://www.tensorflow.org/guide/summaries_and_tensorboard?)。
但是,我想比较训练数据集上的模型性能和评估数据集。
所以我检查了models / research / object_detection / model_main.py并想知道
如果我可以通过以下方法基于训练和评估数据集获得精度,将model_dir的标志设置为model / eval文件夹并设置eval_training_data到model / train文件夹的标志?
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模式下使用,并且必须提供checkpoint_dir。
这是否意味着如果我只想以仅评估模式运行它,那么我必须设置checkpoint_dir?如果我想在火车上进行评估和评估同时,我不需要设置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:将在其中写入结果度量的输出目录,尤其是可通过张量板读取的“ events。*”文件。
-checkpoint_dir:保存检查点的目录。这是模型目录,在训练过程中或通过使用“ export_inference_graph.py”将其导出之后,已在其中写入检查点文件(“ model.ckpt。*”)。
-run_once:如果仅运行一轮评估,则为true。