das.block_stratify#

A bit on semantics: - blocks are parts of the data (individual files in a file list, parts of a data array) - individual blocks are assigned specific groups (train/test/val)

das.block_stratify.blockstats_from_data(data: numpy.ndarray, block_size: int, gap: int = 0) Dict[Tuple[int, int], numpy.ndarray][source]#

_summary_

Last block will contain overhang so is typically longer

Parameters
  • data (np.ndarray) – _description_

  • block_size (int) – _description_

  • gap (int, optional) –

Returns

_description_

Return type

Dict[Tuple[int, int], np.array]

das.block_stratify.blockstats_from_files(file_bases: List[str], class_names: Optional[List] = None) Dict[str, numpy.ndarray][source]#

_summary_

Parameters
  • file_bases (List[str]) – List of annotation files.

  • class_names (Optional[List]) – List of class_names. Defaults to None (will infer from all annotations).

Returns

Block stats for each file name.

Return type

Dict[str, np.ndarray]

das.block_stratify.groupstats(stats: List, groups: List[das.block_stratify.Group])[source]#

_summary_

Parameters
  • stats (_type_) – stats [x] for each group [n, x]

  • groups (_type_) – ids for each group [n,]

Returns

stats average over all members of groups

Return type

Dict[group_id, x]