trw.train.sample_export

We assume throughout that the image format is (samples, channels, height, width)

Module Contents

Functions

export_as_image(name, samples, sample_id, export_root, txt_file)

Export a value as an image

export_as_npy(name, samples, sample_id, export_root, txt_file)

export_as_string(name, samples, sample_id, export_root, txt_file, max_len=1024)

export_functions()

Default export functions

clean_mapping_name(name)

export_sample(batch, sample_id, export_root, txt_file, exports=export_functions, features_to_discard=None, clean_mapping_name_fn=clean_mapping_name, classification_mappings=None)

Export a sample from the batch

trw.train.sample_export.export_as_image(name, samples, sample_id, export_root, txt_file)

Export a value as an image :param name: :param samples: :param export_root: :param txt_file: :return:

trw.train.sample_export.export_as_npy(name, samples, sample_id, export_root, txt_file)
trw.train.sample_export.export_as_string(name, samples, sample_id, export_root, txt_file, max_len=1024)
trw.train.sample_export.export_functions()

Default export functions :return:

trw.train.sample_export.clean_mapping_name(name)
trw.train.sample_export.export_sample(batch, sample_id, export_root, txt_file, exports=export_functions, features_to_discard=None, clean_mapping_name_fn=clean_mapping_name, classification_mappings=None)

Export a sample from the batch :param batch: a batch :param sample_id: the index of the sample to export :param export_root: where to export the data (typically including the sample id) :param txt_file: where to export text data. Must be an opened file for write :param exports: a functor returning the functions to be used for the export :param features_to_discard: a list of feature names to discard :param clean_mapping_name_fn: function to translate the name of batch feature name to class output name :param classification_mappings: a dictionary of mapping output to translate class ID to class name