Docsity
Top Seller

Analisi Modelli Generativi: Auto-Regressive, Normalizing Flows, VAE, GAN e Diffusion, Appunti di Tecniche Di Intelligenza Artificiale

Anteprima parziale del testo

Scarica Analisi Modelli Generativi: Auto-Regressive, Normalizing Flows, VAE, GAN e Diffusion e più Appunti in PDF di Tecniche Di Intelligenza Artificiale solo su Docsity!

Models comparison

Model Training Likelihood Reconstruction Invertible Bottleneck (latents) GAN Unstable Not available No No Possible VAE Stable Approximate Easy No Possible Flows Stable Exact Easy Yes No DDGM Stable Approximate Difficult No No

Models comparison 1

Auto-Regressive Models (ARMs)

Given a random variable in an high-dimensional space (e.g. pixels ), to formulate a Deep Generative Model we have to model the probability distribution :

x ∈ X D^ X = {0, ..., 255} p ( x ) = p ( x 1 , ..., x 255 )

  1. product ruleto factorize joint distribution

p ( x ) = p ( x 1 ) ∏ d =2 ;

D

p ( xd ∣ x < d ), x < d = [ x 1 , .., xd −1 ]⊤

  1. assumption to limit complexity, so that each variable solely depends on the two previous variables;

finite memory

  1. neural network to predict xd categorical distribution (e.g. MLP) input [ xd −1 , xd −2 ] → FC → ReLU → FC → Softmax → θd probabilistic output

◦ non-linear

◦ convenient parametrization since the few weights to train

◦ the limited memory approach is a drawback in problems where is essential to learn complex patterns in

the data (e.g. image processing).

  • long-range memory^ is ensured using^ Sequence Models^ to model the conditional distribution^ p ( xd ∣ x < d ):

◦ RNN^ with^ hidden context computed

recursively acting as memory;

p ( xd ∣ x < d ) = p ( xd ∣RNN( xd −1 , hd −1 )) = p ( xd ∣ hd ) hd

◦ LSTM;^ GRU;

◦ causal CNN^ p ( xd ∣ x < d ) =^ p ( xd ∣CNN 1 D ( x < d )).

  • : modelling a categorical^ with an ARM parameterized by CausalConv1D for the i.i.d. data of training images of size (e.g. ) with values taken by pixels

learning p ( x ) xi ∈ D = { x 1 , ..., x N } D d 64 = 8 × 8 l = [0, 255]

log p (D∣ w ) = ∑ i ∈ D ∑ d ∑ l [ xi , d = l ] log μd , l where

⎧[ x

d =^ l ] = 1 if^ xd =^ l

[ xd = l ] = 0 otherwise

and is the probability predicted by the model (softmax output); or with an ARM parameterized by Transformers (attention mechanism) to understand relations and contexts in any range of the input sequential data.

μd , l = p ( xd = l ∣ x < d ; w )

  • sampling: with a factorized distribution^ x^ ∼^ p ( x ) =^ ∏ D p ( xd ∣ x < d ) i. set x 1 = 0 ii. sample x 2 ∼ p ( x 2 ∣ x 1 = 0) iii. sample x 3 ∼ p ( x 3 ∣ x 1 = 0, x 2 = x 2 )…

PROs

  • Simple
  • Provide the Exact Likelihood value: factorizing the distribution p ( x ) and parametrizing p ( xd ∣ x < d )
  • Allow sampling → learn long-range statistics (good density estimators)

CONs

  • No learned representation
  • Slow at inference time due to the sequential nature → modelling in an auto-regressive manner, sampling results as a slow process

p ( x )

→ is absent a latent representation, is not clear how ARM manipulate internally the data representations

ResNets Invertible Flows

A standard ResNet block can be seen as a special case of couplinglayer, without the need of storing activations

