Ejemplo n.º 1
0
def draw_label_with_scores(draw_obj, box, label, score, method, head, color='White'):

    x, y = box[0], box[1]
    draw_obj.rectangle(xy=[x, y, x + 60, y + 10],
                       fill='White')

    if cfgs.DATASET_NAME.startswith('DOTA'):
        label_name = get_dota_short_names(LABEL_NAME_MAP[label])
    else:
        label_name = LABEL_NAME_MAP[label]
    txt = label_name + ':' + str(round(score, 2))
    # txt = ' ' + label_name
    draw_obj.text(xy=(x, y),
                  text=txt,
                  fill='black',
                  font=FONT)
    if method == 1:
        draw_obj.rectangle(xy=[x, y + 10, x + 60, y + 20],
                           fill='White')
        if cfgs.ANGLE_RANGE == 180:
            if box[2] < box[3]:
                angle = box[-1] + 90
            else:
                angle = box[-1]
        else:
            angle = box[-1]
        txt_angle = 'angle:%.1f' % angle
        # txt_angle = ' %.1f' % angle
        draw_obj.text(xy=(x, y+10),
                      text=txt_angle,
                      fill='black',
                      font=FONT)
        if head != -1:
            draw_obj.rectangle(xy=[x, y + 20, x + 60, y + 30],
                               fill='White')
            txt_head = 'head:%d' % head
            draw_obj.text(xy=(x, y + 20),
                          text=txt_head,
                          fill='black',
                          font=FONT)
            draw_head(draw_obj, box, head, color)
Ejemplo n.º 2
0
def draw_label_with_scores(draw_obj, box, label, score, color):
    x, y = box[0], box[1]
    draw_obj.rectangle(xy=[x, y, x + 60, y + 20], fill=color)

    if cfgs.DATASET_NAME == 'DOTA':
        label_name = get_dota_short_names(LABEL_NAME_MAP[label])
    else:
        label_name = LABEL_NAME_MAP[label]
    txt = label_name + ':' + str(round(score, 2))
    # txt = ' ' + label_name
    draw_obj.text(xy=(x, y), text=txt, fill='black', font=FONT)
    if cfgs.ANGLE_RANGE == 180:
        if box[2] < box[3]:
            angle = box[-1] + 90
        else:
            angle = box[-1]
    else:
        angle = box[-1]
    txt_angle = 'angle:%.1f' % angle
    # txt_angle = ' %.1f' % angle
    draw_obj.text(xy=(x, y + 10), text=txt_angle, fill='black', font=FONT)