我收到一个错误,指出Matplotlib当前正在使用agg,它是非GUI后端,因此无法显示该图。 %get_backend())

时间:2019-01-30 12:48:40

标签: tensorflow matplotlib pycharm

我正在做对象识别,这是Matplotlib当前正在使用agg的一个错误,它是一个非GUI后端,因此无法显示该图。   %get_backend())

我查看了网站上的一些内容,但没有结果

  import matplotlib.pyplot as plt



  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)
  # Actual detection.
  output_dict = run_inference_for_single_image(image_np, detection_graph)
  # Visualization of the results of a detection.
  vis_util.visualize_boxes_and_labels_on_image_array(
  image_np,
  output_dict['detection_boxes'],
  output_dict['detection_classes'],
  output_dict['detection_scores'],
  category_index,
  instance_masks=output_dict.get('detection_masks'),
  use_normalized_coordinates=True,
  line_thickness=8)
  plt.figure(figsize=IMAGE_SIZE)
  plt.imshow(image_np)
  plt.show()

实际上,问题在于plt.show()不会在屏幕上显示任何数字。

0 个答案:

没有答案