qgyd2021 commited on
Commit
c2dc5d5
1 Parent(s): fa2d146

[update]add data

Browse files
.idea/.gitignore ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ # Default ignored files
2
+ /shelf/
3
+ /workspace.xml
4
+ # Datasource local storage ignored files
5
+ /../../../../../../:\Users\tianx\HuggingDatasets\cppe-5\.idea/dataSources/
6
+ /dataSources.local.xml
7
+ # Editor-based HTTP Client requests
8
+ /httpRequests/
.idea/cppe-5.iml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="PYTHON_MODULE" version="4">
3
+ <component name="NewModuleRootManager">
4
+ <content url="file://$MODULE_DIR$" />
5
+ <orderEntry type="inheritedJdk" />
6
+ <orderEntry type="sourceFolder" forTests="false" />
7
+ </component>
8
+ </module>
.idea/deployment.xml ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="PublishConfigData" remoteFilesAllowedToDisappearOnAutoupload="false">
4
+ <serverData>
5
+ <paths name="(GPU) 10.75.27.247">
6
+ <serverdata>
7
+ <mappings>
8
+ <mapping local="$PROJECT_DIR$" web="/" />
9
+ </mappings>
10
+ </serverdata>
11
+ </paths>
12
+ </serverData>
13
+ </component>
14
+ </project>
.idea/encodings.xml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="Encoding" addBOMForNewFiles="with NO BOM" />
4
+ </project>
.idea/inspectionProfiles/Project_Default.xml ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <component name="InspectionProjectProfileManager">
2
+ <profile version="1.0">
3
+ <option name="myName" value="Project Default" />
4
+ <inspection_tool class="DuplicatedCode" enabled="true" level="WEAK WARNING" enabled_by_default="true">
5
+ <Languages>
6
+ <language minSize="14" name="Style Sheets" />
7
+ <language minSize="163" name="JavaScript" />
8
+ <language minSize="715" name="Python" />
9
+ </Languages>
10
+ </inspection_tool>
11
+ <inspection_tool class="JSUnresolvedFunction" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
12
+ <inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
13
+ <option name="ignoredPackages">
14
+ <value>
15
+ <list size="26">
16
+ <item index="0" class="java.lang.String" itemvalue="transformers" />
17
+ <item index="1" class="java.lang.String" itemvalue="jiwer" />
18
+ <item index="2" class="java.lang.String" itemvalue="gradio" />
19
+ <item index="3" class="java.lang.String" itemvalue="librosa" />
20
+ <item index="4" class="java.lang.String" itemvalue="torch" />
21
+ <item index="5" class="java.lang.String" itemvalue="datasets" />
22
+ <item index="6" class="java.lang.String" itemvalue="evaluate" />
23
+ <item index="7" class="java.lang.String" itemvalue="ipywidgets" />
24
+ <item index="8" class="java.lang.String" itemvalue="torchaudio" />
25
+ <item index="9" class="java.lang.String" itemvalue="g2p_en" />
26
+ <item index="10" class="java.lang.String" itemvalue="numpy" />
27
+ <item index="11" class="java.lang.String" itemvalue="numba" />
28
+ <item index="12" class="java.lang.String" itemvalue="montreal-forced-aligner" />
29
+ <item index="13" class="java.lang.String" itemvalue="SQLAlchemy" />
30
+ <item index="14" class="java.lang.String" itemvalue="biopython" />
31
+ <item index="15" class="java.lang.String" itemvalue="praatio" />
32
+ <item index="16" class="java.lang.String" itemvalue="pandas" />
33
+ <item index="17" class="java.lang.String" itemvalue="xlrd" />
34
+ <item index="18" class="java.lang.String" itemvalue="openpyxl" />
35
+ <item index="19" class="java.lang.String" itemvalue="sentencepiece" />
36
+ <item index="20" class="java.lang.String" itemvalue="python-dotenv" />
37
+ <item index="21" class="java.lang.String" itemvalue="gevent" />
38
+ <item index="22" class="java.lang.String" itemvalue="requests" />
39
+ <item index="23" class="java.lang.String" itemvalue="flask" />
40
+ <item index="24" class="java.lang.String" itemvalue="jsonschema" />
41
+ <item index="25" class="java.lang.String" itemvalue="deepspeed" />
42
+ </list>
43
+ </value>
44
+ </option>
45
+ </inspection_tool>
46
+ <inspection_tool class="PyTypeCheckerInspection" enabled="false" level="WARNING" enabled_by_default="false" />
47
+ <inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="WARNING" enabled_by_default="true">
48
+ <option name="ignoredIdentifiers">
49
+ <list>
50
+ <option value="typing.Sequence.__setitem__" />
51
+ </list>
52
+ </option>
53
+ </inspection_tool>
54
+ </profile>
55
+ </component>
.idea/inspectionProfiles/profiles_settings.xml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ <component name="InspectionProjectProfileManager">
2
+ <settings>
3
+ <option name="USE_PROJECT_PROFILE" value="false" />
4
+ <version value="1.0" />
5
+ </settings>
6
+ </component>
.idea/misc.xml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.6" project-jdk-type="Python SDK" />
4
+ </project>
.idea/modules.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/cppe-5.iml" filepath="$PROJECT_DIR$/.idea/cppe-5.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+ </component>
6
+ </project>
README.md CHANGED
@@ -10,4 +10,5 @@ size_categories:
10
  ## cppe-5
