Upload my_dataset.py
Browse files- my_dataset.py +37 -0
my_dataset.py
CHANGED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import json
|
2 |
+
|
3 |
+
import datasets
|
4 |
+
|
5 |
+
|
6 |
+
datasets.Features(
|
7 |
+
{
|
8 |
+
"img_id": datasets.Image("path"),
|
9 |
+
"anno_polygons": datasets.Sequence(
|
10 |
+
{
|
11 |
+
[
|
12 |
+
{'category_id': datasets.Value("int32"),
|
13 |
+
'segmentation': datasets.Sequence(feature=list, ),
|
14 |
+
'area': datasets.Value("int64"),
|
15 |
+
'bbox': datasets.Sequence('list'),
|
16 |
+
'width': datasets.Value('int32'),
|
17 |
+
'height': datasets.Value('int32')
|
18 |
+
},
|
19 |
+
]
|
20 |
+
}
|
21 |
+
),
|
22 |
+
"anno_texts": datasets.Value("string"),
|
23 |
+
"anno_labels": datasets.Value("string"),
|
24 |
+
"anno_num": datasets.Value("int32"),
|
25 |
+
"anno_image_quality": datasets.Value("float64")
|
26 |
+
}
|
27 |
+
)
|
28 |
+
|
29 |
+
|
30 |
+
_URL = ""
|
31 |
+
def _split_generators(self, dl_manager):
|
32 |
+
|
33 |
+
return [
|
34 |
+
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": ".\mcocr_public_train_test_shared_data\mcocr_train_data"}),
|
35 |
+
datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": ".\mcocr_public_train_test_shared_data\mcocr_val_data"}),
|
36 |
+
]
|
37 |
+
|