Conditional Distribution Modelling for Few-Shot Image Synthesis with Diffusion Models
Parul Gupta Munawar Hayat Abhinav Dhall Thanh-Toan Do




 



CDM






P. Gupta et al.




Monash University, Clayton VIC 3168, Australia 

{parul,munawar.hayat,toan.do}@monash.eduIndian Institute of Technology, Ropar, Punjab 140001, India 

abhinav@iitrpr.ac.in

Conditional Distribution Modelling for Few-Shot Image Synthesis with Diffusion Models
    Parul Gupta10000-0002-4379-1573 Munawar Hayat10000-0002-2706-5985 Abhinav Dhall20000-0002-2230-1440 Thanh-Toan Do1

    April 29, 2024
=======================================================================================================================

#1#1

ŝê
int
bd

𝖦𝖬𝖫
𝖧𝖬𝖬
supp
*
Stirl
𝒜
ℬ
𝔼
ℱ
𝒦
ℋ
𝒳
𝒵
𝒮
ℐ
𝒯
𝒫
d
(X)

(Y)

(X,Y)

(X;Y)

|

→
a.s.⟶
p⟶
d⟶
ℒ
𝑙
-0.5ex1.5
sig
ℒ
#1#1

#1#1
#1#1
  


𝕀𝕀
#1#2𝕀{  #1,#2}  
iid∼
0
1
a
𝐚
ḇ
𝐛
B
m
ç
C
ḍ
D
N
h
H̋
𝐇
K
M
f
𝐱

l
s
T
𝐮
v̌
𝐯
o
𝐡
s
x
𝐱
𝐳

z
y
y
X

𝐲
Y
Z
U
n
V
I
J
𝐉
w
w
𝐖
α
δ
σ
β
μ
θ
λ
γ
ψ
ϕ
π
ω
ϵ
τ
ξ
ℝ
^n
ℤ



^n
ℚ
^n
ℂ


#1#1^c
∩
^n
#1#2(#1#2) 
w
Θ
μ
ℳ
𝐦
A
Δ
^n
DP
GG
DP
nDP
HDP
GEM
RFS
BernoulliRFS
PoissonRFS

∇
#1#2#1#2
#1#2∂#1/∂#2
#1#2#1#2
#1#2∂^2#1/∂#2∂#2^⊤
cl
#1#2(#1 | #2)
Var
#1Var[#1]
Cov
#1[ #1 ]
#1#2#2[ #1 ]
Corr
T

𝔼

#1[#1]
ℱ

ℬ
ℬ
Bernoulli
Beta
Dir
Gamma
#1#2Normal(#1, #2 ) 
𝐍
#1#2#3Normal( #1 #2, #3) 
Mult
Pois
Poisson
PG
Wish
InvWish
NW
NIW
Student
Uni
#1#1
#1#1^𝖳
≻
≽
𝐈
tr
#1_#1argmax 
#1_#1argmin  
diag

span
𝒱
ℱ
ℱ
#1#2⟨#1,#2⟩
#1#2#1#2
#1#2#1 ·#2
#1‖#1‖
ℍ
ℍ
#1[#1]
#1#1
𝕀
𝐷
#1#2(#1||#2)
KL
#1#2(#1∥#2)
#1#2(#1 ∥ #2)
𝒞
𝒞
#1#2(#1∥#2)
BD
#1|#1.
#1#1
#1.#1|
#1#1




  Few-shot image synthesis entails generating diverse and realistic images of novel categories using only a few example images. While multiple recent efforts in this direction have achieved impressive results, the existing approaches are dependent only upon the few novel samples available at test time in order to generate new images, which restricts the diversity of the generated images. To overcome this limitation, we propose Conditional Distribution Modelling (CDM) – a framework which effectively utilizes Diffusion models for few-shot image generation. By modelling the distribution of the latent space used to condition a Diffusion process, CDM leverages the learnt statistics of the training data to get a better approximation of the unseen class distribution, thereby removing the bias arising due to limited number of few shot samples. Simultaneously, we devise a novel inversion based optimization strategy that further improves the approximated unseen class distribution, and ensures the fidelity of the generated samples to the unseen class. The experimental results on four benchmark datasets demonstrate the effectiveness of our proposed CDM for few-shot generation. 
  



