Adjust AI polygon detail after the shape is created
Problem
Polygon detail can only be tuned before an AI polygon is committed, and only for point prompts. While placing point prompts, moving the Polygon detail slider re-runs the preview with the new value, so the pending shape updates live. Everything else is fixed at creation:
- Box prompts and AI Text-to-Annotation commit their polygons immediately; there is no pending stage in which to adjust detail.
- Once any AI polygon is committed, the mask is gone and the slider no longer affects it. Getting a simpler or more detailed polygon means deleting it and prompting again.
This is what keeps the shipped default conservative: #2720 lowers it from 80 to 60 rather than further, because a too-coarse result cannot be recovered without re-prompting.
What to build
Let the user change the detail of an AI polygon after it exists. Two candidate shapes, to be decided:
Re-polygonize from the source mask: keep the mask of recently created AI polygons and re-run polygonization when the slider moves with those shapes selected. Can add detail back as well as remove it, but needs the mask kept per shape (session-only; nothing to persist in the Annotation File).
Simplify selected polygons: run the existing simplification on the polygon's own vertices at a chosen tolerance. Works on any polygon, including hand-drawn and loaded ones, and needs no mask, but can only remove detail.
For reference, CVAT re-simplifies the pending shape live from its "approximation accuracy" slider (poly-simplify-control.tsx), which labelme already matches for point prompts; neither tool re-simplifies after commit.
Acceptance criteria
A polygon created from a box prompt or AI Text-to-Annotation can have its detail changed without re-running the prompt.
The change is one undo step.
Label, Group, Shape Flags, and description are kept.
Changelog fragment added.
Related
Absolute-pixel tolerance gives very different vertex counts for the same shape at different sizes (at detail 40: 5 vertices at r=8 px, 55 at r=300 px). A size-relative term with a pixel floor would even that out; worth deciding alongside this, since it changes what the slider means.
Source: wkentaro/labelme