你可以试试这个
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)
width = 1024
height = 600
threshold = 0.5
for i,j in zip(output_dict['detection_boxes'],output_dict['detection_scores']):
if(j>threshold):
print(i[1]*width,i[0]*height,i[3]*width,i[2]*height)
这将按的顺序输出框
xmin,ymin,xmax,ymax
min_score_threshold
.
希望这对你有帮助。如果您遇到任何问题,请告诉我