Set Shape Flag defaults in Settingsv7.6.0
FEATUREv7.5.02 min read

Mask fragments become one mask with one Undo to restore them

One object can end up spread across several mask annotations: separate passes catch different parts, or an obstruction breaks up what you can see. You have the pixels you need, but several shapes to manage for the same object.

In Labelme v7.5.0, Edit → Merge Shapes combines selected masks that share a label into one mask. Every marked pixel stays included, so you can consolidate the annotation without redrawing it. One Undo restores the original fragments. The feature addresses the request to unite masks from separate annotation passes.

Offscreen Labelme v7.5.0 render showing three selected red mask fragments on the exposed wooden pallet around stacked boxes, with three pallet entries in the Shape List.
Before merging · three visible sections of one pallet, three mask shapes.
Offscreen Labelme v7.5.0 render of the same pallet after Merge Shapes, with the same exposed wood masked and one selected pallet entry in the Shape List.
After merging · the same marked pixels, one mask shape.

These offscreen renders use the same depalletizing example image and manually prepared masks. The boxes cover much of the pallet; the selected fragments mark exposed wood. Merging combines those marked areas without filling in the covered center.

Combine only the fragments you want together

  1. Select two or more Mask Shapes belonging to the object you want to consolidate. They must all carry the same label.
  2. Choose Edit → Merge Shapes, also available in the canvas context menu.
  3. Check the single resulting entry in the Shape List. To return to the separate masks, choose Undo once.

A shared label makes masks eligible to merge; it does not mean they depict the same object. Keep separate objects separate when your dataset needs individual instances. Overlapping or disconnected mask fragments can be combined, but polygon, rectangle, and mixed-shape selections cannot.

The merged mask keeps the first selected shape's group ID, flags, and description. If those differ across fragments, check the metadata you want to retain before merging. The merge rules at v7.5.0 define which selections qualify and what the resulting mask retains.

Labelme is an offline-first annotation tool with local AI support.

Try Labelme Free