Data

dragon.operators.data.LMDBData(**kwargs)

Prefetch Image data with LMDB database.

Parameters:
  • source (str) – The path of database.
  • shuffle (bool, optional, default=False) – Whether to shuffle the data.
  • num_chunks (int, optional, default=2048) – The number of chunks to split.
  • padding (int, optional, default=0) – The zero-padding size.
  • fill_value (int or sequence, optional, default=127) – The value(s) to fill for padding or cutout.
  • crop_size (int, optional, default=0) – The cropping size.
  • cutout_size (int, optional, default=0) – The square size to cutout.
  • mirror (bool, optional, default=False) – Whether to mirror(flip horizontally) images.
  • color_augmentation (bool, optional, default=False) – Whether to use color distortion.1
  • min_random_scale (float, optional, default=1.) – The min scale of the input images.
  • max_random_scale (float, optional, default=1.) – The max scale of the input images.
  • force_gray (bool, optional, default=False) – Set not to duplicate channel for gray.
  • phase ({'TRAIN', 'TEST'}, optional) – The phase of this operator.
  • batch_size (int, optional, default=128) – The size of a mini-batch.
  • partition (bool, optional, default=False) – Whether to partition batch for parallelism.
  • prefetch (int, optional, default=5) – The prefetch count.
Returns:

The data and labels respectively.

Return type:

sequence of Tensor

References

DataBatch - How to get a minibatch.

DataReader - How to read data from LMDB.

DataTransformer - How to transform and augment data.

BlobFetcher - How to form blobs.

dragon.operators.data.ImageData(
   inputs,
   mean_values=None,
   std_values=None,
   dtype='float32',
   data_format='NCHW',
   **kwargs
)

Process the images from 4D raw data.

Note that we assume the data format of raw data is NHWC.

Parameters:
  • inputs (Tensor) – The input tensor, with type of uint8 or float32.
  • mean_values (sequence of float, optional) – The optional mean values to subtract.
  • std_values (sequence of float, optional) – The optional std values to divide.
  • dtype ({'float16', 'float32'}, optional) – The data type of output.
  • data_format ({'NCHW', 'NHWC'}, optional) – The data format of output.
Returns:

The output tensor.

Return type:

Tensor