pub trait EvalKernel: Similarity {
// Required methods
fn kind(&self) -> KernelKind;
fn build_gt_anns(
&self,
gt_anns: &[CocoAnnotation],
indices: &[usize],
image: &ImageMeta,
) -> Result<Vec<Self::Annotation>, EvalError>;
fn build_dt_anns(
&self,
dt_anns: &[CocoDetection],
indices: &[usize],
image: &ImageMeta,
parity_mode: ParityMode,
) -> Result<Vec<Self::Annotation>, EvalError>;
// Provided methods
fn extra_gt_ignore(&self, _ann: &CocoAnnotation) -> bool { ... }
fn is_keypoints(&self) -> bool { ... }
}Expand description
Bridges a CocoDataset / CocoDetections cell to a kernel’s
annotation type.
Per ADR-0005, the per-image pass is generic over this trait so a new
IoU type plugs in via one impl EvalKernel for FooIou block — the
matching engine, accumulator, and summarizer never see the new type.
Implementors do the per-cell rasterization / lookup that a Similarity
kernel can’t (because Similarity is dataset-agnostic by design).
image carries the (h, w) segm impls need for crate::segmentation::Segmentation::to_rle.
Required Methods§
Sourcefn kind(&self) -> KernelKind
fn kind(&self) -> KernelKind
Discriminator carried in the distributed-eval wire format (ADR-0031) so heterogeneous partials are refused at merge time. Required (no default): every kernel must declare its kind.
Sourcefn build_gt_anns(
&self,
gt_anns: &[CocoAnnotation],
indices: &[usize],
image: &ImageMeta,
) -> Result<Vec<Self::Annotation>, EvalError>
fn build_gt_anns( &self, gt_anns: &[CocoAnnotation], indices: &[usize], image: &ImageMeta, ) -> Result<Vec<Self::Annotation>, EvalError>
Build the kernel’s GT annotation slice for one (image, category)
cell. indices selects from gt_anns in the order the cell
matcher will see.
Sourcefn build_dt_anns(
&self,
dt_anns: &[CocoDetection],
indices: &[usize],
image: &ImageMeta,
parity_mode: ParityMode,
) -> Result<Vec<Self::Annotation>, EvalError>
fn build_dt_anns( &self, dt_anns: &[CocoDetection], indices: &[usize], image: &ImageMeta, parity_mode: ParityMode, ) -> Result<Vec<Self::Annotation>, EvalError>
Build the kernel’s DT annotation slice for one (image, category)
cell, in score-descending sorted order matching dt_indices.
parity_mode is threaded through so kernels with parity-aware
fallbacks (segm’s J2 bbox→polygon synthesis under
ParityMode::Strict) can dispatch on it without reaching back
up the call stack.
Provided Methods§
Sourcefn extra_gt_ignore(&self, _ann: &CocoAnnotation) -> bool
fn extra_gt_ignore(&self, _ann: &CocoAnnotation) -> bool
Optional kernel-specific GT ignore override. Default false (no
kernel reason to ignore).
The orchestrator OR-s the result with the dataset-level
CocoAnnotation::effective_ignore (quirk D1) when building
gt_base_ignore. OksSimilarity overrides this to fold in
quirk D2 (strict): GT with zero visible keypoints is
treated as an implicit ignore region, OR-ed with the existing
ignore. Bbox / segm / boundary kernels keep the default — D2 is
keypoints-specific and must not bleed across kernels.
Sourcefn is_keypoints(&self) -> bool
fn is_keypoints(&self) -> bool
Marker: is this kernel the keypoints (OKS) kernel?
The streaming evaluator dispatches its summarizer choice on this
flag: keypoints kernels resolve to the 10-stat
crate::summarize::StatRequest::coco_keypoints_default plan, every other
kernel resolves to the 12-stat detection plan. Default false;
OksSimilarity overrides to true. Additive trait method —
existing implementors keep the default.