Update cvdataset-layoutlmv3.py
#3
by
nvm472001
- opened
- cvdataset-layoutlmv3.py +10 -8
cvdataset-layoutlmv3.py
CHANGED
@@ -19,7 +19,7 @@ def normalize_bbox(bbox, size):
|
|
19 |
int(1000 * bbox[0] / size[0]),
|
20 |
int(1000 * bbox[1] / size[1]),
|
21 |
int(1000 * bbox[2] / size[0]),
|
22 |
-
int(
|
23 |
]
|
24 |
|
25 |
def _get_drive_url(url):
|
@@ -80,16 +80,18 @@ class CVDS(datasets.GeneratorBasedBuilder):
|
|
80 |
)
|
81 |
|
82 |
def _split_generators(self, dl_manager):
|
83 |
-
|
84 |
-
|
85 |
-
|
|
|
|
|
86 |
return [
|
87 |
datasets.SplitGenerator(
|
88 |
-
name=datasets.Split.TRAIN, gen_kwargs={
|
89 |
-
),
|
90 |
datasets.SplitGenerator(
|
91 |
-
name=datasets.Split.TEST, gen_kwargs={
|
92 |
-
)
|
93 |
]
|
94 |
|
95 |
def _generate_examples(self, file_path, dest):
|
|
|
19 |
int(1000 * bbox[0] / size[0]),
|
20 |
int(1000 * bbox[1] / size[1]),
|
21 |
int(1000 * bbox[2] / size[0]),
|
22 |
+
int(1000 * bbox[3] / size[1]),
|
23 |
]
|
24 |
|
25 |
def _get_drive_url(url):
|
|
|
80 |
)
|
81 |
|
82 |
def _split_generators(self, dl_manager):
|
83 |
+
"""Returns SplitGenerators."""
|
84 |
+
"""Uses local files located with data_dir"""
|
85 |
+
downloaded_file = dl_manager.download_and_extract(_URLS)
|
86 |
+
dest = Path(downloaded_file[0])/'data1'
|
87 |
+
|
88 |
return [
|
89 |
datasets.SplitGenerator(
|
90 |
+
name=datasets.Split.TRAIN, gen_kwargs={"filepath": dest/"train.txt", "dest": dest}
|
91 |
+
),
|
92 |
datasets.SplitGenerator(
|
93 |
+
name=datasets.Split.TEST, gen_kwargs={"filepath": dest/"test.txt", "dest": dest}
|
94 |
+
),
|
95 |
]
|
96 |
|
97 |
def _generate_examples(self, file_path, dest):
|