【问题标题】:Tensorflow Object Detection Api Box co-ordinateTensorFlow Object Detection Api Box 坐标
【发布时间】:2017-09-06 03:15:25
【问题描述】:

我在自定义对象上使用了 tensorflow 对象检测 api。模型工作得很好,但现在我想知道盒子的坐标。有没有办法知道检测到的每个对象的框坐标??

【问题讨论】:

    标签: machine-learning tensorflow computer-vision object-detection


    【解决方案1】:

    看看 Tutorial IPython notebook,里面有他们用来检测的代码 (link to github):

    with detection_graph.as_default():
      with tf.Session(graph=detection_graph) as sess:
        # Definite input and output Tensors for detection_graph
        image_tensor = detection_graph.get_tensor_by_name('image_tensor:0')
        # Each box represents a part of the image where a particular object was detected.
        detection_boxes = detection_graph.get_tensor_by_name('detection_boxes:0')
        # Each score represent how level of confidence for each of the objects.
        # Score is shown on the result image, together with the class label.
        detection_scores = detection_graph.get_tensor_by_name('detection_scores:0')
        detection_classes = detection_graph.get_tensor_by_name('detection_classes:0')
        num_detections = detection_graph.get_tensor_by_name('num_detections:0')
        for image_path in TEST_IMAGE_PATHS:
          image = Image.open(image_path)
          # the array based representation of the image will be used later in order to prepare the
          # result image with boxes and labels on it.
          image_np = load_image_into_numpy_array(image)
          # Expand dimensions since the model expects images to have shape: [1, None, None, 3]
          image_np_expanded = np.expand_dims(image_np, axis=0)
          # Actual detection.
          (boxes, scores, classes, num) = sess.run(
              [detection_boxes, detection_scores, detection_classes, num_detections],
              feed_dict={image_tensor: image_np_expanded})
    

    他们获取存储在 box 变量中的坐标。

    【讨论】:

    • 是的,它们已标准化。它们的形状是:[[xmin, ymin, xmax, ymax][...]]
    • 非常感谢
    • 当这个答案符合您的需要时,请您接受它,以便其他人可以更快地看到结果吗?谢谢!
    猜你喜欢
    • 2018-01-28
    • 2018-07-28
    • 1970-01-01
    • 1970-01-01
    • 2019-12-08
    • 2018-07-30
    • 2019-04-22
    • 2019-09-06
    • 1970-01-01
    相关资源
    最近更新 更多