Skip to content

API Reference parrot_pipelines.planogram.perception.slots

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

parrot_pipelines.planogram.perception.slots

View source

Slot geometry with pluggable anchoring rules (FEAT-574). Pure and picklable.

Class AnchorRule

How a slot is derived from its anchor shape.

Attribute CLAMP_HALF_WIDTH

Attribute COLUMN_HOLE_MIN_WIDTH

Attribute END_HALF_WIDTH

Attribute FIRST_ROW_GAP_FALLBACK

Attribute GAP_TOLERANCE

Alias ShapeCandidate

Re-exported from parrot_pipelines.planogram.perception.profiles.ShapeCandidate.

Alias Slot

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

Attribute TOP_OFFSET

Attribute UNTAGGED_MIN_PITCH

Function build_slots

Build every slot of one image. Reference: plancheck/grid.py:78.

build_slots(rows: Sequence[Sequence[ShapeCandidate]], image_size: Tuple[int, int], *, image_id: str, rule: AnchorRule, fill_gaps: bool = True, untagged_bottom_row: bool = False, max_rows: Optional[int] = None, expected_facings: Optional[Sequence[int]] = None) -> List[Slot]

Parameter Type Default Description
rows Sequence[Sequence[ShapeCandidate]] Visible rows top→bottom (group_rows output), candidates left→right.
image_size Tuple[int, int] (width, height) of the source image.
image_id str Id of the image (slot ids and anchor ids).
rule AnchorRule How a slot derives from its anchor.
fill_gaps bool True Insert inferred slots for unambiguous holes. TAG_BELOW_PRODUCT reads them off the tag pitch of the row; SHAPE_IS_SLOT off the columns of the fullest row of the fixture.
untagged_bottom_row bool False Synthesize a last row below the last anchored row when room remains (TAG_BELOW_PRODUCT only).
max_rows Optional[int] None Rows the fixture is known to have (shelves of the definition). The bottom row is not synthesized once that many anchored rows are visible: the room below them is not the fixture.
expected_facings Optional[Sequence[int]] None Facings per definition shelf, top→bottom. TAG_BELOW_PRODUCT only, and only when the anchored rows count equals len(expected_facings) (a full-height photo): after the pitch fill each row's deficit against its shelf is filled into its widest inter-tag gaps. Ignored otherwise.

Returns: List[Slot] — Slots ordered by row then left→right. slot_index is 1..n per row after gap filling; gap-filled and synthesized bottom-row slots have inferred=True and no anchor. Degenerate boxes are skipped.

Function candidate_shape_id

Deterministic id of a candidate: "<image_id>:<profile>:<x1>-<y1>-<x2>-<y2>".

candidate_shape_id(image_id: str, candidate: ShapeCandidate) -> str

Parameter Type Default Description
image_id str
candidate ShapeCandidate

Returns: str

Function from_strip_norm

Inverse of to_strip_norm, into SOURCE-image pixels. Raises ValueError on non-finite/out-of-range.

from_strip_norm(norm: Sequence[int], strip: DetectionBox) -> DetectionBox

Parameter Type Default Description
norm Sequence[int] [ymin, xmin, ymax, xmax] in 0..1000 relative to strip.
strip DetectionBox The strip the coordinates are relative to.

Returns: DetectionBox — The box in source pixels, clipped to the strip (confidence=1.0).

Function strip_box

Padded, clipped union of ONE row's slots. Raises ValueError when slots is empty.

strip_box(slots: Sequence[Slot], image_size: Tuple[int, int], pad: float = 0.04) -> DetectionBox

Parameter Type Default Description
slots Sequence[Slot] Slots of one row.
image_size Tuple[int, int] (width, height) of the source image.
pad float 0.04 Padding per side, as a fraction of the union's width (x) and height (y).

Returns: DetectionBox — The strip box (confidence=1.0).

Function to_strip_norm

[ymin, xmin, ymax, xmax] in 0-1000 relative to the strip (rounded, clipped).

to_strip_norm(box: DetectionBox, strip: DetectionBox) -> List[int]

Parameter Type Default Description
box DetectionBox
strip DetectionBox

Returns: List[int]

Raises:

  • ValueError — degenerate strip (zero width or height).

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