ncoop57 commited on
Commit
cd1cf68
1 Parent(s): 973e0e8

Add filtered rico version where bad hierarchies are removed

Browse files
captions_hierarchies_images_filtered.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:df7c2d2cdb2f5e4a7f3409af1c1e40a7a66549a691fa61b469bf838c2084d53d
3
+ size 2135916754
filter.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import shutil
2
+
3
+ from pathlib import Path
4
+ from tqdm.auto import tqdm
5
+
6
+ # filtering file from https://github.com/google-research/google-research/tree/master/seq2act/data_generation
7
+ with open("./filter_24598.txt", "r") as f:
8
+ filtered_files = f.read().replace(".json", "").split("\n")[:-1]
9
+
10
+ print("num_filtered:", len(filtered_files))
11
+
12
+ # make filtered directories
13
+ Path("captions_filtered").mkdir(exist_ok=True)
14
+ Path("hierarchies_filtered").mkdir(exist_ok=True)
15
+ Path("images_filtered").mkdir(exist_ok=True)
16
+
17
+ # copy filtered files into filtered directories
18
+ for file in tqdm(filtered_files):
19
+ shutil.copy(f"captions/{file}.txt", "captions_filtered")
20
+ shutil.copy(f"hierarchies/{file}.json", "hierarchies_filtered")
21
+ shutil.copy(f"images/{file}.jpg", "images_filtered")
filter_24598.txt ADDED
The diff for this file is too large to render. See raw diff
 
rico_captions.py CHANGED
@@ -51,6 +51,7 @@ _LICENSE = ""
51
  # This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
52
  _DATA_URLs = {
53
  "screenshots_captions": "https://huggingface.co/datasets/ncoop57/rico_captions/resolve/main/captions_hierarchies_images.zip",
 
54
  }
55
 
56
 
@@ -77,20 +78,24 @@ class RicoDataset(datasets.GeneratorBasedBuilder):
77
  version=VERSION,
78
  description="Contains 66k+ unique UI screens. For each UI, we present a screenshot (JPG file) and the text shown on the screen that was extracted using an OCR model.",
79
  ),
 
 
 
 
 
80
  ]
81
 
82
- DEFAULT_CONFIG_NAME = "screenshots_captions"
83
 
84
  def _info(self):
85
- if self.config.name == "screenshots_captions":
86
- features = datasets.Features(
87
- {
88
- "screenshot_path": datasets.Value("string"),
89
- "caption": datasets.Value("string"),
90
- # This is a JSON obj, but will be coded as a string
91
- "hierarchy": datasets.Value("string"),
92
- }
93
- )
94
 
95
  return datasets.DatasetInfo(
96
  description=_DESCRIPTION,
 
51
  # This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
52
  _DATA_URLs = {
53
  "screenshots_captions": "https://huggingface.co/datasets/ncoop57/rico_captions/resolve/main/captions_hierarchies_images.zip",
54
+ "screenshots_captions_filtered": "https://huggingface.co/datasets/ncoop57/rico_captions/resolve/main/captions_hierarchies_images_filtered.zip",
55
  }
56
 
57
 
 
78
  version=VERSION,
79
  description="Contains 66k+ unique UI screens. For each UI, we present a screenshot (JPG file) and the text shown on the screen that was extracted using an OCR model.",
80
  ),
81
+ datasets.BuilderConfig(
82
+ name="screenshots_captions_filtered",
83
+ version=VERSION,
84
+ description="Contains 25k unique UI screens. For each UI, we present a screenshot (JPG file) and the text shown on the screen that was extracted using an OCR model. Filtering was done as discussed in this paper: https://aclanthology.org/2020.acl-main.729.pdf",
85
+ ),
86
  ]
87
 
88
+ DEFAULT_CONFIG_NAME = "screenshots_captions_filtered"
89
 
90
  def _info(self):
91
+ features = datasets.Features(
92
+ {
93
+ "screenshot_path": datasets.Value("string"),
94
+ "caption": datasets.Value("string"),
95
+ # This is a JSON obj, but will be coded as a string
96
+ "hierarchy": datasets.Value("string"),
97
+ }
98
+ )
 
99
 
100
  return datasets.DatasetInfo(
101
  description=_DESCRIPTION,