Convert dataset to Parquet

#3
This view is limited to 50 files because it contains too many changes.  See the raw diff here.
.gitignore DELETED
@@ -1,9 +0,0 @@
1
-
2
- .git/
3
- .idea/
4
-
5
- hub_datasets/
6
-
7
- **/__pycache__/
8
-
9
- 222dataset_infos.json
 
 
 
 
 
 
 
 
 
 
README.md CHANGED
@@ -1,11 +1,55 @@
1
  ---
2
  license: apache-2.0
 
 
3
  task_categories:
4
  - object-detection
5
  tags:
6
  - object detection
7
- size_categories:
8
- - 100M<n<1B
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  ---
10
  ## cppe-5
11
 
 
1
  ---
2
  license: apache-2.0
3
+ size_categories:
4
+ - 100M<n<1B
5
  task_categories:
6
  - object-detection
7
  tags:
8
  - object detection
9
+ dataset_info:
10
+ features:
11
+ - name: image_id
12
+ dtype: int64
13
+ - name: image
14
+ dtype: image
15
+ - name: width
16
+ dtype: int32
17
+ - name: height
18
+ dtype: int32
19
+ - name: objects
20
+ sequence:
21
+ - name: id
22
+ dtype: int64
23
+ - name: area
24
+ dtype: int64
25
+ - name: bbox
26
+ sequence: float32
27
+ length: 4
28
+ - name: category
29
+ dtype:
30
+ class_label:
31
+ names:
32
+ '0': Coverall
33
+ '1': Face_Shield
34
+ '2': Gloves
35
+ '3': Goggles
36
+ '4': Mask
37
+ splits:
38
+ - name: train
39
+ num_bytes: 240463364.0
40
+ num_examples: 1000
41
+ - name: test
42
+ num_bytes: 4172164.0
43
+ num_examples: 29
44
+ download_size: 241152991
45
+ dataset_size: 244635528.0
46
+ configs:
47
+ - config_name: default
48
+ data_files:
49
+ - split: train
50
+ path: data/train-*
51
+ - split: test
52
+ path: data/test-*
53
  ---
54
  ## cppe-5
55
 
