kwcoco.cli.coco_modify_categories module

class kwcoco.cli.coco_modify_categories.CocoModifyCatsCLI[source]

Bases: object

Remove, rename, or coarsen categories.

name = 'modify_categories'
class CLIConfig(data=None, default=None, cmdline=False)[source]

Bases: Config

Rename or remove categories

Parameters:
  • data (object) – filepath, dict, or None

  • default (dict | None) – overrides the class defaults

  • cmdline (bool | List[str] | str | dict) – If False, then no command line information is used. If True, then sys.argv is parsed and used. If a list of strings that used instead of sys.argv. If a string, then that is parsed using shlex and used instead

    of sys.argv.

    If a dictionary grants fine grained controls over the args passed to Config._read_argv(). Can contain:

    • strict (bool): defaults to False

    • argv (List[str]): defaults to None

    • special_options (bool): defaults to True

    • autocomplete (bool): defaults to False

    Defaults to False.

Note

Avoid setting cmdline parameter here. Instead prefer to use the cli classmethod to create a command line aware config instance..

epilog = '\n        Example Usage:\n            kwcoco modify_categories --help\n            kwcoco modify_categories --src=special:shapes8 --dst modcats.json\n            kwcoco modify_categories --src=special:shapes8 --dst modcats.json --rename eff:F,star:sun\n            kwcoco modify_categories --src=special:shapes8 --dst modcats.json --remove eff,star\n            kwcoco modify_categories --src=special:shapes8 --dst modcats.json --keep eff,\n\n            kwcoco modify_categories --src=special:shapes8 --dst modcats.json --keep=[] --keep_annots=True\n        '
default = {'compress': <Value('auto')>, 'dst': <Value(None)>, 'keep': <Value(None)>, 'keep_annots': <Value(False)>, 'remove': <Value(None)>, 'rename': <Value(None)>, 'src': <Value(None)>}
classmethod main(cmdline=True, **kw)[source]

Example

>>> # xdoctest: +SKIP
>>> kw = {'src': 'special:shapes8'}
>>> cmdline = False
>>> cls = CocoModifyCatsCLI
>>> cls.main(cmdline, **kw)
kwcoco.cli.coco_modify_categories._CLI

alias of CocoModifyCatsCLI