§ INTRODUCTION


In this paper, we tackle few-shot image synthesis i.e., given only a few samples of a novel category, our goal is to generate diverse and realistic images of this new concept.
Few shot synthesis can be effectively used to generate rarely occurring objects (such as rare species of birds or animals) and help to overcome the class imbalance issue in the naturally occurring datasets <cit.> by generating more examples of the minority categories. 
However, few-shot synthesis is a challenging task because the state of the art generative models such as GANs <cit.> and VAEs <cit.> need a large amount of data to learn any concept. Even with sufficient amount of data, due to their inherent nature (involving adversarial learning) adapting GANs for few samples is unstable to converge <cit.>. On the other hand, the sample quality achieved by VAEs is not as good as GANs even though their training is stable <cit.>. The scarcity of the available novel examples in few-shot learning makes it difficult to estimate the distribution of the new categories which is disjoint from the training distribution. This often leads to overfitting on the few available test samples and lack of diversity in the generated examples.

Most of the existing few-shot synthesis approaches employ GAN-based architectures with carefully formulated auxiliary loss functions. We can broadly categorize these methods into 3 types: fusion based, optimization based and transformation based. Fusion based approaches <cit.> fuse the latent features of a set of same-class images and then decode the fused feature into a new image to generate sample of the same class. 
However in addition to needing at least two novel examples, the generated images lack diversity, as they are similar to the few available examples and can't cover the entire distribution of the novel class. Optimization based approaches <cit.> introduce meta-learning, where they first learn a base model and then fine tune it for each novel category to generate new images. But the images generated by these methods are often blurry and of low quality. Transformation based approaches <cit.> learn the intra-category transformations in the training data and apply them on the novel samples to generate new examples. Our method is a combination of the transformation and optimization based approaches, having the merits of both, good quality samples belonging to unseen class but with added diversity in the generated images, owing to our modelling the entire distribution of the novel class in the conditional latent space, which yields efficient and meaningful augmentation of the novel class samples (as explained in detail in <ref>).

We use a recently popular class of generative methods called Denoising Diffusion Probabilistic Models <cit.> for few shot image generation. These models can learn to generate meaningful images belonging to the training distribution from pure noise and enjoy the benefit of a stabilized training process (no adversarial learning) while maintaining the sample quality. They have shown remarkable success in various applications such as text-conditioned image generation <cit.>, image super-resolution <cit.> and have outperformed GANs in class-conditioned image generation <cit.>.
Since diffusion models are essentially probability density estimators, their application to few shot generation is non-trivial. Unlike VAEs, their latent space is unstructured – the latents are just training images disturbed by adding varying levels of Gaussian noise. Therefore, applying the ideas from few-shot GAN-based approaches <cit.> and fusing or transforming the latent representations of diffusion models is not intuitively expected to yield any meaningful results. Diffusion-conditioning mechanisms have been developed for controlling simpler concepts such as low-shot attribute generation <cit.>, class-conditional synthesis (for seen classes during training) <cit.>, artistic domain-adaptation <cit.> and test-time adaptation <cit.>, but not yet explored to generate entirely novel complex classes, from only a few available examples, using a limited amount of training data.
Our approach successfully generates new samples of unseen concepts by modelling the distribution of the space used to condition the diffusion process. 
In order to do so, we develop Conditional Distribution Modelling (see <ref>) where we estimate the probability distribution of samples belonging to each class. This enables us to augment the conditional vectors for novel class by simply sampling from its approximated distribution, whose statistics are borrowed from the closest class in the training set and optimized using the few novel class samples. 
These augmented unseen conditionals when passed through the conditional diffusion process in turn give us a set of diverse and realistic new samples.
While the latent space distribution of training classes can be accurately estimated using the abundant samples available, using only the small number of samples of the never seen concepts at test time results in poor approximation of their distribution statistics. To counter this, for each unseen class, we propose to transfer the distribution statistics from the closest seen classes <cit.> to get an initial estimate and optimize them using the available samples.
Thus, the sample diversity in our approach comes from two sources – firstly, the conditional space modelling helps us generate more conditionals for the diffusion process and secondly the diffusion model learns valid intra-class transformations (from the conditional latent to the target latent).

