def test_from_dict(self): input_schema = Features({"image": Image()}) label_schema = Features({"labels": ClassLabel}) template_dict = { "image_column": "input_image", "label_column": "input_label", } task = ImageClassification.from_dict(template_dict) self.assertEqual("image-classification", task.task) self.assertEqual(input_schema, task.input_schema) self.assertEqual(label_schema, task.label_schema)
def test_from_dict(self): input_schema = Features({"image_file_path": Value("string")}) label_schema = Features( {"labels": ClassLabel(names=tuple(self.labels))}) template_dict = { "image_file_path_column": "input_image_file_path", "label_column": "input_label", "labels": self.labels, } task = ImageClassification.from_dict(template_dict) self.assertEqual("image-classification", task.task) self.assertEqual(input_schema, task.input_schema) self.assertEqual(label_schema, task.label_schema)