cppe-5.py DELETED
@@ -1,135 +0,0 @@
1
- # coding=utf-8
2
- # Copyright 2021 The HuggingFace Datasets Authors and the current dataset script contributor.
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
- """CPPE-5 dataset."""
16
-
17
-
18
- import collections
19
- import json
20
- import os
21
-
22
- import datasets
23
-
24
-
25
- _CITATION = """\
26
- @misc{dagli2021cppe5,
27
- title={CPPE-5: Medical Personal Protective Equipment Dataset},
28
- author={Rishit Dagli and Ali Mustufa Shaikh},
29
- year={2021},
30
- eprint={2112.09569},
31
- archivePrefix={arXiv},
32
- primaryClass={cs.CV}
33
- }
34
- """
35
-
36
- _DESCRIPTION = """\
37
- CPPE - 5 (Medical Personal Protective Equipment) is a new challenging dataset with the goal
38
- to allow the study of subordinate categorization of medical personal protective equipments,
39
- which is not possible with other popular data sets that focus on broad level categories.
40
- """
41
-
42
- _HOMEPAGE = "https://sites.google.com/view/cppe5"
43
-
44
- _LICENSE = "Unknown"
45
-
46
- # _URL = "https://drive.google.com/uc?id=1MGnaAfbckUmigGUvihz7uiHGC6rBIbvr"
47
- _URL = "data/dataset.tar.gz"
48
-
49
- _CATEGORIES = ["Coverall", "Face_Shield", "Gloves", "Goggles", "Mask"]
50
-
51
-
52
- class CPPE5(datasets.GeneratorBasedBuilder):
53
- """CPPE - 5 dataset."""
54
-
55
- VERSION = datasets.Version("1.0.0")
56
-
57
- def _info(self):
58
- features = datasets.Features(
59
- {
60
- "image_id": datasets.Value("int64"),
61
- "image": datasets.Image(),
62
- "width": datasets.Value("int32"),
63
- "height": datasets.Value("int32"),
64
- "objects": datasets.Sequence(
65
- {
66
- "id": datasets.Value("int64"),
67
- "area": datasets.Value("int64"),
68
- "bbox": datasets.Sequence(datasets.Value("float32"), length=4),
69
- "category": datasets.ClassLabel(names=_CATEGORIES),
70
- }
71
- ),
72
- }
73
- )
74
- return datasets.DatasetInfo(
75
- description=_DESCRIPTION,
76
- features=features,
77
- homepage=_HOMEPAGE,
78
- license=_LICENSE,
79
- citation=_CITATION,
80
- )
81
-
82
- def _split_generators(self, dl_manager):
83
- archive = dl_manager.download(_URL)
84
- return [
85
- datasets.SplitGenerator(
86
- name=datasets.Split.TRAIN,
87
- gen_kwargs={
88
- "annotation_file_path": "annotations/train.json",
89
- "files": dl_manager.iter_archive(archive),
90
- },
91
- ),
92
- datasets.SplitGenerator(
93
- name=datasets.Split.TEST,
94
- gen_kwargs={
95
- "annotation_file_path": "annotations/test.json",
96
- "files": dl_manager.iter_archive(archive),
97
- },
98
- ),
99
- ]
100
-
101
- def _generate_examples(self, annotation_file_path, files):
102
- def process_annot(annot, category_id_to_category):
103
- return {
104
- "id": annot["id"],
105
- "area": annot["area"],
106
- "bbox": annot["bbox"],
107
- "category": category_id_to_category[annot["category_id"]],
108
- }
109
-
110
- image_id_to_image = {}
111
- idx = 0
112
- # This loop relies on the ordering of the files in the archive:
113
- # Annotation files come first, then the images.
114
- for path, f in files:
115
- file_name = os.path.basename(path)
116
- if path == annotation_file_path:
117
- annotations = json.load(f)
118
- category_id_to_category = {category["id"]: category["name"] for category in annotations["categories"]}
119
- image_id_to_annotations = collections.defaultdict(list)
120
- for annot in annotations["annotations"]:
121
- image_id_to_annotations[annot["image_id"]].append(annot)
122
- image_id_to_image = {annot["file_name"]: annot for annot in annotations["images"]}
123
- elif file_name in image_id_to_image:
124
- image = image_id_to_image[file_name]
125
- objects = [
126
- process_annot(annot, category_id_to_category) for annot in image_id_to_annotations[image["id"]]
127
- ]
128
- yield idx, {
129
- "image_id": image["id"],
130
- "image": {"path": path, "bytes": f.read()},
131
- "width": image["width"],
132
- "height": image["height"],
133
- "objects": objects,
134
- }
135
- idx += 1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cppe_5_backup.py DELETED
@@ -1,118 +0,0 @@
1
- #!/usr/bin/python3
2
- # -*- coding: utf-8 -*-
3
- from glob import glob
4
- import json
5
- import os
6
- from pathlib import Path
7
-
8
- import datasets
9
- from PIL import Image
10
-
11
- # _URL = "https://drive.google.com/uc?id=1MGnaAfbckUmigGUvihz7uiHGC6rBIbvr"
12
-
13
- _HOMEPAGE = "https://sites.google.com/view/cppe5"
14
-
15
- _LICENSE = "Unknown"
16
-
17
- _CATEGORIES = ["Coverall", "Face_Shield", "Gloves", "Goggles", "Mask"]
18
-
19
- _CITATION = """\
20
- @misc{dagli2021cppe5,
21
- title={CPPE-5: Medical Personal Protective Equipment Dataset},
22
- author={Rishit Dagli and Ali Mustufa Shaikh},
23
- year={2021},
24
- eprint={2112.09569},
25
- archivePrefix={arXiv},
26
- primaryClass={cs.CV}
27
- }
28
- """
29
-
30
- _DESCRIPTION = """\
31
- CPPE - 5 (Medical Personal Protective Equipment) is a new challenging dataset with the goal
32
- to allow the study of subordinate categorization of medical personal protective equipments,
33
- which is not possible with other popular data sets that focus on broad level categories.
34
- """
35
-
36
-
37
- class CPPE5(datasets.GeneratorBasedBuilder):
38
- """CPPE - 5 dataset."""
39
-
40
- VERSION = datasets.Version("1.0.0")
41
-
42
- def _info(self):
43
- features = datasets.Features(
44
- {
45
- "image_id": datasets.Value("int64"),
46
- "image": datasets.Image(),
47
- "width": datasets.Value("int32"),
48
- "height": datasets.Value("int32"),
49
- "objects": datasets.Sequence(
50
- feature=datasets.Features({
51
- "id": datasets.Value("int64"),
52
- "area": datasets.Value("int64"),
53
- "bbox": datasets.Sequence(datasets.Value("float32"), length=4),
54
- "category": datasets.ClassLabel(names=_CATEGORIES),
55
- })
56
- ),
57
- }
58
- )
59
- return datasets.DatasetInfo(
60
- description=_DESCRIPTION,
61
- features=features,
62
- homepage=_HOMEPAGE,
63
- license=_LICENSE,
64
- citation=_CITATION,
65
- )
66
-
67
- def _split_generators(self, dl_manager):
68
- """Returns SplitGenerators."""
69
- train_json = dl_manager.download("data/annotations/train.jsonl")
70
- test_json = dl_manager.download("data/annotations/test.jsonl")
71
-
72
- return [
73
- datasets.SplitGenerator(
74
- name=datasets.Split.TRAIN,
75
- gen_kwargs={
76
- "archive_path": train_json,
77
- "dl_manager": dl_manager,
78
- },
79
- ),
80
- datasets.SplitGenerator(
81
- name=datasets.Split.TEST,
82
- gen_kwargs={
83
- "archive_path": test_json,
84
- "dl_manager": dl_manager,
85
- },
86
- ),
87
- ]
88
-
89
- def _generate_examples(self, archive_path, dl_manager):
90
- """Yields examples."""
91
- archive_path = Path(archive_path)
92
-
93
- idx = 0
94
-
95
- with open(archive_path, "r", encoding="utf-8") as f:
96
- for row in f:
97
- sample = json.loads(row)
98
-
99
- file_path = sample["image"]
100
- file_path = dl_manager.download(file_path)
101
-
102
- with open(file_path, "rb") as image_f:
103
- image_bytes = image_f.read()
104
- # image = Image.open(image_f)
105
-
106
- yield idx, {
107
- "image_id": sample["image_id"],
108
- "image": {"path": file_path, "bytes": image_bytes},
109
- # "image": image,
110
- "width": sample["width"],
111
- "height": sample["height"],
112
- "objects": sample["objects"],
113
- }
114
- idx += 1
115
-
116
-
117
- if __name__ == '__main__':
118
- pass
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
data/annotations/test.jsonl DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:2dd85c9919bcd33ab761b7ff40024a8bdc81dc936cb30007de267d712c6fd448
3
- size 18910
 
 
 
 
data/images/1.png DELETED

