PyTorchSemanticSegmentationSampleWriter#
- class PyTorchSemanticSegmentationSampleWriter[source]#
Bases:
PyTorchLearnerSampleWriter
- __init__(output_uri: str, class_config: ClassConfig, tmp_dir: str)#
Constructor.
- Parameters:
output_uri (str) – URI of directory where zip file of chips should be placed.
class_config (ClassConfig) – used to convert class ids to names which may be needed for some training data formats.
tmp_dir (str) – local directory which is root of any temporary directories that are created.
Methods
__init__
(output_uri, class_config, tmp_dir)Constructor.
get_image_ext
(chip)Decide which format to store the image in.
get_image_path
(sample)Decide the save location of the image.
get_label_path
(sample, label_arr)write_chip
(chip, path)Save chip as either a PNG image or a numpy array.
write_sample
(sample)Write sample.
- __init__(output_uri: str, class_config: ClassConfig, tmp_dir: str)#
Constructor.
- Parameters:
output_uri (str) – URI of directory where zip file of chips should be placed.
class_config (ClassConfig) – used to convert class ids to names which may be needed for some training data formats.
tmp_dir (str) – local directory which is root of any temporary directories that are created.
- get_image_path(sample: DataSample) str #
Decide the save location of the image. Also, ensure that the target directory exists.
- Parameters:
sample (DataSample) –
- Return type:
- get_label_path(sample: DataSample, label_arr: ndarray) str [source]#
- Parameters:
sample (DataSample) –
label_arr (ndarray) –
- Return type:
- write_sample(sample: DataSample)[source]#
Write sample.
This writes a training or validation sample to
(train|valid)/img/{scene_id}-{ind}.png
and(train|valid)/labels/{scene_id}-{ind}.png
- Parameters:
sample (DataSample) –