Python TensorFlow对象检测API:视频输入的边界框坐标和时间戳

Python TensorFlow对象检测API:视频输入的边界框坐标和时间戳,python,tensorflow,logging,object-detection,bounding-box,Python,Tensorflow,Logging,Object Detection,Bounding Box,我能够以[ymin,xmin,ymax,xmax]的形式输出边界框的坐标,并将其从标准化形式转换为具有图像坐标的数据帧 我想知道是否有一种方法可以将边界框坐标记录到终端,因为代码运行时带有视频中的时间戳,该时间戳概述了每个框的生成时间 我的目标是生成一个数据帧,显示边界框坐标以及生成时的视频时间戳,即[框编号、时间戳、ymin、xmin、ymax、xmax] 相关代码如下所示: with detection_graph.as_default(): with tf.Session(graph=

我能够以[ymin,xmin,ymax,xmax]的形式输出边界框的坐标,并将其从标准化形式转换为具有图像坐标的数据帧

我想知道是否有一种方法可以将边界框坐标记录到终端,因为代码运行时带有视频中的时间戳,该时间戳概述了每个框的生成时间

我的目标是生成一个数据帧,显示边界框坐标以及生成时的视频时间戳,即[框编号、时间戳、ymin、xmin、ymax、xmax]

相关代码如下所示:

with detection_graph.as_default():
  with tf.Session(graph=detection_graph) as sess:
    while cap.isOpened():
      ret, image_np = cap.read()
      if ret == True:
          image_np_expanded = np.expand_dims(image_np, axis=0)
          image_tensor = detection_graph.get_tensor_by_name('image_tensor:0')
          boxes = detection_graph.get_tensor_by_name('detection_boxes:0')
          scores = detection_graph.get_tensor_by_name('detection_scores:0')
          classes = detection_graph.get_tensor_by_name('detection_classes:0')
          num_detections = detection_graph.get_tensor_by_name('num_detections:0')
          (boxes, scores, classes, num_detections) = sess.run(
              [boxes, scores, classes, num_detections],
              feed_dict={image_tensor: image_np_expanded})
          vis_util.visualize_boxes_and_labels_on_image_array(
              image_np,
              np.squeeze(boxes),
              np.squeeze(classes).astype(np.int32),
              np.squeeze(scores),
              category_index,
              use_normalized_coordinates=True,
              line_thickness=8)
          out.write(image_np)
          cv2.imshow('Output',image_np)
          if cv2.waitKey(1) & 0xFF == ord('q'):
              cv2.destroyAllWindows()
              break
      else:
          break

cap.release()
out.release()
cv2.destroyAllWindows()