In summary, our major contributions are: 



  * We propose a novel diffusion model-based framework for few-shot image generation that effectively captures the diversity while maintaining the distinctive characteristics of unseen classes by modelling their distributions in its conditional space.

  * Specifically, instead of relying only on the few-shot examples to generate new samples, we develop a principled approach that leverages the learned statistics from the neighbouring seen classes to approximate the unseen class distribution and faithfully capture the unseen class diversity.

  * Further, we propose a novel inversion based optimization to refine the unseen class distribution 
which in turn ensures the fidelity of the generated samples to the unseen class. 









§ RELATED WORK


The existing literature on few shot image generation can be broadly divided into three categories - fusion-based, optimization-based and transformation-based methods.

Fusion based approaches produce new images of unseen classes by fusing the latent features of the example images in some manner and passing the fused representation through a decoder, e.g. GMN <cit.> and Matching-GAN <cit.> combine the Matching Network <cit.> (used for few-shot classification) with VAEs and GANs respectively. F2GAN <cit.> enhances the fusion of high level features by filling low level details from the example images using a Non-local Attention module. Similarly, LoFGAN <cit.> is based upon a learnable Local feature Fusion module (LFM) combined with GANs. WaveGAN <cit.> adapts Haar Wavelet transform to capture features at different frequencies and fuses them. The images generated using these methods often lack in diversity due to their dependence on the few unseen examples available for the fusion operation.

Optimization based approaches, e.g., FIGR <cit.> and DAWSON <cit.> use adversarial learning (GANs) combined with meta-learning methods, e.g., Reptile <cit.> (used by <cit.>) and MAML <cit.> (used by <cit.>) to generate new images. LSO <cit.> adapts the latent space learnt using StyleGAN <cit.> (an approach for training GANs with limited data) for each unseen class using optimization and semantic stabilization losses. Exposing the model <cit.> to the few unseen samples at test time helps it to capture the class-specific characteristics, allowing the generated samples to have high fidelity with the unseen class; however optimization needs to be performed carefully to ensure that the model does not over-fit on the few samples that can take away the generation quality and diversity.

Transformation based approaches (, AGE <cit.>)learn the pattern of transformations between different pairs of the same class during training and use these transformations to generate new samples of novel categories from the available samples, e.g., in DAGAN <cit.> any sample passed though the encoder gives a feature containing its class-level information. This feature along with a random vector is passed through the decoder to generate a different sample of the same class. DeltaGAN <cit.> learns to generate transformations called sample-specific deltas which represent the information needed to convert the sample to another image of the same class. Given a sample, different plausible deltas can be generated based upon a random vector input.
However, the current transformation-based approaches require end-to-end training of transformation and generation that can be unstable resulting in generation of low quality images.

While Diffusion Models have been rarely explored for few-shot image synthesis, there are several works using diffusion models for few-shot generative adaptation, i.e., they pre-train the model using a large-scale dataset belonging to a source domain (that is related to the domain of the target few shot images), and then adapt it to the target image domain. For example, in D2C <cit.>, the first step involves joint training of a VAE and a Diffusion model in the VAE's latent space in an unsupervised manner on a large dataset. Then a classifier is trained over the learnt latent space of the VAE using the few labelled examples available. For instance, they use the CelebA-64 dataset <cit.> for the first step and then learn a binary classifier in the latent space to predict attributes like blonds/females using just 100 labelled examples. To generate images having these attributes, they first use the diffusion model to generate VAE latents from random noise. Then they pick those latents having high probability scores in the binary classifier and decode them through the VAE inference model.
Similarly, DDPM-PA <cit.> devises a pairwise similarity loss to preserve the relative distances between generated samples during domain adaptation to achieve better sample diversity in the target domain.



