【问题标题】:how to get the name of the object being detected in tensorflow using faster RCNN model如何使用更快的 RCNN 模型获取在 tensorflow 中检测到的对象的名称
【发布时间】:2019-03-16 12:03:34
【问题描述】:

我正在使用 tensorflow 的对象检测 api 来检测对象。我训练了模型并且它工作正常,但我想获取被检测为字符串的对象的名称。有人可以帮我吗?

【问题讨论】:

    标签: tensorflow object-detection-api


    【解决方案1】:

    API提供了一个名为object_detection_tutorial.ipynb的教程文件,在这个文件中,函数run_inference_for_single_image返回一个检测字典output_dict,其中包含键detection_classes,这对应于你在label_map.pbtxt文件中定义的id .同样在这个文件变量category_index 中是存储为字典的标签映射。因此,要获取检测到的所有对象的字符串名称,只需添加:

    string_name = [category_index[i] for i in output_dict['detection_classes']]
    

    在教程中的这一行 output_dict = run_inference_for_single_image(image_np, detection_graph) 之后。

    【讨论】:

      猜你喜欢
      • 2021-07-27
      • 1970-01-01
      • 2017-12-13
      • 2017-12-15
      • 2018-10-01
      • 2020-03-28
      • 1970-01-01
      • 1970-01-01
      • 2016-11-15
      相关资源
      最近更新 更多