added dataset feature
Browse files- docbank.py +3 -0
docbank.py
CHANGED
|
@@ -66,6 +66,7 @@ _FEATURES = datasets.Features(
|
|
| 66 |
# "fonts": datasets.Sequence(datasets.Value("string")),
|
| 67 |
#"image": datasets.Array3D(shape=(3, 224, 224), dtype="uint8"),
|
| 68 |
"original_image": datasets.features.Image(),
|
|
|
|
| 69 |
#"labels": datasets.Sequence(feature=datasets.Value(dtype='int64'))
|
| 70 |
"labels": datasets.Sequence(datasets.features.ClassLabel(
|
| 71 |
names=['abstract', 'author', 'caption', 'equation', 'figure', 'footer', 'paragraph',
|
|
@@ -224,6 +225,7 @@ class Docbank(datasets.GeneratorBasedBuilder):
|
|
| 224 |
# print(filepath)
|
| 225 |
key = 0
|
| 226 |
for f_fp_txt, f_fp_img in filepath:
|
|
|
|
| 227 |
#print(f_fp_txt)
|
| 228 |
f_id = key
|
| 229 |
#f_fp_txt = f['filepath_txt']
|
|
@@ -299,6 +301,7 @@ class Docbank(datasets.GeneratorBasedBuilder):
|
|
| 299 |
# "fonts": split_fonts,
|
| 300 |
#"image": image,
|
| 301 |
"original_image": original_image,
|
|
|
|
| 302 |
"labels": labels
|
| 303 |
}
|
| 304 |
key += 1
|
|
|
|
| 66 |
# "fonts": datasets.Sequence(datasets.Value("string")),
|
| 67 |
#"image": datasets.Array3D(shape=(3, 224, 224), dtype="uint8"),
|
| 68 |
"original_image": datasets.features.Image(),
|
| 69 |
+
"dataset": datasets.Value("string"),
|
| 70 |
#"labels": datasets.Sequence(feature=datasets.Value(dtype='int64'))
|
| 71 |
"labels": datasets.Sequence(datasets.features.ClassLabel(
|
| 72 |
names=['abstract', 'author', 'caption', 'equation', 'figure', 'footer', 'paragraph',
|
|
|
|
| 225 |
# print(filepath)
|
| 226 |
key = 0
|
| 227 |
for f_fp_txt, f_fp_img in filepath:
|
| 228 |
+
dataset = f_fp_txt.split(".")[-2].split("_")[-1]
|
| 229 |
#print(f_fp_txt)
|
| 230 |
f_id = key
|
| 231 |
#f_fp_txt = f['filepath_txt']
|
|
|
|
| 301 |
# "fonts": split_fonts,
|
| 302 |
#"image": image,
|
| 303 |
"original_image": original_image,
|
| 304 |
+
"dataset": dataset,
|
| 305 |
"labels": labels
|
| 306 |
}
|
| 307 |
key += 1
|