jordyvl commited on
Commit
f82197a
1 Parent(s): 6e61c03

test new feature definition without json

Browse files
Files changed (3) hide show
  1. dataset_infos.json +0 -30
  2. rvl_cdip_easyOCR.py +5 -3
  3. test_loader.py +13 -0
dataset_infos.json CHANGED
@@ -4,36 +4,6 @@
4
  "citation": "@inproceedings{harley2015icdar,\n title = {Evaluation of Deep Convolutional Nets for Document Image Classification and Retrieval},\n author = {Adam W Harley and Alex Ufkes and Konstantinos G Derpanis},\n booktitle = {International Conference on Document Analysis and Recognition ({ICDAR})}},\n year = {2015}\n}\n",
5
  "homepage": "https://www.cs.cmu.edu/~aharley/rvl-cdip/",
6
  "license": "https://www.industrydocuments.ucsf.edu/help/copyright/",
7
- "features": {
8
- "image": {
9
- "decode": true,
10
- "id": null,
11
- "_type": "Image"
12
- },
13
- "label": {
14
- "num_classes": 16,
15
- "names": [
16
- "letter",
17
- "form",
18
- "email",
19
- "handwritten",
20
- "advertisement",
21
- "scientific report",
22
- "scientific publication",
23
- "specification",
24
- "file folder",
25
- "news article",
26
- "budget",
27
- "invoice",
28
- "presentation",
29
- "questionnaire",
30
- "resume",
31
- "memo"
32
- ],
33
- "id": null,
34
- "_type": "ClassLabel"
35
- }
36
- },
37
  "post_processed": null,
38
  "supervised_keys": {
39
  "input": "image",
 
4
  "citation": "@inproceedings{harley2015icdar,\n title = {Evaluation of Deep Convolutional Nets for Document Image Classification and Retrieval},\n author = {Adam W Harley and Alex Ufkes and Konstantinos G Derpanis},\n booktitle = {International Conference on Document Analysis and Recognition ({ICDAR})}},\n year = {2015}\n}\n",
5
  "homepage": "https://www.cs.cmu.edu/~aharley/rvl-cdip/",
6
  "license": "https://www.industrydocuments.ucsf.edu/help/copyright/",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  "post_processed": null,
8
  "supervised_keys": {
9
  "input": "image",
rvl_cdip_easyOCR.py CHANGED
@@ -88,6 +88,8 @@ class RvlCdip(datasets.GeneratorBasedBuilder):
88
  "id": datasets.Value("string"),
89
  "image": datasets.Image(),
90
  "label": datasets.ClassLabel(names=_CLASSES),
 
 
91
  }
92
  ),
93
  supervised_keys=("image", "label"),
@@ -171,10 +173,10 @@ class RvlCdip(datasets.GeneratorBasedBuilder):
171
  @staticmethod
172
  def _path_to_OCR(image_to_OCR, file_path):
173
  # obtain text and boxes given file_path
174
- text, boxes = None, None
175
  if file_path in image_to_OCR:
176
- text, boxes = image_to_OCR[file_path]
177
- return text, boxes
178
 
179
  def _generate_examples(self, archive_iterator, labels_filepath, split):
180
  with open(labels_filepath, encoding="utf-8") as f:
 
88
  "id": datasets.Value("string"),
89
  "image": datasets.Image(),
90
  "label": datasets.ClassLabel(names=_CLASSES),
91
+ "words": datasets.Sequence(datasets.Value("string")),
92
+ "boxes": datasets.Sequence(datasets.Sequence(datasets.Value("int32"))),
93
  }
94
  ),
95
  supervised_keys=("image", "label"),
 
173
  @staticmethod
174
  def _path_to_OCR(image_to_OCR, file_path):
175
  # obtain text and boxes given file_path
176
+ words, boxes = None, None
177
  if file_path in image_to_OCR:
178
+ words, boxes = image_to_OCR[file_path]
179
+ return words, boxes
180
 
181
  def _generate_examples(self, archive_iterator, labels_filepath, split):
182
  with open(labels_filepath, encoding="utf-8") as f:
test_loader.py CHANGED
@@ -1,5 +1,18 @@
1
  from datasets import load_dataset
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  data = load_dataset(
4
  "./rvl_cdip_easyOCR.py",
5
  split="test",
 
1
  from datasets import load_dataset
2
 
3
+
4
+ data = load_dataset(
5
+ "jordyvl/rvl-cdip_easyOCR",
6
+ split="test",
7
+ #cache_dir="/mnt/lerna/data/HFcache",
8
+ # data_files={ # this is the path to the images if it does not download it
9
+ # "binary": __file__#"/mnt/lerna/data/HFcache/downloads/c8cc6f89129255a9adf3e97e319ebe2055cf97662135b3ad26c79e9432544db5",
10
+ # },
11
+ #data_dir="/home/jordy/Downloads/OCRedText", # this is the path to the OCR data
12
+ )
13
+ from pdb import set_trace; set_trace()
14
+
15
+
16
  data = load_dataset(
17
  "./rvl_cdip_easyOCR.py",
18
  split="test",