To our knowledge, diffusion models for few-shot synthesis have only been investigated in FSDM <cit.>, which uses a DDPM to generate images of different classes in a fusion approach-based manner. It obtains a set-level context by passing the set of images for each class along with the timestep embedding through a Vision Transformer <cit.> and uses the context to condition the generative path (reverse path) of the DDPM. However, its diffusion process lies in the image space which has the disadvantage of large memory requirements and longer inference time for high-resolution images. For this reason, this approach has been evaluated only on small-scale datasets having 32×32 images.
On the contrary, our approach ensures diversity and fidelity in the synthesized images by adequately modelling the distribution of the few shot samples in the conditional space of the diffusion process. This provides us with the flexibility to sample new and varied conditionals which are then effectively mapped to the image space. Since the diffusion itself happens in a regularized latent space, we are able to efficiently generate high-resolution and realistic novel class images.



§ METHOD




 §.§ Preliminaries

Problem Definition Given a dataset 𝔻=(_j, y), y∈[1,ℂ], j∈[1,n_y] with ℂ classes and n_y images in each class, we divide the dataset into seen classes ℂ_s and unseen classes ℂ_u where ℂ_s∩ℂ_u=ϕ. Only the images from seen classes can be used while training. The task of K- shot generation involves generating new images of any class from ℂ_u, using only K images of this class.


Below, for the sake of completeness, we briefly revisit diffusion models <cit.> and latent diffusion models <cit.>, followed by the description of our proposed conditional distribution modelling approach for few-shot synthesis (<ref>)

Diffusion Models <cit.> are a special class of generative models which configure the data distribution as a reverse (or denoising) process of iteratively adding noise to the data.
Thus, the forward diffusion process converts the structured data (𝐱_0) into pure noise (𝐱_T) in T timesteps by adding small amounts of Gaussian noise each time. The amount of noise ϵ added at each step is controlled by a non-decreasing variance schedule [β_t ∈(0,1)]_t=1^T. Thus at each step t, we sample ϵ∼𝒩(0,I) and then get 𝐱_t=√(1-β_t)_t-1+√(β_t)ϵ. After T steps through the encoder, the information in the data point is destroyed completely and 𝐱_T becomes random Gaussian noise. 
The Denoising Diffusion Probabilistic Model (DDPM) <cit.> learns the reverse, where we start from pure noise and recover a point from the original data distribution through T steps of a decoder (denoted by p_θ). Given the noisy data point 𝐱_t and the time step t as input, the decoder predicts the noise (ϵ) added to the original data point that lead to this noisy input. The architecture most commonly used for p_θ is a time-conditioned UNet <cit.>. The training objective (L_vlb) comes by minimizing the variational bound on the negative log-likelihood of the data distribution and is used in combination with the mean square error (L_simple= E_t,x_0,ϵ[‖ϵ - ϵ_θ(_t,t)‖^2]) between the true noise and predicted noise. A detailed derivation of the training objective can be found in <cit.>.

Latent Diffusion Model (LDM) <cit.> provides an efficient setup for high resolution image synthesis. LDM benefits from the diversity and high sample quality offered by Diffusion models but does not trade off the computational efficiency by taking the diffusion process to the latent space of a pretrained Variational Autoencoder <cit.> (with Encoder ℰ and Decoder 𝒟). Since training the VAE beforehand leads to a compressed but meaningful latent space with only the imperceptible details gone, the latent diffusion process is able to model the semantic bits of the data much more efficiently as compared to the high dimensional image space. They also introduce the Cross-Attention mechanism <cit.> to effectively condition the diffusion on signals from other modalities. We adapt this conditional latent diffusion pipeline for our use case.





 §.§ Conditional Distribution Modelling (CDM)