Git LFS Details

  • SHA256: 1cefd6a64cc495eb94faa0337a48deb2fb03a1a7334b901bd0580fa0c50cb110
  • Pointer size: 129 Bytes
  • Size of remote file: 9.72 kB
data/images/10.png DELETED

Git LFS Details

  • SHA256: e3960858e7cdda5962fae48e8cdd2bad41eef85d59338f9bcc58ed4b0ce78370
  • Pointer size: 130 Bytes
  • Size of remote file: 89.3 kB
data/images/100.png DELETED

Git LFS Details

  • SHA256: bcf875c6e6005456aa60313f116abbd694c2f5931cbfb29bc8eae7a7c71135eb
  • Pointer size: 130 Bytes
  • Size of remote file: 23.9 kB
data/images/1000.png DELETED

Git LFS Details

  • SHA256: c2fc5f54fa33c316823b19f82e97f1a1c1c6884b7349ea0c42c936ad30989fb2
  • Pointer size: 130 Bytes
  • Size of remote file: 35.9 kB
data/images/1001.png DELETED

Git LFS Details

  • SHA256: 11d5bbc0214d0bc82c17ddfd23a0ecee016b1c6c72c3a7562324de65d2e76a8a
  • Pointer size: 130 Bytes
  • Size of remote file: 35.7 kB
data/images/1002.png DELETED

Git LFS Details

  • SHA256: 7a66e9417f2b96f8d126e967552c7d46a3482cdbc8163e1ef7b494e800933b6b
  • Pointer size: 130 Bytes
  • Size of remote file: 44 kB
data/images/1003.png DELETED

Git LFS Details

  • SHA256: 0422ae0b06bfd9349fe086a8172d5ab6f761a861fec30334cffb96627a879ee8
  • Pointer size: 131 Bytes
  • Size of remote file: 505 kB
data/images/1004.png DELETED

Git LFS Details

  • SHA256: 00ca077d7dc67d22ce3b0b89c23fea669f8de38f644cf8da6c3c8cb571d10e59
  • Pointer size: 131 Bytes
  • Size of remote file: 268 kB
data/images/1005.png DELETED

Git LFS Details

  • SHA256: a425d679a16a269914f2a0bcbf6278b21d0c1722e7e8fbe21afa216cf4fcc05b
  • Pointer size: 131 Bytes
  • Size of remote file: 102 kB
data/images/1006.png DELETED

Git LFS Details

  • SHA256: 5e13a4221524338513cbe392afe6134cc8d95cd4e9718d97869aca3b6fac5bca
  • Pointer size: 130 Bytes
  • Size of remote file: 72.1 kB
