trw.reporting.export
¶
Module Contents¶
Functions¶
|
Try interpreting the value as an image. (e.g., 2D, RGB) and return a RGB image |
|
Rescale the image to fit in [0..255] range. |
|
Export an image |
|
|
|
|
|
|
|
|
|
Export samples to a SQL database with large binary objects on he local drive |
- trw.reporting.export.as_rgb_image(value)¶
Try interpreting the value as an image. (e.g., 2D, RGB) and return a RGB image :param value: an array of shape (y, x), (1, y, x), (3, y, x) :return: return a (3, y, x) array
- trw.reporting.export.as_image_ui8(image, min_value=None, max_value=None)¶
Rescale the image to fit in [0..255] range.
Image min will be mapped to 0 and max to 255. Values in this range are interpolated :param image: a RGB float image :return: a RGB unsigned char image
- trw.reporting.export.export_image(image, path)¶
Export an image
- Parameters
image – a RGB image (float or ui8) with format (channels, height, width)
path – where to write the image
- Returns
- trw.reporting.export.export_as_image(batch, feature_name, name, sample_id, export_root, feature_attributes)¶
- trw.reporting.export.export_as_npy(batch, feature_name, name, sample_id, export_root, feature_attributes)¶
- trw.reporting.export.export_as_text(batch, feature_name, name, sample_id, export_root, feature_attributes)¶
- trw.reporting.export.convert_tuple_to_list(batch, feature_name, name, sample_id, export_root, feature_attributes)¶
- trw.reporting.export.export_sample(export_root, table_stream, base_name, batch, sample_ids=None, export_fns=[convert_tuple_to_list, export_as_image, export_as_npy, export_as_text], name_expansions=['epoch', 'batch', 'split', 'dataset'])¶
Export samples to a SQL database with large binary objects on he local drive with the following schema:
{export_root}/{table_stream.table_name}/{base_name}_{**name_expansions}
- Parameters
export_root – the root from which the data will be exported relatively
table_stream – the SQL table where the data will be stored
base_name – the basename for the features to be exported on the local drive
batch – a key/value store
sample_ids – the index of the samples to be exported
export_fns – functions to be run to special features such as images, large numpy arrays
name_expansions – if the name is present in the batch, the sample name to be exported on the drive will be expanded ``base_name``_{name_expansion}_{batch[name_expansion]}.The purpose is to make sure the name is unique