dataeval.data.View¶
-
class dataeval.data.View(dataset, operations=
None)¶ Dataset view built from an ordered pipeline of
Operation.Wraps a source dataset and applies operations that filter, reorder, transform, or relabel it, producing a subset/rewritten view without modifying the original.
- Parameters:¶
- dataset : Dataset[_TDatum]¶
Source dataset to apply operations to. Any object implementing the
Datasetinterface – indexed access via__getitem__and__len__– is accepted, including a bare, image-only dataset. A target-bearing (annotated) dataset is only required when an applied operation reads per-datum targets, i.e. when an operation declaresOperation.requires(e.g.ClassFilter,ClassBalance,Relabel). Target-free operations such asLimit,Shuffle,Reverse, andIndicesoperate on a plain dataset. Operations that need targets trigger an upfront validation of the source dataset, raisingMaiteShapeErrorif the targets are missing.- operations : Operation or Sequence[Operation] or None, default None¶
Operations to apply, in order. When
Nonethe view is an unfiltered, untransformed pass-through.
Notes
Operations are applied strictly in the order provided, each one seeing the result of the previous. Order is therefore meaningful —
[Relabel(...), ClassFilter([0])]filters on the relabeled classes, while the reverse filters on the source ones, and[Limit(1000), Shuffle(), Limit(100)]keeps a random 100 of the first 1000.Examples
>>> from dataeval.data import View, ClassFilter, Limit>>> view = View(dataset, [ClassFilter(classes=[0, 2]), Limit(size=5)]) >>> print(view) View Dataset ------------ Operations: [ClassFilter(classes=[0, 2], filter_detections=True), Limit(size=5)] Selected Size: 5-
resolve_indices(indices=
None)¶ Return the list of source dataset indices after all operations have been applied.
- Parameters:¶
- indices : int or SourceIndex or Sequence[int | SourceIndex] or None, default None¶
Specific indices from the view to resolve to source indices. When None, returns all selected indices.
- Returns:¶
The list of selected indices from the original dataset.
- Return type:¶
- property metadata : dataeval.protocols.DatasetMetadata¶
Dataset metadata information, including any operation rewrites.
- property operation_groups : list[list[Operation]]¶
Operation lists from each construction call, innermost (oldest) first.
View(View(base, [A, B]), [C])returns[[A, B], [C]]. Empty wrappers contribute nothing. The grouping matches the user’s nesting intent and is the natural shape for sidecar metadata (seedataeval.io).
- property root_dataset : dataeval.protocols.Dataset[_TDatum]¶
The original dataset at the bottom of any
Viewwrapping chain.