【问题标题】:Output score , class, id and BOXES Extraction using TensorFlow object detection使用 TensorFlow 对象检测的输出分数、类别、id 和 BOXES 提取
【发布时间】:2019-02-22 05:50:19
【问题描述】:

据此question。 我的是; 让我们假设有一张图片包含 3 只猫、2 只狗和 1 只鸟。 在检测到整个对象后,我们如何获得分离的 6 个对象的 xmin ymin xmax ymax 值。

【问题讨论】:

    标签: tensorflow object-detection object-detection-api


    【解决方案1】:

    在这几行之后

        (boxes, scores, classes, num_detections) = sess.run(
              [boxes, scores, classes, num_detections],
              feed_dict={image_tensor: image_np_expanded})
    

    您可以检索您需要查看的信息

        boxes, scores, classes, num_detections
    

    【讨论】:

      【解决方案2】:

      在 Python 中看起来像

          # this loop Counting the Objects found from highest to lowest %, Default is 100Results. Only > x% get counted
              scores = output_dict['detection_scores'] as example
              boxes = output_dict['detection_boxes'] as example
              classes = output_dict['detection_classes'] as example
              count=0  
              xmin=[]
              xmax=[]
              ymin=[]
              ymax=[] 
              classlist=[]         
              for s in range (100):
                  if scores is None or scores [s] > 0.5:
                      count = count + 1
              for i in range (count):
                  position = np.squeeze(boxes[0][i])
                  (xmin, xmax, ymin, ymax) = (position[1]*im_width, position[3]*im_width, position[0]*im_height, position[2]*im_height)
              xmin.append(xmin)
              xmax.append(xmax)
              ymin.append(ymin)
              ymax.append(ymax)
              classlist.append(classes[i])
      

      列表按分数从高到低排序。 抱歉,我是新手代码。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-02-19
        • 1970-01-01
        • 2021-01-31
        • 1970-01-01
        • 1970-01-01
        • 2018-05-17
        相关资源
        最近更新 更多