Update FCD_lmv2.py
Browse files- FCD_lmv2.py +9 -9
FCD_lmv2.py
CHANGED
|
@@ -110,8 +110,8 @@ class FCD(datasets.GeneratorBasedBuilder):
|
|
| 110 |
image_path = image_path.replace("json", "jpg")
|
| 111 |
image, size = load_image(image_path)
|
| 112 |
for item in data:
|
| 113 |
-
words, label = item[
|
| 114 |
-
words = [w for w in words if w["text"].strip() != ""]
|
| 115 |
|
| 116 |
if len(words) == 0:
|
| 117 |
continue
|
|
@@ -121,13 +121,13 @@ class FCD(datasets.GeneratorBasedBuilder):
|
|
| 121 |
# ner_tags.append("O")
|
| 122 |
# bboxes.append(normalize_bbox(w["box"], size))
|
| 123 |
# else:
|
| 124 |
-
tokens.append(words[0]["text"])
|
| 125 |
-
ner_tags.append("B-" + label.upper())
|
| 126 |
-
bboxes.append(normalize_bbox(words[0]["box"], size))
|
| 127 |
-
for w in words[1:]:
|
| 128 |
-
tokens.append(w["text"])
|
| 129 |
-
ner_tags.append(
|
| 130 |
-
bboxes.append(normalize_bbox(w["box"], size))
|
| 131 |
|
| 132 |
|
| 133 |
|
|
|
|
| 110 |
image_path = image_path.replace("json", "jpg")
|
| 111 |
image, size = load_image(image_path)
|
| 112 |
for item in data:
|
| 113 |
+
words, label = item[0][5], item[0][4]
|
| 114 |
+
#words = [w for w in words if w["text"].strip() != ""]
|
| 115 |
|
| 116 |
if len(words) == 0:
|
| 117 |
continue
|
|
|
|
| 121 |
# ner_tags.append("O")
|
| 122 |
# bboxes.append(normalize_bbox(w["box"], size))
|
| 123 |
# else:
|
| 124 |
+
#tokens.append(words[0]["text"])
|
| 125 |
+
#ner_tags.append("B-" + label.upper())
|
| 126 |
+
#bboxes.append(normalize_bbox(words[0]["box"], size))
|
| 127 |
+
#for w in words[1:]:
|
| 128 |
+
#tokens.append(w["text"])
|
| 129 |
+
ner_tags.append(label.upper())
|
| 130 |
+
#bboxes.append(normalize_bbox(w["box"], size))
|
| 131 |
|
| 132 |
|
| 133 |
|