data/images/1007.png DELETED

Git LFS Details

  • SHA256: 3a10fc17cc0e552fc8a87e4d1cf8a344db2de24b16f20c0333f46a3ed3c9e698
  • Pointer size: 130 Bytes
  • Size of remote file: 94.5 kB
data/images/1008.png DELETED

Git LFS Details

  • SHA256: d8e7ee2917bf534b34adfaf0b061d03aca1bbab980855fdad735c225d5b6e547
  • Pointer size: 131 Bytes
  • Size of remote file: 167 kB
data/images/1009.png DELETED

Git LFS Details

  • SHA256: 93114565abccd865585d8a8f423950ecc08afed94c6d852832a13e808c110af1
  • Pointer size: 130 Bytes
  • Size of remote file: 28.7 kB
data/images/101.png DELETED

Git LFS Details

  • SHA256: 3871d8ceafcc131d4aeb4ae8d6a41644e144b7b3eaa96f5d5ad9b83f851e8bde
  • Pointer size: 130 Bytes
  • Size of remote file: 94.1 kB
data/images/1010.png DELETED

Git LFS Details

  • SHA256: 24d63217ecf8bc79236d9fbb7eaf8ed02f2c9af3f01416cc19ea10f24dce500e
  • Pointer size: 131 Bytes
  • Size of remote file: 296 kB
data/images/1011.png DELETED

Git LFS Details

  • SHA256: d23d3cb715f036fd60ea16d0787996029a223188839b487ad3f7aac4e02aabbb
  • Pointer size: 131 Bytes
  • Size of remote file: 492 kB
data/images/1012.png DELETED

Git LFS Details

  • SHA256: afc5adc7f85b577d62a6bc934d46f0dfddb38540fa95e3a84f691b739ef60f77
  • Pointer size: 130 Bytes
  • Size of remote file: 66.4 kB
data/images/1013.png DELETED

Git LFS Details

  • SHA256: 5ca851d0d08817f86feb0d41ea039f14740e1fc972ac1e2f6cc6f4c18410a42b
  • Pointer size: 131 Bytes
  • Size of remote file: 180 kB
data/images/1014.png DELETED

Git LFS Details

  • SHA256: 7799839df088ab810c3f99b815a430bff8f7334ce77e502c49f98c41cc84f304
  • Pointer size: 130 Bytes
  • Size of remote file: 97.8 kB
data/images/1015.png DELETED

Git LFS Details

  • SHA256: 6a4e6159cf3d09137aa58ffc2339e79569f64569603c3b2aff5bc93cd866a73f
  • Pointer size: 130 Bytes
  • Size of remote file: 42.6 kB
data/images/1016.png DELETED

Git LFS Details

  • SHA256: 650926aef2ee91976d8f0b3cd39897bcf4f838e375146cf8a692673e63aa8fa0
  • Pointer size: 131 Bytes
  • Size of remote file: 101 kB
data/images/1017.png DELETED

Git LFS Details

  • SHA256: 33fd4c8df96107c60ef38f358cc415336ddf9172850d67f066e78b2138393ebf
  • Pointer size: 130 Bytes
  • Size of remote file: 16.5 kB
data/images/1018.png DELETED

Git LFS Details

  • SHA256: 77b7064b04b8cdb26e22351a6dff24c76efde646ef2ba1d80955d34a01dee2eb
  • Pointer size: 130 Bytes
  • Size of remote file: 84.4 kB
data/images/1019.png DELETED

Git LFS Details

  • SHA256: 5604fe82f0f9be6d3d9157b4b590687d262d2c68da5e11721bc673a20bee8677
  • Pointer size: 130 Bytes
  • Size of remote file: 88.1 kB
data/images/102.png DELETED

Git LFS Details

  • SHA256: b271045f32f6923389b8e8a5eee19e493d1562ea29452000db0fb6e9c805d391
  • Pointer size: 131 Bytes
  • Size of remote file: 929 kB
data/images/1020.png DELETED

Git LFS Details

  • SHA256: 06f1bbd0184e8b8ed29185a55eee34ff58362c2f3ede0281500db7883a4c040e
  • Pointer size: 130 Bytes
  • Size of remote file: 54.3 kB
data/images/1021.png DELETED

Git LFS Details

  • SHA256: 27cb1813073f43c77da16edea50808233ac469db439cfa1514a4c67226d7e4c6
  • Pointer size: 130 Bytes
  • Size of remote file: 59.9 kB
data/images/1022.png DELETED

