Search code examples
tensorflowlabelobject-detection-api

Is there any possibility to move label position from top to bottom?


I'm using tensorflow object detection api to find some objects inside some images. This objects are very close one to other.

Is there any possibility to move the label of the class and score from top of the box to the bottom? I can't see clearly the scores and I always need to check them in the log file.

This are the detection boxes that I'm talking about and as you can see the label is on top.

Link to image


Solution

  • Yes, you can move the label to the bottom by just modifying the plot function.

    Specifically the function you need to modify is this one.

    if top > total_display_str_height:
        text_bottom = top
    else:
        text_bottom = bottom + total_display_str_height
    

    Modify the above line to

    text_bottom = bottom + total_display_str_height
    

    And you will see the labels printed at the bottom of the bounding box.

    I've tried it myself and here is the result.

    enter image description here