Skip to content

Latest commit

 

History

History
96 lines (69 loc) · 2.39 KB

move_and_copy.rst

File metadata and controls

96 lines (69 loc) · 2.39 KB

Move And Copy

This topic describes TensorBay dataset operations:

  • examples/move_and_copy:Copy Segment
  • examples/move_and_copy:Move Segment
  • examples/move_and_copy:Copy Data
  • examples/move_and_copy:Move Data

Take the Oxford-IIIT Pet as an example. Its structure looks like:

datasets/
    test/
        Abyssinian_002.jpg
        ...
    trainval/
        Abyssinian_001.jpg
        ...

Note

Before operating this dataset, fork it first.

Get the dataset client.

../../../docs/code/move_and_copy.py

There are currently two segments: test and trainval.

Copy Segment

Copy segment test to test_1.

../../../docs/code/move_and_copy.py

Move Segment

Move segment test to test_2.

../../../docs/code/move_and_copy.py

Copy Data

Copy all data with prefix Abyssinian in both test_1 and trainval segments to abyssinian segment.

../../../docs/code/move_and_copy.py

Move Data

Split trainval segment into train and val:

  1. Extract 500 data from trainval to val segment.
  2. Move trainval to train.

../../../docs/code/move_and_copy.py

Note

The data storage space will only be calculated once when a segment is copied.

Note

TensorBay SDK supports three strategies to solve the conflict when the target segment/data already exists, which can be set as an keyword argument in the above-mentioned functions.

  • abort(default): abort the process by raising ResponseSystemError.
  • skip: skip moving or copying segment/data.
  • override: override the whole target segment/data with the source segment/data.