Top AI Repos — open-source AI, indexed and scored
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Official pytorch implementation of the paper: "SinGAN: Learning a Generative Model from a Single Natural Image"
| Date | Stars |
|---|---|
| 2026-07-24 | 3346 |
| 2026-07-25 | 3346 |
| 2026-07-28 | 3346 |
| 2026-07-30 | 3346 |
| 2026-08-06 | 3346 |
Today
— stars today
This week
— stars this week
This month
— stars this month
Momentum
0.0
growth rate 0.00%/day
# SinGAN
[Project](https://tamarott.github.io/SinGAN.htm) | [Arxiv](https://arxiv.org/pdf/1905.01164.pdf) | [CVF](http://openaccess.thecvf.com/content_ICCV_2019/papers/Shaham_SinGAN_Learning_a_Generative_Model_From_a_Single_Natural_Image_ICCV_2019_paper.pdf) | [Supplementary materials](https://openaccess.thecvf.com/content_ICCV_2019/supplemental/Shaham_SinGAN_Learning_a_ICCV_2019_supplemental.pdf) | [Talk (ICCV`19)](https://youtu.be/mdAcPe74tZI?t=3191)
### Official pytorch implementation of the paper: "SinGAN: Learning a Generative Model from a Single Natural Image"
#### ICCV 2019 Best paper award (Marr prize)
## Random samples from a *single* image
With SinGAN, you can train a generative model from a single natural image, and then generate random samples from the given image, for example:

## SinGAN's applications
SinGAN can be also used for a line of image manipulation tasks, for example:

This is done by injecting an image to the already trained model. See section 4 in our [paper](https://arxiv.org/pdf/1905.01164.pdf) for more details.
### Citation
If you use this code for your research, please cite our paper:
```
@inproceedings{rottshaham2019singan,
title={SinGAN: Learning a Generative Model from a Single Natural Image},
author={Rott Shaham, Tamar and Dekel, Tali and Michaeli, Tomer},
booktitle={Computer Vision (ICCV), IEEE International Conference on},
year={2019}
}
```
## Code
### Install dependencies
```
python -m pip install -r requirements.txt
```
This code was tested with python 3.6, torch 1.4
Please note: the code currently only supports torch 1.4 or earlier because of the optimization scheme.
For later torch versions, you may try this repository: https://github.com/kligvasser/SinGAN (results won't necessarily be identical to the official implementation).
### Train
To train SinGAN model on your own image, put the desired training image under Input/Images, and run
```
python main_train.py --input_name <input_file_name>
```
This will also use the resulting trained model to generate random samples starting from the coarsest scale (n=0).
To run this code on a cpu machine, specify `--not_cuda` when calling `main_train.py`
### Random samples
To generate random samples from any starting generation scale, please first train SinGAN model on the desired image (as described above), then run
```
python random_samples.py --input_name <training_image_file_name> --mode random_samples --gen_start_scale <generation start scale number>
```
pay attention: for using the full model, specify the generation start scale to be 0, to start the generation from the second scale, specify it to be 1, and so on.
### Random samples of arbitrary sizes
To generate random samples of arbitrary sizes, please first train SinGAN model on the desired image (as described above), then run
```
python random_samples.py --input_name <training_image_file_name> --mode random_samples_arbitrary_sizes --scale_h <horizontal scaling factor> --scale_v <vertical scaling factor>
```
### Animation from a single image
To generate short animation from a single image, run
```
python animation.py --input_name <input_file_name>
```
This will automatically start a new training phase with noise padding mode.
### Harmonization
To harmonize a pasted object into an image (See example in Fig. 13 in [our paper](https://arxiv.org/pdf/1905.01164.pdf)), please first train SinGAN model on the desired background image (as described above), then save the naively pasted reference image and it's binary mask under "Input/Harmonization" (see saved images for an example). Run the command
```
python harmonization.py --input_name <training_image_file_name> --ref_name <naively_pasted_reference_image_file_name> --harmonization_start_scale <scale to inject>
```
Please note that different injection scale will produce different harmonization effects. The coarsest injection scale equals 1.
### EditingExcerpt of 6,890 characters
Read on GitHubWould you bet a product on this? Bounded 0–100 and slow moving.
matched fp:7721a1f060304057, topic:super-resolution, topic:gan
matched fp:7721a1f060304057, topic:animation