TID2013 / TID2013.py
Jorgvt's picture
rollback
87814e8
import os
import pandas as pd
import datasets
_CITATION = """\
@article{ponomarenko_image_2015,
title = {Image database {TID2013}: {Peculiarities}, results and perspectives},
volume = {30},
issn = {09235965},
shorttitle = {Image database {TID2013}},
url = {https://linkinghub.elsevier.com/retrieve/pii/S0923596514001490},
doi = {10.1016/j.image.2014.10.009},
abstract = {This paper describes a recently created image database, TID2013, intended for evaluation of full-reference visual quality assessment metrics. With respect to TID2008, the new database contains a larger number (3000) of test images obtained from 25 reference images, 24 types of distortions for each reference image, and 5 levels for each type of distortion. Motivations for introducing 7 new types of distortions and one additional level of distortions are given; examples of distorted images are presented. Mean opinion scores (MOS) for the new database have been collected by performing 985 subjective experiments with volunteers (observers) from five countries (Finland, France, Italy, Ukraine, and USA). The availability of MOS allows the use of the designed database as a fundamental tool for assessing the effectiveness of visual quality. Furthermore, existing visual quality metrics have been tested with the proposed database and the collected results have been analyzed using rank order correlation coefficients between MOS and considered metrics. These correlation indices have been obtained both considering the full set of distorted images and specific image subsets, for highlighting advantages and drawbacks of existing, state of the art, quality metrics. Approaches to thorough performance analysis for a given metric are presented to detect practical situations or distortion types for which this metric is not adequate enough to human perception. The created image database and the collected MOS values are freely available for downloading and utilization for scientific purposes.},
language = {en},
urldate = {2023-07-04},
journal = {Signal Processing: Image Communication},
author = {Ponomarenko, Nikolay and Jin, Lina and Ieremeiev, Oleg and Lukin, Vladimir and Egiazarian, Karen and Astola, Jaakko and Vozel, Benoit and Chehdi, Kacem and Carli, Marco and Battisti, Federica and Jay Kuo, C.-C.},
month = jan,
year = {2015},
pages = {57--77},
}
"""
_DESCRIPTION = """\
Image Quality Assessment Dataset consisting of 25 reference images, 25 different distortions and 5 intensities per distortion.
In total there are 3000 (reference, distortion, MOS) tuples.
"""
_HOMEPAGE = "https://www.ponomarenko.info/tid2013.htm"
# _LICENSE = ""
class TID2013(datasets.GeneratorBasedBuilder):
"""TID2013 Image Quality Dataset"""
VERSION = datasets.Version("1.0.0")
def _info(self):
# TODO: This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset
features = datasets.Features(
{
"reference": datasets.Image(),
"distorted": datasets.Image(),
"mos": datasets.Value("float"),
}
)
return datasets.DatasetInfo(
description=_DESCRIPTION,
features=features,
# supervised_keys=("reference", "distorted", "mos"),
homepage=_HOMEPAGE,
# license=_LICENSE,
citation=_CITATION,
)
def _split_generators(self, dl_manager):
data_path = dl_manager.download("data.zip")
return [
datasets.SplitGenerator(
name=datasets.Split.TRAIN,
gen_kwargs={
"data": dl_manager.download_and_extract(data_path),
"split": "train",
},
)
]
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
def _generate_examples(self, data, split):
df = pd.read_csv(os.path.join(data, "image_pairs_mos.csv"), index_col=0)
reference_paths = (
df["Reference"]
.apply(lambda x: os.path.join(data, "reference_images", x))
.to_list()
)
distorted_paths = (
df["Distorted"]
.apply(lambda x: os.path.join(data, "distorted_images", x))
.to_list()
)
for key, (ref, dist, m) in enumerate(
zip(reference_paths, distorted_paths, df["MOS"])
):
yield (
key,
{
"reference": ref,
"distorted": dist,
"mos": m,
},
)