【发布时间】:2020-11-23 06:19:31
【问题描述】:
我尝试使用 tensorflow 对象检测 api 中可用的 mask_rcnn_inception_v2_coco 模型进行分割任务。在这里,我想对视频进行推理。
首先我进行了推理,一次一帧(批量大小 =1)。 然后性能(每秒帧数)非常低。为了获得更好的“fps”值,我尝试更改代码以支持批量推理。
当我使用 batch_size >1 运行代码时,出现以下错误。
我已将相同的批量推理代码用于其他模型,例如 ssd_inception_v2_coco(它们是对象检测模型),它们运行时没有任何问题。
这是否意味着 mask_rcnn_inception_v2_coco 不支持批处理? 或者这是另一个问题?
box_ind is deprecated, use box_indices instead
Traceback (most recent call last):
File "/home/omega/anaconda3/envs/tf_gpu_env/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 1365, in _do_call
return fn(*args)
File "/home/omega/anaconda3/envs/tf_gpu_env/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 1350, in _run_fn
target_list, run_metadata)
File "/home/omega/anaconda3/envs/tf_gpu_env/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 1443, in _call_tf_sessionrun
run_metadata)
tensorflow.python.framework.errors_impl.InvalidArgumentError: 2 root error(s) found.
(0) Invalid argument: Can not squeeze dim[0], expected a dimension of 1, got 2
[[{{node Squeeze_4}}]]
[[detection_boxes/_333]]
(1) Invalid argument: Can not squeeze dim[0], expected a dimension of 1, got 2
[[{{node Squeeze_4}}]]
0 successful operations.
0 derived errors ignored.
【问题讨论】:
标签: python tensorflow machine-learning computer-vision object-detection-api