Skip to main content

Module detect

Module detect 

Source
Expand description

DETECT: what an analyzer says it FOUND — the word, the confidence, and the two shapes a finding comes in.

§It is a FAMILY, and it is the SECOND here that is domain-neutral

geometry arrived as one because a point, a rectangle and a quadrilateral are one geometry read at three arities. This house arrives as one for a narrower reason: a classification is a WORD and a NUMBER, and the only thing that varies between its members is whether the finding also has a place. Three types, one subject.

Nothing here knows what a label is a label OF. An image classifier’s tag, a sound event, a zero-shot query hit, a barcode’s symbology and a document region’s kind are five callers with one (word, confidence) pair between them, and the vision-specific PAYLOADS that pair one of these with a pose, a mask or a set of landmarks are NOT this module’s — they belong to the crate that has the poses, consuming these. That split is what makes the house domain-neutral rather than a vision library with the vision taken out: the types below would be the same types for a PDF’s classified regions, which have no camera anywhere near them.

§THE MODULE IS CALLED detect, and that is a census verdict

The alternative was a classify-class name, and the word this house is built from decided it: the types are Detection and LocatedDetection<T>, so a module named classify would put a reader through one translation on every path they ever wrote. The word is also the RULING’s own — the seal that sent this cluster here names it, and it names an assess house beside it for the frame-level measurements that carry no label at all, so detect is one half of a pair rather than a name chosen alone.

The producer this framework has met calls the pair a classification and the type a detection in one breath — a labelled, scored classification with no geometry of its own — so no name here could have satisfied both words. The one that matches the types is the one that landed.

§THE MEMBERS, in two clusters

typeholdsfor
Labela non-empty wordthe vocabulary half of the two below it
Detectiona label and a Scorea WHOLE-FRAME classification — no geometry
LocatedDetection<T>a detection and a BoundingBox<T>a finding WITH a place — box REQUIRED
TextDetection<T>words, a score and a boxwhat a RECOGNISER read out of a region
Symbologya barcode standard, openthe vocabulary half of the row below
BarcodeDetection<T>a payload, a symbology, a score and a boxwhat a DECODER read
DocumentSegment<T>a Quad<T> and a scorea four-cornered region a detector found

§THE PAYLOAD TRIO IS A SECOND CLUSTER, and what separates it is what a WORD IS

The first three are built out of a Label — a CLASS a model chose from its own vocabulary. The last four carry a PAYLOAD instead: a recognised string and a decoded code are the picture’s own content read back, and they name nothing. Putting either in a label field would call one thing by the other’s name in every schema that published it, so the two clusters have the same SHAPE and different subjects — and a shape is not a reason to share a type.

The division is visible at the doors. Label::new refuses the empty word, because a classification of nothing is not one; TextDetection::new and BarcodeDetection::new refuse nothing at all, because a recogniser that found a region and no characters in it has made an observation and the region is what a caller is asking about.

Symbology is the one closed-ish VOCABULARY here, and it is open anyway. Twenty-four named standards read out of a documentation page, plus an escape carrying the folded word — so it takes the ENUM filter’s four membership operators where a payload takes the text family’s twenty. See that type, where the roster, the fold and the wire scalar are argued.

DocumentSegment<T> is the only member that holds a Quad<T>, and it is therefore the only one whose columns are ALL VALUE — see below, where the derived leaf the other two inherit is accounted for.

There is no Option<BoundingBox<T>> anywhere in this house. One type with an optional box would make a classification that never had a location and a located finding whose box went missing the same value; two types make the second unrepresentable. That is the ruling this house was built to state, and every face below inherits it — there is no null box in a column, none in a filter and none on the wire.

§WHERE AN INVARIANT LIVES: on the leaf, and nowhere else

A rule about ONE WORD is Label::new’s — non-empty, and nothing about case. A rule about one number is Confidence’s and NormCoord’s, each in its own house. Neither composite here checks anything at all, and that is not laziness: a label says nothing about what a confidence may be, and neither says anything about where a rectangle may sit. Both constructors are total and const, which is what building out of validated parts buys — see avanalyze’s own contract, whose subject-detection constructor is infallible for exactly this reason.

§THE ENGINE OWNS NORMALISATION

