update
Browse files- .gitattributes +2 -0
- data/annotations.zip +2 -2
- data/{fisheye.zip → images.zip} +2 -2
- data/soiling_annotations.zip +2 -2
- requirements.txt +3 -7
- testdata.py +3 -151
.gitattributes
CHANGED
@@ -49,3 +49,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
49 |
*.jpg filter=lfs diff=lfs merge=lfs -text
|
50 |
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
51 |
*.webp filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
49 |
*.jpg filter=lfs diff=lfs merge=lfs -text
|
50 |
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
51 |
*.webp filter=lfs diff=lfs merge=lfs -text
|
52 |
+
testdata.py filter=lfs diff=lfs merge=lfs -text
|
53 |
+
requirements.txt filter=lfs diff=lfs merge=lfs -text
|
data/annotations.zip
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:aca1fed529a6f00598db63a1c685c3915d33d420430bad252a2822bac4b6609c
|
3 |
+
size 982986
|
data/{fisheye.zip → images.zip}
RENAMED
@@ -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:486d98266f56405840eda965c6d4e54008013e11456ed2e878abb9070cdc5286
|
3 |
+
size 4512838147
|
data/soiling_annotations.zip
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:10731fc73eead247d280ce895d342f71b934eefdec1b7ab3622c92d7a3ddf516
|
3 |
+
size 1005826
|
requirements.txt
CHANGED
@@ -1,7 +1,3 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
pathlib
|
5 |
-
collections2
|
6 |
-
typing
|
7 |
-
Pillow
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:75d5618340023c3bab178f665513bee627f116ad66ba3a13963d7fe798330588
|
3 |
+
size 45
|
|
|
|
|
|
|
|
testdata.py
CHANGED
@@ -1,151 +1,3 @@
|
|
1 |
-
|
2 |
-
|
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 |
-
"""PP4AV dataset."""
|
16 |
-
|
17 |
-
import os
|
18 |
-
from glob import glob
|
19 |
-
from tqdm import tqdm
|
20 |
-
from pathlib import Path
|
21 |
-
from typing import List
|
22 |
-
import re
|
23 |
-
from collections import defaultdict
|
24 |
-
import datasets
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
_HOMEPAGE = "http://shuoyang1213.me/WIDERFACE/"
|
29 |
-
|
30 |
-
_LICENSE = "Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)"
|
31 |
-
|
32 |
-
_CITATION = """\
|
33 |
-
@inproceedings{yang2016wider,
|
34 |
-
Author = {Yang, Shuo and Luo, Ping and Loy, Chen Change and Tang, Xiaoou},
|
35 |
-
Booktitle = {IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
|
36 |
-
Title = {WIDER FACE: A Face Detection Benchmark},
|
37 |
-
Year = {2016}}
|
38 |
-
"""
|
39 |
-
|
40 |
-
_DESCRIPTION = """\
|
41 |
-
WIDER FACE dataset is a face detection benchmark dataset, of which images are
|
42 |
-
selected from the publicly available WIDER dataset. We choose 32,203 images and
|
43 |
-
label 393,703 faces with a high degree of variability in scale, pose and
|
44 |
-
occlusion as depicted in the sample images. WIDER FACE dataset is organized
|
45 |
-
based on 61 event classes. For each event class, we randomly select 40%/10%/50%
|
46 |
-
data as training, validation and testing sets. We adopt the same evaluation
|
47 |
-
metric employed in the PASCAL VOC dataset. Similar to MALF and Caltech datasets,
|
48 |
-
we do not release bounding box ground truth for the test images. Users are
|
49 |
-
required to submit final prediction files, which we shall proceed to evaluate.
|
50 |
-
"""
|
51 |
-
|
52 |
-
|
53 |
-
_REPO = "https://huggingface.co/datasets/khaclinh/testdata/resolve/main/data"
|
54 |
-
_URLS = {
|
55 |
-
"test": f"{_REPO}/fisheye.zip",
|
56 |
-
"annot": f"{_REPO}/annotations.zip",
|
57 |
-
}
|
58 |
-
|
59 |
-
IMG_EXT = ['png', 'jpeg', 'jpg']
|
60 |
-
_SUBREDDITS = ["zurich"]
|
61 |
-
|
62 |
-
class TestDataConfig(datasets.BuilderConfig):
|
63 |
-
"""BuilderConfig for TestData."""
|
64 |
-
|
65 |
-
def __init__(self, name, **kwargs):
|
66 |
-
"""BuilderConfig for TestData.
|
67 |
-
Args:
|
68 |
-
**kwargs: keyword arguments forwarded to super.
|
69 |
-
"""
|
70 |
-
super(TestDataConfig, self).__init__(version=datasets.Version("1.0.0", ""), name=name, **kwargs)
|
71 |
-
|
72 |
-
class TestData(datasets.GeneratorBasedBuilder):
|
73 |
-
"""WIDER FACE dataset."""
|
74 |
-
|
75 |
-
BUILDER_CONFIGS = [
|
76 |
-
TestDataConfig("fisheye"),
|
77 |
-
]
|
78 |
-
|
79 |
-
BUILDER_CONFIGS += [TestDataConfig(subreddit) for subreddit in _SUBREDDITS]
|
80 |
-
|
81 |
-
DEFAULT_CONFIG_NAME = "fisheye"
|
82 |
-
|
83 |
-
VERSION = datasets.Version("1.0.0")
|
84 |
-
|
85 |
-
def _info(self):
|
86 |
-
return datasets.DatasetInfo(
|
87 |
-
description=_DESCRIPTION,
|
88 |
-
features=datasets.Features(
|
89 |
-
{
|
90 |
-
"image": datasets.Image(),
|
91 |
-
"faces": datasets.Sequence(datasets.Sequence(datasets.Value("float32"), length=4)),
|
92 |
-
"plates": datasets.Sequence(datasets.Sequence(datasets.Value("float32"), length=4)),
|
93 |
-
|
94 |
-
}
|
95 |
-
),
|
96 |
-
supervised_keys=None,
|
97 |
-
homepage=_HOMEPAGE,
|
98 |
-
license=_LICENSE,
|
99 |
-
citation=_CITATION,
|
100 |
-
)
|
101 |
-
|
102 |
-
def _split_generators(self, dl_manager):
|
103 |
-
data_dir = dl_manager.download_and_extract(_URLS)
|
104 |
-
return [
|
105 |
-
datasets.SplitGenerator(
|
106 |
-
name=datasets.Split.TEST,
|
107 |
-
gen_kwargs={
|
108 |
-
"name": self.config.name,
|
109 |
-
"data_dir": data_dir["test"],
|
110 |
-
"annot_dir": data_dir["annot"],
|
111 |
-
},
|
112 |
-
),
|
113 |
-
]
|
114 |
-
|
115 |
-
def _generate_examples(self, name, data_dir, annot_dir):
|
116 |
-
|
117 |
-
image_dir = os.path.join(data_dir, name)
|
118 |
-
annotation_dir = os.path.join(annot_dir, name)
|
119 |
-
files = []
|
120 |
-
|
121 |
-
idx = 0
|
122 |
-
for i_file in glob(os.path.join(image_dir, "*.png")):
|
123 |
-
plates = []
|
124 |
-
faces = []
|
125 |
-
|
126 |
-
img_relative_file = os.path.relpath(i_file, image_dir)
|
127 |
-
gt_relative_path = img_relative_file.replace(".png", ".txt")
|
128 |
-
|
129 |
-
gt_path = os.path.join(annotation_dir, gt_relative_path)
|
130 |
-
|
131 |
-
annotation = defaultdict(list)
|
132 |
-
with open(gt_path, "r", encoding="utf-8") as f:
|
133 |
-
line = f.readline().strip()
|
134 |
-
while line:
|
135 |
-
assert re.match(r"^\d( [\d\.]+){4,5}$", line), "Incorrect line: %s" % line
|
136 |
-
cls, cx, cy, w, h = line.split()[:5]
|
137 |
-
cls, cx, cy, w, h = int(cls), float(cx), float(cy), float(w), float(h)
|
138 |
-
x1, y1, x2, y2 = cx - w / 2, cy - h / 2, cx + w / 2, cy + h / 2
|
139 |
-
annotation[cls].append([x1, y1, x2, y2])
|
140 |
-
line = f.readline().strip()
|
141 |
-
|
142 |
-
for cls, bboxes in annotation.items():
|
143 |
-
for x1, y1, x2, y2 in bboxes:
|
144 |
-
if cls == 0:
|
145 |
-
faces.append([x1, y1, x2, y2])
|
146 |
-
else:
|
147 |
-
plates.append([x1, y1, x2, y2])
|
148 |
-
|
149 |
-
yield idx, {"image": i_file, "faces": faces, "plates": plates}
|
150 |
-
|
151 |
-
idx += 1
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3a3c670d21b2609d4427111d778dfec3438529f196a2287b778541809e357c54
|
3 |
+
size 5682
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|