O RACLE G UIDED I MAGE S YNTHESIS WITH R ELATIVE Q UERIES
Anonymous authors
Paper under double-blind review
A BSTRACT
Isolating and controlling specific features in the outputs of generative models in a user-friendly way is a difficult and open-ended problem.
We develop techniques that allow a user to generate an image they are envisioning in their head by answering a sequence of relative queries of the form “do you prefer image a or image b ?”
Our framework consists of a Conditional VAE that uses the collected relative queries to partition the latent space into preference-relevant features and nonpreference-relevant features.
We then use the user’s responses to relative queries to determine the preference-relevant features that correspond to their envisioned output image.
Additionally, we develop techniques for modeling the uncertainty in images’ predicted preference-relevant features, allowing our framework to generalize to scenarios in which the relative query training set contains noise.
I NTRODUCTION
Deep generative models have recently demonstrated the ability to transform samples from a latent distribution to high-fidelity, photorealistic images (Oussidi & Elhassouny, 2018).
However, the latent attributes learned by these models do not necessarily correspond to intuitive features that a user will implicitly understand.
This makes rendering images with specific semantic features difficult for end-users.
In this paper, we outline a framework for using relative queries to guide the generative process of Variational Autoencoders (VAEs) (Kingma & Welling, 2014) to allow end-users to render images that they can envision but not directly describe.
Many image features, called relative features, are best understood by comparing pairs of images (Parikh & Grauman, 2011).
For example, most people would likely find it difficult to quantify how angry a person appears, but are easily able to articulate which of two people appears angrier .
Our core contribution is a framework that allows a user to generate images with specific relative features by simply answering a sequence of relative queries of the form “do you prefer image a or image b ?”
We learn a Conditional VAE model (Kingma et al., 2014) which can conditionally generate images from a set of preference-relevant “relative” features r ∈ R z and latent reconstructive features z ∈ R z .
The VAE encoder E : x → ( r , z ) learns to infer both relative features and reconstructive features given an image, and the decoder D : ( r , z ) → x learns to conditionally generate images
[Figure]
from r and z .
We then use a sequence of relative queries to deduce a distribution of user preference over these relative features (Canal et al., 2019; Jamieson & Nowak, 2011), and sample from this distribution to generate images that match user preferences (See Figure 1).
Using relative queries unlocks the ability to model intuitive concepts that are difficult to explicitly describe or quantify (Thurstone, 1927; David, 1963).
Prior work has used these types relative comparisons to perform tasks such as learning an embedding (Agarwal et al., 2007; Tamuz et al., 2011) or searching an embedding of relative attributes (Canal et al., 2019; Jamieson & Nowak, 2011;
Davenport, 2013); we build upon this literature by using relative queries to control the generative process of a VAE.
We train our VAE to map images to a set of relative attributes using the triplet loss (Karaletsos et al., 2015).
Additionally, we train our model to be robust to noisy relative queries by quantifying the uncertainty in the predicted relative features (Warburg et al.).
We demonstrate the success of our approach with experiments on the Morpho-MNIST dataset (Castro et al., 2019).
Input: Decoder D ( r , z ) , Oracle O ( q ) ,
Response Model R , Query Selector S ,
Number of Queries T
Initialize query set Q = {} for i = 1 to T do
Generate query from q i = { p , n } from S
Answer q i with the oracle o i
= O
( q i )
Add the answered query to Q = Q ∪ o
i
Find p ( r ∗ | Q ) with response model R end for
Sample an arbitrary vector (cid:98)
z ∼ N (0 , I z )
Decode the posterior mean (cid:98) x ∗ =
D ( r ∗ µ , (cid:98) z )
Output: decoded image (cid:98) x ∗
Final Search
[Figure]
NearestNeighbor
GroundTruth
the Nearest Neighbor image with relative features closest to our final estimate vector, and 3) the ground truth image.
We use the Bayesian VAE model with noise using the triplet response model.
Both the decoded and nearest neighbor images seem similar to the ground truth.
D EDUCING USER PREFERENCES FROM RELATIVE QUERIES
We first describe our method for determining the relative features r ∗ corresponding to a user’s envisioned image x ∗ .
We search the space of relative features r by asking a sequence of queries
[Equation]
where x ip ≺ x in indicates that in the i th query the user prefers x ip to x in .
We assume that x ip ≺ x in implies that | r ip − r ∗ | < | r in − r ∗ | in relative attribute space.
Following Canal et al.
(2019), we model the probability that a user will select an image with relative features r ip over an image with features r in using the logistic response model
[Equation]
where σ ( x ) denotes the logistic function and k is a tuneable noise constant corresponding to the confidence in a user responses.
Using the information from the queries Q , we infer a probability distribution p ( r ∗ | Q ) over relative features.
We model the relationship between a single query response and r ∗ through the posterior p ( Q i | r ∗ ) where Q i = ( x ip , x in ) , and combine the information from multiple queries using a recursive application of Bayes rule.
Using MCMC with a Gaussian prior p ( r ) ∼ N (0 , I r ) , we sample from p ( r ∗ | Q ) to predict r ∗ .
We concatenate r ∗ with an arbitrary vector z ∼ N (0 , I z ) and decode this using our VAE decoder to generate an approximation of the user’s envisioned image (cid:98) x ∗ .
This procedure is shown in Algorithm 1 and Figure 1.
R ELATIVE A TTRIBUTE C ONDITIONAL V ARIATIONAL A UTOENCODER
We now describe our procedure for training the Conditional VAE (Kingma et al., 2014) that allows us to model the conditional likelihood p θ ( x | r , z ) , which we can use to generate images x conditioned on relative features r and reconstructive features z .
We restrict the relative attributes r to be a contextually relevant set of features; in a face generation task, for example, this may include hair or eye color.
The reconstructive features z encode properties necessary to generate images (such as lighting or pose), but which a user has no particular interest in controlling.
There is no guarantee that an unsupervised VAE will by default learn to encode relative features r
so that points are ordered in a way that respects a user’s perceptual similarity.
To solve this problem we optimize a variation of the triplet loss (Schroff et al., 2015)
(Figure 1), which allows us to learn an embedding of features r that satisfy triplet constraints of the form “anchor x a is more similar to a positive image x
p than a negative image x n .”
A core benefit of using triplet comparisons is that they can be indirectly inferred from easily-available sources like search engine mouse click data (Joachims, 2002; Joachims et al., 2007), so they can be applied in more general contexts than explicit quantitative attributes.
We add the triplet loss L t ( r a , r p , r n ) to our objective function as
[Equation]
R ELATIVE COMPARISON SEARCH WITH UNCERTAINTY QUANTIFICATION
We found that when data is limited or noisy it is very rarely feasible to perfectly learn an embedding that matches relative features r .
However, the logistic response model of Equation 2 assumes we know the exact features r for each image.
If our VAE encoder incorrectly predicts features r for a pair of query images ( x p , x n ) the logistic response model can be overconfident in the predicted locations of the user’s preferred features r ∗ , leading to the generation of images that do not satisfy the user’s preferences.
We address this problem by modeling the uncertainty in predicted relative features r .
For each image x we use our VAE encoder to predict a distribution N ( r µ , r σ ) , using the variance r σ 2 to encode the uncertainty of the exact relative features corresponding to an image.
To perform this uncertainty quantification, we optimize the Bayesian Triplet Loss (BTL) (Warburg et al.).
Using the BTL we represent each triplet item as a Gaussian over relative attributes r .
We predict the distribution for a triplet t =
( r a , r p , r n ) as p
[Equation]
Here τ is a random variable representing | r a − r p | 2 − | r a − r n | 2 given the parameters of the distributions of the positive r p = N ( p µ , p σ ) , negative r n = N ( n µ , n σ ) , and the ideal point r ∗ =
N ( r ∗ µ , r ∗ σ ) (derivation in Appendix A).
p ( τ < 0) corresponds to the probability that r p is closer to r ∗ than r n .
We optimize the negative log likelihood of p ( τ < − m )
[Equation]
where m corresponds to the triplet margin (Warburg et al.)
We replace the logistic response model with a response model with uncertainty quantification, and model the posterior p ( Q i | r ∗ ) as p ( user chooses r p over r n given r ∗ ) =
p ( τ < 0)
≈ p
( | r ∗ − r p | 2 − | r ∗ − r n | 2 < 0) .
[Equation]
[Equation]
This model, which we call the Bayesian Triplet Response Model (BTRM), allows us to account for the uncertainty in the predicted relative attributes r .
This allows our technique for predicting p ( r ∗ | Q ) to be robust to imperfect predictions of an image’s relative attributes r .
E XPERIMENTS
The focus of our experiments is to 1) demonstrate that we can generate images that align with user preferences, and 2) investigate the impact of noise in the triplet dataset on localization performance.
We use the simple MorphoMNIST dataset, which consists of MNIST-like digits associated with metadata features (such as slant and thickness) that allow us to quantitatively evaluate the performance of our method (Castro et al., 2019).
After using this metadata to generate training triplets, we withhold the exact quantitative values from the model and use it only for testing purposes.
We train each of our models using the objective of Equation 3; for simplicity, our experiments use only the digit 1 , a six-dimensional relative attribute space, and a zero-dimensional reconstructive space.
We compare the localization performance of three objective functions: the BTL (“Bayesian”), the traditional triplet loss (“Traditional”), and the unsupervised VAE objective with no triplet constraint
[Table]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
(“Unsupervised”).
We also investigate two response models during our localization task: the Logistic Response Model and the Bayesian Triplet Response Model.
Finally, we investigate the impact of noise in the triplet collection process by adding Gaussian noise to the MorphoMNIST metadata, then generating triplet data from the noisy metadata.
We follow Algorithm 1 using a synthetic oracle meant to simulate a user and ask 30 queries for 20 trials. See Appendix B for experimental details.
Our quantitative results (Figure 3) show that the “Bayesian” model with the triplet response model outperforms other approaches at the localization task.
As expected, the logistic response model fails in the presence of noise compared to the triplet response model.
In the noiseless setting the triplet response model still outperforms the logistic model, likely due to better alignment between the triplet objective and triplet response model.
We believe the unsupervised model gets closer to the ground truth for several queries and then diverges because the response model is overconfident in its estimate of p ( r ∗ | Q i ) , which causes convergence to incorrect local minima.
It is interesting that the triplet response model works relatively well even for the Unsupervised and Traditional objective functions, despite those functions not attempting to quantify uncertainty.
This is likely due, in part, to the encoded means for each image being accurate.
There may also be a degree of unsupervised uncertainty quantification from the VAE objective.
While we can achieve satisfactory qualitative localization performance (Figure 2), there is a slight trade-off in reconstructive performance for the supervised models, particularly in the presence of noise.
D ISCUSSION
Our experiments provide a preliminary demonstration of our framework’s efficacy in allowing users to guide the image synthesis process of VAEs using relative comparisons.
There are several avenues for future work.
First, when using higher-dimensional latent spaces we found that information from the relative subspace often “leaked” into the reconstructive subspace, causing the decoder to ignore the relative features in favor of the reconstructive features, and leading to poor generative performance.
One potential solution to this problem may be to use cycle consistency (Jha et al., 2018), which may explicitly encourage independence between the reconstructive and relative features.
Second, constraining the dimensionality of the relative features can reduce computational cost; constraints that allow a low dimensional relative feature embedding to be learned dynamically (e.g., Veit et al.
Finally, active query selection techniques (e.g., Canal et al.
(2019)) can reduce the number of queries required to converge on a quality image estimate by minimizing redundant queries.
A C LOSED - FORM EXPRESSION FOR B AYESIAN T RIPLET L IKELIHOOD
Warburg et al.
shows that the distribution p ( τ < − m ) , where m corresponds to the triplet-margin, has a closed form representation with mean
[Equation]
and variance
[Equation]
B D ETAILS OF EXPERIMENTAL SETUP B. S YNTHETIC ORACLE
We use a synthetic oracle O ( a, b ) to evaluate our framework.
For each query our oracle is given the ground truth image and metadata, as well as two choice images along with their metadata.
The oracle selects as “preferred” the image whose metadata vector is closest in ℓ 2 distance to the metadata vector of the ground truth image.
This procedure simulates a person who answers queries based on a few high-level features such as digit slant, width, and height.
B. L OCALIZATION PROCEDURE
For our experiments we ran 20 trials of 30 queries each for each technique.
We use the following procedure for each localization trial:
Randomly select an image and its corresponding metadata ( x ∗ , r ∗ ) from our test set, which we call the ground truth image 2.
Follow Algorithm 1 using the synthetic oracle described above as O (a) During each iteration record current posterior mean estimate (cid:98) x ∗ (b) Decode the posterior mean estimate to an image (c) Measure the MorphoMNIST metadata values of the given image and measure the distance to the ground truth metadata B. N EURAL N ETWORK A RCHITECTURE We used a simple VAE architecture with the following layers: We had 4 units each with: (a) A Convolutional Layer (b) A Batchnorm Layer (c) A ReLU layer 2.
2 Linear layers each followed by a ReLU and BatchNorm 3.
6 Latent Units 4.
2 Linear Layers 5.
4 units each with: (a) A Transposed Convolution Layer (b) A Batchnorm Layer (c)
A ReLU layer
B. H YPERPARAMETER S ETTINGS
The core hyperparemters of our system and values are as follows:
Learning Rate (0.0001) 2.
Epochs (100) 3.
Batch Size (256) 4.
Optimizer Type (Adam) 5.
Latent Dimension (6) 6.
KL Divergence Beta (0.01) 7.
Triplet Beta (0.1) 8.
Triplet Margin (0.1) 9.
Adam Betas (0.9, 0.999)