RiccardoMaso commited on
Commit
9472272
1 Parent(s): e38f762

Delete README.md

Browse files
Files changed (1) hide show
  1. README.md +0 -165
README.md DELETED
@@ -1,165 +0,0 @@
1
- # coding=utf-8
2
- # Copyright 2020 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
- """WIDER FACE dataset."""
16
-
17
- import os
18
-
19
- import datasets
20
-
21
-
22
- _HOMEPAGE = "http://shuoyang1213.me/WIDERFACE/"
23
-
24
- _LICENSE = "Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)"
25
-
26
- _CITATION = """\
27
- @inproceedings{yang2016wider,
28
- Author = {Yang, Shuo and Luo, Ping and Loy, Chen Change and Tang, Xiaoou},
29
- Booktitle = {IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
30
- Title = {WIDER FACE: A Face Detection Benchmark},
31
- Year = {2016}}
32
- """
33
-
34
- _DESCRIPTION = """\
35
- WIDER FACE dataset is a face detection benchmark dataset, of which images are
36
- selected from the publicly available WIDER dataset. We choose 32,203 images and
37
- label 393,703 faces with a high degree of variability in scale, pose and
38
- occlusion as depicted in the sample images. WIDER FACE dataset is organized
39
- based on 61 event classes. For each event class, we randomly select 40%/10%/50%
40
- data as training, validation and testing sets. We adopt the same evaluation
41
- metric employed in the PASCAL VOC dataset. Similar to MALF and Caltech datasets,
42
- we do not release bounding box ground truth for the test images. Users are
43
- required to submit final prediction files, which we shall proceed to evaluate.
44
- """
45
-
46
-
47
- _REPO = "https://huggingface.co/datasets/wider_face/resolve/main/data"
48
- _URLS = {
49
- "train": f"{_REPO}/WIDER_train.zip",
50
- "validation": f"{_REPO}/WIDER_val.zip",
51
- "test": f"{_REPO}/WIDER_test.zip",
52
- "annot": f"{_REPO}/wider_face_split.zip",
53
- }
54
-
55
-
56
- class WiderFace(datasets.GeneratorBasedBuilder):
57
- """WIDER FACE dataset."""
58
-
59
- VERSION = datasets.Version("1.0.0")
60
-
61
- def _info(self):
62
- return datasets.DatasetInfo(
63
- description=_DESCRIPTION,
64
- features=datasets.Features(
65
- {
66
- "image": datasets.Image(),
67
- "faces": datasets.Sequence(
68
- {
69
- "bbox": datasets.Sequence(datasets.Value("float32"), length=4),
70
- "blur": datasets.ClassLabel(names=["clear", "normal", "heavy"]),
71
- "expression": datasets.ClassLabel(names=["typical", "exaggerate"]),
72
- "illumination": datasets.ClassLabel(names=["normal", "exaggerate "]),
73
- "occlusion": datasets.ClassLabel(names=["no", "partial", "heavy"]),
74
- "pose": datasets.ClassLabel(names=["typical", "atypical"]),
75
- "invalid": datasets.Value("bool"),
76
- }
77
- ),
78
- }
79
- ),
80
- supervised_keys=None,
81
- homepage=_HOMEPAGE,
82
- license=_LICENSE,
83
- citation=_CITATION,
84
- )
85
-
86
- def _split_generators(self, dl_manager):
87
- data_dir = dl_manager.download_and_extract(_URLS)
88
- return [
89
- datasets.SplitGenerator(
90
- name=datasets.Split.TRAIN,
91
- gen_kwargs={
92
- "split": "train",
93
- "data_dir": data_dir["train"],
94
- "annot_dir": data_dir["annot"],
95
- },
96
- ),
97
- datasets.SplitGenerator(
98
- name=datasets.Split.TEST,
99
- gen_kwargs={
100
- "split": "test",
101
- "data_dir": data_dir["test"],
102
- "annot_dir": data_dir["annot"],
103
- },
104
- ),
105
- datasets.SplitGenerator(
106
- name=datasets.Split.VALIDATION,
107
- gen_kwargs={
108
- "split": "val",
109
- "data_dir": data_dir["validation"],
110
- "annot_dir": data_dir["annot"],
111
- },
112
- ),
113
- ]
114
-
115
- def _generate_examples(self, split, data_dir, annot_dir):
116
- image_dir = os.path.join(data_dir, "WIDER_" + split, "images")
117
- annot_fname = "wider_face_test_filelist.txt" if split == "test" else f"wider_face_{split}_bbx_gt.txt"
118
- with open(os.path.join(annot_dir, "wider_face_split", annot_fname), "r", encoding="utf-8") as f:
119
- idx = 0
120
- while True:
121
- line = f.readline()
122
- line = line.rstrip()
123
- if not line.endswith(".jpg"):
124
- break
125
- image_file_path = os.path.join(image_dir, line)
126
- faces = []
127
- if split != "test":
128
- # Read number of bounding boxes
129
- nbboxes = int(f.readline())
130
- # Cases with 0 bounding boxes, still have one line with all zeros.
131
- # So we have to read it and discard it.
132
- if nbboxes == 0:
133
- f.readline()
134
- else:
135
- for _ in range(nbboxes):
136
- line = f.readline()
137
- line = line.rstrip()
138
- line_split = line.split()
139
- assert len(line_split) == 10, f"Cannot parse line: {line_split}"
140
- line_parsed = [int(n) for n in line_split]
141
- (
142
- xmin,
143
- ymin,
144
- wbox,
145
- hbox,
146
- blur,
147
- expression,
148
- illumination,
149
- invalid,
150
- occlusion,
151
- pose,
152
- ) = line_parsed
153
- faces.append(
154
- {
155
- "bbox": [xmin, ymin, wbox, hbox],
156
- "blur": blur,
157
- "expression": expression,
158
- "illumination": illumination,
159
- "occlusion": occlusion,
160
- "pose": pose,
161
- "invalid": invalid,
162
- }
163
- )
164
- yield idx, {"image": image_file_path, "faces": faces}
165
- idx += 1