Skip to content

API Reference parrot_pipelines.planogram.perception.shelf_rows

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot_pipelines.planogram.perception.shelf_rows

View source

Shelf rows for SHAPE_IS_SLOT fixtures: one row per shelf, one slot per product column.

Product shapes do not arrive as clean rows. Two shape profiles propose the same rectangle, a price tag is proposed as a small box, a promotional card stands between the products, and cartons stacked two high on one shelf look like two rows. These helpers reduce the anchors of one image to at most the number of shelves the fixture is known to have, never using what the shelves should contain.

Attribute Box

Attribute COLUMN_OVERLAP

Attribute DUPLICATE_IOU

Attribute RowSlot

Attribute STRAY_AREA

Alias Shape

Re-exported from parrot_pipelines.planogram.contracts.Shape.

Alias ShapeKind

Re-exported from parrot_pipelines.planogram.contracts.ShapeKind.

Attribute TAG_IOU

Function centre_bands

Group anchors into horizontal bands by vertical centre, top to bottom.

centre_bands(anchors: Sequence[Shape]) -> List[List[Shape]]

Parameter Type Default Description
anchors Sequence[Shape]

Returns: List[List[Shape]]

Function dedupe_anchors

Drop anchors that repeat another anchor or that are really a tag.

dedupe_anchors(anchors: Sequence[Shape], shapes: Sequence[Shape]) -> List[Shape]

Parameter Type Default Description
anchors Sequence[Shape] Product-like shapes proposed as slot anchors.
shapes Sequence[Shape] Every non-zone shape of the image (tags included).

Returns: List[Shape] — The anchors to keep, in their original order.

Function fit_rows

Reduce bands to at most max_rows rows.

Only when there are more bands than the fixture has shelves: the two vertically closest bands are merged until the count fits. With stack_columns the shapes of merged bands that share a column become one stacked slot (cartons piled two high), and shapes far smaller than the median anchor are dropped first (cards, tags). Without it — a shelf with tiers of different products — every shape stays a slot of its own, slim ones included.

fit_rows(bands: Sequence[Sequence[Shape]], max_rows: Optional[int], stack_columns: bool = True) -> List[List[RowSlot]]

Parameter Type Default Description
bands Sequence[Sequence[Shape]] Bands top to bottom (centre_bands output or shelf-edge bands).
max_rows Optional[int] Shelves the fixture is known to have, or None when unknown.
stack_columns bool True Whether shapes stacked in one column of a shelf are one slot.

Returns: List[List[RowSlot]] — Rows top to bottom, slots left to right (top first within a column).

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally