如何为张量流对象检测模型运行eval.py作业 [英] How to run eval.py job for tensorflow object detection models

查看:147
本文介绍了如何为张量流对象检测模型运行eval.py作业的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用Google Colab上的Tensorflow的对象检测API训练了对象检测器.在一天中的大部分时间里都在互联网上进行研究之后,我无法找到有关如何对模型进行评估的教程,因此我可以获得诸如mAP之类的指标.

I have trained an object detector using tensorflow's object detection API on Google Colab. After researching on the internet for most of the day, I haven't been able to find a tutorial about how to run an evaluation for my model, so I can get metrics like mAP.

我发现必须使用来自models/research/object_detection文件夹的eval.py,但是我不确定应该将哪些参数传递给脚本.

I figured out that I have to use the eval.py from the models/research/object_detection folder, but I'm not sure which parameters should I pass to the script.

简短地说,到目前为止,我所做的就是生成测试标签和训练图像,并将其存储在object_detection/images文件夹下.我还生成了train.record和test.record文件,并编写了labelmap.pbtxt文件.我正在使用来自Tensorflow模型Zoo的faster_rcnn_inception_v2_coco模型,因此我已经配置了faster_rcnn_inception_v2_coco.config文件,并将其存储在object_detection/training文件夹中. 训练过程运行得很好,所有检查点也都存储在object_detection/training文件夹中.

Shortly, what I've done so far is, generated the labels for the test and train images and stored them under the object_detection/images folder. I have also generated the train.record and test.record files, and I have written the labelmap.pbtxt file. I am using the faster_rcnn_inception_v2_coco model from the tensorflow model zoo, so I have configured the faster_rcnn_inception_v2_coco.config file, and stored it in the object_detection/training folder. The training process ran just fine and all the checkpoints are stored also in the object_detection/training folder.

现在我必须评估模型,我运行了eval.py脚本,如下所示:

Now that I have to evaluate the model, I ran the eval.py script like this:

!python eval.py --logtostderr --pipeline_config_path=training/faster_rcnn_inception_v2_pets.config --checkpoint_dir=training/ --eval_dir=eval/

这样可以吗?因为这开始运行良好,但是当我打开张量板时,只有两个选项卡,即图像和图形,但没有标量.另外,我用logdir = eval运行张量板.

Is this okay? Because this started running fine, but when I opened tensorboard there were only two tabs, namely images and graph, but no scalars. Also, I ran tensorboard with logdir=eval.

我是tensorflow的新手,所以欢迎您提供任何帮助. 谢谢.

I am new to tensorflow, so any kind of help is welcome. Thank you.

推荐答案

设置看起来不错.我需要等待很长时间才能使Scalars选项卡与其他两个选项一起加载/显示-就像评估工作完成后的10分钟一样.

The setup looks good. I had to wait a long time for the Scalars tab to load/show up alongside the other two - like 10 minutes after the evaluation job finished.

但是在评估作业结束时,它将在控制台中打印将在标量"选项卡中显示的所有标量指标:

But at the end of the evaluation job, it prints in the console all the scalar metrics that will be displayed in the Scalars tab:

Accumulating evaluation results...
DONE (t=1.57s).
Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.434
Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=100 ] = 0.693
Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=100 ] = 0.470
Average Precision  (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.000

如果您想使用新的model_main.py脚本而不是legacy/eval.py,则可以这样称呼它

If you want to use the new model_main.py script instead of legacy/eval.py, you can call it like

python model_main.py --alsologtostderr --run_once --checkpoint_dir=/dir/with/checkpoint/at/one/timestamp --model_dir=eval/ --pipeline_config_path=training/faster_rcnn_inception_v2_pets.config 

请注意,此新API将需要train_config中的optimizer字段,该字段可能已经在您的pipeline.config中,因为您在训练和评估时都使用了相同的字段.

Note that this new API would require the optimizer field in train_config, which is probably already in your pipeline.config since you're using the same for both training and evaluation.

这篇关于如何为张量流对象检测模型运行eval.py作业的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