根据这个question。我的是;我们假设有一张图片包含3只猫,2只狗和1只鸟。在检测到整个物体后,我们如何得到分离的6个物体的xmin ymin xmax ymax值。
经过这些台词
(boxes, scores, classes, num_detections) = sess.run(
[boxes, scores, classes, num_detections],
feed_dict={image_tensor: image_np_expanded})
您可以检索您需要查看的信息
boxes, scores, classes, num_detections
在Python中它看起来像
# this loop Counting the Objects found from highest to lowest %, Default is 100Results. Only > x% get counted
scores = output_dict['detection_scores'] as example
boxes = output_dict['detection_boxes'] as example
classes = output_dict['detection_classes'] as example
count=0
xmin=[]
xmax=[]
ymin=[]
ymax=[]
classlist=[]
for s in range (100):
if scores is None or scores [s] > 0.5:
count = count + 1
for i in range (count):
position = np.squeeze(boxes[0][i])
(xmin, xmax, ymin, ymax) = (position[1]*im_width, position[3]*im_width, position[0]*im_height, position[2]*im_height)
xmin.append(xmin)
xmax.append(xmax)
ymin.append(ymin)
ymax.append(ymax)
classlist.append(classes[i])
列表从最高到最低分数排序。对不起初学者代码我是新手。