spacr.inference_augmentation

Optional deterministic multi-view phenotype classification.

Functions

predict_augmented(model, images, settings)

Average probabilities or vote across selected image orientations.

transforms_for(settings)

Return distinct right-angle rotations/reflections, with identity first.

Module Contents

spacr.inference_augmentation.predict_augmented(model, images, settings)[source]

Average probabilities or vote across selected image orientations.

Parameters:
  • model – evaluation-mode callable returning binary or multiclass logits.

  • images – NCHW tensor; input pixels are never modified in place.

  • settings – tta_* options and optional binary score_threshold.

Returns:

score tensor, selected class tensor and named diagnostic tensors. Binary scores remain positive-class probabilities; multiclass scores refer to the selected class. prediction_std is the population standard deviation of that same class’s probability across views. Agreement is the fraction of view labels matching the selected label, not calibrated confidence. Majority ties prefer mean probability, then lowest index.

Raises:

ValueError – invalid aggregation, thresholds or model output shape.

spacr.inference_augmentation.transforms_for(settings)[source]

Return distinct right-angle rotations/reflections, with identity first.

Parameters:

settings – mapping containing the optional tta_* switches.

Returns:

(quarter-turns, horizontal-reflection) pairs; at most eight. Both flips together also include their composed 180-degree rotation.