-2
我在自定义对象上使用了tensorflow对象检测API。模型完美运行,但现在我想知道框的坐标。是否有办法知道检测到的每个对象的框的坐标?Tensorflow对象检测Api框坐标
我在自定义对象上使用了tensorflow对象检测API。模型完美运行,但现在我想知道框的坐标。是否有办法知道检测到的每个对象的框的坐标?Tensorflow对象检测Api框坐标
看一看教程IPython的笔记本,还有他们用来做检测(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})
他们获取存储在框中变量的坐标。
是标准化的坐标吗? – Jai
是的他们是正常化。它们的形状:[[xmin,ymin,xmax,ymax] [...]] – ITiger
非常感谢您 – Jai