【问题标题】:Tensorflow object detection api print prediction in the order of the objects in the pictureTensorflow object detection api 按图片中物体的顺序打印预测
【发布时间】:2020-05-15 13:36:30
【问题描述】:

我使用 tensorflow object-detection API 训练了一个神经网络来解决简单的验证码,预测质量足够好,但是当我使用以下代码输出预测时:

for index, value in enumerate(classes[0]):
    object_dict = {}
    if scores[0, index] > threshold:
        object_dict[(category_index.get(value)).get('name').encode('utf8')] = scores[0, index]
        objects.append(object_dict)

每个函数运行时,我都会以随机顺序获得预测。是否可以按照对象在图片中的位置顺序得到预测的类?输出图片示例:

Picture

【问题讨论】:

    标签: python tensorflow object computer-vision detection


    【解决方案1】:

    如果我理解了这个问题,您希望它们从左到右排序吗?您需要获取框坐标并对它们进行排序。

    默认情况下,您将获得按分数从高到低排序的检测结果,这就是您在上面所做的。

    获取boxes[0]的内容,定义从左到右的排序方式。你会只考虑盒子的xmin吗?最大?两者的结合?您可以选择几种不同的方法来执行此操作,但之后,您可以使用排序方法从左到右获取框的索引。

    【讨论】:

      猜你喜欢
      • 2018-08-14
      • 1970-01-01
      • 2022-10-08
      • 1970-01-01
      • 2018-01-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多