> **Important Warning**: This competition has an experimental format and submission style (images as submission). Competitors **must** use generative methods to create their submission images and are not permitted to make submissions that include any images already classified as dogs or altered versions of such images. 

> To enforce and prevent cheating, we reserve the right to: (a) Visually inspect all participants' submitted images, (b) review any submitted source code, (c) use these reviews to identify violators or determine winners, and (d) disqualify participants from the competition who are found in violation. This is also specified in the [competition's rules](https://www.kaggle.com/c/generative-dog-images/overview)



## MiFID

Submissions are evaluated on MiFID (Memorization-informed Fréchet Inception Distance), which is a modification from [Fréchet Inception Distance (FID)](https://arxiv.org/abs/1706.08500). 

The smaller MiFID is, the better your generated images are.  



## What is FID?
Originally published [here](https://arxiv.org/abs/1706.08500) ([github](https://github.com/bioinf-jku/TTUR)), FID, along with [Inception Score (IS)](https://arxiv.org/abs/1606.03498), are both commonly used in recent publications as the standard for evaluation methods of GANs. 

In FID, we use the Inception network to extract features from an intermediate layer. Then we model the data distribution for these features using a multivariate Gaussian distribution with mean µ and covariance Σ. The FID between the real images \\(r\\) and generated images \\(g\\) is computed as:

\\[
\text{FID} = ||\mu\_r - \mu\_g||^2 + \text{Tr} (\Sigma\_r + \Sigma\_g - 2 (\Sigma\_r \Sigma\_g)^{1/2})
\\]

where \\(Tr\\) sums up all the diagonal elements. FID is calculated by computing the Fréchet distance between two Gaussians fitted to feature representations of the Inception network.



## What is MiFID (Memorization-informed FID)?
In addition to FID, Kaggle takes training sample memorization into account. 

The memorization distance is defined as the minimum cosine distance of all training samples in the feature space, averaged across all user generated image samples. This distance is thresholded, and it's assigned to 1.0 if the distance exceeds a pre-defined epsilon. 

In mathematical form:

\\[d\_{ij} = 1 - cos(f\_{gi}, f\_{rj}) = 1 - \frac{f\_{gi} \cdot f\_{rj}}{|f\_{gi}| |f\_{rj}|}\\] 

where \\(f\_g\\) and \\(f\_r\\) represent the generated/real images in feature space (defined in pre-trained networks); and \\(f\_{gi}\\) and \\(f\_{rj}\\) represent the \\(i^{th}\\) and \\(j^{th}\\) vectors of \\(f\_g\\) and \\(f\_r\\), respectively. 


\\[d = \frac{1}{N} \sum\_{i} \min\_j d\_{ij} \\]

defines the minimum distance of a certain generated image (\\(i\\)) across all real images ((\\(j\\)), then averaged across all the generated images. 

![enter image description here][1]
defines the threshold of the weight only applies when the (\\(d\\)) is below a certain empirically determined threshold. 

Finally, this memorization term is applied to the FID:
\\[ MiFID = FID \cdot \frac{1}{d\_{thr}}\\]

## Kaggle's workflow calculating MiFID for public and private scores
Kaggle calculates public and private MiFID scores with the same code, but with different pre-trained models and evaluation images. The public pre-train neural network is [Inception](http://download.tensorflow.org/models/image/imagenet/inception-2015-12-05.tgz), and the public images used for evaluation are the ImageNet Dogs (all 120 breeds). **We will not be sharing what private model or dataset is used for the private MiFID score.**

A demo of our MiFID evaluation code can be seen [here](https://www.kaggle.com/wendykan/demo-mifid-metric-for-dog-image-generation-comp).

Our workflow of computing the public/private MiFID is demonstrated below:

![enter image description here][2]


## Submission File
You are going to generate 10,000 images that are in `PNG` format. Their sizes should be 64x64x3 (RGB). Then you need to zip those images and your output from your Kernel should only have **ONE** output file named `images.zip`. 

Please note that Kaggle Kernels has a number of output files capped at 500. We highly encourage you to either directly write to a `zip` file as you generate images, or create a folder at `../tmp` as your temporary directory. 


  [1]: https://storage.googleapis.com/kaggle-media/competitions/GAN/latex-img-150.png
  [2]: https://storage.googleapis.com/kaggle-media/competitions/GAN/Kaggle%20GAN%20Diagram%20(3).png