PyTorchChipClassificationSampleWriter#
- class PyTorchChipClassificationSampleWriter[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.
write_chip
(chip, path)Save chip as either a PNG image or a numpy array.
write_sample
(sample)This writes a training or validation sample to (train|valid)/{class_name}/{scene_id}-{ind}.png
- __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 [source]#
Decide the save location of the image. Also, ensure that the target directory exists.
- Parameters
sample (DataSample) –
- Return type
- write_sample(sample: DataSample)[source]#
This writes a training or validation sample to (train|valid)/{class_name}/{scene_id}-{ind}.png
- Parameters
sample (DataSample) –