Eugene Siow
commited on
Commit
·
2221e74
1
Parent(s):
bcb97ac
Add fix for config name bug.
Browse files
Set5.py
CHANGED
|
@@ -68,7 +68,7 @@ class Set5Config(datasets.BuilderConfig):
|
|
| 68 |
):
|
| 69 |
if name not in _DATA_OPTIONS:
|
| 70 |
raise ValueError("data must be one of %s" % _DATA_OPTIONS)
|
| 71 |
-
super(Set5Config, self).__init__(version=datasets.Version("1.0.0"
|
| 72 |
self.hr_url = hr_url
|
| 73 |
self.lr_url = lr_url
|
| 74 |
|
|
@@ -78,12 +78,14 @@ class Set5(datasets.GeneratorBasedBuilder):
|
|
| 78 |
|
| 79 |
BUILDER_CONFIGS = [
|
| 80 |
Set5Config(
|
| 81 |
-
name=
|
| 82 |
hr_url=values['hr'],
|
| 83 |
lr_url=values['lr']
|
| 84 |
-
) for
|
| 85 |
]
|
| 86 |
|
|
|
|
|
|
|
| 87 |
DEFAULT_CONFIG_NAME = _DEFAULT_CONFIG
|
| 88 |
|
| 89 |
def _info(self):
|
|
@@ -112,7 +114,7 @@ class Set5(datasets.GeneratorBasedBuilder):
|
|
| 112 |
# These kwargs will be passed to _generate_examples
|
| 113 |
gen_kwargs={
|
| 114 |
"lr_path": lr_data_dir,
|
| 115 |
-
"hr_path": hr_data_dir
|
| 116 |
},
|
| 117 |
)
|
| 118 |
]
|
|
@@ -124,10 +126,10 @@ class Set5(datasets.GeneratorBasedBuilder):
|
|
| 124 |
# This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
|
| 125 |
# The `key` is here for legacy reason (tfds) and is not important in itself.
|
| 126 |
extensions = {'.jpg', '.jpeg', '.png'}
|
| 127 |
-
for file_path in sorted(Path(
|
| 128 |
if file_path.suffix in extensions:
|
| 129 |
file_path_str = str(file_path.as_posix())
|
| 130 |
yield file_path_str, {
|
| 131 |
-
'
|
| 132 |
-
'
|
| 133 |
}
|
|
|
|
| 68 |
):
|
| 69 |
if name not in _DATA_OPTIONS:
|
| 70 |
raise ValueError("data must be one of %s" % _DATA_OPTIONS)
|
| 71 |
+
super(Set5Config, self).__init__(name=name, version=datasets.Version("1.0.0"), **kwargs)
|
| 72 |
self.hr_url = hr_url
|
| 73 |
self.lr_url = lr_url
|
| 74 |
|
|
|
|
| 78 |
|
| 79 |
BUILDER_CONFIGS = [
|
| 80 |
Set5Config(
|
| 81 |
+
name=key,
|
| 82 |
hr_url=values['hr'],
|
| 83 |
lr_url=values['lr']
|
| 84 |
+
) for key, values in _DATA_OPTIONS.items()
|
| 85 |
]
|
| 86 |
|
| 87 |
+
print(BUILDER_CONFIGS)
|
| 88 |
+
|
| 89 |
DEFAULT_CONFIG_NAME = _DEFAULT_CONFIG
|
| 90 |
|
| 91 |
def _info(self):
|
|
|
|
| 114 |
# These kwargs will be passed to _generate_examples
|
| 115 |
gen_kwargs={
|
| 116 |
"lr_path": lr_data_dir,
|
| 117 |
+
"hr_path": str(Path(hr_data_dir) / 'Set5_HR')
|
| 118 |
},
|
| 119 |
)
|
| 120 |
]
|
|
|
|
| 126 |
# This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
|
| 127 |
# The `key` is here for legacy reason (tfds) and is not important in itself.
|
| 128 |
extensions = {'.jpg', '.jpeg', '.png'}
|
| 129 |
+
for file_path in sorted(Path(lr_path).glob("**/*")):
|
| 130 |
if file_path.suffix in extensions:
|
| 131 |
file_path_str = str(file_path.as_posix())
|
| 132 |
yield file_path_str, {
|
| 133 |
+
'lr': file_path_str,
|
| 134 |
+
'hr': str((Path(hr_path) / file_path.name).as_posix())
|
| 135 |
}
|