Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alexiajm/generative-model-most-similar-images
Function that output the 5 most similar training (real) images to the given generated (fake) images.
https://github.com/alexiajm/generative-model-most-similar-images
deep-learning gan generative-adversarial-network generator picture
Last synced: about 1 month ago
JSON representation
Function that output the 5 most similar training (real) images to the given generated (fake) images.
- Host: GitHub
- URL: https://github.com/alexiajm/generative-model-most-similar-images
- Owner: AlexiaJM
- License: gpl-3.0
- Created: 2017-07-15T12:35:28.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-08-22T19:31:32.000Z (over 3 years ago)
- Last Synced: 2024-11-04T14:43:58.610Z (about 2 months ago)
- Topics: deep-learning, gan, generative-adversarial-network, generator, picture
- Language: Python
- Size: 3.61 MB
- Stars: 44
- Watchers: 4
- Forks: 13
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Generative-model-most-similar-images
After generating fake images with a Generator (generally GANs), many are concerned about whether the generated images are really novel or rather just copies of the training dataset. This repository contains a python function that output the 5 most similar training (real) images to the given generated (fake) images. I couldn't find an implementation for this so I made one. It does not require any deep learning library and you only need the training images and the fake generated images (of batch size 1).
The code is slow, especially if the training sample is large, this is because we compare every "fake image" x "real image" pair. Coding optimizations are welcome.
**Needed**
* Python 3.6
* opencv-python
* scikit-image**To run**
```bash
$ # Replace folders with yours and replace "png" by "jpg" if necessary
$ python most_similar.py --input_folder_fake_img "folder1" --input_folder_real_img "folder2" --output_folder "folder3" --fake_img_type "png" --real_img_type' "png"
```**Example**
I chose 10 cute looking 128x128 images of cats using a trained DCGAN with SELU and looked for the 5 most similar cats. Here's the results (Top row contains the generated (fake) cats):
![](/images/DCGAN_SELU_128X128_most_similar_images1.png)
![](/images/DCGAN_SELU_128X128_most_similar_images2.png)