As depicted in <ref>, Conditional Distribution Modelling involves five stages, each of which are described below.


  
A. ResNet and VAE Training. (<ref> (A)) We initially train a vector-quantization <cit.> regularized Variational Autoencoder (VAE) on the seen data (denoted by ℂ_s), following the LDM architecture. The LDM is trained at a later stage in this VAE's latent space, denoted by . Simultaneously, we also train a simple ResNet-based classifier on the seen data using Cross-Entropy loss and choose the output of its penultimate layer (denoted by f) as the conditioning space for our LDM.


  
B. Distribution Modelling of seen and unseen classes. (<ref> (B)) We obtain class-wise latent mean μ^y and latent variance (σ^2)^y on the seen data as follows–

    μ^y=1/n_y∑_j=1^n_y f_j^y


    (σ^2)^y=1/n_y-1∑_j=1^n_y(f_j^y-μ^y)^2


    𝔻^y=𝒩(μ^y,(σ^2)^y)

where n_y is the number of samples in seen class y and each dimension in the latent space f is considered to be uncorrelated. 
We assume that every dimension in the latent vector f_j^y follows a Gaussian distribution (denoted by 𝔻_y, f_seen={𝔻_y}_y∈ℂ_s) and observe that similar classes usually have similar statistics (mean and variance) of the feature representations. This allows us to transfer the mean and variance statistics across similar classes, i.e., from seen classes for which we have a better approximation of these statistics to the unseen classes for which we only have a few examples, which are insufficient to approximate the underlying distribution. 
Therefore, given K support samples of an unseen class c(∈ℂ_u), we first obtain the latent vectors f^c_k  (1≤ k≤ K) for each of these K samples using the ResNet from stage (A). Then, we augment the latent space f^c by calibrating the mean and variance statistics from the seen classes which are nearest to this unseen class. The nearest seen classes are the ones with the minimum Euclidean distance between their mean latent μ^y and the mean of the unseen latent μ^c. The mean of an unseen class distribution is computed from latent vectors f_k^c of support samples of that class: 


    μ^c=∑_k=1^Kf_k^c/K

Let the set of nearest seen classes be denoted by 𝕊_N, the calibrated variance (σ^2)^c of that unseen class distribution is given by: 

    (σ^2)^c=∑_y∈𝕊_N(σ^2)^y/|𝕊_N|






  
C. Diffusion Model Training. (<ref> (C)) In this stage, we train a Latent Diffusion Model (LDM) on the seen data in the z-space of the stage (A) VAE. This LDM is conditioned using samples from the seen data distributions f_seen defined in (B). Thus, given an image  belonging to a seen class y, we first sample a latent f^y ∼𝔻^y (the corresponding distribution obtained as per <ref>) and also get the perceptually compressed representation  corresponding to  from the pretrained VAE. Now, the LDM learns to denoise the noisy version  _t of , conditioned on f^y and time-stamp t which can be shown as the overall training objective <cit.>,

    ℒ := ℒ_simple+λℒ_vlb,

where ℒ_vlb is the variational lower bound based loss and ℒ_simple is the mean squared error between the true noise and predicted noise and is given by

    ℒ_simple := 𝔼_ℰ(),y,ϵ∼𝒩(0,I),t[‖ϵ - ϵ_θ(_t,t,f^y)‖^2_2]


We further employ classifier-free guidance proposed by <cit.> in order to enhance the sample diversity. In summary, while training the LDM, we ensure that the model learns to transform the vectors f^y that are sampled from the class distribution 𝔻^y into the latent representations  of the same class. Algorithm <ref> describes the LDM training process with the proposed CDM.





  
D. Inversion based optimization of unseen class distributions. (<ref> (D)) Once the diffusion model is trained, we can use the unseen class distributions defined in stage (B) (denoted by f_unseen) to generate unseen class samples from the model, however, we observe that the samples generated using these distributions are more similar to the seen classes which are in the neighbourhood of the unseen classes. We hypothesize that the few conditionals f^c_k corresponding to the support samples of unseen class c are not able to properly capture the characteristics of the unseen class and hence, the unseen class distribution ends up being very close to the neighbouring seen class distributions. Hence, we propose to refine the unseen distributions using inversion based optimization, i.e., given a support image  from an unseen class c, we aim to find the conditional f^c_ that results in the construction of  from our frozen LDM. Since the conditional f^c_ is sampled from the Gaussian distribution of class c, we back-propagate the gradients to optimize the mean μ^c and variance (σ^2)^c as well. Our optimization goal can therefore be defined as

    (μ^c)^*, ((σ^2)^c)^* = μ^c, (σ^2)^cmin 𝔼_ℰ(),c,ϵ∼𝒩(0,I),t[‖ϵ - ϵ_θ(_t,t,f^c_)‖^2_2]

