我正在使用Tensorflow Object Detection API和默认模型运行检测,我只想将检测分数打印到控制台。
例如,object_detection_tutorial.ipynb
有一个名为visualize_boxes_and_labels_on_image_array
的函数,它在图像上绘制边界框。此函数有一个参数min_score_thresh=.5
,如果你更改它,它会为超过该阈值的所有内容绘制边界框。
我不是可视化的图像,只是想打印任何> 0.2
的分数,但我找不到指定这个的方法?
目前它只打印到控制台检测,分数高于.5
,我猜这是默认值?
看起来你想根据分数进行查询,以下是你可以在output_dict上使用的代码
for index, value in enumerate(output_dict['detection_classes'][0]):
if(scores[index] > **0.2**):
if((category_index.get(value)).get('name').encode('utf8') == b'person'):
print("Car exists at Index,value : ",index, value)
personExists = True[![enter image description here][1]][1]
print("person Exists: {} ",personExists)
如果上面的格式不明确,请在此处编码:
转到utils / visualization_utils.py并找到visualize_boxes_and_labels_on_image_array()并将min_score_thresh的默认值更改为您想要的任何值。默认情况下,该值为0.5。