kwcoco.cli.coco_move_assets module

class kwcoco.cli.coco_move_assets.CocoMoveAssetsCLI(*args, **kwargs)[source]

Bases: DataConfig

Move assets and update corresponding kwcoco files as well

Note

The options: src and dst refer to folderes of asset, NOT kwcoco files. Think about this the same way you think about moving files. All kwcoco files that reference the moved assets need to be specified so they can have their paths updated. Unspecified kwcoco files may break.

This modifies the kwcoco files inplace.

This operation is not atomic and if it is interupted then your kwcoco bundle may be put into a bad state.

Valid options: []

Parameters:
  • *args – positional arguments for this data config

  • **kwargs – keyword arguments for this data config

default = {'coco_fpaths': <Value([])>, 'dst': <Value('destination asset file or folder')>, 'io_workers': <Value(0)>, 'src': <Value('source asset file or folder')>}
class kwcoco.cli.coco_move_assets.CocoMoveAssetManager(coco_dsets)[source]

Bases: object

submit(src, dst)[source]

Enqueue a move operation, or mark that one has already occurred.

If dst exists we assume the move has already been done, and we will update any coco files that were impacted by this, but not updated.

Otherwise we assume src needs to be moved to dst.

find_impacted()[source]
modify_datasets()[source]
move_files()[source]
dump_datasets()[source]
run()[source]
kwcoco.cli.coco_move_assets.main(cmdline=1, **kwargs)[source]

Example

>>> # xdoctest: +SKIP
>>> cmdline = 0
>>> kwargs = dict(
>>>     coco_fpaths=['*_E.kwcoco.zip', '*_mae.kwcoco.zip'],
>>>     src='./_assets/teamfeats',
>>>     dst='./teamfeats/mae',
>>>     io_workers='avail',
>>> )
>>> cmdline = 0
>>> kwargs = dict(
>>>     coco_fpaths=['*_M.kwcoco.zip', '*_rutgers_material_seg_v4.kwcoco.zip'],
>>>     src='./_teamfeats',
>>>     dst='./teamfeats/materials',
>>>     io_workers='avail',
>>> )
>>> main(cmdline=cmdline, **kwargs)