Integrate images so parquet conversion will work

#1
by dhdeco - opened
Files changed (1) hide show
  1. FUNSD-vu2020revising.py +4 -4
FUNSD-vu2020revising.py CHANGED
@@ -64,7 +64,7 @@ class Funsd(datasets.GeneratorBasedBuilder):
64
  BUILDER_CONFIGS = [
65
  FunsdConfig(
66
  name="funsd_vu2020revising",
67
- version=datasets.Version("1.0.0"),
68
  description="Revised FUNSD dataset",
69
  ),
70
  ]
@@ -92,7 +92,7 @@ class Funsd(datasets.GeneratorBasedBuilder):
92
  ]
93
  )
94
  ),
95
- "image_path": datasets.Value("string"),
96
  }
97
  ),
98
  supervised_keys=None,
@@ -129,7 +129,7 @@ class Funsd(datasets.GeneratorBasedBuilder):
129
  data = json.load(f)
130
  image_path = os.path.join(img_dir, file)
131
  image_path = image_path.replace("json", "png")
132
- _, size = load_image(image_path)
133
  for item in data["form"]:
134
  words_example, label = item["words"], item["label"]
135
  words_example = [w for w in words_example if w["text"].strip() != ""]
@@ -153,5 +153,5 @@ class Funsd(datasets.GeneratorBasedBuilder):
153
  "words": words,
154
  "bboxes": bboxes,
155
  "ner_tags": ner_tags,
156
- "image_path": image_path,
157
  }
 
64
  BUILDER_CONFIGS = [
65
  FunsdConfig(
66
  name="funsd_vu2020revising",
67
+ version=datasets.Version("2.0.0"),
68
  description="Revised FUNSD dataset",
69
  ),
70
  ]
 
92
  ]
93
  )
94
  ),
95
+ "image": datasets.Image(),
96
  }
97
  ),
98
  supervised_keys=None,
 
129
  data = json.load(f)
130
  image_path = os.path.join(img_dir, file)
131
  image_path = image_path.replace("json", "png")
132
+ image, size = load_image(image_path)
133
  for item in data["form"]:
134
  words_example, label = item["words"], item["label"]
135
  words_example = [w for w in words_example if w["text"].strip() != ""]
 
153
  "words": words,
154
  "bboxes": bboxes,
155
  "ner_tags": ner_tags,
156
+ "image": image,
157
  }