def test_classification_output(): img = get_img() image_data = MockTaggedData("", img) image_ds_object = DataSetObject(image_data, output_function=classification_output) image_ds_object.label = 5 img_output, label = image_ds_object.output() assert np.all(img_output == img) assert label == 5
def transform_single_object( self, ds_input: DataSetObject) -> List[DataSetObject]: values = extract_values(template=self.template, path=ds_input.relative_path) if self.input_item in values: label = values[self.input_item] ds_input.label = label return [ds_input] elif self.drop_if_no_match: return [] else: return [ds_input]