﻿# Repairing polygon annotations: validate geometry type after make_valid

Repairing polygon annotations: validate geometry type after make_valid. A practical data-quality guide with failure mechanisms, validation steps, acceptance evidence and primary references.

Author: Retrivium team
Updated: 2026-11-06
Canonical URL: https://retrivium.ai/journal/dq-polygon-make-valid-annotation-type-change/
Language: en

A dataset repair calls make_valid on a self-intersecting polygon and accepts any successful result. The repaired geometry can change type or contain lower-dimensional parts that the segmentation target cannot represent.

## The mechanism that changes the example

Geometric validity, non-emptiness and compatibility with the annotation schema are different predicates. A valid geometry is not automatically an acceptable polygon target, and repair is a transformation requiring its own acceptance rule.



## Define the comparison boundary

Inspect the repaired geometry's type and components before attempting to serialize it into a polygon-only annotation field. A GeometryCollection or line result can be geometrically valid while incompatible with the segmentation target's dimensionality.

Pin the repair method and its options to the installed Shapely and GEOS capabilities. Different methods and collapsed-component policies can preserve different evidence from the invalid input. Do not describe a repaired outline as the annotator's intended boundary without reviewing that interpretation.

Compare rasterized masks at the target image resolution when mask equivalence matters. Area equality alone cannot detect a shifted region or changed topology. Preserve the original invalid shape, the validity reason and the proposed output so adjudication can choose acceptance, manual correction or exclusion without losing the disputed annotation.

## A constructed test case

Repair a deliberately invalid polygon and inspect every returned component. The result must satisfy the supported annotation type and coverage rules, rather than pass merely because a geometry validity check or repair call returned successfully.

## A reproducible validation procedure

Pin geometry library and repair method, then test self-intersections, empty and already-valid controls. Inspect output type, components and label association before export. Preserve the original annotation and route incompatible repaired targets to review instead of coercing them silently.

Include an unchanged control and a deliberately invalid case. Verify that the checker distinguishes them before testing the complete release.

Exercise the actual preparation path, including later serialization and reload. Limit retained diagnostic content to the evidence required for this comparison.

## Evidence needed for acceptance

Keep validity reason, repair configuration and reviewed output geometry type and cardinality.

## Containment and recovery

Repair does not establish the intended human annotation boundary or guarantee an equivalent training mask.

Quarantine an invalid release candidate or use an explicit partial-release rule. Preserve the last approved artifact and record corrections without silently rewriting historical inputs.

## Interpretation and references

Implementation references: [Shapely geometric validity](https://shapely.readthedocs.io/en/stable/reference/shapely.is_valid.html); [Shapely geometry repair output contract](https://shapely.readthedocs.io/en/stable/reference/shapely.make_valid.html).

This is a proposed engineering validation, not an executed Retrivium benchmark. Documentation specifies interfaces; dataset acceptance needs its own evidence and must be repeated after relevant dependency changes.

## Related reading

Continue with [Label Studio pre-annotations: a model suggestion is not a reviewed label](/journal/fg2-label-studio-prediction-review-boundary/); [Labelbox label history: recorded workflow handoffs do not represent every editor change](/journal/fg2-labelbox-history-handoff-coverage/). These guides supply adjacent context; the decision in this article remains the specific example-preservation check above.
