jordyvl commited on
Commit
c9be2dd
1 Parent(s): a84fc92

Update rvl_cdip_easyocr.py

Browse files
Files changed (1) hide show
  1. rvl_cdip_easyocr.py +5 -5
rvl_cdip_easyocr.py CHANGED
@@ -71,8 +71,11 @@ _CLASSES = [
71
  "memo",
72
  ]
73
 
74
- _IMAGES_DIR = "images/"
75
- _OCR_DIR = "data/" # np files live under here with OCR results
 
 
 
76
 
77
 
78
  # class OCRConfig(datasets.BuilderConfig):
@@ -195,9 +198,6 @@ class RvlCdipEasyOcr(datasets.GeneratorBasedBuilder):
195
  with open(labels_filepath, encoding="utf-8") as f:
196
  data = f.read().splitlines()
197
 
198
- # hardcoded to not get stuck in annoying IO and LFS problems in Hub
199
- _OCR_DIR = "/cw/liir_data/NoCsBack/jordy/BDPC"
200
-
201
  image_to_OCR = self._get_image_to_OCR(_OCR_DIR, split)
202
  image_to_class_id = self._get_image_to_class_map(data)
203
 
 
71
  "memo",
72
  ]
73
 
74
+ _IMAGES_DIR = "images/"
75
+ # hardcoded to not get stuck in annoying IO and LFS problems in Hub
76
+ _OCR_DIR = "/cw/liir_data/NoCsBack/jordy/BDPC"
77
+ _OCR_DIR = _OCR_DIR if os.path.exists(_OCR_DIR) else "data/"
78
+
79
 
80
 
81
  # class OCRConfig(datasets.BuilderConfig):
 
198
  with open(labels_filepath, encoding="utf-8") as f:
199
  data = f.read().splitlines()
200
 
 
 
 
201
  image_to_OCR = self._get_image_to_OCR(_OCR_DIR, split)
202
  image_to_class_id = self._get_image_to_class_map(data)
203