ImagePipe.Transform.Detector.Composite (image_pipe v0.1.0)

Copy Markdown View Source

Routes requested classes to an ordered list of detectors and merges their regions.

Each class goes to every child that lists it in supported_classes/1; :all routes to every child, and unclaimed classes are dropped. Identity and availability reflect only routed children, so an object-only request is unaffected by a face-model change. A failing child fails the detection.

An unavailable child contributes no regions, and the other children's regions are used. A child must return a different identity while it is unavailable (see "Identity" in ImagePipe.Transform.Detector), so that result is cached under its own key and replaced once the child is available again. When every routed child is unavailable, the composite returns {:error, {:detector, :unavailable}}. With detector_required: true, any unavailable routed child fails the request with 501 instead.

The default combines the face (YuNet) and object (RT-DETR) adapters.

Summary

Types

t()

@type t() :: %ImagePipe.Transform.Detector.Composite{children: [module()]}

Functions

available?(composite, opts)

@spec available?(t(), keyword()) :: boolean()

default()

@spec default() :: t()

detect(composite, image, opts)

@spec detect(t(), term(), keyword()) :: {:ok, [map()]} | {:error, term()}

identity(composite, opts)

@spec identity(t(), keyword()) :: {module(), [term()]}

new(children)

@spec new([module()]) :: t()

ready?(composite, opts)

@spec ready?(t(), keyword()) :: boolean()

warmup(composite, opts)

@spec warmup(t(), keyword()) :: :ok | {:error, term()}