BBoxStrategy Class
ml_debugger.data_filter.config.bbox_strategy.BBoxStrategy
Bases: BaseModel
BBox-level aggregation strategy for image-level error scoring.
Attributes:
| Name | Type | Description |
|---|---|---|
target_column |
Union[str, RankIndex, List[RankIndex]]
|
Value to aggregate per bbox. Either the name of a column
or of a built-in feature ('error_proba' (default), 'det_error_proba',
'cls_error_proba', 'pred_score', 'entropy', 'margin', 'tail_proba',
'mld_entropy', 'mld_confusion_proba'), a ranking definition
(:class: |
top_n |
Optional[int]
|
Number of top-error bboxes per image. None (default) means no top-N restriction. |
bbox_filter |
Optional[Union[FilterConfig, Dict[str, Any]]]
|
Filter conditions for bbox selection. None (default) means no threshold filtering. If both bbox_filter and top_n are set, threshold is applied before top_n. |
aggregation |
str
|
How to aggregate per-bbox values to image-level. 'mean' (default), 'median' or 'sum'. |
weight_column |
Optional[str]
|
Optional weight column (e.g. 'pred_size'). - None: unweighted aggregation - set: switches to weighted_mean / weighted_median |
sort |
str
|
Sort order for image-level results. 'desc' (default) or 'asc'. |
img_error_threshold |
Optional[float]
|
Image-level error threshold for real-time filter flags. None (default) means filter flags are all None (no filtering). If set, aggregated value >= threshold → True, else False. The threshold is read on the scale of the target_column values, so a column of probabilities and a column of entropies take different numbers. |
Example
Top 3 bboxes by det_error_proba, aggregated with max
strategy = BBoxStrategy( ... target_column="det_error_proba", ... top_n=3, ... aggregation="mean", ... )
Threshold + top_n + weighted aggregation by bbox size
strategy = BBoxStrategy( ... bbox_filter={"conditions": [{"error_proba": ">=0.3"}]}, ... top_n=3, ... aggregation="median", ... weight_column="pred_size", ... )
validate_dict(data)
classmethod
Validate dict and return result with guide message.