datumaro.cli.commands.stats#

Functions

build_parser([parser_ctor])

stats_command(args)

datumaro.cli.commands.stats.build_parser(parser_ctor=<class 'argparse.ArgumentParser'>)[source]#
class datumaro.cli.commands.stats.MultilineFormatter(keep_natural=False, **kwargs)[source]#

Bases: HelpFormatter

Keeps line breaks introduced with ‘|n’ separator and spaces introduced with ‘|s’, also removes the ‘code-block’ directives.

datumaro.cli.commands.stats.compute_ann_statistics(dataset: IDataset)[source]#
datumaro.cli.commands.stats.compute_image_statistics(dataset: IDataset)[source]#
datumaro.cli.commands.stats.dump_json_file(path: str, data: Any, *, sort_keys: bool = False, allow_numpy: bool = True, indent: bool = False, append_newline: bool = False) None[source]#
datumaro.cli.commands.stats.generate_next_file_name(basename, basedir='.', sep='.', ext='')[source]#

If basedir does not contain basename, returns basename, otherwise generates a name by appending sep to the basename and the number, next to the last used number in the basedir for files with basename prefix. Optionally, appends ext.

datumaro.cli.commands.stats.parse_dataset_pathspec(s: str, env: Environment | None = None) Dataset[source]#
Parses Dataset paths. The syntax is:
  • <dataset path>[ :<format> ]

Returns: a dataset from the parsed path

datumaro.cli.commands.stats.scoped(func, arg_name=None)[source]#

A function decorator, which allows to do actions with the current scope, such as registering error and exit callbacks and context managers.

datumaro.cli.commands.stats.stats_command(args)[source]#
datumaro.cli.commands.stats.str_to_bool(val)#

Convert “boolean” strings (for example, from environment variables) to real booleans.

Values mapping to True:

  • True

  • "true" / "t"

  • "yes" / "y"

  • "on"

  • "1"

  • 1

Values mapping to False:

  • False

  • "false" / "f"

  • "no" / "n"

  • "off"

  • "0"

  • 0

Raises:

ValueError – For any other value.

New in version 21.3.0.