Algorithm <ref> describes the inversion based optimization of unseen class distributions.


  
E. Few-shot Image generation using optimized unseen distributions. (<ref> (E)) Once our unseen class distributions are optimized, we can generate diverse samples for each class using the LDM by sampling _T∼𝒩(0,I) and f^c∼𝒩(μ^c,(σ^2)^c).









§ EXPERIMENTS




 §.§ Evaluation Setup

For our evaluation, we follow the setup in recent state-of-the-art approach <cit.>. Given a dataset 𝔻=(_j, y), y∈[1,ℂ], j∈[1,n_y] with ℂ classes and n_y images in each class, we split it into ℂ_u unseen and ℂ_s seen categories. After training on ℂ_s, at test time for K-shot generation, the model uses K images and generates 128 fake images of each unseen class giving a set S_fake of 128|ℂ_u| fake images. These fake images are generated by considering 2 nearest classes corresponding to each image for conditional space modelling (stage (B) in <ref>) and using 25 steps of DDIM sampling <cit.> in the diffusion model. The remaining n_y-K images are combined from each unseen category to obtain a set S_real of real images. For quantitative comparisons, we calculate the Fréchet Inception Distance (FID) <cit.> between S_real and S_fake and the Learned Perceptual Image Patch Similarity (LPIPS) <cit.> for S_fake. FID score measures the distance between the latent features of real unseen images and generated unseen images and is an indicator of image fidelity. The latent space used to calculate the distance is from an Inception-V3 <cit.> architecture pretrained on the Imagenet dataset <cit.>. LPIPS indicates the diversity in the generated images by calculating the distance between all the same class image pairs and then averaging it for each class followed by measuring the average over all the unseen classes.
We use the following four datasets in order to compare our method with the existing approaches:

Flowers <cit.> dataset has total 102 categories with number of images in each class varying from 40 to 258. We split it into 85 seen and 17 unseen classes resulting in 7121 seen and 680 unseen images.

Animal Faces <cit.> dataset contains 149 classes. We split it into 119 seen categories having total 96621 images and 30 unseen categories with 3000 images.

In VGGFace <cit.> dataset, we select 2299 classes and choose 100 images for each class. 1802 classes out of these are used for training and the remaining 497 for evaluation.

NABirds <cit.> dataset has 555 classes out of which 444 are used for training and 111 for evaluation. This gives a total of 38306 seen images and 10221 unseen images.



 §.§ Implementation Details

For the Variational Autoencoder (VAE), we set the downsampling factor to 4 in all our experiments, i.e. given the image-space ∈ℝ^128×128×3, the latent space ∈ℝ^32×32×3. We maintain a codebook ℤ of size 2048 for the vector-quantization based regularization and set the batch size to 16 for all other datasets except VGGFace (due its large size), for which we set it to 128. We train the VAE for 100 epochs. For the conditional space, we train ResNet-50 <cit.> using Cross-Entropy Loss and SGD optimizer for 500 epochs on seen data. Our conditional latent space is then constructed by taking the output of the last latent convolution layer having dimensions 4×4×512. Finally, the conditional latent diffusion pipeline is learnt which uses 1000 timesteps and a linear noise schedule. The value of λ in the training objective <ref> is set to 0.001 following the previous works <cit.>. We use a batch size of 128 to train the LDM for around 200 epochs. The learning rate has a warmup schedule, increasing linearly from 0 to 2e-4 in 50K steps. It takes roughly 24 hours to train the diffusion model on a single NVIDIA GeForce RTX 3060 GPU for all the datasets except VGGFace. Due to its large size, the LDM for VGGFace is trained on a single Nvidia RTX A6000 GPU for nearly 70 hours. The inversion based optimization is performed with a learning rate of 2e-4 for 50K steps.













































 §.§ Quantitative Evaluation

