-2

我在自定義對象上使用了tensorflow對象檢測API。模型完美運行,但現在我想知道框的座標。是否有辦法知道檢測到的每個對象的框的座標?Tensorflow對象檢測Api框座標

回答

2

看一看教程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}) 

他們獲取存儲在框中變量的座標。

+0

是標準化的座標嗎? – Jai

+0

是的他們是正常化。它們的形狀:[[xmin,ymin,xmax,ymax] [...]] – ITiger

+0

非常感謝您 – Jai

相關問題