Git LFS Details

  • SHA256: e80f923a506f3f5191c0b35a2e3af084e224e58dcb20fb1b5f78c9816bc9ffcc
  • Pointer size: 130 Bytes
  • Size of remote file: 40 kB
data/images/1023.png DELETED

Git LFS Details

  • SHA256: b1b7ce789bb14c3cde5f445a4b6999f75211cb028339763563e2061d96df8ed1
  • Pointer size: 130 Bytes
  • Size of remote file: 53.3 kB
data/images/1024.png DELETED

Git LFS Details

  • SHA256: 6cf70824648a1252f805fb36a5358ee6febc4c9046b6c67bc2c16823a6c3b452
  • Pointer size: 130 Bytes
  • Size of remote file: 48.4 kB
data/images/1025.png DELETED

Git LFS Details

  • SHA256: 038923096161f078d06e48d6e2decfebc35ec8d42b3b925cfa9c071aa27bc2c6
  • Pointer size: 131 Bytes
  • Size of remote file: 521 kB
data/images/1026.png DELETED

Git LFS Details

  • SHA256: 651dde97b42827f551231bff086995988eef21fd673af6a2778795622a4477ac
  • Pointer size: 131 Bytes
  • Size of remote file: 264 kB
data/images/1027.png DELETED

Git LFS Details

  • SHA256: 7f788e59d271d1646a041c223b340510ba40b6f84a40d95f37ea7c063133f0bb
  • Pointer size: 131 Bytes
  • Size of remote file: 142 kB
data/images/1028.png DELETED

Git LFS Details

  • SHA256: 39f80c4ca3f04863c9029b07cc924ec942fd87b5a58cc9f94cf52d099a87c49a
  • Pointer size: 130 Bytes
  • Size of remote file: 86.4 kB
data/images/1029.png DELETED

Git LFS Details

  • SHA256: b9f147c2f390712f6ac22827ecf3e07c5f3b24788c7e1bd903fe6cd8b89542ab
  • Pointer size: 131 Bytes
  • Size of remote file: 111 kB
data/images/103.png DELETED

Git LFS Details

  • SHA256: 1b432d607659b9623f2573c4dc503737479befa1008d48d1568b27bb93d3bfc2
  • Pointer size: 130 Bytes
  • Size of remote file: 30.1 kB
data/images/104.png DELETED

Git LFS Details

  • SHA256: 79acf40fd4548039cee4b7e1ca39a1bf6688a0dd33bab2093cad9ceda56dc491
  • Pointer size: 131 Bytes
  • Size of remote file: 381 kB
data/images/105.png DELETED

Git LFS Details

  • SHA256: 6ed6dfc2d09277f9aad412361c1eb640396959bf911fcc7c7cc91e94b6c3ced4
  • Pointer size: 130 Bytes
  • Size of remote file: 75.6 kB
data/images/106.png DELETED

Git LFS Details

  • SHA256: 754893c07434b593e5d90a6d8c1470c99269f4c7d6b78cdcd495b116f8f15c36
  • Pointer size: 130 Bytes
  • Size of remote file: 55.8 kB
data/images/107.png DELETED

Git LFS Details

  • SHA256: d8a0cf52c4b0d0327334d95f6eb15263c5cf04e85208f10c2a6c9a9638bb7990
  • Pointer size: 130 Bytes
  • Size of remote file: 29.6 kB
data/images/108.png DELETED

Git LFS Details

  • SHA256: 3ef73e5ac79f089e5d3d103a6e2454ef640ceadba60d3445b475362a0f101f67
  • Pointer size: 130 Bytes
  • Size of remote file: 23.3 kB
data/images/109.png DELETED

Git LFS Details

  • SHA256: 5f5941e5d85c3bddc548b684e3fca35657f18e88800a95078ced0e9168c7d2c5
  • Pointer size: 129 Bytes
  • Size of remote file: 8.49 kB
data/images/11.png DELETED

Git LFS Details

  • SHA256: 331aef5423a9275c97e726515a96ff83c7a2d0f918fe55dd771858a3a19a27a1
  • Pointer size: 130 Bytes
  • Size of remote file: 87.1 kB
data/images/110.png DELETED

Git LFS Details

  • SHA256: f51e32de84be5df20a379dc79e02ddb92f85033436a4cc4c0714c5e96f557d1e
  • Pointer size: 130 Bytes
  • Size of remote file: 57 kB
data/images/111.png DELETED

Git LFS Details

  • SHA256: 869cf4b79429a1e16adfe23a7d875a9cc15f093777f335b094f2bc8deab90bd7
  • Pointer size: 131 Bytes
  • Size of remote file: 714 kB