小编Roh*_*nke的帖子

如何在Tensorflow Object Detection API中计算对象

我正在执行https://github.com/tensorflow/tensorflow这个检测图像中对象的示例.

我想得到检测到的对象的数量,下面是代码,它给出了我在图像中绘制的检测对象.但是我无法计算检测到的物体数量.

with detection_graph.as_default():
with tf.Session(graph=detection_graph) as sess:
    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)
      image_tensor = detection_graph.get_tensor_by_name('image_tensor:0')
      # Each box represents a part of the image where a particular …
Run Code Online (Sandbox Code Playgroud)

python machine-learning tensorflow jupyter-notebook

9
推荐指数
2
解决办法
1万
查看次数