11
 
12
  我正在 transformers 上练习 [object-detection](https://huggingface.co/docs/transformers/tasks/object_detection)
13
- 我在 Kaggle 上执行代码,因为那上面提供免费的GPU, 可是它访问不到 google drive,因此我复制了这个数据库。
 
 
10
  ## cppe-5
11
 
12
  我正在 transformers 上练习 [object-detection](https://huggingface.co/docs/transformers/tasks/object_detection)
13
+
14
+ 我在 Kaggle 上执行代码,因为那上面提供免费的GPU, 可是它访问不到 google drive,因此我复制了这个数据集[cppe-5](https://huggingface.co/datasets/cppe-5)。
cppe-5.py ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
data/dataset.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1151086e59fcb87825ecf4d362847a3f023ba69e7ace0f513d5aadc0e3dd3094
3
+ size 238482705
dataset_infos.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"default": {"description": "CPPE - 5 (Medical Personal Protective Equipment) is a new challenging dataset with the goal\nto allow the study of subordinate categorization of medical personal protective equipments,\nwhich is not possible with other popular data sets that focus on broad level categories.\n", "citation": "@misc{dagli2021cppe5,\n title={CPPE-5: Medical Personal Protective Equipment Dataset},\n author={Rishit Dagli and Ali Mustufa Shaikh},\n year={2021},\n eprint={2112.09569},\n archivePrefix={arXiv},\n primaryClass={cs.CV}\n}\n", "homepage": "https://sites.google.com/view/cppe5", "license": "Unknown", "features": {"image_id": {"dtype": "int64", "id": null, "_type": "Value"}, "image": {"id": null, "_type": "Image"}, "width": {"dtype": "int32", "id": null, "_type": "Value"}, "height": {"dtype": "int32", "id": null, "_type": "Value"}, "objects": {"feature": {"id": {"dtype": "int64", "id": null, "_type": "Value"}, "area": {"dtype": "int64", "id": null, "_type": "Value"}, "bbox": {"feature": {"dtype": "float32", "id": null, "_type": "Value"}, "length": 4, "id": null, "_type": "Sequence"}, "category": {"num_classes": 5, "names": ["Coverall", "Face_Shield", "Gloves", "Goggles", "Mask"], "names_file": null, "id": null, "_type": "ClassLabel"}}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "cppe5", "config_name": "default", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 240481281, "num_examples": 1000, "dataset_name": "cppe5"}, "test": {"name": "test", "num_bytes": 4172739, "num_examples": 29, "dataset_name": "cppe5"}}, "download_checksums": {"https://drive.google.com/uc?id=1MGnaAfbckUmigGUvihz7uiHGC6rBIbvr": {"num_bytes": 238482705, "checksum": "1151086e59fcb87825ecf4d362847a3f023ba69e7ace0f513d5aadc0e3dd3094"}}, "download_size": 238482705, "post_processing_size": null, "dataset_size": 244654020, "size_in_bytes": 483136725}}