kwcoco.cli.coco_conform module¶
- class kwcoco.cli.coco_conform.CocoConformCLI[source]¶
Bases:
object
- name = 'conform'¶
- class CLIConfig(data=None, default=None, cmdline=False)[source]¶
Bases:
Config
Infer properties to make the COCO file conform to different specs.
Arguments can be used to control which information is inferred. By default, information such as image size, annotation area, are added to the file.
Other arguments like
--legacy
and--mmlab
can be used to conform to specifications expected by external tooling.- 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 thecli
classmethod to create a command line aware config instance..- epilog = '\n Example Usage:\n kwcoco conform --help\n kwcoco conform --src=special:shapes8 --dst conformed.json\n kwcoco conform special:shapes8 conformed.json\n '¶
- default = {'compress': <Value('auto')>, 'dst': <Value(None)>, 'ensure_imgsize': <Value(True)>, 'legacy': <Value(False)>, 'mmlab': <Value(False)>, 'pycocotools_info': <Value(True)>, 'src': <Value(None)>, 'workers': <Value(8)>}¶
- classmethod main(cmdline=True, **kw)[source]¶
Example
>>> from kwcoco.cli.coco_conform import * # NOQA >>> import kwcoco >>> import ubelt as ub >>> dpath = ub.Path.appdir('kwcoco/tests/cli/conform').ensuredir() >>> dst = dpath / 'out.kwcoco.json' >>> kw = {'src': 'special:shapes8', 'dst': dst, 'compress': True} >>> cmdline = False >>> cls = CocoConformCLI >>> cls.main(cmdline, **kw)
- kwcoco.cli.coco_conform._CLI¶
alias of
CocoConformCLI