% WACV 2024 Paper Template
% based on the CVPR 2023 template (https://media.icml.cc/Conferences/CVPR2023/cvpr2023-author_kit-v1_1-1.zip) with 2-track changes from the WACV 2023 template (https://github.com/wacv-pcs/WACV-2023-Author-Kit)
% based on the CVPR template provided by Ming-Ming Cheng (https://github.com/MCG-NKU/CVPR_Template)
% modified and extended by Stefan Roth (stefan.roth@NOSPAMtu-darmstadt.de)

\documentclass[10pt,twocolumn,letterpaper]{article}

%%%%%%%%% PAPER TYPE  - PLEASE UPDATE FOR FINAL VERSION
\usepackage[review,algorithms]{wacv}      % To produce the REVIEW version for the algorithms track
%\usepackage[review,applications]{wacv}      % To produce the REVIEW version for the applications track
%\usepackage{wacv}              % To produce the CAMERA-READY version
%\usepackage[pagenumbers]{wacv} % To force page numbers, e.g. for an arXiv version

% Include other packages here, before hyperref.
\usepackage{times}
\usepackage{epsfig}
\usepackage{graphicx,scalerel}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{booktabs}
%%% --- Commands Agnolucci --- %%%
\newcommand*{\thead}[1]{\multicolumn{1}{c}{\bfseries #1}} %% table headers
\newcommand{\hide}[1]{}
\newcommand{\hidefoot}[1]{\footnote{{\bf #1}}}
\newcommand{\todo}[1]{{\bf TO DO: {#1}}}
\newcommand{\dquote}[1]{``#1''}
\newcommand{\alert}[1]{\textcolor{red}{#1}}
\newcommand{\answer}[1]{\textcolor{blue}{#1}}
\newcommand\wh[1]{\hstretch{2}{\hat{\hstretch{0.5}{#1\mkern1.5mu}}}\mkern0mu}
\usepackage{color}
\usepackage{xcolor,colortbl}
\usepackage{mathtools}
\usepackage{multirow}
\usepackage{bm} % For bolding math symbols
%% Commands to use when the space is tight
\setlength{\floatsep}{11.0pt plus 2.0pt minus 2.0pt}
\setlength{\textfloatsep}{11.0pt plus 2.0pt minus 2.0pt}
\setlength{\intextsep}{13.0pt plus 2.0pt minus 2.0pt}
\setlength{\dbltextfloatsep}{13.0pt plus 2.0pt minus 2.0pt}
\setlength{\dblfloatsep}{13.0pt plus 2.0pt minus 2.0pt}
%\raggedbottom     % To see where there is some blank space
\definecolor{purple}{rgb}{0.65,0,0.65}
\definecolor{dark_green}{rgb}{0, 0.5, 0}
\definecolor{blueish}{rgb}{0.0, 0.3, .6}
\definecolor{tabhighlight}{HTML}{e5e5e5}
\newcolumntype{h}{>{\columncolor{tabhighlight}}c}

% Marco Bertini (MB)
\newcommand{\mb}[1]{{\color{blueish}#1}} %< I changed something and I want you to see it
\newcommand{\MB}[1]{{\color{blueish}{\bf [MB: #1]}}} %< inlined comment for max visibility
\newcommand{\Mb}[1]{\marginpar{\tiny{\textcolor{blueish}{#1}}}} %< useful for ~deadline (no layout changes)
% Lorenzo Agnolucci (LA)
\newcommand{\la}[1]{{\color{purple}#1}}
\newcommand{\LA}[1]{{\color{purple}{\bf [LA: #1]}}}
\newcommand{\La}[1]{\marginpar{\tiny{\textcolor{purple}{#1}}}}
% Leonardo Galteri (LG)
\newcommand{\leo}[1]{{\color{dark_green}#1}}
\newcommand{\LEO}[1]{{\color{dark_green}{\bf [LEO: #1]}}}
\newcommand{\Leo}[1]{\marginpar{\tiny{\textcolor{dark_green}{#1}}}}

% Define command for lower widetilde
\makeatletter
\newcommand*\wt[2][0.15ex]{%
        \begingroup
        \mathchoice{\wt@helper{#1}{#2}{\displaystyle}{\textfont}}
                   {\wt@helper{#1}{#2}{\textstyle}{\textfont}}
                   {\wt@helper{#1}{#2}{\scriptstyle}{\scriptfont}}
                   {\wt@helper{#1}{#2}{\scriptscriptstyle}{\scriptscriptfont}}%
        \endgroup
        #2%
}
\newcommand*\wt@helper[4]{%
        \def\currentfont{\the#41}%
        \def\currentskewchar{\char\the\skewchar\currentfont}%
        \setbox\tw@\hbox{\currentfont#2\currentskewchar}%
        \dimen@ii\wd\tw@
        \setbox\tw@\hbox{\currentfont#2{}\currentskewchar}%
        \advance\dimen@ii-\wd\tw@
        \rlap{\raisebox{-#1}{$\m@th#3\kern\dimen@ii\widetilde{\phantom{#2}}$}}%
}
\makeatother

\newcommand{\method}{ARNIQA\xspace}
\newcommand{\methodextended}{ARNIQA (leArning distoRtion maNifold for Image Quality Assessment)\xspace}
\newcommand{\live}{LIVE\xspace}
\newcommand{\clive}{CLIVE\xspace}
\newcommand{\csiq}{CSIQ\xspace}
\newcommand{\tid}{TID2013\xspace}
\newcommand{\kadid}{KADID\xspace}
\newcommand{\koniq}{KonIQ\xspace}
\newcommand{\spaq}{SPAQ\xspace}
\newcommand{\flive}{FLIVE\xspace}
\newcommand{\srcc}{SRCC\xspace}
\newcommand{\plcc}{PLCC\xspace}
\newcommand{\ndist}{n_{dist}\xspace}
\newcommand{\Ndist}{N_{dist}\xspace}


% It is strongly recommended to use hyperref, especially for the review version.
% hyperref with option pagebackref eases the reviewers' job.
% Please disable hyperref *only* if you encounter grave issues, e.g. with the
% file validation for the camera-ready version.
%
% If you comment hyperref and then uncomment it, you should delete
% ReviewTempalte.aux before re-running LaTeX.
% (Or just hit 'q' on the first LaTeX run, let it finish, and you
%  should be clear).
\usepackage[pagebackref,breaklinks,colorlinks]{hyperref}


% Support for easy cross-referencing
\usepackage[capitalize]{cleveref}
\crefname{section}{Sec.}{Secs.}
\Crefname{section}{Section}{Sections}
\Crefname{table}{Table}{Tables}
\crefname{table}{Tab.}{Tabs.}


%%%%%%%%% PAPER ID  - PLEASE UPDATE
\def\wacvPaperID{2061} % *** Enter the WACV Paper ID here
\def\confName{WACV}
\def\confYear{2024}


\begin{document}

%%%%%%%%% TITLE - PLEASE UPDATE
\title{\method: Learning Distortion Manifold for Image Quality Assessment}

\author{First Author\\
Institution1\\
Institution1 address\\
{\tt\small firstauthor@i1.org}
% For a paper whose authors are all at the same institution,
% omit the following lines up until the closing ``}''.
% Additional authors and addresses can be added with ``\and'',
% just like the second author.
% To save space, use either the email address or home page, not both
\and
Second Author\\
Institution2\\
First line of institution2 address\\
{\tt\small secondauthor@i2.org}
}
\maketitle

%%%%%%%%% ABSTRACT
\begin{abstract}
    No-Reference Image Quality Assessment (NR-IQA) aims to develop methods to measure image quality in alignment with human perception without the need for a high-quality reference image. In this work, we propose a self-supervised approach named \methodextended for modeling the image distortion manifold to obtain quality representations in an intrinsic manner. First, we introduce an image degradation model that randomly composes ordered sequences of consecutively applied distortions. In this way, we can synthetically degrade images with a large variety of degradation patterns. Second, we propose to train our model by maximizing the similarity between the representations of patches of different images distorted equally, despite varying content. Therefore, images degraded in the same manner correspond to neighboring positions within the distortion manifold. Finally, we map the image representations to the quality scores with a simple linear regressor, thus without fine-tuning the encoder weights. The experiments show that our approach achieves state-of-the-art performance on several datasets. In addition, \method demonstrates improved data efficiency, generalization capabilities, and robustness compared to competing methods. The code and the model are publicly available \footnote{\url{URL} available upon acceptance}. 
\end{abstract}

%%%%%%%%% BODY TEXT
\section{Introduction}

\begin{figure}
    \captionsetup{skip=6pt}
    \centering
    \includegraphics[width=\linewidth]{WACV2024/imgs/teaser.pdf}
    \caption{Comparison between our approach and the State of the Art for NR-IQA. While the SotA maximizes the similarity between the representations of crops from the same image, we propose to consider crops from different images degraded equally to learn the image distortion manifold. The t-SNE visualization of the embeddings of the \kadid dataset \cite{kadid10k} shows that, compared to Re-IQA \cite{saha2023re}, \method yields more discernable clusters for different distortions. In the plots, a higher alpha value corresponds to a stronger degradation intensity.}
    \label{fig:teaser}
\end{figure}

Image Quality Assessment (IQA) refers to the computer vision task of automatically evaluating the quality of images with a high correlation with human judgments. Specifically, No-Reference IQA (NR-IQA) focuses on devising methods that can be used when a high-quality reference image is unavailable. NR-IQA finds diverse applications in industries and research domains, including image restoration \cite{wang2021real, liang2021swinir}, captioning \cite{chiu2020assessing}, and multimedia streaming \cite{agnolucci2023perceptual}.

Although supervised learning techniques have shown notable advances in NR-IQA \cite{su2023distortion, su2020blindly, golestaneh2022no, zhang2018blind}, their effectiveness is based on labeled data. Acquiring such annotations is challenging and resource-intensive, given the requirement for a substantial number of ratings to obtain dependable mean opinion scores. For example, the KADID dataset \cite{kadid10k}, which comprises 10125 images synthetically degraded with several distortion types, required approximately 300K annotations. This inherent dependence on labeled data hampers the scalability and broad applicability of supervised approaches.

More recently, several works based on self-supervised learning \cite{chen2020simple, chen2020improved, he2020momentum} have been presented \cite{zhao2023quality, madhusudana2022image, saha2023re}. These methods involve the pre-training of an encoder on unlabeled data with a contrastive loss. Then, the image representations are mapped to the quality scores with a fine-tuning of the encoder weights \cite{zhao2023quality} or by just using a linear regression \cite{madhusudana2022image, saha2023re}. For example, Re-IQA \cite{saha2023re} generates image representations by concatenating low-level and high-level features obtained through a quality-aware and content-aware encoder, respectively. Existing methods involve maximizing the similarity between the representations of two crops of the same distorted image. Therefore, since crops share similar visual information, the model is exposed to content-dependent degradation patterns, which inevitably leads to content-dependent embeddings. The upper part of \cref{fig:teaser} shows the t-SNE visualization \cite{van2008visualizing} of the embeddings of the \kadid \cite{kadid10k} dataset generated by Re-IQA. We notice that the representations related to some types of distortions, \eg blur, are scattered across the space, without being confined into separable clusters. This result stems from the training strategy, as images distorted equally may correspond to different representations due to their diverse content. 

In contrast, we propose a self-supervised approach, named \methodextended, to model the image distortion manifold so that images that exhibit similar degradation patterns correspond to resembling embeddings, despite varying content. We refer to \textit{image distortion manifold} as the continuous space of all the possible degradations to which an image can be subjected. Different regions along this manifold represent various types and degrees of degradation. For example, images showing distinct blur and noise patterns lie in different areas of the manifold. Similarly, images subjected to varying compression rates using the same algorithm correspond to diverse regions within the space. Such a distortion manifold represents image quality in an intrinsic manner. In fact, images that show similar degrees and patterns of degradation are prone to be perceived as having similar quality. At the same time, images exhibiting comparable levels and types of distortion correspond to similar positions in the manifold. Therefore, to map the representation in the manifold to a quality score, it is sufficient to train a simple linear regressor, without the need of fine-tuning the encoder weights. Moreover, by focusing on the inherent distortions within images rather than being dependent on their content, our approach significantly reduces the complexity of the learning process \cite{su2023distortion}. Given two different images that are degraded in the same way, our training strategy consists of extracting a crop from each of them and maximizing the similarity between their representations. At the same time, we maximize the distance from the embeddings of other images degraded in a different manner. In this way, our model learns to recognize image degradation despite varying content. To improve contrastive learning performance, we present a strategy to ensure the presence of hard negative examples within each batch by also considering half-scale images. To train our model, we propose to synthetically distort pristine images with a wide variety of degradations. To this end, we introduce an image degradation model that produces random compositions of consecutively applied distortions. Our degradation model is capable of generating about 100 times more possible distortion compositions than existing approaches. In the lower section of \cref{fig:teaser} we report the t-SNE visualization of the embeddings of the \kadid dataset obtained by \method. We notice that compared to Re-IQA \cite{saha2023re}, our approach produces more easily distinguishable clusters for different types of degradation, thanks to our training strategy.

Extensive experiments show that \method achieves state-of-the-art performance on datasets with both synthetic and authentic (\ie real-world) distortions. Furthermore, since our learning process is less complex, the proposed approach proves to be more data efficient than competing methods, requiring only up to 0.5\% of the training images compared to the competitors. In addition, cross-dataset evaluation and the gMAD competition \cite{ma2016group} demonstrate that \method has better generalization capabilities and is more robust than the baselines.

We summarize our contributions as follows:
\begin{enumerate}
    \vspace{-4pt}
    \item We propose \method, a self-supervised approach for learning the image distortion manifold. By maximizing the similarity between the embeddings of different images distorted equally, we make the encoder generate similar representations for images exhibiting the same degradation patterns regardless of their content;
    \vspace{-4pt}
    \item We introduce an image degradation model that randomly assembles ordered sequences of distortions, with $1.9 \cdot 10^{9}$ distinct possible compositions, for synthetically degrading images;
    \vspace{-4pt}
    \item \method achieves state-of-the-art performance on NR-IQA datasets with both synthetic and authentic distortions while showing enhanced data efficiency, generalization capabilities, and robustness.
\end{enumerate}

\section{Related Work}

\subsection{No-Reference Image Quality Assessment}

Due to its importance in both industry and computer vision tasks, No-Reference Image Quality Assessment (NR-IQA) has been an active area of research for several years \cite{mittal2012no, xu2016blind, su2020blindly, ke2021musiq, madhusudana2022image, prabhakaran2023image, saha2023re, wang2023exploring, galteri2022lanbique}. 

Traditional methods \cite{zhang2015feature, mittal2012making, mittal2012no, moorthy2011blind, xue2014blind}, such as BRISQUE \cite{mittal2012no} and NIQE \cite{mittal2012making}, rely on the extraction of handcrafted features from the images. Subsequently, they employ a regression model to predict quality scores. Codebook-based approaches, such as CORNIA \cite{ye2012unsupervised} and HOSA \cite{xu2016blind}, build a visual codebook from local patches to obtain quality-aware features. In recent years, methods using supervised learning achieved a significant boost in performance in NR-IQA \cite{ke2021musiq, su2020blindly, su2023distortion, golestaneh2022no, zhang2018blind, zeng2017probabilistic, ying2020patches}. For example, HyperIQA \cite{su2020blindly} presents a self-adaptive hypernetwork that distinguishes content understanding from quality predictions. The most similar to our work is Su \etal \cite{su2023distortion}, which learns the image distortion manifold in a supervised manner on IQA datasets. Given that it requires distortion-specific information for training, it cannot be used for NR-IQA on datasets with authentic degradations. On the contrary, we model the distortion manifold using unlabeled data with self-supervised learning. Due to their dependence on ground-truth quality scores for training, supervised methods suffer from the scarcity of labeled data for IQA, which are expensive and time-consuming to collect.

Recently, self-supervised learning has emerged as a promising technique for NR-IQA \cite{saha2023re, zhao2023quality, madhusudana2022image}. Self-supervised methods train an encoder on unlabeled data with a contrastive loss and then use its image representations to obtain the final quality scores, either by fine-tuning the model weights \cite{zhao2023quality} or using a linear regressor \cite{madhusudana2022image, zhao2023quality}. QPT \cite{zhao2023quality} proposes a quality-aware contrastive loss based on the assumption that the quality of patches is similar for the same distorted image but differs as the image or the degradations vary. CONTRIQUE \cite{madhusudana2022image} models the representation learning problem as a classification task, where each class is composed of images degraded equally. Re-IQA \cite{saha2023re} trains a quality-aware and a content-aware encoder to generate low-level and high-level representations, respectively. Existing methods are based on maximizing the similarity between the representations of crops of the same distorted image. On the contrary, we maximize the similarity between the embeddings of patches that belong to different images that were degraded equally, regardless of varying content, to model the image distortion manifold. After training, we freeze the encoder weights and map the image representation to the final quality scores with a simple linear regressor.


% In recent years, there has been a significant shift in the field of No-Reference Image Quality Assessment (NR-IQA). This shift has been driven by the development of models that can accurately predict human perceptions of visual quality without the need for a pristine reference image. This progress has been made possible by the use of Deep Learning architectures trained on large subjective image databases, rather than relying on handcrafted feature extraction and shallow machine learning.

% Traditional NR-IQA techniques usually take a two-stage approach. Initially, a complex feature extractor is used to generate perceptually relevant data, which is then fed into a basic regression model to generate quality scores. The idea is that the changes and artifacts that are created during distortion can be used as indicators of the image's accuracy. Modeling the statistical properties of natural scenes, traditional NR-IQA techniques attempt to quantify the degradation of various perceptual dimensions, such as luminance, contrast, structure, and noise. Nevertheless, these models have difficulty in dealing with complex scenes and grasping the intricate non-linear connections between image features and subjective human assessments.

% Well-known examples of traditional NR-IQA models include BRISQUE \cite{mittal2012no} and NIQE \cite{mittal2012making}. BRISQUE operates in normalized bandpass space, combining four submodels that assess brightness, contrast, structural similarity, and noise-induced degradations. NIQE focuses specifically on noise estimation from statistical regularities in natural images. Other similar models like ILNIQE \cite{zhang2015feature} and \cite{xue2014blind} also rely heavily on natural scene statistics of image gradients and other low-level cues for quality prediction. BLIINDS \cite{moorthy2011blind} uses DCT coefficients instead to analyze distortions from a frequency domain perspective. This approach offers a more comprehensive quality evaluation based on statistical image features rather than structural information. DIVINE, a pioneering model, uses steerable pyramids to capture subtle variations in quality that are not seen by other methods. CORNIA \cite{ye2012unsupervised} and HOSA \cite{xu2016blind} are models that use codebooks of local image patches to extract more precise quality-aware features. These data-driven patch-based approaches enable a more precise quality assessment that is tailored to the individual characteristics of the image.

% Most deep learning strategies for NR-IQA are based on convolutional neural networks (CNNs) that have been pre-trained on large datasets as feature extractors. The latest CNN architectures for NR-IQA have been inspired by progress in other computer vision tasks. The aim is to obtain semantic features that are indicative of perceptual image quality. 

% To enhance training, various approaches can be taken such as using multiple Convolutional Neural Networks (CNNs) that are specifically designed for different types of distortion, using full reference image quality assessment maps (FR-IQA) as intermediate objectives, and using statistical modeling of subjective scores \cite{kim2016fully}. In PQR \cite{zeng2017probabilistic}, a deep neural network is used to learn a probabilistic representation of image quality. This model is designed to capture the uncertainty associated with quality prediction, resulting in more reliable and precise evaluations. Hyper-IQA \cite{su2020blindly} on a self-adaptive hypernetwork that alters its parameters depending on the individual input images. This network acts as a guide for the quality assessment process by determining the amount of distortion in the images examined. The PAQ-2-PIQ model \cite{ying2020patches} is designed to evaluate the quality of entire images using the idea of "patch-wise quality pooling." This process involves combining the quality scores of individual patches to generate an overall quality assessment for the entire image. 

% The growing interest in transformer technology in computer vision has resulted in its use in IQA, which has achieved the highest level of performance.
% MUSIQ \cite{ke2021musiq} is a transformer-based approach that can process images of varying sizes and proportions without the need to resize or crop, which could potentially damage image quality. It utilizes a multi-scale image representation to capture the image quality at different levels of detail. TReS \cite{golestaneh2022no} is another transformer-based approach that uses relative ranking and self-consistency. Relative ranking is a method of learning quality scores based on pairwise comparisons, while self-consistency is a technique to ensure that quality scores are consistent across different scales and crops of the same image.

% Certain image quality assessment methods make use of supervised learning that is based on mean opinion scores (MOS) of the users. QPT \cite{zhao2023quality} takes advantage of pre-trained models that have been trained on large-scale image datasets with quality labels and modifies them to fit different datasets through a quality-aware distillation approach. This technique has achieved the highest results on multiple quality assessment benchmarks and is robust to various distortions and resolutions. Additionally, the paper provides an understanding of the quality-aware features that the pre-trained models have learned. 
% Su et al. \cite{su2023distortion} present a data-efficient, no-reference image quality assessment approach that can estimate the perceptual quality of images without the need for reference images or specific distortion types. The concept is to learn a distortion manifold from a limited number of distorted images and use it to calculate the distance between a test image and the manifold. This distance is then converted to a quality score using a quality regression network.

% In comparison, there is a group of techniques that do not depend on the Mean Opinion Score (MOS) for training, but rather utilize contrastive learning in a totally self-supervised fashion. CONTRIQUE \cite{madhusudana2022image} and RE-IQA \cite{saha2023re} are two closely related studies that aim to learn quality-aware representations in a self-supervised setting using constrastive learning. CONTRIQUE uses the prediction of the distortion type and degree as an auxiliary task to learn features from an unlabeled image dataset containing a mixture of synthetic and realistic distortions. Re-IQA requires minimal assumptions, utilizing a convolutional neural network that has been pre-trained on ImageNet and then further adjusted on image pairs that can be distinguished by quality. To generate these pairs, they apply various levels of distortion to the reference images, resulting in two distorted versions, one of which has higher quality than the other. This allows CNN to learn differences in quality without the need for human-assigned quality scores.

\subsection{Image Degradation Models}
Image degradation models aim to synthetically distort images so that the degradation patterns closely resemble those found in real-world scenarios. They play an important role in both blind image restoration \cite{wang2021real, zhang2022closer, zhang2021designing, yue2022blind, shyam2022giqe} and IQA \cite{zhang2018blind, golestaneh2022no, saha2023re, zhao2023quality}. Degradation models differ mainly in how many distinct types of distortion they consider and how they compose them. Specifically, the number of times and the order in which they apply the degradations. RealESRGAN \cite{wang2021real} proposes a second-order degradation model, \ie that performs the distortion process twice but with different parameters. The images are degraded sequentially with one distortion from each of 4 predefined groups, always following the same order. Re-IQA \cite{saha2023re} considers 25 distortion types but applies only one of them to each image, thus not studying combined degradation patterns. QPT \cite{zhao2023quality} presents a second-order degradation model with skip and shuffle operations. It takes into account 3 distortion groups comprising a total of 9 degradation types. In contrast, we introduce an image degradation model that randomly composes ordered sequences of consecutively applied distortions. Given that we consider 24 distortion types divided into 7 groups, we obtain 100 times more possible compositions than existing methods. We rely on our degradation model to synthetically degrade the training images.

\section{Proposed Approach}
Our approach relies on the SimCLR \cite{chen2020simple} framework to train a model composed of a pre-trained ResNet-50 \cite{chen2020simple} encoder and a 2-layer MLP projector that reduces the dimension of the features. We employ unlabeled pristine images distorted with the proposed degradation model for self-supervised learning. After training, we discard the projector and consider the encoder output features as the image representations. Finally, we freeze the encoder and train a linear regressor on top of it to obtain the quality score of an image from its representation.

\subsection{Image Degradation Model}

\begin{figure*}
    \captionsetup{skip=6pt}
    \centering
    \includegraphics[width=0.9\linewidth]{WACV2024/imgs/degradation_model.pdf}
    \caption{Overview of the proposed image degradation model. We randomly assemble distortion compositions $\mathcal{C}$, \ie ordered sequences of distortions applied consecutively, to synthetically generate images with a wide variety of degradation patterns. Each distortion composition contains a maximum of $\Ndist$ degradations sampled from 7 distinct distortion groups.}
    \label{fig:degradation_model}
\end{figure*}

To effectively learn the image distortion manifold, during training our model must be exposed to a very wide range of diverse degradation patterns. Additionally, it is imperative to possess information about the nature and intensity of degradations within each image for self-supervised learning with a contrastive loss. To address these requirements, we propose to train our model using synthetically degraded images. To this end, we need to make two considerations. First, a broad spectrum of distortion types, spanning varying degrees of intensity, must be taken into account to create a rich collection of degradation patterns. Second, we also need to consider the case of multiple distortions applied at once to investigate how the degradations appear when combined together. Therefore, we introduce an image degradation model that randomly composes ordered sequences of consecutively applied distortions to generate images that exhibit a large variety of degradation patterns. \Cref{fig:degradation_model} shows an overview of the proposed degradation model. 


We consider 24 distinct degradation types $D$ divided into the 7 distortion groups $\mathcal{G}\!=\!\{\mathcal{G}_1, \ldots, \mathcal{G}_7\}$ defined by the \kadid \cite{kadid10k} dataset. Each distortion has $L \!=\! 5$ levels of intensity. See the supplementary material for more details on the specific degradation types. The distortion groups we consider are: 1) Brightness change; 2) Blur; 3) Spatial distortions; 4) Noise; 5) Color distortions; 6) Compression; 7) Sharpness \& contrast. Each of them is defined as $\mathcal{G}_{i} \!=\! \{\ldots, D^{ij}, \ldots \}$, where $i\!\in\!\{1, \ldots, 7 \}$ is the index of the distortion group within $\mathcal{G}$ and $j\!\in\!\{ 1, \ldots, \left | G_{i} \right | \}$ indicates the index of the degradation type within $\mathcal{G}_{i}$, with $\left | \cdot \right |$ that represents the cardinality.

Let $\underline{I}$ be a pristine image. Our aim is to obtain a randomly selected distortion composition $\mathcal{C}$, \ie an ordered sequence of distortions that generates the degraded image $I$ from $\underline{I}$. We define $\Ndist$ as the maximum number of different distortions that can be applied to $\underline{I}$. First, we randomly select a number $\ndist \!=\! \{1, \ldots, \Ndist \}$ of distortions. Then, we sample $\ndist$ distortion types with a uniform distribution from $\ndist$ different degradation groups. In other words, as in \cite{zhang2021designing, zhang2022closer}, for each distortion composition, there can be a maximum of one degradation for each group. Finally, we shuffle the order of the selected distortions and sample a level of intensity for each of them with a given probability distribution. In the end, we obtain a distortion composition $\mathcal{C}\!=\!\{\ldots, D^{ij_{l}}_k, \ldots \}$ where $k\!\in\!\{1, \ldots, \ndist \}$ is the distortion index within $\mathcal{C}$, $i$ and $j$ are defined above and $l\!\in\!\{1, \ldots, L \}$ is the intensity level. Since we want our model to also have access to pristine images during training, we define a hyperparameter $p_{prist}$ and apply the degradation composition to an image with probability $1 - p_{prist}$. Compared to the 9 types of distortion considered by QPT \cite{zhao2023quality}, we take significantly more degradation patterns into account. Moreover, contrary to Re-IQA \cite{saha2023re}, we consecutively apply multiple distortions to the same image, thus studying the effect of their combination.

Applying multiple distortions with a high level of intensity to the same image usually results in a complete disruption of its content. Although our aim encompasses learning areas of the distortion manifold corresponding to very severe degradations, our primary focus resides in regions that are more likely to be related to real-world scenarios. These regions correspond to degradation compositions that alter the content of the image, but not so severely as to make it unrecognizable. In fact, when evaluating the performance of an image restoration model or assessing the quality of a picture uploaded to social platforms, it is unlikely that the images under consideration would be degraded to the point of rendering their content indistinguishable.  Therefore, we propose to sample the intensity level of each distortion with a Gaussian distribution with mean 0 and standard deviation $\sigma$. In this way, lower intensity levels are more likely to be sampled, leading to less severe degradation compositions. Thus, we model regions of the distortion manifold corresponding to degradations most probably corresponding to real-world scenarios in a more fine-grained manner.

Ultimately, our image degradation model is capable of yielding a large variety of distinct distortion compositions. Specifically, the number of possible ways in which the degradations can be assembled is given by:
%
\begin{equation}
    \sum_{m=1}^{\Ndist}m!L^{m}\left[ \sum_{i=1}^{7}\left | G_{i} \right | \sum_{j=2}^{7}\left | G_{j} \right | \ldots \sum_{k=m}^{7}\left | G_{k} \right | \right]
\end{equation}
%
As an example, with $\Ndist\!=\!4$, we obtain $1.9 \cdot 10^{9}$ possible compositions, which are about 100 times more than the $2 \cdot 10^{7}$ available with the model proposed in QPT \cite{zhao2023quality}.


\subsection{Training Strategy}

\begin{figure*}
    \captionsetup{skip=6pt}
    \centering
    \includegraphics[width=0.9\textwidth]{WACV2024/imgs/method.pdf}
    \caption{Overview of the proposed training strategy. Given two pristine images, we extract two crops and degrade them equally. Then, we maximize the similarity of their embeddings. At the same time, we minimize the similarity with respect to the embeddings of degraded crops from the half-scale versions of the original images. These embeddings constitute hard negative examples for the representations of the full-scale images since they share similar content and differ only for a downsample distortion. Notice how the original and half-scale degraded crops differ despite being degraded in the same way due to the downsampling operation.}
    \label{fig:method}
\end{figure*}

Existing self-supervised NR-IQA methods, such as Re-IQA \cite{saha2023re}, extract two crops from a single distorted image. Then, they maximize the similarity between their representations. Since the crops share similar visual information, the models learn content-dependent distortion features. In contrast, we maximize the similarity of the representations of crops from two different images with completely diverse content but distorted in the same manner. This way, the encoder learns to model the distortion manifold, thus yielding resembling embeddings for images that exhibit similar degradation patterns, despite varying content. \Cref{fig:method} shows an overview of our training strategy.

Our approach is based on SimCLR \cite{chen2020simple}. SimCLR is a framework for self-supervised learning based on a contrastive loss. Given a training example (\ie an image), SimCLR constructs a positive pair for the contrastive loss by generating two views of the original image with random augmentation techniques. The training process aims to maximize the similarity between the representations of the two views of each training example while maximizing the distance between the embeddings of all the other augmented images in the batch. Thus, the number of examples in each batch is doubled. Intuitively, given that our goal is to learn the image distortion manifold, we can interpret a specific distortion composition as a training example. Therefore, by using it to degrade two different images, we are generating the two views considered by SimCLR. Formally, let $\mathcal{C}\!=\!\{\mathcal{C}_1, \ldots, \mathcal{C}_B\}$ be a batch of distortion compositions obtained with the proposed degradation model, where $B$ is the batch size. Similarly, let $\mathcal{B}^{\scriptscriptstyle 1}\!=\!\{\underline{x}^{\scriptscriptstyle 1}_{\scriptscriptstyle 1}, \ldots, \underline{x}^{\scriptscriptstyle 1}_{\scriptscriptstyle B}\}$ and $\mathcal{B}^{\scriptscriptstyle 2}\!=\!\{\underline{x}^{\scriptscriptstyle 2}_{\scriptscriptstyle 1}, \ldots, \underline{x}^{\scriptscriptstyle 2}_{\scriptscriptstyle B}\}$ be two batches of pristine images randomly selected from the training dataset. For each pair $(\underline{x}^{\scriptscriptstyle 1}_i, \underline{x}^{\scriptscriptstyle 2}_i)$ where $i\! \in \! \{1, \ldots, B\}$, we extract a random crop from each image and employ $\mathcal{C}_i$ to obtain the degraded version $(x^{\scriptscriptstyle 1}_{i}, x^{\scriptscriptstyle 2}_{i})$. Each pair constitutes the two views of the SimCLR framework, and their embeddings represent a positive pair in the contrastive loss. 

However, since the proposed degradation model has a very large number of possible compositions, the given batch of distortion compositions $\mathcal{C}$ could lead to considerably different image pairs. In that case, it would be trivial for the model to discriminate between the different examples, making the learning process less effective. To avoid this issue, we propose a strategy to ensure the presence of hard negative examples in each batch, which is known to enhance contrastive learning \cite{robinson2020contrastive, kalantidis2020hard}. Given an image pair $(\underline{x}^{\scriptscriptstyle 1}_i, \underline{x}^{\scriptscriptstyle 2}_i)$ defined as above, we downsample the images to half size before cropping, resulting in $(\wh{\underline{x}}^{\scriptscriptstyle 1}_i, \wh{\underline{x}}^{\scriptscriptstyle 2}_i)$. After applying $\mathcal{C}_i$, we obtain the distorted image pair $(\wh{x}^{\scriptscriptstyle 1}_i, \wh{x}^{\scriptscriptstyle 2}_i)$. Given that the downsampling operation fundamentally reduces the pixel count, it inherently results in information loss and thus can be viewed as a degradation. Therefore, this process can be likened to prepending a downsampling degradation to each distortion composition $\mathcal{C}_i$. Finally, we apply this technique to all the image pairs and add the new $B$ pairs to the batch, thereby doubling the batch size and the number of negative examples, which improves the performance of contrastive learning \cite{chen2020simple, grill2020bootstrap}. Moreover, since we use all the images both at full-scale and half-scale, the size of the training dataset is also doubled. Thanks to our strategy, the model always has to discriminate between the two examples $x^{\scriptscriptstyle 1}_{i}$ and $\wh{x}^{\scriptscriptstyle 1}_i$, which mutually serve as hard negatives for each other. Indeed, they share similar content as they are crops taken from the same image at two different scales, and their degradation differs only for a downsample distortion. Therefore, by minimizing the similarity between the representations of $x^{\scriptscriptstyle 1}_{i}$ and $\wh{x}^{\scriptscriptstyle 1}_i$, our model learns to discriminate between images with slightly different degradation, even if they share similar content. The same considerations apply for $x^{\scriptscriptstyle 2}_{i}$ and $\wh{x}^{\scriptscriptstyle 2}_i$. CONTRIQUE \cite{madhusudana2022image} considers images at half-scale as well but regards them as positive examples belonging to the same distortion class. On the contrary, we treat the half-scale resolution crops as challenging negative examples, since they actually differ for a single distortion.

Formally, let $f(\cdot)$ be the ResNet-50 encoder and $g(\cdot)$ the 2-layer MLP projector that we use for dimensionality reduction. Then, given an image $x \! \in \! \mathbb{R}^{3 \times H \times W}$, with $H$ and $W$ representing respectively its height and width, we compute its representation $z$ with:
%
\begin{align}
    h &= f(x) \in \mathbb{R}^C, & z = g(h) &= g(f(x)) \in \mathbb{R}^D
\end{align}
%
where $C$ and $D$ are the number of channels of the encoder and the projector, respectively. First, we generate the embeddings of all the views, both at full- and half-scale. Then, following SimCLR, we employ the NT-Xent contrastive loss \cite{chen2020simple} for training. To this end, we define the loss terms:
%
\begin{equation}
    \resizebox{0.8\columnwidth}{!}{$ \begin{aligned}
    \ell^{\scriptscriptstyle 1, 2}_{i} &= -\log \frac{\gamma^{\scriptscriptstyle 1, 2}_{i, i}}{\sum\limits_{k = 1}^{B} \left [ \gamma^{\scriptscriptstyle 1, 2}_{i, k} + \gamma^{\scriptscriptstyle 1, 2}_{i, \wh{k}} + \gamma^{\scriptscriptstyle 1, 1}_{i, \wh{k}} \right ] + \sum\limits_{k \ne i}^{B}  \gamma^{\scriptscriptstyle 1, 1}_{i, k}} \\
    \wh{\ell}^{\scriptscriptstyle 2, 1}_{i} &= -\log \frac{\gamma^{\scriptscriptstyle 2, 1}_{\wh{i}, \wh{i}}}{\sum\limits_{k = 1}^{B} \left [ \gamma^{\scriptscriptstyle 2, 1}_{\wh{i}, \wh{k}} + \gamma^{\scriptscriptstyle 2, 1}_{\wh{i}, k} + \gamma^{\scriptscriptstyle 2, 2}_{\wh{i}, k} \right ] + \sum\limits_{k \ne i}^{B}  \gamma^{\scriptscriptstyle 2, 2}_{\wh{i}, \wh{k}}}
    \end{aligned}$}
    \label{eq:term_loss_info_nce}
\end{equation}
%
where $\gamma^{\scriptscriptstyle 1, 2}_{i, \wh{k}} = e^{( cos(z_i^1, \wh{z}_k^2) / \tau )}$ and $cos(\cdot)$ and $\tau$ represent the cosine similarity and a temperature hyperparameter, respectively. Hence, the overall training loss is given by:
%
\begin{equation}
    \mathcal{L} = \frac{1}{4B} \sum_{i=1}^{B} \left [ \ell^{1, 2}_{i} + \ell^{2, 1}_{i} + \wh{\ell}^{1, 2}_{i} + \wh{\ell}^{2, 1}_{i} \right ]
    \label{eq:total_loss_info_nce}
\end{equation}
%
Intuitively, the loss maximizes the similarity between the representation of each view and the corresponding one, while maximizing the distance to all the other views, both at full-scale and half-scale. Therefore, we consider 2 (views) $\times$ 2 (scales) $\times$ $B$ (batch size) $\!=\!$ 4$B$ elements in total.

After training, our model has learned a distortion manifold and hence generates similar embeddings for images degraded in the same way, regardless of their content.


\section{Experimental Results}

\subsection{Implementation Details}
We train our model for 10 epochs using a stochastic gradient descent (SGD) optimizer with momentum 0.9 and weight decay $1e-4$. Starting from a learning rate of $1e-3$, we employ a cosine annealing with warm restarts scheduler \cite{loshchilov2016sgdr}. Differently from \cite{madhusudana2022image, saha2023re}, we start from a pre-trained ResNet-50 encoder and fine-tune its weights during training. The encoder and the projector have a number of channels $C$ and $D$ of 2048 and 128, respectively. During training, we use a patch size of 224, a temperature $\tau$ of 0.1, and a batch size of 16. Regarding the image degradation model, we set the maximum number of distortions $\Ndist$ to 4, the probability of using pristine images $p_{prist}$ to 0.05, and the standard deviation of the Gaussian distribution $\sigma$ to 2.5. Finally, we use a Ridge regressor \cite{hoerl1970ridge} with a regularization coefficient of 0.1 to obtain the quality scores.

\subsection{Datasets}
We employ the 140K pristine images from the KADIS dataset \cite{kadid10k} for training, discarding the 700K degraded ones it provides. In fact, we use our image degradation model to obtain the degraded versions of the pristine images.

We test \method on datasets with both synthetic and authentic distortions. These consist of collections of degraded images labeled with subjective opinions of picture quality in the form of Mean Opinion Score (MOS). We consider four synthetically degraded datasets: \live \cite{sheikh2006statistical}, \csiq \cite{larson2010most}, \tid \cite{ponomarenko2013color}, and \kadid \cite{kadid10k}.  \live comprises 779 images degraded with 5 types of distortion at 5 levels of intensity, with 29 reference images as the base. \csiq, on the other hand, stems from 30 reference images, each undergoing 6 types of distortions at 5 levels of intensity, yielding 866 images. \tid and \kadid contain 3000 and 10125 images synthetically degraded with 24 and 25 types of distortion at 5 different levels of intensity, starting from 25 and 81 reference images, respectively. Regarding the datasets with authentic distortions, we consider \flive \cite{ying2020patches} and \spaq \cite{fang2020perceptual}. \flive is the largest existing dataset for NR-IQA, comprising nearly 40K real-world images. \spaq contains 11K high-resolution images captured by several mobile devices. Similar to \cite{fang2020perceptual, madhusudana2022image}, for evaluation, we resize the \spaq images so that the shorter side is 512. 

\begin{table*}
  \captionsetup{skip=6pt}
  \centering
  \Large
  \resizebox{\linewidth}{!}{ %< auto-adjusts font size to fill line
  \begin{tabular}{lccccccccccccccc} 
  \toprule
  \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{8}{c}{Synthetic Distortions} & \multicolumn{4}{c}{Authentic Distortions} & \multicolumn{2}{c}{} \\
  \cmidrule(lr){3-10}
  \cmidrule(lr){11-14}
  % \cmidrule(lr){18-23}
  \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{2}{c}{\live} & \multicolumn{2}{c}{\csiq} & \multicolumn{2}{c}{\tid} &\multicolumn{2}{c}{\kadid} & \multicolumn{2}{c}{\flive} & \multicolumn{2}{c}{\spaq} & \multicolumn{2}{c}{Average} \\
  \multicolumn{1}{l}{Method} & \multicolumn{1}{c}{Type} & \srcc & \plcc & \srcc & \plcc & \srcc & \plcc & \srcc & \plcc & \srcc & \plcc & \srcc & \plcc & \srcc & \plcc \\ 
  \midrule
  BRISQUE \cite{mittal2012no} & \multirow{2}{*}{Handcrafted} & 0.939 & 0.935 & 0.746 & 0.829 & 0.604 & 0.694 & 0.528 & 0.567 & 0.288 & 0.373 & 0.809 & 0.817 & 0.652 & 0.703 \\
  NIQE \cite{mittal2012making} &  & 0.907 & 0.901 & 0.627 & 0.712 & 0.315 & 0.393 & 0.374 & 0.428 & 0.211 & 0.288 & 0.700 & 0.709 & 0.522 & 0.572 \\ \midrule[0.01em]
  CORNIA \cite{ye2012unsupervised} & \multirow{2}{*}{Codebook} & 0.947 & 0.950 & 0.678 & 0.776 & 0.678 & 0.768 & 0.516 & 0.558 & -- & -- & 0.709 & 0.725 & -- & -- \\
  HOSA \cite{xu2016blind} &  & 0.946 & 0.950 & 0.741 & 0.823 & 0.735 & 0.815 & 0.618 & 0.653 & -- & -- & 0.846 & 0.852 & -- & -- \\ \midrule[0.01em]
  DB-CNN \cite{zhang2018blind} & \multirow{4}{*}{\shortstack[c]{Supervised \\ learning}} & 0.968 & \underline{0.971} & 0.946 & 0.959 & 0.816 & 0.865 & 0.851 & 0.856 & 0.554 & 0.652 & 0.911 & 0.915 & 0.841 & 0.870 \\
  HyperIQA \cite{su2020blindly} &  & 0.962 & 0.966 & 0.923 & 0.942 & 0.840 & 0.858 & 0.852 & 0.845 & 0.535 & 0.623 & \underline{0.916} & \underline{0.919} & 0.838 & 0.859 \\
  TReS \cite{golestaneh2022no} &  & 0.969 & 0.968 & 0.922 & 0.942 & \underline{0.863} & \underline{0.883} & 0.859 & 0.858 & 0.554 & 0.625 & -- & -- & -- & -- \\
  Su \etal \cite{su2023distortion} &  & \textbf{0.973} & \textbf{0.974} & 0.935 & 0.952 & 0.815 & 0.859 & 0.866 & 0.874 & -- & -- & -- & -- & -- & -- \\ \midrule[0.01em]
  CONTRIQUE \cite{madhusudana2022image} & \multirow{2}{*}{SSL + LR} & 0.960 & 0.961 & 0.942 & 0.955 & 0.843 & 0.857 & \textbf{0.934} & \textbf{0.937} & 0.580 & 0.641 & 0.914 & \underline{0.919} & \underline{0.862} & 0.878 \\
  Re-IQA \cite{saha2023re} &  & \underline{0.970} & \underline{0.971} & \underline{0.947} & \underline{0.960} & 0.804 & 0.861 & 0.872 & 0.885 & \textbf{0.645} & \textbf{0.733} & \textbf{0.918} & \textbf{0.925} & 0.859 & \underline{0.889} \\ \midrule
  \rowcolor{tabhighlight}
  \textbf{\method} & SSL + LR & 0.966 & 0.970 & \textbf{0.962} & \textbf{0.973} & \textbf{0.880} & \textbf{0.901} & \underline{0.908} & \underline{0.912} & \underline{0.595} & \underline{0.671} & 0.905 & 0.910 & \textbf{0.869} & \textbf{0.890} \\
  \bottomrule
  \end{tabular}}
  \caption{Comparison between the proposed approach and competing methods on datasets with synthetic and authentic distortions. Best and second-best scores are highlighted in bold and underlined, respectively. -- denotes results not reported in the original paper. SSL and LR stands for self-supervised learning and linear regression, respectively.}
  \label{tab:main_results}
\end{table*}


\subsection{Evaluation Protocol}
To evaluate the performance, we employ Spearman's rank order correlation coefficient (\srcc) and Pearson's linear correlation coefficient (\plcc) to measure prediction monotonicity and accuracy, respectively.

Following \cite{madhusudana2022image,saha2023re}, we randomly divide the datasets into 70\%, 10\%, and 20\% splits corresponding to training, validation, and test sets, respectively. Splits are selected based on reference images to ensure no overlap of contents. We employ the ground-truth MOS scores of the training split to train a regressor with an L2 loss. Note that we do not perform any fine-tuning of the encoder weights during the evaluation. During testing, we compute the image features at full-scale and half-scale and concatenate them to obtain the final representation, as in \cite{madhusudana2022image}. Similarly to \cite{zhao2023quality}, we take the four corners and the center crops at both scales and average the corresponding predicted quality scores to obtain the final one. To remove any bias in the selection of the training set, we repeat the training/test procedure 10 times and report the median results. Given the large size of the dataset, for FLIVE we use only the official train-test split \cite{ying2020patches}.


\subsection{Results}

\begin{table}
    \captionsetup{skip=6pt}
    \centering
    \Large
    \resizebox{\linewidth}{!}{ %< auto-adjusts font size to fill line
    \begin{tabular}{llcccch}
        \toprule
        \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{5}{c}{Method} \\
        \cmidrule(lr){3-7}
        Training & Testing & HyperIQA & Su \etal & CONTRIQUE$^{\dagger}$ & Re-IQA$^{\dagger}$ & \textbf{\method} \\
        \midrule
        \live & \csiq & 0.744 & 0.777 & 0.803 & 0.795 & \textbf{0.904} \\
        \live & \tid & 0.541 & 0.561 & 0.640 & 0.588 & \textbf{0.697} \\
        \live & \kadid & 0.492 & 0.506 & 0.699 & 0.557 & \textbf{0.764} \\
        \csiq & \live & 0.926 & \textbf{0.930} & 0.912 & 0.919 & 0.921 \\
        \csiq & \tid & 0.541 & 0.550 & 0.570 & 0.575 & \textbf{0.721} \\
        \csiq & \kadid & 0.509 & 0.515 & 0.696 & 0.521 & \textbf{0.735} \\
        \tid & \live & 0.876 & 0.892 & \textbf{0.904} & 0.900 & 0.869 \\
        \tid & \csiq & 0.709 & 0.754 & 0.811 & 0.850 & \textbf{0.866} \\
        \tid & \kadid & 0.581 & 0.554 & 0.640 & 0.636 & \textbf{0.726} \\
        \kadid & \live & \textbf{0.908} & 0.896 & 0.900 & 0.892 & 0.898 \\
        \kadid & \csiq & 0.809 & 0.828 & 0.773 & 0.855 & \textbf{0.882} \\
        \kadid & \tid & 0.706 & 0.687 & 0.612 & \textbf{0.777} & 0.760 \\
        \bottomrule
    \end{tabular}}
    \caption{Cross-dataset evaluation results for the \srcc metric. $^{\dagger}$ denotes results evaluated by us with the official pre-trained models. Best scores are highlighted in bold.}
    \label{tab:cross_dataset}
\end{table}


In \cref{tab:main_results} we compare the performance of the proposed approach with other state-of-the-art methods. \method achieves competitive performance for both synthetic and authentic distortions and obtains the best results on average. In particular, we notice how our method outperforms Su \etal \cite{su2023distortion}, which also aims to learn the distortion manifold but in a supervised manner and directly on IQA datasets. Furthermore, contrary to our approach, Su \etal cannot be evaluated on datasets with authentic degradations, as it requires distortion-specific information for training. Compared to other self-supervised approaches, namely CONTRIQUE \cite{madhusudana2022image} and Re-IQA \cite{saha2023re}, \method achieves comparable or better performance. However, our method is significantly more data-efficient than the competitors. Indeed, we employ 140K (training dataset) $\times$ 2 (scales) $\times$ 10 (epochs) $\!=\!$ 2.8M images for training. In contrast, doing similar computations, we get that CONTRIQUE uses 65M images, while Re-IQA requires 512M and 38M images for the content and quality encoders, respectively. See the supplementary material for more details. Therefore, \method achieves state-of-the-art performance while requiring only up to 0.5\% of the data compared to competing methods. The reason is that focusing solely on the degradation patterns within images reduces the complexity of the learning process compared to depending on image content as well, as also observed by \cite{su2023distortion}.

We evaluate the generalization capabilities of our model by measuring cross-dataset performance. We train the regressor on the whole training dataset and then use it to obtain the quality predictions on the testing dataset. We report the results for the \srcc metric in \cref{tab:cross_dataset}. \method significantly outperforms all the competing methods. In particular, the proposed approach achieves the largest improvements compared to the baselines when training on a dataset comprising few distortion types (\eg \csiq) and testing on one with a large variety of different degradations (\eg \tid). We hypothesize that the reason behind this outcome is that our method makes the encoder model the regions of the distortion manifold that correspond to distinct types of degradations in a consistent way. In other words, the mapping from the distortion manifold to the quality scores is consistent across different types of degradation. Therefore, a regressor trained by mapping only some specific regions of the manifold -- \ie considering only a few different distortions -- to quality scores behaves well even when used on unseen degradation types. We will study this phenomenon more thoroughly in future work. 

To evaluate the robustness of the model, we conduct the group maximum differentiation (gMAD) competition \cite{ma2016group} between \method and Re-IQA on the Waterloo Exploration Database \cite{ma2016waterloo}, a dataset with synthetically degraded images without MOS annotations. We fix one model to act as the defender and group its quality predictions into several levels. Then, the other model functions as the attacker by identifying the image pairs within each level that differ the most in terms of quality. Therefore, for a model to be robust, the selected image pairs should exhibit similar quality when functioning as the defender and show a noticeable quality difference when acting as the attacker. We show the results in \cref{fig:gmad_reiqa}. When we fix \method (\cref{fig:ours_def_low,fig:ours_def_high}), Re-IQA is unable to identify image pairs showing an obvious quality difference. On the contrary, when \method acts as the attacker (\cref{fig:ours_att_low,fig:ours_att_high}), it manages to spot the failures of Re-IQA by finding image pairs that clearly have significantly different quality. Thus, the proposed approach proves to be more robust than Re-IQA.

We provide additional experimental results in the supplementary material.

\begin{figure}
    \captionsetup{skip=6pt}
    \centering
    \begin{subfigure}{0.225\linewidth}
        \includegraphics[width=\linewidth]{WACV2024/imgs/gmad/gmad-reiqa_att_ours_def_low.pdf}
        \caption{}
        \label{fig:ours_def_low}
    \end{subfigure}
    \hfill
    \begin{subfigure}{0.225\linewidth}
        \includegraphics[width=\linewidth]{WACV2024/imgs/gmad/gmad-reiqa_att_ours_def_high.pdf}
        \caption{}
        \label{fig:ours_def_high}
    \end{subfigure}
    \hfill
    \begin{subfigure}{0.225\linewidth}
        \includegraphics[width=\linewidth]{WACV2024/imgs/gmad/gmad-ours_att_reiqa_def_low.pdf}
        \caption{}
        \label{fig:ours_att_low}
    \end{subfigure}
    \hfill
    \begin{subfigure}{0.225\linewidth}
        \includegraphics[width=\linewidth]{WACV2024/imgs/gmad/gmad-ours_att_reiqa_def_high.pdf}
        \caption{}
        \label{fig:ours_att_high}
    \end{subfigure}
    \caption{gMAD competition results between \method and Re-IQA \cite{saha2023re}. (a) and (b): Fixed \method at a low- and high-quality level, respectively. (c) and (d): Fixed Re-IQA at a low- and high-quality level, respectively.}
    \label{fig:gmad_reiqa}
\end{figure}

\subsection{Ablation Studies}

\paragraph{Image Degradation Model} We conduct ablation studies on our image degradation model: 1) \textit{RealESRGAN}: we replicate the degradation model of RealESRGAN \cite{wang2021real}; 2) \textit{w/o gaussian}: we sample the intensity level of each degradation with a uniform distribution instead of a Gaussian one;
3) \textit{$\Ndist\!=\!1$} and 4) \textit{$\Ndist\!=\!7$}: we reduce and increase the maximum number of distorsions $\Ndist$, respectively.

The upper part of \cref{tab:ablation} shows the results for the \srcc metric. 
We observe that the RealESRGAN degradation model obtains poor performance on all the datasets. Expectedly, considering only 4 distortion groups and applying them always in the same order limits the variety of degradation patterns the model is exposed to during training, hampering the learning process. We notice that sampling the levels of intensity of the degradations with a uniform distribution degrades the performance compared to using a Gaussian one. This is because it leads to more coarse modeling of the regions of the manifold corresponding to degradations more likely to be related to those found in real-world scenarios. Finally, the variants of the degradation model with \textit{$\Ndist\!=\!1$} and \textit{$\Ndist\!=\!7$} generate images that respectively contain no combined degradation patterns and too strong distortions, thus hampering the training process.

\begin{table}[t]
    \captionsetup{skip=6pt}
    \centering
    \Large
    \resizebox{\linewidth}{!}{ %< auto-adjusts font size to fill line
    \begin{tabular}{lccccc}
        \toprule
        Method & \live & \csiq & \tid & \kadid & Average\\
        \midrule
        RealESRGAN & 0.926 & 0.896 & 0.616 & 0.727 & 0.791 \\
        w/o gaussian & 0.965 & 0.953 & 0.866 & \textbf{0.920} & 0.926 \\
        $\Ndist\!=\!1$ & 0.966 & 0.957 & 0.857 & 0.916 & 0.924 \\
        $\Ndist \!=\!7$ & \textbf{0.970} & 0.957 & 0.868 & 0.902 & 0.924 \\ \midrule[.01em]
        same image & 0.940 & 0.863 & 0.721 & 0.775 & 0.825 \\
        w/o HN & 0.966 & 0.960 & 0.851 & 0.908 & 0.921 \\
        \midrule
        \rowcolor{tabhighlight}
        \textbf{\method} & 0.966 & \textbf{0.962} & \textbf{0.880} & 0.908 & \textbf{0.929} \\
        \bottomrule
    \end{tabular}}
    \caption{Ablation studies results for the \srcc metric. Best scores are highlighted in bold.}
    \label{tab:ablation}
\end{table}

\vspace{-2ex}
\paragraph{Training Strategy} We perform ablation studies on our training strategy: 1) \textit{same image}: we extract the crops from the same image, instead of from two different ones; 2) \textit{w/o HN}: we do not employ our strategy to obtain hard negative examples and, for a fair comparison, we double the batch size to have the same number of negative examples. 

We report the results for the \srcc metric in the lower section of \cref{tab:ablation}. We observe that extracting two crops from the same degraded image leads to poor performance. Even if it proved to be a viable technique to achieve state-of-the-art results in NR-IQA, it requires more convoluted approaches compared to ours, such as considering multiple loss terms \cite{zhao2023quality} or two different encoders \cite{saha2023re}. Furthermore, we notice that our strategy to guarantee the presence of hard negatives in every batch improves the results compared to using the same number of randomly sampled negative examples, as expected for contrastive learning \cite{robinson2020contrastive, kalantidis2020hard}. 

\section{Conclusion}
In this work, we present a self-supervised approach, named \method, to learn the image distortion manifold for NR-IQA. First, we introduce an image degradation model that randomly assembles ordered sequences of distortions, with about 100 times more possible compositions than competing methods. Second, we propose a training strategy that maximizes the similarity between the embeddings of crops belonging to distinct images degraded equally, regardless of their content. This way, we model the distortion manifold so that a simple linear regressor can effectively map image representations to quality scores. The experiments show that \method achieves state-of-the-art performance on datasets with both synthetic and authentic distortions. Also, our method exhibits enhanced generalization capabilities, data efficiency, and robustness compared to the baselines. In future work, we will study how our learned distortion manifold can be used for blind image restoration.


% \begin{table*}
%   \centering
%   \Large
%   \resizebox{0.8\linewidth}{!}{ %< auto-adjusts font size to fill line
%   \begin{tabular}{lccccccccccc} 
%   \toprule
%   \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{2}{c}{\live} & \multicolumn{2}{c}{\csiq} & \multicolumn{2}{c}{\tid} &\multicolumn{2}{c}{\kadid} & \multicolumn{2}{c}{Average}\\
%   % \cmidrule(lr){2-3}
%   % \cmidrule(lr){4-5}
%   % \cmidrule(lr){6-7}
%   % \cmidrule(lr){8-9}
%   % \cmidrule(lr){10-11}
%   % \cmidrule(lr){12-13}
%   % \cmidrule(lr){14-15}
%   % \cmidrule(lr){16-17}
%   \multicolumn{1}{l}{Method} & \multicolumn{1}{c}{Type} & \srcc & \plcc & \srcc & \plcc & \srcc & \plcc & \srcc & \plcc & \srcc & \plcc \\ 
%   \midrule
%   BRISQUE$^{\dagger}$ \cite{mittal2012no} & \multirow{2}{*}{Handcrafted} & 0.939 & 0.935 & 0.746 & 0.829 & 0.604 & 0.694 & 0.528 & 0.567 & 0.704 & 0.756 \\
%   NIQE$^{\dagger}$ \cite{mittal2012making} &  & 0.907 & 0.901 & 0.627 & 0.712 & 0.315 & 0.393 & 0.374 & 0.428 &  &  \\ \midrule[0.01em]
%   CORNIA$^{\dagger}$ \cite{ye2012unsupervised} & \multirow{2}{*}{Codebook} & 0.947 & 0.950 & 0.678 & 0.776 & 0.678 & 0.768 & 0.516 & 0.558 &  &  \\
%   HOSA$^{\dagger}$ \cite{xu2016blind} &  & 0.946 & 0.950 & 0.741 & 0.823 & 0.735 & 0.815 & 0.618 & 0.653 &  &  \\ \midrule[0.01em]
%   DB-CNN$^{\dagger}$ \cite{zhang2018blind} & \multirow{4}{*}{\shortstack[c]{Supervised +\\ fine-tuning}} & 0.968 & \underline{0.971} & 0.946 & 0.959 & 0.816 & 0.865 & 0.851 & 0.856 & 0.895 & 0.913 \\
%   HyperIQA$^{\dagger}$ \cite{su2020blindly} &  & 0.962 & 0.966 & 0.923 & 0.942 & 0.840 & 0.858 & 0.852 & 0.845 & 0.894 & 0.903 \\
%   % RN50 pretr. \cite{madhusudana2022image} & 0.925 & 0.931 & 0.840 & 0.848 & 0.679 & 0.729 & 0.701 & 0.677 & 0.786 & 0.796 \\
%   TReS \cite{golestaneh2022no} &  & 0.969 & 0.968 & 0.922 & 0.942 & \underline{0.863} & \underline{0.883} & 0.859 & 0.858 & 0.903 & 0.913 \\
%   Su \etal \cite{su2023distortion} &  & \textbf{0.973} & \textbf{0.974} & 0.935 & 0.952 & 0.815 & 0.859 & 0.866 & 0.874 & 0.897 & 0.915 \\ \midrule[0.01em]
%   CONTRIQUE \cite{madhusudana2022image} & \multirow{2}{*}{SSL + LR} & 0.960 & 0.961 & 0.942 & 0.955 & 0.843 & 0.857 & \textbf{0.934} & \textbf{0.937} & \underline{0.920} & \underline{0.928} \\
%   Re-IQA \cite{saha2023re} &  & \underline{0.970} & \underline{0.971} & \underline{0.947} & \underline{0.960} & 0.804 & 0.861 & 0.872 & 0.885 & 0.898 & 0.919 \\ \midrule
%   \rowcolor{tabhighlight}
%   \textbf{\method} & SSL + LR & 0.966 & 0.970 & \textbf{0.962} & \textbf{0.973} & \textbf{0.880} & \textbf{0.901} & \underline{0.908} & \underline{0.912} & \textbf{0.929} & \textbf{0.939} \\
%   \bottomrule
%   \end{tabular}}
%   \caption{\LA{Forse aggiungerei una colonna per indicare il tipo di metodo stile CONTRIQUE} Results are taken from the original papers, except for those marked with $^{\dagger}$ which are from \cite{madhusudana2022image}. Best and second-best scores are highlighted in bold and underlined, respectively.}
%   \label{tab:synthetic_results}
% \end{table*}

% \begin{table}
%   \centering
%   \Large
%   \resizebox{\linewidth}{!}{ %< auto-adjusts font size to fill line
%   \begin{tabular}{lcccccc} 
%   \toprule
%   \multicolumn{1}{c}{} & \multicolumn{2}{c}{\flive} & \multicolumn{2}{c}{\spaq} & \multicolumn{2}{c}{Average}\\
%   \multicolumn{1}{l}{Method} & \srcc & \plcc & \srcc & \plcc & \srcc & \plcc\\ 
%   \midrule
%   BRISQUE$^{\dagger}$ \cite{mittal2012no} & 0.288 & 0.373 & 0.809 & 0.817 & 0.509 & 0.595 \\
%   DB-CNN$^{\dagger}$ \cite{zhang2018blind} & 0.554 & 0.652 & 0.911 & 0.915 & 0.733 & 0.784 \\
%   HyperIQA$^{\dagger}$ \cite{su2020blindly} & 0.535 & 0.623 & \underline{0.916} & \underline{0.919} & 0.723 & 0.771 \\
%   % RN50 pretr. \cite{madhusudana2022image} & 0.595 & 0.648 & 0.904 & 0.909 &  &  \\
%   CONTRIQUE \cite{madhusudana2022image} & 0.580 & 0.641 & 0.914 & \underline{0.919} & 0.747 & 0.78 \\
%   TReS \cite{golestaneh2022no} & 0.554 & 0.625 & -- & -- & -- & -- \\
%   Re-IQA \cite{saha2023re} & \textbf{0.645} & \textbf{0.733} & \textbf{0.918} & \textbf{0.925} & \textbf{0.782} & \textbf{0.829} \\ \midrule
%   \rowcolor{tabhighlight}
%   \textbf{\method} & \underline{0.595} & \underline{0.671} & 0.905 & 0.910 & \underline{0.750} & \underline{0.791} \\
%   \bottomrule
%   \end{tabular}}
%   \caption{\LA{Manca qualche metodo inutile} Results are taken from the original papers, except for those marked with $^{\dagger}$ which are from \cite{madhusudana2022image}. Best and second-best scores are highlighted in bold and underlined, respectively.}
%   \label{tab:authentic_results}
% \end{table}

% \begin{table*}
%   \centering
%   \Large
%   \resizebox{\linewidth}{!}{ %< auto-adjusts font size to fill line
%   \begin{tabular}{lcccccccccccccccccccccc} 
%   \toprule
%   \multicolumn{1}{c}{} & \multicolumn{8}{c}{Synthetic Distortions} & \multicolumn{8}{c}{Authentic Distortions} & \multicolumn{6}{c}{Average} \\
%   \cmidrule(lr){2-9}
%   \cmidrule(lr){10-17}
%   \cmidrule(lr){18-23}
%   \multicolumn{1}{c}{} & \multicolumn{2}{c}{\live} & \multicolumn{2}{c}{\csiq} & \multicolumn{2}{c}{\tid} &\multicolumn{2}{c}{\kadid} & \multicolumn{2}{c}{\koniq} & \multicolumn{2}{c}{\clive} & \multicolumn{2}{c}{\flive} & \multicolumn{2}{c}{\spaq} & \multicolumn{2}{c}{Synthetic} & \multicolumn{2}{c}{Authentic} & \multicolumn{2}{c}{Global} \\
%   % \cmidrule(lr){2-3}
%   % \cmidrule(lr){4-5}
%   % \cmidrule(lr){6-7}
%   % \cmidrule(lr){8-9}
%   % \cmidrule(lr){10-11}
%   % \cmidrule(lr){12-13}
%   % \cmidrule(lr){14-15}
%   % \cmidrule(lr){16-17}
%   \multicolumn{1}{l}{Method} & \srcc & \plcc & \srcc & \plcc & \srcc & \plcc & \srcc & \plcc & \srcc & \plcc & \srcc & \plcc & \srcc & \plcc & \srcc & \plcc & \srcc & \plcc & \srcc & \plcc & \srcc & \plcc \\ 
%   \midrule
%   BRISQUE$^{\dagger}$ \cite{mittal2012no} & 0.939 & 0.935 & 0.746 & 0.829 & 0.604 & 0.694 & 0.528 & 0.567 & 0.665 & 0.681 & 0.608 & 0.629 & 0.288 & 0.373 & 0.809 & 0.817 & 0.704 & 0.756 & 0.593 & 0.625 & 0.648 & 0.691 \\
%   DB-CNN$^{\dagger}$ \cite{zhang2018blind} & 0.968 & \underline{0.971} & \underline{0.946} & \underline{0.959} & 0.816 & \underline{0.865} & 0.851 & 0.856 & 0.875 & 0.884 & 0.851 & 0.869 & 0.554 & 0.652 & 0.911 & 0.915 & 0.895 & 0.913 & 0.798 & 0.830 & 0.847 & 0.871 \\
%   HyperIQA$^{\dagger}$ \cite{su2020blindly} & 0.962 & 0.966 & 0.923 & 0.942 & 0.840 & 0.858 & 0.852 & 0.845 & 0.906 & 0.917 & \underline{0.859} & \underline{0.882} & 0.535 & 0.623 & 0.916 & 0.919 & 0.894 & 0.903 & 0.804 & 0.835 & 0.849 & 0.869 \\
%   RN50 pretr. \cite{madhusudana2022image} & 0.925 & 0.931 & 0.840 & 0.848 & 0.679 & 0.729 & 0.701 & 0.677 & 0.888 & 0.904 & 0.781 & 0.809 & 0.595 & 0.648 & 0.904 & 0.909 & 0.786 & 0.796 & 0.792 & 0.818 & 0.789 & 0.807 \\
%   CONTRIQUE \cite{madhusudana2022image} & 0.960 & 0.961 & 0.942 & 0.955 & \underline{0.843} & 0.857 & \textbf{0.934} & \textbf{0.937} & 0.894 & 0.906 & 0.845 & 0.857 & 0.580 & 0.641 & 0.914 & 0.919 & \textbf{0.920} & \textbf{0.928} & 0.808 & 0.831 & \textbf{0.864} & \underline{0.879} \\
%   MUSIQ \cite{ke2021musiq} & -- & -- & -- & -- & -- & -- & -- & -- & \underline{0.916} & \underline{0.928} & -- & -- & \textbf{0.646} & \textbf{0.739} & 0.917 & 0.921 & -- & -- & -- & -- & -- & -- \\ 
%   TReS \cite{golestaneh2022no} & 0.969 & 0.968 & 0.922 & 0.942 & \textbf{0.863} & \textbf{0.883} & 0.859 & 0.858 & 0.915 & \underline{0.928} & 0.846 & 0.877 & 0.554 & 0.625 & -- & -- & 0.903 & 0.913 & -- & -- & -- & -- \\
%   Su \etal \cite{su2023distortion} & \textbf{0.973} & \textbf{0.974} & 0.935 & 0.952 & 0.815 & 0.859 & 0.866 & 0.874 & -- & -- & -- & -- & -- & -- & -- & -- & 0.897 & 0.915 & -- & -- & -- & -- \\
%   % QPT \cite{zhao2023quality} & -- & -- &  -- & -- & -- & -- & -- & -- & \textbf{0.927} & \textbf{0.941} & \textbf{0.895} & \textbf{0.914} & 0.610 & 0.677 & \textbf{0.925} & \textbf{0.928} & -- & -- & \textbf{0.839} & \textbf{0.865} & -- & -- \\ 
%   Re-IQA \cite{saha2023re} & \underline{0.970} & \underline{0.971} & \textbf{0.947} & \textbf{0.960} & 0.804 & 0.861 & \underline{0.872} & \underline{0.885} & 0.914 & 0.923 & 0.840 & 0.854 & \underline{0.645} & \underline{0.733} & \underline{0.918} & \underline{0.925} & \underline{0.898} & \underline{0.919} & \underline{0.829} & \underline{0.859} & \textbf{0.864} & \textbf{0.889} \\
%   \rowcolor{tabhighlight}
%   \textbf{\method 5 crops} & 0.961 & 0.964 & 0.876 & 0.915 & 0.891 & 0.906 & 0.908 & 0.912 & 0.839 & 0.852 & 0.742 & 0.786 & 0.556 & 0.611 & 0.783 & 0.780 & 0.909 & 0.924 & 0.730 & 0.757 & 0.819 & 0.841 \\
%   \rowcolor{tabhighlight}
%   \textbf{\method whole} & 0.963 & 0.965 & 0.882 & 0.916 & 0.887 & 0.904 & 0.919 & 0.923 & -- & -- & -- & -- & -- & -- & -- & -- & 0.913 & 0.927 & -- & -- & -- & -- \\\bottomrule
%   \end{tabular}}
%   \caption{\todo{Aggiornare nostri risultati} \LA{Nostro best result: $simclr\_1e-3lr\_1T0CAWR\_1e-4wdSGD\_4dist\_5lvl$} 
%   \LA{Controllare la nostra media: potrebbero esserci arrotondamenti diversi} Results are taken from the original papers, except for those marked with $^{\dagger}$ which are from \cite{madhusudana2022image}. Best and second-best scores are highlighted in bold and underlined, respectively. -- denotes results not reported in the original paper. }
%   \label{tab:main_results}
% \end{table*}


%%%%%%%%% REFERENCES
{\small
\bibliographystyle{ieee_fullname}
\bibliography{egbib}
}

\end{document}
