问题
in Tensorflow object detection API, we usually do this for each test image:
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]
This gives us the score for each object. For example, there is a dog object, and the score for it is 95%. However I want it to output the score for other classes as well, for example, with the same object, the score for it being a cat would be 3%, being a bicycle would be 2%. Please help me, thank you very much.
回答1:
It turns out in newer versions of the API, there was output_dict['detection_multiclass_scores'] which gives scores for each class. I used an older version which did not have it.
来源:https://stackoverflow.com/questions/58828422/output-score-probability-for-all-class-for-each-object-with-tensorflow-object-de