[update]add data
Browse files- cppe5.py +0 -1
- data/annotations/test.jsonl +2 -2
- data/annotations/train.jsonl +2 -2
- examples/make_jsonl.py +7 -2
cppe5.py
CHANGED
|
@@ -96,7 +96,6 @@ class CPPE5(datasets.GeneratorBasedBuilder):
|
|
| 96 |
sample = json.loads(row)
|
| 97 |
|
| 98 |
file_path = sample["image"]
|
| 99 |
-
file_path = os.path.join("data/images", file_path)
|
| 100 |
file_path = dl_manager.download(file_path)
|
| 101 |
|
| 102 |
with open(file_path, "rb") as image_f:
|
|
|
|
| 96 |
sample = json.loads(row)
|
| 97 |
|
| 98 |
file_path = sample["image"]
|
|
|
|
| 99 |
file_path = dl_manager.download(file_path)
|
| 100 |
|
| 101 |
with open(file_path, "rb") as image_f:
|
data/annotations/test.jsonl
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2dd85c9919bcd33ab761b7ff40024a8bdc81dc936cb30007de267d712c6fd448
|
| 3 |
+
size 18910
|
data/annotations/train.jsonl
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f59a6b1993501b30cb916d7faf9d5e11c549bc3de98399a32ec3a1e85f60540a
|
| 3 |
+
size 450728
|
examples/make_jsonl.py
CHANGED
|
@@ -2,6 +2,8 @@
|
|
| 2 |
# -*- coding: utf-8 -*-
|
| 3 |
from collections import defaultdict
|
| 4 |
import json
|
|
|
|
|
|
|
| 5 |
|
| 6 |
from project_settings import project_path
|
| 7 |
|
|
@@ -30,14 +32,17 @@ def main():
|
|
| 30 |
image_id = annotation["image_id"]
|
| 31 |
image_id_to_annotations[image_id].append(annotation)
|
| 32 |
|
| 33 |
-
|
|
|
|
| 34 |
for image in images:
|
| 35 |
image_id = image["id"]
|
| 36 |
annotations = image_id_to_annotations[image_id]
|
| 37 |
|
|
|
|
|
|
|
| 38 |
row = {
|
| 39 |
"image_id": image["id"],
|
| 40 |
-
"image":
|
| 41 |
"width": image["width"],
|
| 42 |
"height": image["height"],
|
| 43 |
"objects": [
|
|
|
|
| 2 |
# -*- coding: utf-8 -*-
|
| 3 |
from collections import defaultdict
|
| 4 |
import json
|
| 5 |
+
import os
|
| 6 |
+
from pathlib import Path
|
| 7 |
|
| 8 |
from project_settings import project_path
|
| 9 |
|
|
|
|
| 32 |
image_id = annotation["image_id"]
|
| 33 |
image_id_to_annotations[image_id].append(annotation)
|
| 34 |
|
| 35 |
+
to_filename = project_path / "data/annotations/{}.jsonl".format(subset)
|
| 36 |
+
with open(to_filename.as_posix(), "w", encoding="utf-8") as f:
|
| 37 |
for image in images:
|
| 38 |
image_id = image["id"]
|
| 39 |
annotations = image_id_to_annotations[image_id]
|
| 40 |
|
| 41 |
+
image_path = Path("data/images") / image["file_name"]
|
| 42 |
+
|
| 43 |
row = {
|
| 44 |
"image_id": image["id"],
|
| 45 |
+
"image": image_path.as_posix(),
|
| 46 |
"width": image["width"],
|
| 47 |
"height": image["height"],
|
| 48 |
"objects": [
|