在预测期间获得最高置信度的边界框

Getting Bounding Boxes with highest confidence during prediction

我正在使用 TensorFlow 对象识别 API。通常,开发人员所做的是设置训练管道,提供一些检查点或 tfrecords 以开始训练,同时监控 TensorBoard 上的性能。 这就是我所做的,现在我可以在 Tensorboard 上看到所有预测的边界框,它们根据迭代次数而变化。 但是,如果我需要获取这些边界框怎么办? 是否有任何代码行给图像 returns 预测的边界框?

如果您使用 sess.run(...) 命令进行推理,它将 return 一个 python 字典对象(例如称为 output_dict)。它包含模型应该 return 的所有内容,例如 output_dict['detection_boxes'][0]output_dict['detection_scores'][0]output_dict['detection_classes'][0]。您可以以常见的 'pythonic' 方式遍历此字典。例如:

box_index = 0
for box in output_dict['detection_boxes'][0]:
   current_box = box
   current_class_id = output_dict['detection_classes'][0][box_index]
   current_score = output_dict['detection_scores'][0][box_idx]

   # Do something with box

   box_index += 1

编辑: 如上所述,您可以使用 jupyter notebook 使用冻结图计算 'out of the box' 推理。对于生产用途,请查看 Tensoflow Serve。