Update testdata.py
Browse files- testdata.py +25 -19
testdata.py
CHANGED
|
@@ -23,9 +23,6 @@ import re
|
|
| 23 |
from collections import defaultdict
|
| 24 |
import datasets
|
| 25 |
|
| 26 |
-
datasets.logging.set_verbosity_info()
|
| 27 |
-
|
| 28 |
-
|
| 29 |
|
| 30 |
|
| 31 |
_HOMEPAGE = "http://shuoyang1213.me/WIDERFACE/"
|
|
@@ -60,11 +57,29 @@ _URLS = {
|
|
| 60 |
}
|
| 61 |
|
| 62 |
IMG_EXT = ['png', 'jpeg', 'jpg']
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
|
| 65 |
class TestData(datasets.GeneratorBasedBuilder):
|
| 66 |
"""WIDER FACE dataset."""
|
| 67 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
VERSION = datasets.Version("1.0.0")
|
| 69 |
|
| 70 |
def _info(self):
|
|
@@ -90,24 +105,17 @@ class TestData(datasets.GeneratorBasedBuilder):
|
|
| 90 |
datasets.SplitGenerator(
|
| 91 |
name=datasets.Split.TEST,
|
| 92 |
gen_kwargs={
|
| 93 |
-
"
|
| 94 |
-
"data_dir": data_dir["test"],
|
| 95 |
-
"annot_dir": data_dir["annot"],
|
| 96 |
-
},
|
| 97 |
-
),
|
| 98 |
-
datasets.SplitGenerator(
|
| 99 |
-
name=datasets.Split.TRAIN,
|
| 100 |
-
gen_kwargs={
|
| 101 |
-
"split": "normal",
|
| 102 |
"data_dir": data_dir["test"],
|
| 103 |
"annot_dir": data_dir["annot"],
|
| 104 |
},
|
| 105 |
),
|
| 106 |
]
|
| 107 |
|
| 108 |
-
def _generate_examples(self,
|
| 109 |
-
|
| 110 |
-
|
|
|
|
| 111 |
files = []
|
| 112 |
|
| 113 |
idx = 0
|
|
@@ -140,6 +148,4 @@ class TestData(datasets.GeneratorBasedBuilder):
|
|
| 140 |
|
| 141 |
yield idx, {"image": i_file, "faces": faces, "plates": plates}
|
| 142 |
|
| 143 |
-
idx += 1
|
| 144 |
-
|
| 145 |
-
|
|
|
|
| 23 |
from collections import defaultdict
|
| 24 |
import datasets
|
| 25 |
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
|
| 28 |
_HOMEPAGE = "http://shuoyang1213.me/WIDERFACE/"
|
|
|
|
| 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):
|
|
|
|
| 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
|
|
|
|
| 148 |
|
| 149 |
yield idx, {"image": i_file, "faces": faces, "plates": plates}
|
| 150 |
|
| 151 |
+
idx += 1
|
|
|
|
|
|