【问题标题】:How to make tensorflow bounding boxes to show up every "n" seconds?如何使张量流边界框每“n”秒出现一次?
【发布时间】:2019-09-26 16:22:22
【问题描述】:

目前我正在使用我自己的数据集使用 Tensorflow 对象检测 Api。我想每 5 帧“隐藏”一次检测边界框。因此,这些边界框将显示为“闪烁”,并且在使用检测框架时会受到更多关注。

我已经搞砸了 visualization_utils.py 并尝试使用另一种方法来可视化边界框,并将其与 while 循环一起使用:

def draw_bounding_box_every5(image,
                         ymin,
                         xmin,
                         ymax,
                         xmax,
                         count,                            
                         use_normalized_coordinates=True):


#while True:

  count+=1

  draw = ImageDraw.Draw(image)
  im_width, im_height = image.size

  ## with the "if" below, I'm aiming to have only 1 bounding box to display from every 5 frames.##

  if(count %5 == 0):
      if use_normalized_coordinates:
          (left, right, top, bottom) = (xmin * im_width, xmax * im_width,
                                        ymin * im_height, ymax * im_height)       
      else:
          (left, right, top, bottom) = (xmin, xmax, ymin, ymax)
      draw.line([(left, top), (left, bottom), (right, bottom),
                (right, top), (left, top)])



      print("line drawed")

如果我一开始不使用 while True 循环,Tensorflow 将继续按预期显示检测到的对象。但是当我使用它时,它会崩溃。我猜想在显示边界框之前创建一个无限循环,在绘制时禁用一些回调函数。 如果有人知道如何制作闪烁的边界框,我会全力以赴。

提前致谢。

【问题讨论】:

    标签: python tensorflow bounding-box object-detection-api


    【解决方案1】:

    我放弃了。我没有摆脱边界框,而是在其中添加了另一种颜色。边界框现在在固定时间内改变颜色。

    【讨论】:

      猜你喜欢
      • 2019-06-29
      • 1970-01-01
      • 1970-01-01
      • 2018-01-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-10-08
      • 2018-03-27
      相关资源
      最近更新 更多