invertible block : {

y 1 = x 1 + F( x 2 ) y 2 = x 2 + G( y 1 )

feature reconstruction: {

x 2 = y 2 − G( y 1 ) x 1 = y 1 − F( x 2 )

Original ResNet seen as a reversible Neural Network, considering the forward pass , where invertibility is guaranteed if

ft +1 ( xt ) = xt + g ( xt )

  • (^) for univariate f : ∂ x t

∂ ft +1 ( xt ) (^) > 0

  • for multivariate^ f^ : Lipschitz condition^ ∣∣ gt ( x 2 ) −^ gt ( x 1 )∣∣ ≤^ λ ∣∣ x 2 −^ x 1 ∣∣^ holds for λ^ < 1

Glow (Generative Flows)

Invertible block = ActNorm → Invertible Conv1 × 1 → Affine coupling layer

  • Differently from RealNVP, no variable dropping or multiscale strategy.

PROs

  • Flexible
  • Exact Likelihood: modeled using invertible transformations (Neural Networks)
  • Fast Sampling
  • Latent representation

CONs

  • No complete freedom in flow blocks (computational + theoretical constraints)
  • Constraint on latent space dimensionality (same as output for invertibility)

Latent Variable Models

Given high-dimensional objects of interest (e.g. images in ) and low-dimensional latent factors/variables (in manifold, e.g. ), the generative process is:

x ∈ X D^ X ∈ {0, 1, ..., 255} z ∈ Z M^ Z = R

  1. sample z ∼ p ( z )priors not directly observable;
  2. sample x ∼ p ( x ∣ z ) generator observable and conditioned by the hidden latent factors z. According to , the unknown element can be to obtain the posterior distribution of : LATENT VARIABLE MODEL.

probabilistic inference z marginalized x p ( x ) = ∫ p ( x ∣ z ) p ( z ) d z ⇒ The integral can be estimated with various approaches: Monte Carlo p ( x ) ≅ (^) K^1 ∑ p ( x ∣ z k )→ Curse of Dimensionality. Variational Estimation, instead, considers:

  • a^ family of^ parameterized by^ ,^ , assuming that they assign non-zero probability mass to all , for istance, Gaussian distributions with → AUTO-ENCODERS

variational distributions ϕ { qϕ ( z )} ϕ z ∈ Z M^ qϕ = N ( μ , σ^2 ) ϕ = { μ , σ^2 = Σ }

  • an^ amortized variational posterior^ qϕ ( z ∣ x )in particular^ →^ VARIATIONAL AUTO-ENCODERS ⟹ ln p ( x ) ≥ ELBO where

ELBO = E z ∼ qϕ ( z ∣ x ) [ln p ( x ∣ z )] − E z ∼ qϕ ( z ∣ x ) [ln qϕ ( z ∣ x ) − ln p ( z )] Evidence Lower Bound

E z ∼ qϕ ( z ∣ x ) [ln p ( x ∣ z )] Reconstruction Error E z ∼ qϕ ( z ∣ x ) [ln qϕ ( z ∣ x ) − ln p ( z )] Regularizer (KL divergence p ∣∣ q ) p ( z ) prior (marginal distribution).

Auto-Encoders

  • idea: learn a representation for^ z^ in a low-dimensional latent space and reconstruct the input^ x.
  • guide principles:

◦ bottleneck to enforce the net and retain important features in the latent representation^ z ;

◦ encoder and decoder don’t share weights neither are connected.

  • constraint: the decoder output layer match in dimension with the input layer.
  • applications:

◦ not supervised pre-training of the representation;

◦ anomaly detection (search for high reconstruction error);

◦ feature learning of the prior for other not supervised tasks (clustering, matching,^ …).

VAE

Latent Variable Model learnt maximizing the ELBO. Assuming xd ∈ X = {0, 1, ..., L − 1}, the model consist of:

  1. parametrization of the prior p ( z ) as an high-dimensional standard Gaussian N (0, I );
  2. use a deep NN to decode the latent vector z i in the observed space (images);
  3. pθ ( x ∣ z ) ∼ Categorical( x ∣ θ ( z ))
  4. use another deep NN to encode the sample x i and compute qϕ ( z ∣ x ) ∼ N ( z ∣ μϕ ( x ), Σ ϕ ( x ))

β -VAE

A good latent space is not just about reducing dimensionality, the aim is getting some out of the latent dimensions → isolate a single direction that can be used to control the generation in the target domain by scaling it in the latent space.

semantics

Objective: L( θ , ϕ , β ) = − ln Categorical( x ∣ θ ( z )) + β KL[ qϕ ( z ∣ x ) ∣∣ p ( z )]

β hyper-parameter that controls the pressure to disentangle components.

How to measure Factor Disentanglement? How our latent variables are actually representing the latent factors?

  1. pick a target factor y uniformly at random (e.g. rotation);
  2. create a batch of L samples with the following procedure: a. sample two different set of latent representations and where we force the k-th components of each set to be the same if k represent factor ;

v 1, l v 2, l y b. get images and using some process allowing to simulate given latent factors (e.g. rendering of shapes);

x 1, l x 2, l x x

c. encode x using q ( z ∣ x ) to compute the latent representations z 1, l and z 2, l ;

d. compute z diff, l = ∣ z 1, l − z 2, l ∣;

3. learn a classifier to predict factor y using z diff^ b^ =.

L

i =

L

z diff, l

The classifier accuracy represents the Disentanglement Metric Score.

VQ-VAE

Enforce the quantized representation in the latent space using a to compress the representation and for indexing the and an encoder that outputs discrete latent variables with a training inspired by Vector Quantization (VQ).

codebook embeddings e ∈ R K × D

K : size of the discrete latent space

D : dimensionality of each latent embedding vector ei ∈ R D , i ∈ 1, 2, ..., K

input x → ENC → ze ( x ) → discretisation q ( z ∣ x ) → zq ( x ) → DEC → p ( x ∣ zq )

Discrete latent z calculated by a nearest neighbour look-up using the shared embedding space e :

q ( z = k ∣ x ) = {

1 for k = arg min j ∣∣ ze ( x ) − ej ∣∣ 2 0 otherwise

learning : L = log p ( x ∣ zq ( x )) + ∣∣sg[ ze ( x )] − e ∣∣ 22 + β ∣∣ ze ( x ) − sg[ e ]∣∣ 22

: Stop Gradient operator defined as identity at forward computation time and has zero partial derivatives, thus effectively constraining its operand to be a non-updated constant.

sg

PROs

  • No constraint on the NN
  • Efficient to learn and flexible
  • Allow Sampling

CONs

  • No exact likelihood (is approximate)
  • May produce blurry samples when wrongly tuned

Generative Adversarial Networks (GANs)

PRESCRIBED Models Models that provide an explicit parametric specification of the distribution of the output.

  • ARMs fit a Bernoulli distribution learning a NN to model p ( xi ∣ xj < i );
  • NFs learn a suitable change of variable to reshape a Gaussian source noise;
  • VAEs assume a Gaussian prior that gets decoded by a NN modelling.

p ( z ) ∼ N (0, I ) p ( x ∣ z )

Schematic representation of Density Networks.

IMPLICIT Models Models that directly generate data by passing a noise vector through a deterministic function which is generally a neural network. : assume a NN able to reparametrize a noise and a distribution Latent Variable Model.

idea Gθ ( z ) p ( z ) ∼ N (0, I ) local ⇒ p ( x ∣ z ) = δ ( x − Gθ ( z )) Instead of outputting a full distribution, returns a point-wise posterior (infinite mixture of Dirac peaks) for each , resulting in an observable space covered by points with some regions than others.

pθ ( x ) = ∫ δ ( x − Gθ ( z )) p ( z ) d z z denser → (since and divergence are ill-defined and not usable for optimization).

Adversarial Loss log δ (...) KL

Two players game Expert (discriminator) VS Fraud (generator) :

  • starting from an unlabeled dataset of instances^ xi ∈^ D;
  • Discriminator^ takes an object^ and returns a probability whether it is real (i.e. coming from the empirical distribution), trained as a binary classification to flag real examples as 1 and fake as 0

Dα : X → [0, 1] x

→ maximize , where

;

log p ( D ( x )) = BCE ( x , y ) = ∑ y log( D ( x )) + (1 − y ) log(1 − D ( G ( z )))

{ x samples y labels (fake: 0, real: 1)

  • Generator^ Gβ :^ Z^ →^ X^ takes a source of noise^ z^ ∼^ N^ (0,^ I )^ and turns it into an object^ x , a fake point xl^ ⋆^ = Gβ ( zl ) → minimize log p ( D ( x ));
  • x^ from empirical distribution,^ x^ ∼^ pdata ( x ), are^ real;
  • x^ generated by^ Gβ ( z ),^ x ⋆^ ∼^ pθ ( x ) =^ ∫^ Gβ ( z ) p ( z ) d z , are^ fake.

Schematic representation of GANs. Generator resembles Density Networks.

Conditional GANs (CGAN)

In an unconditioned generative model there is no control on modes of the data being generated.

→ Conditioning on additional info: In the Conditional GAN, learns to generate a fake sample with a specific condition or (i.e. a label associated with an image or more detailed tag) rather than a generic sample from unknown noise distribution, because improve the GAN in:

G

characteristics c

  1. more stable training;
  2. faster training;
  3. images with better quality;
  4. class labels also used for the deliberate or targeted generation of images of a given type.

G ( z , c ), D ( x , c ) : c act as an extension to the latent space Zto better generate and discriminate images.

Image-to-Image

Given a source image in a domain , the objective is to learn some function to in a different one in a target domain.

Is Ds transform Is It Dt

design choices for Image2Image frameworks :

  1. Generator Architecture
    • affects inference performance^ →^ a large^ may not run in real-time on the embedded edge device to defog image;
G
  • good design improves convergence of training;
  • may be responsible for artifacts; → Checkerboard Artifacts: deconvolutions are the main cause, a better upsampling strategy is [upsampling Nearest Neighbor]+convolution.
  1. Loss Function
  • seen as a coincise description of what we want to obtain in the output image;
  • usually composed of multiple term ensuring both the adversarial objective and image content;
  • D^ evaluate pairs of conditioning^ x^ and output images^ y ;
  • if random noise^ is removed, the learnt mapping^ is deterministic^ →^ desirable for enhancement, denoising, superresolution;

z x → y

  • to improve the appearance of generated images so called^ content lossesare employed.

L G = L perceptual + λ L adversarial L D = L CE computed at sub-patch level

Label-to-image

Map2Satellite

Day2Night Sketch2Image

: , distorted images (through additive noise, compression, subsampling) are inverted leaning to approximate original

Image Enhancement Ds == Dt

G ( Id ) I

Parameter Free restoration :

  • train a CNN regressor (QF predictor) to drive a finite Ensemble of Generators;
  • use the most appropriate Generator to restore the image.

Real Time processing :

  • residual blocks are the natural part to optimize;
  • pick how many blocks to use [SCALABILITY];
  • they represent the most demanding part computationally [EFFICIENCY];
  • MobileNetV2 was originally proposed to reduce computational burden of CNNs;
  • Depth-wise separableconvolutions drop-in replacement for convolutional layers;
  • Inverted residual blocksbetter propagate gradients across layers but more memory efficient;
  • keep^ G identical except for the Inverted Residual Blocks;
  • train on the small DIV2K dataset;
  • augmentation: resizing 256, 384 and 512; random crops of 224x224; mirror flipping.

Unpaired Image-to-Image

Train 2 image transformations to translate images into , where are 2 different domains (or set of images).

x ∈ X y ∈ Y X , Y

  • Two Generators with two respective Discriminators
  • Cycle Consistency: an image translated into a domain and then translated back should end up close to itself F ( G ( x )) ≈ x and G ( F ( y )) ≈ y → combining two adversarial losses and the cycle consistency ( ) loss.

L = L GAN ( G , DY , X , Y ) + L GAN ( F , DX , Y , X ) + λ L cyc ( G , F ) content

◦ Style transfer

◦ Texture transfer: same domain, different subjects

PROs

  • Full freedom in architectures (more of a meta algorithm)
  • Great at modelling higher frequencies in images
  • Fast Sampling
  • Latent representation

CONs

  • No likelihood available
  • Unstable training (minimax game: Nash equilibrium)

this Loss is further decomposable as three KL divergence terms:

E q

LT

D KL ( q ( x T ∣ x 0 ) ∥ p ( x T )) + ∑ t >

Lt −

D KL ( q ( x t −1 ∣ x t , x 0 ) ∥ pθ ( x t −1 ∣ x t )) −

L 0

log pθ ( x 0 ∣ x 1 )

  • 1st term: no parameters to optimize;
  • 2nd term: most important one, to be optimized^ →^ since^ and^ are Gaussians, the term is obtainable in closed form as , formulation where learning a deep NN is used to predict the mean of the denoising process from an image at stage of the diffusion process.

q p Lt −1 = E q [ (^2) σ t^2

(^1) ∥ μ ~ t ( x t , x 0 ) − μθ ( x t , t )∥^2 ] + C

x t t

The posterior can be computed as , with parameters and also computable in closed form.

q ( x t −1 ∣ x t , x 0 ) = N ( x t −1 ; μ ~ t ( x t , x 0 ), β

t I )^ μ ~ t ( x t ,^ x 0 ) β

t

The mean of the denoisercan be expressible as a function of the noise:

μθ ( x t , t ) = (^) 1−^1 βt ( x t − (^) 1−^ βt^ αtϵθ ( x t , t ))

yielding to a simpler problem since we train a deep NN to predict the noise that generated x 0 directly

Lt −1 = E x 0 ∼ q ( x 0 ), ϵ ∼N ( 0 , I )

λt

2 σt^2 (1 − βt )(1 − α ˉ t )

βt^2 ϵ − ϵθ ( α ˉ t x 0 + 1 − α ˉ t ϵ , t ) 2

In practice, while should ensure that the noise is properly scaled depending on the diffusion stage, it has been observed empirically that training yields better results, then the final objective is:

λt λt = 1

⟹ ϵ − ϵθ ( α ˉ t x 0 + 1 − α ˉ t ϵ , t )

2

Until the solution converges, repeat:

  1. sample some data x 0 ∼ q ( x 0 );
  2. pick a stage t ∼ Uniform ({1, … , T });
  3. draw some noise ϵ ∈ N ( 0 , I );
  4. diffuse x 0 to get x t ;
  5. predict noise;
  6. take a gradient descent step on ∇ θ of the final objective.

sampling :

  1. start from some noisy sample x T ∼ N ( 0 , I )at the final stage;
  2. loop for all stages t = T , … , 1 and denoise using fixed variances σt ;
  3. return sample x 0.

Noise Prediction Network

  • →^ skip-connections allow gradients to bypass inter-layers and keep high resolution details across the processing

U-Net

  • Self-attention→^ allow learning different and distant dependencies in features
  • Encoding → of the time step with a deterministic representation of t , to correctly optimize ϵθ for all Lt
  • Positional embedding →^ via summation of embedding and features
  • Noise schedule^ →^ linearly with^ βT = 0.02^ and^ β 1 = 10−4, also setting^ σt =^ βt fixed

Improving Diffusion-based Deep Generative Models (DDGM)

  • (^) Learning Σ θ ( xt , t ) = exp ( v log βt + (1 − v ) log β^ ~ t )
  • Improving noise schedule
  • Faster sampling

High Resolution Samples

  • A cascade of models is trained conditioning on the lower resolution image
  • U-Net is designed to condition from previous stage and upsample
  • Training and sampling a two-stage Cascaded Diffusion Model (CDM) with Gaussian conditioning augmentation

PROs

  • Stable training
  • Simple to train by^ “matching”^ noise with a source image
  • Great Tractability/Flexibility trade-off
  • High quality samples

CONs

  • Lower likelihood value
  • Can be slow to sample from

i dati reali sono assenti nella valutazione IS che infatti valuta solo la distribuzione delle immagini generate , al contrario di FID che considera anche la relazione con i dati reali comparando media e varianza di molte immagini generate con le stesse statistiche di immagini ground truth; FID verifica e misura la diversità delle immagini generate rispetto immagini vere di reference; consistente con disturbi (immagini rumorose o corrotte ottengono valutazione peggiore).

No-reference Low level metrics Usate per valutare la qualità visiva di un'immagine, senza bisogno del ground truth.

BRISQUE (Blind/Referenceless Image Spatial Quality Evaluator) - best ( 0-20) Supervisionato da valutatori umani  L'immagine viene analizzata per estrarre statistiche di distorsione naturale Natural Scene Statistics, NSS calcolate fittando un Asymmetric Generalized Gaussian Model AGGD sulle intensità medie sotto-trattate di contrasto normalizzate MSNC e sui prodotti locali tra i coefficienti.  Le feature statistiche (es. media, varianza locale) vengono estratte su: Immagine originale Versione normalizzata (detrending locale)  Viene usato un regressore addestrato (es. SVM su immagini etichettate con MOS Mean Opinion Score) per predire un punteggio di qualità.

NIQE (Natural Image Quality Evaluator) - best ( 2-4) Non supervisionato  Si costruisce un modello statistico di immagini “naturaliˮ (es. Gaussian Mixture Model sulle feature NSS;  Quando si valuta unʼimmagine: si estraggono le sue NSS features si confrontano con la distribuzione statistica delle immagini naturali (fit del modello)  Si calcola una distanza tra le due distribuzioni dell'immagine e quelle “naturaliˮ → questo è il punteggio. BRISQUE e NIQUE possono essere utilizzati per misurare la qualità nei compiti di miglioramento delle immagini (super risoluzione, denoising, rimozione degli artefatti). Possono fornire risultati strani: immagini generate da GAN possono ottenere un punteggio più alto rispetto alle immagini reali a causa dei dettagli ad alta risoluzione.

DeepIQA

Full-reference Low level metrics task di misurazione della distorsione rispetto a unʼimmagine sorgente importante per comprendere la performance di sistemi streaming, image filtering, video editing può essere usato solo quando è disponibile unʼimmagine di riferimento (es. denoising task)

Peak Signal-to-Noise Ratio (PSNR) - best Utilizzato per quantificare la qualità della ricostruzione di immagini e video soggetti a lossy compression confrontando lʼimmagine originale con quella degradata/ricostruita.

torchmetrics.image.PeakSignalNoiseRatio(data_range=None, base=10.0, reduction='elementwise_mean', dim=None, **kwargs)

Rapporto tra la massima potenza possibile di un segnale e la potenza del rumore di disturbo che influisce sulla fedeltà della sua rappresentazione.

x g

↑ (> 40 dB)

Evaluating Generative Models 2

Sia il valore massimo di un pixel dellʼimmagine 255 se pixels in 8 bit) e il Mean Squared Error (differenza, pixel per pixel, quadratica media) calcolato tra lʼimmagine sorgente noise-free e lʼimmagini distorta da valutare (approssimazioni rumorose), si definisce in decibel dB

Structural Similarity Index Measure (SSIM) - best Misurare il degrado dell'immagine come variazione percepita dell'informazione strutturale invece di errori assoluti.

torchmetrics.image.StructuralSimilarityIndexMeasure(gaussian_kernel=True, sigma=1.5, kernel_size=11, reduction='elementwise_mean', data_range=None, k10.01, k20.03, return_full_image=False, return_contrast_sensitivity=False, **kwargs)

Siano e due segnali discreti non negativi che sono stati allineati tra loro (es. due patch di immagini estratte dalla stessa posizione spaziale da due immagini da confrontare), i valori di (uguale per ) e (uguale per e ) possono essere visti come stime della luminanza e del contrasto di (e ), mentre misura la tendenza di e di variare insieme, quindi unʼindicazione della similarità strutturale , allora si definiscono queste misure, dati tre valori costanti piccoli , come:

con parametri che definiscono lʼimportanza dei corrispondenti termini, che se posti portano a un indice:

media dei pixel della patch media dei pixel della patch

varianze delle patch e covarianza tra le patches che soddisfa le proprietà di  simmetria: ;  limitatezza: ;  massimo unico:. → indice applicato con approccio sliding window pixel per pixel attraverso tutta lʼimmagine, dove ad ogni step è calcolato allʼinterno della finestra locale → di questa quality map ottenuta se ne fa la media alla fine per valutare la qualità dellʼimmagine complessiva.

PSNR vs SSIM Sia la SSIM che il PSNR misurano la somiglianza dei pixel tra l'immagine sorgente e quella distorta Le immagini restaurate dalla GAN avranno probabilmente un punteggio molto basso secondo queste metriche D'altra parte, le reti ottimizzate per queste metriche (basate su errore medio) di solito generano immagini sfocate → sono funzioni semplici e superficiali e non riescono a tenere conto di molte sfumature della percezione umana.

Multi-scale SSIM (MS-SSIM) - best Prendendo in ingresso i segnali dell'immagine di riferimento e di quella distorta, il sistema applica iterativamente un filtro passa-basso e ricampiona l'immagine filtrata di un fattore 2. Si indica l'immagine originale come Scala I, e la scala più alta come Scala M, che si ottiene dopo M  1 iterazioni. Alla j- esima scala, vengono calcolati il contrast comparison e il structure comparison. La luminance comparison viene calcolata solo alla scala M.

→ conveniente per incorporare i dettagli dellʼimmagini a diverse risoluzioni.

M AXI MSE

PSNR = 10 ⋅ log 10 ( M AXMSEI =

2 ) 20 ⋅ log 10 ( M AX (^) I ) −10 ⋅ log 10 ( MSE )

x = { x (^) i ∣ i =1, … , N } y = { y (^) i ∣ i =1, … , N } μ (^) x = N^1 ∑ i^ N =1^ xi^ μy^ yi^ σ^ x^ = σx^2 = N^1 ∑ i^ N =1^ ( x^ i^ −^ μ^ x^ )^2 σy^ yi^ μy x y σxy x y c (^) 1 , c (^) 2 , c 3

l ( x , y ) = (^) μ^2 (^) x 2 μ (^) +^ x^ μμ^ y (^) y 2^ ++ cc^11 c ( x , y ) = (^) σ^2 (^) x 2 σ (^) +^ xσ^ σ^ y (^) y 2 +^ + cc^22 s ( x ,^ y ) =^ σ (^) x σ (^) y + c 3 σ (^) xy + c 3

SSIM( x , y ) = [ l ( x , y )] α^ ⋅[ c ( x , y )] β^ ⋅[ s ( x , y )] γ^ α , β , γ α = β = γ = 1 SSIM( x , y ) = (^) ( μ + μ + c )( σ + σ + c ) x^2 y^2 1 x^2 y^2

(2 μ (^) xμ y + c (^) 1 )(2 σ (^) xy + c (^) 2 )

μx x μy y

σ (^) x , σy x y σxy x , y

SSIM( x , y ) = SSIM( y , x ) SSIM( x , y ) ≤ 1 SSIM( x , y ) = 1 ⇔ x = y SSIM

c (^) j ( x , y ) s (^) j ( x , y ) l (^) M ( x , y ) MS-SSIM( x , y ) = [ l (^) M ( x , y )] αM^ ⋅∏ j^ M =1^ [ c (^) j ( x , y )] βj^ [ s (^) j ( x , y )] γj

Evaluating Generative Models 3

 data unʼimmagine originale e una iniziale , si vuole recuperare ottimizzando numericamente con Gradient Descent , con la misura full-reference di Image Quality Assessment IQA dove uno score basso indica qualità predetta più alta;  per sintetizzare le texture visive si usa un modello parametrico Portilla e Simoncelli, “A parametric texture model based on joint statistics of complex wavelet coefficientsˮ) risolvendo:

con texture dellʼimmagine target, texture dellʼimmagine sintetizzata, le sono le medie spaziali dei canali e . La misura di perceptual distance DISTS combina misurazioni di qualità per la texture (con medie globali) e la structure (con correlazioni globali) dai diversi layer convolutivi usando una media pesata:

Gradient Magnitude Similarity Deviation (GMSD) - best I gradienti dell'immagine sono sensibili alle distorsioni dell'immagine, mentre le diverse strutture locali in un'immagine distorta subiscono diversi gradi di degradazione. Questo motiva ad esplorare l'uso della variazione globale del gradiente basata sulla mappa di qualità locale per la previsione della qualità complessiva dell'immagine. Scopriamo che la somiglianza della magnitudine del gradiente GMS tra l'immagine di riferimento e quella distorta , combinata con una nuova strategia di pooling — la deviazione standard della mappa GMS  può predire con precisione la qualità percettiva dell'immagine. con e le magnitudini dei gradienti di piccole patch locali delle immagini alla posizione ; ottenuto applicando average pooling alla mappa GMS;

deviazione standard della mappa GMS, che riflette il range di gravità della distorsione di unʼimmagine.

Feature Similarity Index for Color Images (FSIMc) - best Basata sulla combinazione di due caratteristiche primaria ritenute importanti per la percezione umana:  Phase Congruency PC, misura di quanto i diversi componenti della frequenza spaziale (come i bordi e gli angoli) sono allineati in fase, ritenendo che le aree con alta congruenza di fase siano molto salienti per il sistema visivo umano;  Gradient Magnitude GM, grandezza del gradiente dell'immagine, che cattura l'informazione sul contrasto e sui bordi.

Perceptual Image-Adaptive Pairwise Averaging (PieAPP) - best Invece di sommare o mediare semplicemente le distanze locali tra le features estratte con una rete ta due immagini, PieAPP usa un modello di apprendimento automatico (spesso un SVM o un classificatore simile, addestrato su giudizi umani) per ponderare l'importanza di ogni distanza locale. L'idea è che alcune distorsioni in alcune aree dell'immagine (o su certi tipi di contenuto) sono più fastidiose per l'occhio umano di altre. Il modello apprende quali distanze locali contribuiscono maggiormente al degrado percepito complessivo.

Most Appreciable Distortion (MAD)

x y 0 x y ⋆^ =arg min (^) y D ( x , y ) D

y ⋆^ =arg min (^) y D ( x , y ) =arg min (^) y ∑ i , j ( μ (^) x ~^ ( ij )− μ y ~^ ( ij ))

2

x y ⋆^ μ x ~ j^ ( i ) y ~ j^ ( i ) l (⋅, ⋅) s (⋅, ⋅) D ( x , y ; α , β ) = 1 − ∑ i^ m =0^ ∑ j^ n =1 i^ ( α (^) ij l ( x ~ j^ ( i )^ , y ~ j^ ( i )) +^ β (^) ij s ( x ~ j^ ( i )^ , y ~ j^ ( i )^ ))

↓

r d

GMS( i ) = (^) m^2 m (^) r (^2) (^ ri^ ()+ i ) mm^ d (^) d 2^ (( ii )+)+ cc m r m d i GMSM = (^) N^1 ∑ i^ N =1GMS( i )

GMSD = (^) N^1 ∑ i^ N =1^ (GMS(^ i ) − GMSM)^2

Evaluating Generative Models 5