jordyvl commited on
Commit
0ae7826
1 Parent(s): b6a0e02

linked trainvalv3 as annotations

Browse files
Files changed (2) hide show
  1. DUDE_loader.py +2 -12
  2. test_loader.py +1 -1
DUDE_loader.py CHANGED
@@ -49,10 +49,9 @@ _URLS = {
49
  # "binaries": "https://huggingface.co/datasets/jordyvl/DUDE_loader/resolve/main/data/DUDE_binaries.tar.gz", #
50
  # "annotations": "https://huggingface.co/datasets/jordyvl/DUDE_loader/resolve/main/data/DUDE_dataset-sample_gt.json" #"
51
  "binaries": "https://huggingface.co/datasets/jordyvl/DUDE_loader/resolve/main/data/DUDE_train-val-test_binaries.tar.gz", # DUDE_train-val-test_binaries.tar.gz
52
- "annotations": "https://zenodo.org/record/7600505/files/DUDE_gt_release-candidate_trainval_exabs.json?download=1",
53
  }
54
 
55
- #'0017b64bd017f06db47e56a6a113e22e'
56
  SKIP_DOC_IDS = ["ef03364aa27a0987c9870472e312aceb", "5c5a5880e6a73b4be2315d506ab0b15b"]
57
 
58
 
@@ -72,15 +71,6 @@ def parse_bbox(bbox):
72
  if len(page_bb) == 0:
73
  continue
74
  page_bb = {key: page_bb[key] for key in keys}
75
- """
76
- if page_bb.get("label"):
77
- del page_bb["label"]
78
- if page_bb.get("error"):
79
- del page_bb["error"]
80
- if page_bb.get("multipage_box"):
81
- del page_bb["multipage_box"]
82
- #assert all(key in page_bb for key in keys)
83
- """
84
  answers_page_bounding_boxes.append(page_bb)
85
  return answers_page_bounding_boxes
86
 
@@ -201,7 +191,7 @@ class DUDE(datasets.GeneratorBasedBuilder):
201
  annotations = json.load(open(_URLS[f"annotations"], "r"))
202
  # binaries_archive = dl_manager.iter_archive(binaries_path)
203
 
204
- if self.config.data_dir: # unpacked it to a custom directory
205
  binary_extraction_path = self.config.data_dir
206
  else:
207
  binaries_path = dl_manager.download(_URLS["binaries"])
 
49
  # "binaries": "https://huggingface.co/datasets/jordyvl/DUDE_loader/resolve/main/data/DUDE_binaries.tar.gz", #
50
  # "annotations": "https://huggingface.co/datasets/jordyvl/DUDE_loader/resolve/main/data/DUDE_dataset-sample_gt.json" #"
51
  "binaries": "https://huggingface.co/datasets/jordyvl/DUDE_loader/resolve/main/data/DUDE_train-val-test_binaries.tar.gz", # DUDE_train-val-test_binaries.tar.gz
52
+ "annotations": "https://zenodo.org/record/7652563/files/DUDE_gt_release-candidate_trainval.json?download=1",
53
  }
54
 
 
55
  SKIP_DOC_IDS = ["ef03364aa27a0987c9870472e312aceb", "5c5a5880e6a73b4be2315d506ab0b15b"]
56
 
57
 
 
71
  if len(page_bb) == 0:
72
  continue
73
  page_bb = {key: page_bb[key] for key in keys}
 
 
 
 
 
 
 
 
 
74
  answers_page_bounding_boxes.append(page_bb)
75
  return answers_page_bounding_boxes
76
 
 
191
  annotations = json.load(open(_URLS[f"annotations"], "r"))
192
  # binaries_archive = dl_manager.iter_archive(binaries_path)
193
 
194
+ if self.config.data_dir: # when unpacked to a custom directory
195
  binary_extraction_path = self.config.data_dir
196
  else:
197
  binaries_path = dl_manager.download(_URLS["binaries"])
test_loader.py CHANGED
@@ -22,7 +22,7 @@ from codetiming import Timer
22
  for binding in ["dict_annotations (new)"]: #"dict_PDF",
23
  with Timer(name=f"{binding}", text=binding + " Elapsed time: {:.4f} seconds"):
24
  if binding == "dict_annotations (new)":
25
- ds = load_dataset("../DUDE_loader/DUDE_loader.py", 'bin_Amazon_original', data_dir="/home/jordy/Downloads/DUDE_train-val-test_binaries", ocr_engine='Azure') #ignore_verifications=True, , writer_batch_size=10
26
  else:
27
  ds = load_dataset("jordyvl/DUDE_loader", revision='db20bbf751b14e14e8143170bc201948ef5ac83c')
28
 
 
22
  for binding in ["dict_annotations (new)"]: #"dict_PDF",
23
  with Timer(name=f"{binding}", text=binding + " Elapsed time: {:.4f} seconds"):
24
  if binding == "dict_annotations (new)":
25
+ ds = load_dataset("../DUDE_loader/DUDE_loader.py", 'Amazon_original', data_dir="/home/jordy/Downloads/DUDE_train-val-test_binaries", ocr_engine='Azure') #ignore_verifications=True, , writer_batch_size=10
26
  else:
27
  ds = load_dataset("jordyvl/DUDE_loader", revision='db20bbf751b14e14e8143170bc201948ef5ac83c')
28