59
59
class Div2kConfig (tfds .core .BuilderConfig ):
60
60
"""BuilderConfig for Div2k."""
61
61
62
- def __init__ (self , data , ** kwargs ):
62
+ def __init__ (self , name , ** kwargs ):
63
63
"""Constructs a Div2kConfig."""
64
- if data not in _DATA_OPTIONS :
64
+ if name not in _DATA_OPTIONS :
65
65
raise ValueError ("data must be one of %s" % _DATA_OPTIONS )
66
66
67
- name = kwargs .get ("name" , data )
68
- kwargs ["name" ] = name
69
-
70
67
description = kwargs .get ("description" , "Uses %s data." % data )
71
68
kwargs ["description" ] = description
72
69
73
- super (Div2kConfig , self ).__init__ (** kwargs )
70
+ super (Div2kConfig , self ).__init__ (name = name , ** kwargs )
74
71
self .data = data
75
72
76
73
def download_urls ():
@@ -95,7 +92,6 @@ class Div2k(tfds.core.GeneratorBasedBuilder):
95
92
"""DIV2K dataset: DIVerse 2K resolution high quality images"""
96
93
97
94
BUILDER_CONFIGS = _make_builder_configs ()
98
- VERSION = tfds .core .Version ("2.0.0" )
99
95
100
96
def _info (self ):
101
97
return tfds .core .DatasetInfo (
@@ -105,7 +101,7 @@ def _info(self):
105
101
"lr" : tfds .features .Image (),
106
102
"hr" : tfds .features .Image (),
107
103
}),
108
- # homepage=_DL_URL,
104
+ homepage = _DL_URL ,
109
105
citation = _CITATION ,
110
106
)
111
107
@@ -139,10 +135,11 @@ def _generate_examples(self, lr_path, hr_path):
139
135
140
136
for root , _ , files in tf .io .gfile .walk (lr_path ):
141
137
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
145
142
"hr" : os .path .join (hr_path ,
146
143
re .search (r'\d{4}' ,
147
- str (file )).group (0 ) + ".png" )
144
+ str (file_path )).group (0 ) + ".png" )
148
145
}
0 commit comments