Stated once here because it decides the shape of Label and therefore of everything above it: the engine lowercases and trims image-classification labels but passes animal labels through verbatim, and uses the literal "person" for human subjects — the label vocabulary is Apple’s, not this crate’s. So Cat and cat are two labels, the type folds nothing, and a caller that wants them to be one asks with the nocase half of a text filter’s affix slots. See Label, where the division is argued at the constructor that keeps it.

§THE GATE: none, on the geometry house’s own precedent

Every vocabulary door in this crate is named for the DEPENDENCY it admits. This house admits none: Label is text over the crate’s own carrier, Score is the crate’s own confidence, and the geometry it composes is ungated beside it.

It needs no TIER either, and that is a measurement rather than a preference. The #[ingraph(composed)] derive takes a CONCRETE struct — which is why lang rides derive for a filter this house’s sibling declares — and LocatedDetectionFilter<CF> is generic over its component’s filter, so it could not be declared through that word whatever this module wanted. Declaring ONE of the two and hand-writing the other would have bought a derive gate for half a house. Both are hand-written on TimeRangedFilter’s road, and a build that declines the declaration tier keeps every one of them.

Each FACE beneath the family carries its own cross-gate, as every family here does: sqlx for the binds, decodes and lowerings, mongo for the documents, async-graphql for the wire.

§The three layers, and the crossings between them

  domain                  crossing            storage
  Label                   identity            text
  Symbology               CANONICALISING      text
  Detection               per half            (text, f32)
  LocatedDetection<T>     per half            (text, f32) + the box's FIVE
  TextDetection<T>        per half            (text, f32) + the box's FIVE
  BarcodeDetection<T>     per half            (text, text, f32) + the box's FIVE
  DocumentSegment<T>      per half            the quad's EIGHT + f32

Every crossing is a HALF’s, applied per column, and ONE of them canonicalises: Symbology folds ASCII case and three separators at its door, so DATA-MATRIX and data_matrix are one value and a stored slug reads back as the named member. That is a vocabulary’s business and not a payload’s — Label, a recognised string and a decoded payload each rewrite NOTHING, so a value this crate wrote reads back byte for byte at every door.

The located finding INHERITS a derived leaf, and it is the geometry house’s. BoundingBox<T> stores an area beside the four numbers it holds, so a subject: LocatedDetection<NormCoord> spans SEVEN columns of which SIX are the value. This house computes nothing — the fifth box column is the box’s own bind — and what it owes is the CONSEQUENCE: a holder of a citizen with a derived leaf owes an order of its own, because a wide term does not know that one of the columns beneath it is an index. See LocatedDetection<T>’s ORDER, where six levels are named over seven leaves.

§What a DECODE re-proves, and it is everything

A read goes through each half’s own constructor, so an empty stored label is refused at the column that held it and a confidence outside [0.0, 1.0] at its own. Unlike the geometry house one door over, there is no cross-column rule to lose: a detection’s two columns are independent and a located detection’s six are its parts’, so the composites promise nothing at construction that a decode cannot re-establish. The recorded gap in the sibling family — a sum rule no Assemble can re-check — has no analogue here.

§WHAT IS REFUSED, BY NAME

No whole-value operator, at either arity. No eq, ne, in or ordering over a whole detection: the leaf tuple IS the conjunction of the facets and is reachable as one, a whole-value ne over a composite is a disjunction, a per-column in is the cartesian product, and an order composed of a word’s and a float’s is an order over the storage that would read like a ranking. See DetectionFilter, where each clause is argued.

No FIXED-WIDTH cursor, and this house frames its members instead. The composites’ keyset positions are written with write_member and read with read_member — the crate’s one authority for several values in one buffer, four bytes of big-endian length a member — where the geometry family divides its payload by a constant. The division is unavailable here: a label is variable-width and it is FIRST in segment order, so there is no constant split point from either end. See Detection’s own cursor row, where the choice is argued; what four bytes a member buys is a read that refuses a frame this type did not write.

No Vec<Label>, which is Utf8Bytes’ own position inherited: the crate’s text carrier is not a CollectionElement on any backend, and neither are the lang subtags. A list of words is a Vec<Detection> in every declaration this framework has met — a bare tag has no confidence to rank it by — and THAT is admitted, along with Vec<LocatedDetection<T>>.