We compare our proposed approach against several competing methods. These include DAGAN <cit.>, MatchingGAN <cit.>, F2GAN <cit.>, LoFGAN <cit.> DeltaGAN <cit.> and LSO <cit.> in both 3 and 1 shot settings. For fusion-based approaches, we report only 3-shot results, since they can not be evaluated in 1 shot setting. For the transformation-based approaches, which need only one conditional image, 3-shot setting implies that S_fake is generated using 3 images per episode, choosing one randomly out of the 3 each time. The results are summarized in <ref> on two datasets. The results shows that our method performs comparable to GAN-based approaches in terms of both sample quality as well as diversity. For example, for the Flowers dataset, our model is second-best in terms of both FID (sample quality) as well as LPIPS (sample diversity) in both 1 and 3 shot settings. While LSO obtains the best sample quality, the generated samples lack diversity. Similarly, DeltaGAN samples, though diverse, lack in terms of quality. On the AnimalFaces dataset, our approach achieves the best FID score and second-best LPIPS score in 3-shot setting.


  §.§.§ Few-Shot Classification

To further evaluate the representativeness of the generated samples, we present the results of Few-shot classification performed on a held-out test set comprising of unseen classes. For N-way C-shot classification, we randomly choose N unseen classes and use C images of each class to generate 512 fake images. A ResNet18 pretrained on seen data is used as a feature extractor and the final linear layer is trained using N×(C+512) images. The rest of the unseen images are used for testing. As <ref> shows, the models trained using CDM-generated samples are able to classify the test set images with performance comparable to state-of-the-art GAN-based methods. Therefore, the generated samples match the characteristics of the unseen classes.











 §.§ Qualitative Results

For qualitative comparison, we show some generated samples using LSO <cit.> in 3-shot setting in <ref> on Flowers, VGGFace and NABirds datasets. For all the datasets, the images generated by CDM are comparable to the ones produced by the state-of-the-art LSO in terms of quality as well as diversity. We observe changes in pose/orientation and colour transfers when compared to the conditional (support) images for both CDM and LSO. Rather, for VGGFace dataset, we can observe a doppelganger kind of effect on the generated samples for LSO, i.e., the generated faces don't necessarily have the same identity as the input faces (evident in rows 4 and 6). This is not the case with CDM, where the generated faces are considerably diverse, yet preserve the input identity. The same effect is visible in the NABirds dataset samples too, in row 8 (column 5) and row 9 (column 4), where the generated bird appears to be from a different (yet considerably similar) category than the input images, which does not happen with CDM. Perhaps the CDM samples lag in terms of FID scores, primarily because of poorer background generation as compared to LSO, and not due to the quality of birds themselves.

In <ref>, we show some samples generated in 1-shot setting on the NABirds, AnimalFaces, Flowers and VGGFace datasets using our approach. The generated samples display a wide range of poses/orientations/expressions, while maintaining the definitive characteristics of the input sample for all four datasets.



 §.§ Ablation Experiments















Effect of inversion based optimization In order to demonstrate the effectiveness of optimizing the unseen class distributions using inversion <ref>(D), we calculate the FID and LPIPS scores of the samples generated with and without inversion based optimization on the AnimalFaces dataset in 3-shot setting. As observed in <ref>, the image quality improves drastically using inversion based optimization, although the diversity of the generated samples drops. The improvement in the generation quality can be attributed to the increased fidelity of the samples after optimization; when inversion is not applied, samples belonging to neighbouring seen classes are generated. This is also evident in <ref> – for a specific species of fox in AnimalFaces, CDM without inversion tends to produce a different species of fox, one that the model has seen while training. This is not the case when inversion is applied.





§ CONCLUSION AND FUTURE DIRECTIONS

In this work, we have proposed Conditional Distribution Modelling (CDM) - a framework that successfully employs Diffusion models for few-shot image synthesis on large scale datasets and achieves state-of-the-art results. We show how taking advantage of the neighbouring seen class statistics at test time can greatly benefit the image generation diversity. However, like all the diffusion based approaches, its generation time is longer than GAN-based works because of the multiple forward passes required during the denoising process. 













splncs04

