输出 score/probability for all class for each object with Tensorflow object detection API
Output score/probability for all class for each object with Tensorflow object detection API
在Tensorflow对象检测中API,我们通常对每个测试图像都这样做:
output_dict = sess.run(tensor_dict, feed_dict={image_tensor: image_np_expanded})
# pdb.set_trace()
# all outputs are float32 numpy arrays, so convert types as appropriate
output_dict['num_detections'] = int(output_dict['num_detections'][0])
output_dict['detection_classes'] = output_dict['detection_classes'][0].astype(np.int64)
output_dict['detection_boxes'] = output_dict['detection_boxes'][0]
output_dict['detection_scores'] = output_dict['detection_scores'][0]
这为我们提供了每个对象的分数。例如,有一个狗对象,它的分数是 95%。但是我希望它也输出其他 类 的分数,例如,对于相同的对象,它是猫的分数是 3%,是自行车的分数是 2%。请帮帮我,非常感谢。
事实证明,在 API 的较新版本中,output_dict['detection_multiclass_scores'] 给出了每个 class 的分数。我使用了没有它的旧版本。
在Tensorflow对象检测中API,我们通常对每个测试图像都这样做:
output_dict = sess.run(tensor_dict, feed_dict={image_tensor: image_np_expanded})
# pdb.set_trace()
# all outputs are float32 numpy arrays, so convert types as appropriate
output_dict['num_detections'] = int(output_dict['num_detections'][0])
output_dict['detection_classes'] = output_dict['detection_classes'][0].astype(np.int64)
output_dict['detection_boxes'] = output_dict['detection_boxes'][0]
output_dict['detection_scores'] = output_dict['detection_scores'][0]
这为我们提供了每个对象的分数。例如,有一个狗对象,它的分数是 95%。但是我希望它也输出其他 类 的分数,例如,对于相同的对象,它是猫的分数是 3%,是自行车的分数是 2%。请帮帮我,非常感谢。
事实证明,在 API 的较新版本中,output_dict['detection_multiclass_scores'] 给出了每个 class 的分数。我使用了没有它的旧版本。