Skip to content

Commit 38df44e

Browse files
address requested changes
1 parent 38979b3 commit 38df44e

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

tensorflow_datasets/image/div2k.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,15 @@
5959
class Div2kConfig(tfds.core.BuilderConfig):
6060
"""BuilderConfig for Div2k."""
6161

62-
def __init__(self, data, **kwargs):
62+
def __init__(self, name, **kwargs):
6363
"""Constructs a Div2kConfig."""
64-
if data not in _DATA_OPTIONS:
64+
if name not in _DATA_OPTIONS:
6565
raise ValueError("data must be one of %s" % _DATA_OPTIONS)
6666

67-
name = kwargs.get("name", data)
68-
kwargs["name"] = name
69-
7067
description = kwargs.get("description", "Uses %s data." % data)
7168
kwargs["description"] = description
7269

73-
super(Div2kConfig, self).__init__(**kwargs)
70+
super(Div2kConfig, self).__init__(name=name, **kwargs)
7471
self.data = data
7572

7673
def download_urls():
@@ -95,7 +92,6 @@ class Div2k(tfds.core.GeneratorBasedBuilder):
9592
"""DIV2K dataset: DIVerse 2K resolution high quality images"""
9693

9794
BUILDER_CONFIGS = _make_builder_configs()
98-
VERSION = tfds.core.Version("2.0.0")
9995

10096
def _info(self):
10197
return tfds.core.DatasetInfo(
@@ -105,7 +101,7 @@ def _info(self):
105101
"lr": tfds.features.Image(),
106102
"hr": tfds.features.Image(),
107103
}),
108-
#homepage=_DL_URL,
104+
homepage=_DL_URL,
109105
citation=_CITATION,
110106
)
111107

@@ -139,10 +135,11 @@ def _generate_examples(self, lr_path, hr_path):
139135

140136
for root, _, files in tf.io.gfile.walk(lr_path):
141137
if len(files):
142-
for file in files:
143-
yield root + file, {
144-
"lr": os.path.join(root, file),
138+
for file_path in files:
139+
yield root + file_path, {
140+
"lr": os.path.join(root, file_path),
141+
#extract for corresponding file with matching 4 digit id
145142
"hr": os.path.join(hr_path,
146143
re.search(r'\d{4}',
147-
str(file)).group(0) + ".png")
144+
str(file_path)).group(0) + ".png")
148145
}

0 commit comments

Comments
 (0)