Datasets:

Tasks:
Other
Multilinguality:
monolingual
Size Categories:
unknown
Language Creators:
found
Annotations Creators:
machine-generated
Source Datasets:
original
ArXiv:
License:
Eugene Siow commited on
Commit
6262939
1 Parent(s): 8a5c23b

Initial commit.

Browse files
PIRM.py ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
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
+ """PIRM dataset: An validation and test dataset for the image super resolution task"""
16
+
17
+
18
+ import datasets
19
+ from pathlib import Path
20
+
21
+
22
+ _CITATION = """
23
+ @misc{shoeiby2019pirm2018,
24
+ title={PIRM2018 Challenge on Spectral Image Super-Resolution: Dataset and Study},
25
+ author={Mehrdad Shoeiby and Antonio Robles-Kelly and Ran Wei and Radu Timofte},
26
+ year={2019},
27
+ eprint={1904.00540},
28
+ archivePrefix={arXiv},
29
+ primaryClass={cs.CV}
30
+ }
31
+ """
32
+
33
+ _DESCRIPTION = """
34
+ The PIRM dataset consists of 200 images, which are divided into two equal sets for validation and testing.
35
+ These images cover diverse contents, including people, objects, environments, flora, natural scenery, etc.
36
+ Images vary in size, and are typically ~300K pixels in resolution.
37
+
38
+ This dataset was first used for evaluating the perceptual quality of super-resolution algorithms in The 2018 PIRM
39
+ challenge on Perceptual Super-resolution, in conjunction with ECCV 2018.
40
+ """
41
+
42
+ _HOMEPAGE = "https://github.com/roimehrez/PIRM2018"
43
+
44
+ _LICENSE = "cc-by-nc-sa-4.0"
45
+
46
+ _DL_URL = "https://huggingface.co/datasets/eugenesiow/PIRM/resolve/main/data/"
47
+
48
+ _DEFAULT_CONFIG = "bicubic_x2"
49
+
50
+ _DATA_OPTIONS = {
51
+ "bicubic_x2": {
52
+ "hr_test": _DL_URL + "PIRM_test_HR.tar.gz",
53
+ "lr_test": _DL_URL + "PIRM_test_LR_x2.tar.gz",
54
+ "hr_valid": _DL_URL + "PIRM_valid_HR.tar.gz",
55
+ "lr_valid": _DL_URL + "PIRM_valid_LR_x2.tar.gz",
56
+ },
57
+ "bicubic_x3": {
58
+ "hr_test": _DL_URL + "PIRM_test_HR.tar.gz",
59
+ "lr_test": _DL_URL + "PIRM_test_LR_x3.tar.gz",
60
+ "hr_valid": _DL_URL + "PIRM_valid_HR.tar.gz",
61
+ "lr_valid": _DL_URL + "PIRM_valid_LR_x3.tar.gz",
62
+ },
63
+ "bicubic_x4": {
64
+ "hr_test": _DL_URL + "PIRM_test_HR.tar.gz",
65
+ "lr_test": _DL_URL + "PIRM_test_LR_x4.tar.gz",
66
+ "hr_valid": _DL_URL + "PIRM_valid_HR.tar.gz",
67
+ "lr_valid": _DL_URL + "PIRM_valid_LR_x4.tar.gz",
68
+ },
69
+ "unknown_x4": {
70
+ "hr_test": _DL_URL + "PIRM_test_HR.tar.gz",
71
+ "lr_test": _DL_URL + "PIRM_test_LR_unknown_x4.tar.gz",
72
+ "hr_valid": _DL_URL + "PIRM_valid_HR.tar.gz",
73
+ "lr_valid": _DL_URL + "PIRM_valid_LR_unknown_x4.tar.gz",
74
+ }
75
+ }
76
+
77
+
78
+ class PirmConfig(datasets.BuilderConfig):
79
+ """BuilderConfig for PIRM."""
80
+
81
+ def __init__(
82
+ self,
83
+ name,
84
+ download_urls,
85
+ **kwargs,
86
+ ):
87
+ if name not in _DATA_OPTIONS:
88
+ raise ValueError("data must be one of %s" % _DATA_OPTIONS)
89
+ super(PirmConfig, self).__init__(name=name, version=datasets.Version("1.0.0"), **kwargs)
90
+ self.download_urls = download_urls
91
+
92
+
93
+ class Pirm(datasets.GeneratorBasedBuilder):
94
+ """PIRM dataset for single image super resolution test and validation."""
95
+
96
+ BUILDER_CONFIGS = [
97
+ PirmConfig(
98
+ name=key,
99
+ download_urls=values,
100
+ ) for key, values in _DATA_OPTIONS.items()
101
+ ]
102
+
103
+ DEFAULT_CONFIG_NAME = _DEFAULT_CONFIG
104
+
105
+ def _info(self):
106
+ features = datasets.Features(
107
+ {
108
+ "hr": datasets.Value("string"),
109
+ "lr": datasets.Value("string"),
110
+ }
111
+ )
112
+ return datasets.DatasetInfo(
113
+ description=_DESCRIPTION,
114
+ features=features,
115
+ supervised_keys=None,
116
+ homepage=_HOMEPAGE,
117
+ license=_LICENSE,
118
+ citation=_CITATION,
119
+ )
120
+
121
+ def _split_generators(self, dl_manager):
122
+ """Returns SplitGenerators."""
123
+ extracted_paths = dl_manager.download_and_extract(
124
+ self.config.download_urls)
125
+ return [
126
+ datasets.SplitGenerator(
127
+ name=datasets.Split.VALIDATION,
128
+ gen_kwargs={
129
+ "lr_path": extracted_paths["lr_valid"],
130
+ "hr_path": str(Path(extracted_paths["hr_valid"]) / 'PIRM_valid_HR')
131
+ },
132
+ ),
133
+ datasets.SplitGenerator(
134
+ name=datasets.Split.TEST,
135
+ gen_kwargs={
136
+ "lr_path": extracted_paths["lr_test"],
137
+ "hr_path": str(Path(extracted_paths["hr_test"]) / 'PIRM_test_HR')
138
+ },
139
+ )
140
+ ]
141
+
142
+ def _generate_examples(
143
+ self, hr_path, lr_path
144
+ ):
145
+ """ Yields examples as (key, example) tuples. """
146
+ # This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
147
+ # The `key` is here for legacy reason (tfds) and is not important in itself.
148
+ extensions = {'.png'}
149
+ for file_path in sorted(Path(lr_path).glob("**/*")):
150
+ if file_path.suffix in extensions:
151
+ file_path_str = str(file_path.as_posix())
152
+ yield file_path_str, {
153
+ 'lr': file_path_str,
154
+ 'hr': str((Path(hr_path) / file_path.name).as_posix())
155
+ }
README.md ADDED
@@ -0,0 +1,193 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ annotations_creators:
3
+ - machine-generated
4
+ language_creators:
5
+ - found
6
+ languages: []
7
+ licenses:
8
+ - cc-by-nc-sa-4.0
9
+ multilinguality:
10
+ - monolingual
11
+ pretty_name: PIRM
12
+ size_categories:
13
+ - unknown
14
+ source_datasets:
15
+ - original
16
+ task_categories:
17
+ - other
18
+ task_ids:
19
+ - other-other-image-super-resolution
20
+ ---
21
+
22
+ # Dataset Card for PIRM
23
+
24
+ ## Table of Contents
25
+ - [Table of Contents](#table-of-contents)
26
+ - [Dataset Description](#dataset-description)
27
+ - [Dataset Summary](#dataset-summary)
28
+ - [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
29
+ - [Languages](#languages)
30
+ - [Dataset Structure](#dataset-structure)
31
+ - [Data Instances](#data-instances)
32
+ - [Data Fields](#data-fields)
33
+ - [Data Splits](#data-splits)
34
+ - [Dataset Creation](#dataset-creation)
35
+ - [Curation Rationale](#curation-rationale)
36
+ - [Source Data](#source-data)
37
+ - [Annotations](#annotations)
38
+ - [Personal and Sensitive Information](#personal-and-sensitive-information)
39
+ - [Considerations for Using the Data](#considerations-for-using-the-data)
40
+ - [Social Impact of Dataset](#social-impact-of-dataset)
41
+ - [Discussion of Biases](#discussion-of-biases)
42
+ - [Other Known Limitations](#other-known-limitations)
43
+ - [Additional Information](#additional-information)
44
+ - [Dataset Curators](#dataset-curators)
45
+ - [Licensing Information](#licensing-information)
46
+ - [Citation Information](#citation-information)
47
+ - [Contributions](#contributions)
48
+
49
+ ## Dataset Description
50
+
51
+ - **Homepage**: https://github.com/roimehrez/PIRM2018
52
+ - **Repository**: https://huggingface.co/datasets/eugenesiow/PIRM
53
+ - **Paper**: https://arxiv.org/abs/1809.07517
54
+ - **Leaderboard**: https://github.com/eugenesiow/super-image#scale-x2
55
+
56
+ ### Dataset Summary
57
+
58
+ The PIRM dataset consists of 200 images, which are divided into two equal sets for validation and testing.
59
+ These images cover diverse contents, including people, objects, environments, flora, natural scenery, etc.
60
+ Images vary in size, and are typically ~300K pixels in resolution.
61
+
62
+ This dataset was first used for evaluating the perceptual quality of super-resolution algorithms in The 2018 PIRM
63
+ challenge on Perceptual Super-resolution, in conjunction with ECCV 2018.
64
+
65
+ Install with `pip`:
66
+ ```bash
67
+ pip install datasets super-image
68
+ ```
69
+
70
+ Evaluate a model with the [`super-image`](https://github.com/eugenesiow/super-image) library:
71
+ ```python
72
+ from datasets import load_dataset
73
+ from super_image import EdsrModel
74
+ from super_image.data import EvalDataset, EvalMetrics
75
+
76
+ dataset = load_dataset('eugenesiow/PIRM', 'bicubic_x2', split='validation')
77
+ eval_dataset = EvalDataset(dataset)
78
+ model = EdsrModel.from_pretrained('eugenesiow/edsr-base', scale=2)
79
+ EvalMetrics().evaluate(model, eval_dataset)
80
+ ```
81
+
82
+ ### Supported Tasks and Leaderboards
83
+
84
+ The dataset is commonly used for evaluation of the `image-super-resolution` task.
85
+
86
+ Unofficial [`super-image`](https://github.com/eugenesiow/super-image) leaderboard for:
87
+ - [Scale 2](https://github.com/eugenesiow/super-image#scale-x2)
88
+ - [Scale 3](https://github.com/eugenesiow/super-image#scale-x3)
89
+ - [Scale 4](https://github.com/eugenesiow/super-image#scale-x4)
90
+ - [Scale 8](https://github.com/eugenesiow/super-image#scale-x8)
91
+
92
+ ### Languages
93
+
94
+ Not applicable.
95
+
96
+ ## Dataset Structure
97
+
98
+ ### Data Instances
99
+
100
+ An example of `validation` for `bicubic_x2` looks as follows.
101
+ ```
102
+ {
103
+ "hr": "/.cache/huggingface/datasets/downloads/extracted/PIRM_valid_HR/1.png",
104
+ "lr": "/.cache/huggingface/datasets/downloads/extracted/PIRM_valid_LR_x2/1.png"
105
+ }
106
+ ```
107
+
108
+ ### Data Fields
109
+
110
+ The data fields are the same among all splits.
111
+
112
+ - `hr`: a `string` to the path of the High Resolution (HR) `.png` image.
113
+ - `lr`: a `string` to the path of the Low Resolution (LR) `.png` image.
114
+
115
+ ### Data Splits
116
+
117
+ | name |validation|test|
118
+ |-------|---:|---:|
119
+ |bicubic_x2|100|100|
120
+ |bicubic_x3|100|100|
121
+ |bicubic_x4|100|100|
122
+ |unknown_x4|100|100|
123
+
124
+ ## Dataset Creation
125
+
126
+ ### Curation Rationale
127
+
128
+ [More Information Needed]
129
+
130
+ ### Source Data
131
+
132
+ #### Initial Data Collection and Normalization
133
+
134
+ [More Information Needed]
135
+
136
+ #### Who are the source language producers?
137
+
138
+ [More Information Needed]
139
+
140
+ ### Annotations
141
+
142
+ #### Annotation process
143
+
144
+ No annotations.
145
+
146
+ #### Who are the annotators?
147
+
148
+ No annotators.
149
+
150
+ ### Personal and Sensitive Information
151
+
152
+ [More Information Needed]
153
+
154
+ ## Considerations for Using the Data
155
+
156
+ ### Social Impact of Dataset
157
+
158
+ [More Information Needed]
159
+
160
+ ### Discussion of Biases
161
+
162
+ [More Information Needed]
163
+
164
+ ### Other Known Limitations
165
+
166
+ [More Information Needed]
167
+
168
+ ## Additional Information
169
+
170
+ ### Dataset Curators
171
+
172
+ - **Original Authors**: [Blau et al. (2018)](https://arxiv.org/abs/1809.07517)
173
+
174
+ ### Licensing Information
175
+
176
+ This dataset is published under the [Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-nc-sa/4.0/).
177
+
178
+ ### Citation Information
179
+
180
+ ```bibtex
181
+ @misc{blau20192018,
182
+ title={The 2018 PIRM Challenge on Perceptual Image Super-resolution},
183
+ author={Yochai Blau and Roey Mechrez and Radu Timofte and Tomer Michaeli and Lihi Zelnik-Manor},
184
+ year={2019},
185
+ eprint={1809.07517},
186
+ archivePrefix={arXiv},
187
+ primaryClass={cs.CV}
188
+ }
189
+ ```
190
+
191
+ ### Contributions
192
+
193
+ Thanks to [@eugenesiow](https://github.com/eugenesiow) for adding this dataset.
data/PIRM_test_HR.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:722d9d12835b5a101327b7252f9f513266208e6f9c63d62c5469633ab9d5f8f0
3
+ size 53252850
data/PIRM_test_LR_unknown_x4.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c00ce09b637dd5b46d3786e9978be088acec80ecbc6da12dfb486386bd71d7c3
3
+ size 3683703
data/PIRM_test_LR_x2.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a365aca6499c043326d2732f54b56129a2398a9adf7f484c339019a9e12ba210
3
+ size 14047897
data/PIRM_test_LR_x3.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:711b7b79ccd1507e6db1e42145c3443750a09992780d30bcf823ade110377b2c
3
+ size 6450434
data/PIRM_test_LR_x4.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2026c21b1167b3746cf11d587527f39836ceda22964aec7c6d262fc731016a48
3
+ size 3715004
data/PIRM_valid_HR.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:edea941b7c2449d7f6074ebd513ca102fa2d8597c09f6127d2cc39c02414e48c
3
+ size 51785319
data/PIRM_valid_LR_unknown_x4.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:257e8326db1cd331fb9cb433936f613e644b08df3bd8448c6328ce5c9831308b
3
+ size 3613501
data/PIRM_valid_LR_x2.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:da23f799bf2ecef10e613445f44fec2d5879fa08d0d119787f8fcd675a733a7e
3
+ size 13687321
data/PIRM_valid_LR_x3.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a82751e82aaa6a95da7bb19747a18eb9302945c53e0b6f858b9d60c77afb4e1f
3
+ size 6293280
data/PIRM_valid_LR_x4.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:59d3c017fdb2cd958a74372acc123c549431f4ac8311d4c58a7101d0b12c0bac
3
+ size 3638593