Skip to content

API Reference parrot_pipelines.planogram.identification.detector

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

parrot_pipelines.planogram.identification.detector

View source

LLM detector: fixture ROI, then box proposals inside it, through the vision adapter (detection_source="llm").

Attribute BOX_2D_HINT

Type: str

Alias CycleContext

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

Attribute DETECT_PROMPT_VERSION

Type: str

Attribute DETECT_STAGE

Type: str

Class FixtureRoi

Region of interest of one image: the fixture, and its header panel when the model located it.

Fields:

Field Type Default Description
fixture Optional[PixelBox] None
panel Optional[PixelBox] None
panel_text Optional[str] None
zones List[Tuple[str, PixelBox, Optional[str]]]
units List[PixelBox]

Attribute GENERIC_DETECTION_PROMPT

Type: str

Class KindDetection

One detector proposal; label is required and restricted to the shape kinds.

Attributes:

Attribute Type Description
label ShapeKind
confidence float
content Optional[str]

Class KindDetections

Answer schema of the detector call.

Fields:

Field Type Default Description
detections List[KindDetection]

Attribute MAX_SIDE

Type: int

Alias ObservationSource

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

Attribute PixelBox

Attribute ROI_CARD_AREA

Type: float

Attribute ROI_FIXTURE_LABELS

Attribute ROI_MIN_SIDE

Type: float

Attribute ROI_PAD

Type: float

Attribute ROI_PANEL_LABELS

Attribute ROI_PROMPT_VERSION

Type: str

Attribute ROI_SIDE_EXCESS

Type: float

Attribute ROI_SIDE_MARGIN

Type: float

Attribute ROI_STAGE

Type: str

Attribute ROI_TEXT_LABELS

Class RoiDetection

One ROI component; label is the name the ROI prompt asked for.

Attributes:

Attribute Type Description
label str
confidence float
content Optional[str]

Class RoiDetections

Answer schema of the ROI call.

Fields:

Field Type Default Description
detections List[RoiDetection]

Alias Shape

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

Alias ShapeKind

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

Attribute TIERED_DETECTION_HINT

Type: str

Attribute UNIT_CONTAINED

Type: float

Attribute UNIT_MISSED

Type: float

Attribute UNIT_SAME

Type: float

Attribute UNIT_STACK_AREA

Type: float

Alias VisionError

Re-exported from parrot_pipelines.planogram.identification.vision.VisionError.

Alias assign_membership

Re-exported from parrot_pipelines.planogram.perception.membership.assign_membership.

Function detect_roi

Locate the fixture with the configured ROI prompt, so detection ignores neighbouring fixtures.

detect_roi(image: np.ndarray, image_id: str, ctx: CycleContext) -> Optional[FixtureRoi]

Parameter Type Default Description
image np.ndarray Untouched full-resolution BGR image.
image_id str Image id.
ctx CycleContext Per-run services; ctx.roi_prompt is the rendered ROI prompt.

Returns: Optional[FixtureRoi] — The padded fixture box in source pixels, or None when no ROI prompt is configured, the call fails, or the answer holds no usable fixture box (the caller then detects on the whole image).

Function downscale_and_encode

Resize so the longest side is <= max_side (never upscale) and PNG-encode. Picklable (CPU executor).

downscale_and_encode(image: np.ndarray, max_side: int = MAX_SIDE) -> bytes

Parameter Type Default Description
image np.ndarray Source BGR image.
max_side int MAX_SIDE Longest side of the encoded copy.

Returns: bytes — PNG bytes.

Alias encode_png

Re-exported from parrot_pipelines.planogram.identification.vision.encode_png.

Function llm_detect_shapes

LLM proposals inside the fixture's region of interest; every shape has source=llm.

With an ROI prompt on the context the fixture is located first and only its crop is sent to the detector, so products of neighbouring fixtures are never proposed; shapes come back in SOURCE-image pixels. Without one (or when the ROI call yields nothing) the whole image is sent.

llm_detect_shapes(image: np.ndarray, image_id: str, ctx: CycleContext, *, prompt: str) -> List[Shape]

Parameter Type Default Description
image np.ndarray Untouched full-resolution BGR image.
image_id str Image id.
ctx CycleContext Per-run services (vision adapter, CPU executor, error sink, ROI prompt).
prompt str Detection prompt (types may pass GENERIC_DETECTION_PROMPT).

Returns: List[Shape] — Zones first, then the other shapes with membership assigned; [] on failure.

Attribute logger

Function render_roi_prompt

Fill the placeholders of a stored ROI prompt ({brand}, {tag_hint}, {image_size}).

render_roi_prompt(template: Optional[str], *, brand: str = '', tags: Sequence[str] = ()) -> Optional[str]

Parameter Type Default Description
template Optional[str] PlanogramConfig.roi_detection_prompt.
brand str '' Brand of the fixture.
tags Sequence[str] () Phrases expected on the header ({tag_hint}).

Returns: Optional[str] — The prompt, or None without a template. A template with stray braces is used as written.

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