No MONGO face on the four citizens that hold GEOMETRY, and it is a RECORDED GAP rather than a refusal. Label, Detection and Symbology all have their document forms, but a located finding, a reading, a decoded code or a segment would need BoundingBox<T> or Quad<T> to have a MongoCarrier, and the geometry house publishes none for any of its three holders. Writing one here would put the geometry family’s BSON shape in the detect family’s file, decided by the house that consumes it rather than the house that owns it. So the door is named and left at the type that has to open it.

§THE DERIVED LEAF FOUR OF THESE INHERIT, and the sequence each of them owes

BoundingBox<T> stores an area beside the four numbers it holds — a DERIVED leaf, computed by the write and read by no decode. Nothing in this house computes anything; what it inherits is an OBLIGATION, and it is worth stating once for all four:

A holder of a citizen with a derived leaf owes a sequence of its own.

A composite that states no ORDER keeps a WIDE term whose keyset row value is its whole width — so a finding, a reading or a decoded code wearing the non-reordering word would put …_bbox_area inside a pagination cursor, which is the 2026-08-29 law’s own prohibition. So LocatedDetection<T>, TextDetection<T> and BarcodeDetection<T> each state a sequence and publish a leaf vocabulary, and each of those sequences is the DECLARATION order minus the box’s derived leaf: the point is the EXPANSION, not a claim about how findings sort.

DocumentSegment<T> states none and needs none, and the contrast is what makes the rule legible: a quad is four positions and a position is two components, so nothing beneath it derives anything and every one of its nine columns holds the value.

Structs§

BarcodeDetection
A DECODED CODE, the standard it was read under, and where on the frame it was.
BarcodeDetectionFilter
The filter that guards a BarcodeDetection<T> column: the payload, the standard, the confidence and the region.
Detection
A CLASSIFICATION — what something was decided to be, and how sure the decider was.
DetectionFilter
The filter that guards a Detection column: the WORD’s own filter, and the CONFIDENCE beside it.
DocumentSegment
A FOUR-CORNERED REGION, with the detector’s confidence in it.
DocumentSegmentFilter
The filter that guards a DocumentSegment<T> column: the four corners, and the confidence.
EmptyLabel
What a label refuses a value with — one sentence, at the four doors that mint one from the outside: a caller’s constructor, a stored column, a cursor a client handed back, and a wire operand.
Label
A CLASSIFICATION’S WORD — what a detector, a classifier or a tagger says a thing IS.
LocatedDetection
A CLASSIFICATION AND ITS PLACE — what was found, how sure the finder was, and WHERE.
LocatedDetectionFilter
The filter that guards a LocatedDetection<T> column: the CLASSIFICATION axis flattened, and the GEOMETRY beside it.
SqlBarcodeDetectionComparisonsqlx
BarcodeDetectionFilter’s storage-side twin — four comparisons, and the two text-shaped ones reached through two different kinds.
SqlDetectionComparisonsqlx
DetectionFilter’s storage-side twin — the label’s comparison and the confidence’s, and nothing of its own.
SqlDocumentSegmentComparisonsqlx
DocumentSegmentFilter’s storage-side twin — the quad’s whole comparison and the confidence’s.
SqlLocatedDetectionComparisonsqlx
LocatedDetectionFilter’s storage-side twin — the classification’s whole comparison, and the box’s beside it.
SqlTextDetectionComparisonsqlx
TextDetectionFilter’s storage-side twin — the words’ comparison, the confidence’s, and the region’s.
TextDetection
WORDS THAT WERE READ, and the region they were read from.
TextDetectionFilter
The filter that guards a TextDetection<T> column: the WORDS, the confidence, and the region.

Enums§

BarcodeDetectionLeaf
The VALUE one of a decoded code’s seven levels compares.
BarcodePayloadKind
THE KIND OF THING a barcode’s decoded payload names — ten named kinds, plus an escape for a word this vocabulary does not name.
LabelWire
How a label crosses when the framework’s own text filter holds it — the reading that gives TextFilter<Label, LabelWire> a face.
LocatedDetectionLeaf
The VALUE one of a located finding’s six levels compares — the per-leaf vocabulary this citizen publishes beside its sequence.
Symbology
THE BARCODE STANDARD a payload was encoded in — twenty-four named symbologies, plus an escape for a word this vocabulary does not name.
TextDetectionLeaf
The VALUE one of a reading’s six levels compares.