Skip to content

Detection label plot - #479

Open
Gautzilla wants to merge 28 commits into
Project-OSmOSE:mainfrom
Gautzilla:detection-label
Open

Detection label plot#479
Gautzilla wants to merge 28 commits into
Project-OSmOSE:mainfrom
Gautzilla:detection-label

Conversation

@Gautzilla

@Gautzilla Gautzilla commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

🏷️Supsupsup

This PR implements the feature of plotting detection labels next to the detection rectangles.

The usage looks like this:

detection.plot(
    ax=ax,
    detection_rect_kwargs={ # Keyword arguments passed to the detection Rectangle constructor
        "color": "#fde725",
        "linewidth": 7,
    },
    plot_label=True,
    label_kwargs={
        "anchor": "bottom_left",
        "inner_text": True,
        "text_kwargs": { # Keyword arguments passed to the label Text
            "color": "#440154",
            "size": "x-large"
        },
        "background_kwargs": {}, # Keyword arguments passed to the label background rectangle
    },
)

plt.show()
image

The anchor and inner_text parameter allow to place the label relative to the detection rectangle:

image

There are 8 possible combinations. In the notation x_y_z above, x_y represents the anchor (T_R stands for "top_right") and z represents the inner_text parameter (I for True (inner), O for False (outer)).

Resolves #433

@Gautzilla Gautzilla self-assigned this Sep 9, 2026
@Gautzilla Gautzilla added the Feature A new feature to add to OSEkit label Sep 9, 2026
@coveralls

coveralls commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Coverage Status

coverage: 99.114% (+0.03%) from 99.089% — Gautzilla:detection-label into Project-OSmOSE:main

@Gautzilla
Gautzilla marked this pull request as ready for review September 11, 2026 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature A new feature to add to OSEkit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Detection labelling on plot

2 participants