geninhu commited on
Commit
53418f9
1 Parent(s): eb7a4b7

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +66 -0
README.md ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - huggan
4
+ - gan
5
+ # See a list of available tags here:
6
+ # https://github.com/huggingface/hub-docs/blob/main/js/src/lib/interfaces/Types.ts#L12
7
+ # task: unconditional-image-generation or conditional-image-generation or image-to-image
8
+ license: mit
9
+ ---
10
+
11
+ # Generate fauvism still life image using FastGAN
12
+
13
+ ## Model description
14
+
15
+ [FastGAN model](https://arxiv.org/abs/2101.04775) is a Generative Adversarial Networks (GAN) training on a small amount of high-fidelity images with minimum computing cost. Using a skip-layer channel-wise excitation module and a self-supervised discriminator trained as a feature-encoder, the model was able to converge after some hours of training for either 100 high-quality images or 1000 images datasets.
16
+
17
+ This model was trained on a dataset of 136 high-quality moon gate images.
18
+
19
+ #### How to use
20
+
21
+ ```python
22
+ # Clone this model
23
+ git clone https://huggingface.co/huggan/fastgan-few-shot-moongate
24
+
25
+ def load_generator(model_name_or_path):
26
+ generator = Generator(in_channels=256, out_channels=3)
27
+ generator = generator.from_pretrained(model_name_or_path, in_channels=256, out_channels=3)
28
+ _ = generator.eval()
29
+ return generator
30
+
31
+ def _denormalize(input: torch.Tensor) -> torch.Tensor:
32
+ return (input * 127.5) + 127.5
33
+
34
+ # Load generator
35
+ generator = load_generator("huggan/fastgan-few-shot-moongate")
36
+ # Generate a random noise image
37
+ noise = torch.zeros(1, 256, 1, 1, device=device).normal_(0.0, 1.0)
38
+ with torch.no_grad():
39
+ gan_images, _ = generator(noise)
40
+
41
+ gan_images = _denormalize(gan_images.detach())
42
+ save_image(gan_images, "sample.png", nrow=1, normalize=True)
43
+ ```
44
+
45
+ #### Limitations and bias
46
+
47
+ * Converge faster and better with small datasets (less than 1000 samples)
48
+
49
+ ## Training data
50
+
51
+ [few-shot-moongate](huggan/few-shot-moongate)
52
+
53
+ ## Generated Images
54
+
55
+ ![Example image](example.png)
56
+
57
+ ### BibTeX entry and citation info
58
+
59
+ ```bibtex
60
+ @article{FastGAN,
61
+ title={Towards Faster and Stabilized GAN Training for High-fidelity Few-shot Image Synthesis},
62
+ author={Bingchen Liu, Yizhe Zhu, Kunpeng Song, Ahmed Elgammal},
63
+ journal={ICLR},
64
+ year={2021}
65
+ }
66
+ ```