jordyvl commited on
Commit
f22f65b
1 Parent(s): 521c199

dunno how to fic

Browse files
Files changed (1) hide show
  1. rvl_cdip_easyOCR.py +11 -5
rvl_cdip_easyOCR.py CHANGED
@@ -88,7 +88,9 @@ class RvlCdipEasyOCR(datasets.GeneratorBasedBuilder):
88
  "image": datasets.Image(),
89
  "label": datasets.ClassLabel(names=_CLASSES),
90
  "words": datasets.Sequence(datasets.Value("string")),
91
- "boxes": datasets.Sequence(datasets.Sequence(datasets.Value("int32"))),
 
 
92
  }
93
  ),
94
  homepage=_HOMEPAGE,
@@ -104,7 +106,7 @@ class RvlCdipEasyOCR(datasets.GeneratorBasedBuilder):
104
  _URLS["rvl-cdip"]
105
  ) # only download images if need be
106
  labels_path = dl_manager.download(_METADATA_URLS)
107
-
108
  return [
109
  datasets.SplitGenerator(
110
  name=datasets.Split.TRAIN,
@@ -155,7 +157,7 @@ class RvlCdipEasyOCR(datasets.GeneratorBasedBuilder):
155
  os.path.join(OCR_dir, f"Easy_{split[0].upper()+split[1:]}_Data.npy"),
156
  allow_pickle=True,
157
  )
158
- for ex in tqdm(data, desc='Loading OCR data'):
159
  w, h = ex["images"][0]["image_width"], ex["images"][0]["image_height"]
160
  filename = ex["images"][0]["file_name"]
161
  words = ex["word-level annotations"][0]["ocred_text"]
@@ -174,7 +176,9 @@ class RvlCdipEasyOCR(datasets.GeneratorBasedBuilder):
174
  return words, boxes
175
 
176
  def _generate_examples(self, archive_iterator, labels_filepath, split):
177
- from pdb import set_trace; set_trace()
 
 
178
  with open(labels_filepath, encoding="utf-8") as f:
179
  data = f.read().splitlines()
180
 
@@ -195,5 +199,7 @@ class RvlCdipEasyOCR(datasets.GeneratorBasedBuilder):
195
  boxes=boxes,
196
  )
197
  print(a)
198
- from pdb import set_trace; set_trace()
 
 
199
  yield file_path, a
 
88
  "image": datasets.Image(),
89
  "label": datasets.ClassLabel(names=_CLASSES),
90
  "words": datasets.Sequence(datasets.Value("string")),
91
+ "boxes": datasets.Sequence(
92
+ datasets.Sequence(datasets.Value("int32"))
93
+ ),
94
  }
95
  ),
96
  homepage=_HOMEPAGE,
 
106
  _URLS["rvl-cdip"]
107
  ) # only download images if need be
108
  labels_path = dl_manager.download(_METADATA_URLS)
109
+ from pdb import set_trace; set_trace()
110
  return [
111
  datasets.SplitGenerator(
112
  name=datasets.Split.TRAIN,
 
157
  os.path.join(OCR_dir, f"Easy_{split[0].upper()+split[1:]}_Data.npy"),
158
  allow_pickle=True,
159
  )
160
+ for ex in tqdm(data, desc="Loading OCR data"):
161
  w, h = ex["images"][0]["image_width"], ex["images"][0]["image_height"]
162
  filename = ex["images"][0]["file_name"]
163
  words = ex["word-level annotations"][0]["ocred_text"]
 
176
  return words, boxes
177
 
178
  def _generate_examples(self, archive_iterator, labels_filepath, split):
179
+ from pdb import set_trace
180
+
181
+ set_trace()
182
  with open(labels_filepath, encoding="utf-8") as f:
183
  data = f.read().splitlines()
184
 
 
199
  boxes=boxes,
200
  )
201
  print(a)
202
+ from pdb import set_trace
203
+
204
+ set_trace()
205
  yield file_path, a