我运行代码时得到Attribute Error: 'function' object has no attribute 'visualize_boxes_and_labels_on_image_array'
。
我正在使用python 3.6.5和tensorflow 2.0.0
我导入了numpy,utils,vis,但仍然出现相同的错误
如何解决此问题?
import numpy as np
import os
# import six.moves.urllib as urllib
import sys
import tarfile
import tensorflow as tf
import zipfile
from collections import defaultdict
from io import StringIO
from matplotlib import pyplot as plt
from PIL import Image
import urllib
from utils import label_map_util
from utils import visualization_utils as vis_util
这是我代码的可视化部分
# Visualization of the results of a detection.
vis_util.visualize_boxes_and_labels_on_image_array(
image_np,
np.squeeze(boxes),
np.squeeze(classes).astype(np.int32),
np.squeeze(scores),
category_index,
use_normalized_coordinates=True,
line_thickness=4
)
cv2.imshow('Frame' ,cv2.resize(image_np ,(1280 ,960)))
if cv2.waitKey(25) & 0xFF == ord('q'):
cv2.destroyAllWindows()
cap.release()
break
我该怎么办?
答案 0 :(得分:0)
在运行程序之前是否设置了python路径,需要从研究文件夹中运行以下行-
export PYTHONPATH = $ PYTHONPATH:`pwd`:`pwd` / slim