带有TensorFlow对象检测的ZED立体相机

时间:2017-12-20 13:35:20

标签: tensorflow

有没有办法从ZED相机获取sync_frames?

我有一个张量流对象检测模型,它可以与普通相机完美配合。

但是当我使用ZED sdk从ZED相机中获取帧时,tensorFlow会崩溃。

tensorflow / core / common_runtime / bfc_allocator.cc:702]统计数据:
    限制:2530779136
    In Inse:22228736
    MaxInUse:44315648
    NumAllocs:778
    MaxAllocSize:11059200

2017-12-20 17:56:14.056428: W tensorflow/core/common_runtime/bfc_allocator.cc:277] *___________________________________________________________________________________________________
2017-12-20 17:56:14.056598: W tensorflow/core/framework/op_kernel.cc:1192] Resource exhausted: OOM when allocating tensor with shape[1011293441,1]
2017-12-20 17:56:14.058614: W tensorflow/core/framework/op_kernel.cc:1192] Resource exhausted: OOM when allocating tensor with shape[1011293441,1]
     [[Node: Postprocessor/BatchMultiClassNonMaxSuppression/map/while/MultiClassNonMaxSuppression/FilterGreaterThan/Where = Where[_device="/job:localhost/replica:0/task:0/gpu:0"](Postprocessor/BatchMultiClassNonMaxSuppression/map/while/MultiClassNonMaxSuppression/FilterGreaterThan/Greater)]]
Traceback (most recent call last):
  File "/home/nvidia/.local/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1327, in _do_call
    return fn(*args)
  File "/home/nvidia/.local/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1306, in _run_fn
    status, run_metadata)
  File "/usr/lib/python3.5/contextlib.py", line 66, in __exit__
    next(self.gen)
  File "/home/nvidia/.local/lib/python3.5/site-packages/tensorflow/python/framework/errors_impl.py", line 466, in raise_exception_on_not_ok_status
    pywrap_tensorflow.TF_GetCode(status))
tensorflow.python.framework.errors_impl.ResourceExhaustedError: OOM when allocating tensor with shape[1011293441,1]
     [[Node: Postprocessor/BatchMultiClassNonMaxSuppression/map/while/MultiClassNonMaxSuppression/FilterGreaterThan/Where = Where[_device="/job:localhost/replica:0/task:0/gpu:0"](Postprocessor/BatchMultiClassNonMaxSuppression/map/while/MultiClassNonMaxSuppression/FilterGreaterThan/Greater)]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/nvidia/models-13-updated/research/object_detection/ZED-clr-wed.py", line 324, in <module>
    (boxes, scores, classes, num_detections) = sess.run([boxes, scores, classes, num_detections], feed_dict={image_tensor: image_np_expanded})
  File "/home/nvidia/.local/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 895, in run
    run_metadata_ptr)
  File "/home/nvidia/.local/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1124, in _run
    feed_dict_tensor, options, run_metadata)
  File "/home/nvidia/.local/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1321, in _do_run
    options, run_metadata)
  File "/home/nvidia/.local/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1340, in _do_call
    raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.ResourceExhaustedError: OOM when allocating tensor with shape[1011293441,1]
     [[Node: Postprocessor/BatchMultiClassNonMaxSuppression/map/while/MultiClassNonMaxSuppression/FilterGreaterThan/Where = Where[_device="/job:localhost/replica:0/task:0/gpu:0"](Postprocessor/BatchMultiClassNonMaxSuppression/map/while/MultiClassNonMaxSuppression/FilterGreaterThan/Greater)]]

Caused by op 'Postprocessor/BatchMultiClassNonMaxSuppression/map/while/MultiClassNonMaxSuppression/FilterGreaterThan/Where', defined at:
  File "/home/nvidia/models-13-updated/research/object_detection/ZED-clr-wed.py", line 89, in <module>
    tf.import_graph_def(od_graph_def, name='')
  File "/home/nvidia/.local/lib/python3.5/site-packages/tensorflow/python/framework/importer.py", line 313, in import_graph_def
    op_def=op_def)
  File "/home/nvidia/.local/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 2630, in create_op
    original_op=self._default_original_op, op_def=op_def)
  File "/home/nvidia/.local/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 1204, in __init__
    self._traceback = self._graph._extract_stack()  # pylint: disable=protected-access

ResourceExhaustedError (see above for traceback): OOM when allocating tensor with shape[1011293441,1]
     [[Node: Postprocessor/BatchMultiClassNonMaxSuppression/map/while/MultiClassNonMaxSuppression/FilterGreaterThan/Where = Where[_device="/job:localhost/replica:0/task:0/gpu:0"](Postprocessor/BatchMultiClassNonMaxSuppression/map/while/MultiClassNonMaxSuppression/FilterGreaterThan/Greater)]]

1 个答案:

答案 0 :(得分:1)

这是资源耗尽错误,是由于未正确关闭会话而引起的。您正在#line324中启动会话,但可能未在检测过程结束时将其关闭。

Stereolabs创建了一个可与TensorFlow一起使用的存储库。您可以参考这里以供参考:https://github.com/stereolabs/zed-tensorflow

相关问题