TF对象检测API - 删除标签和百分比;只有边界框

时间:2018-04-11 05:26:25

标签: python tensorflow object-detection-api

我已经训练了自己的模型,它检测自定义对象。但我需要一些调整。

如何删除标签和百分比? 示例图像如下所示。我只想显示边界框。

enter image description here

2 个答案:

答案 0 :(得分:1)

第190行:在/util/visualization.py内部:

for display_str in display_str_list[::-1]:
    text_width, text_height = font.getsize(display_str)
    margin = np.ceil(0.05 * text_height)
    print("\n"+display_str+"\n")
    #draw.rectangle(
        #[(left, text_bottom - text_height - 2 * margin), (left + text_width,
                                                     # text_bottom)],
        #fill=color)
    #draw.text(
    # (left + margin, text_bottom - text_height - margin),
    # display_str,
    # fill='black',
    # font=font)
    text_bottom -= text_height - 2 * margin

您可以注释绘制文本的线条和周围的矩形。

答案 1 :(得分:0)

                   vis_util.visualize_boxes_and_labels_on_image_array(
                    image_np,
                    output_dict['detection_boxes'],
                    output_dict['detection_classes'],
                    output_dict['detection_scores'],
                    category_index,
                    max_boxes_to_draw=10,
                    min_score_thresh=.6,
                    instance_masks=output_dict.get('detection_masks'),
                    use_normalized_coordinates=True,
                    **skip_scores=True**,#removes scores
                    **skip_labels=True**,#removes lables
                    line_thickness=5)