geninhu commited on
Commit
3cbfab6
1 Parent(s): 0316a6e

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +65 -0
README.md ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 120 high-quality Anime face images.
18
+
19
+ #### How to use
20
+
21
+ ```python
22
+ # Clone this model
23
+ git clone https://huggingface.co/huggan/fastgan-few-shot-anime-face
24
+ def load_generator(model_name_or_path):
25
+ generator = Generator(in_channels=256, out_channels=3)
26
+ generator = generator.from_pretrained(model_name_or_path, in_channels=256, out_channels=3)
27
+ _ = generator.eval()
28
+ return generator
29
+
30
+ def _denormalize(input: torch.Tensor) -> torch.Tensor:
31
+ return (input * 127.5) + 127.5
32
+
33
+ # Load generator
34
+ generator = load_generator("huggan/fastgan-few-shot-anime-face")
35
+ # Generate a random noise image
36
+ noise = torch.zeros(1, 256, 1, 1, device=device).normal_(0.0, 1.0)
37
+ with torch.no_grad():
38
+ gan_images, _ = generator(noise)
39
+
40
+ gan_images = _denormalize(gan_images.detach())
41
+ save_image(gan_images, "sample.png", nrow=1, normalize=True)
42
+ ```
43
+
44
+ #### Limitations and bias
45
+
46
+ * Converge faster and better with small datasets (less than 1000 samples)
47
+
48
+ ## Training data
49
+
50
+ [few-shot-anime-face](https://huggingface.co/datasets/huggan/few-shot-anime-face)
51
+
52
+ ## Generated Images
53
+
54
+ ![Example image](example.png)
55
+
56
+ ### BibTeX entry and citation info
57
+
58
+ ```bibtex
59
+ @article{FastGAN,
60
+ title={Towards Faster and Stabilized GAN Training for High-fidelity Few-shot Image Synthesis},
61
+ author={Bingchen Liu, Yizhe Zhu, Kunpeng Song, Ahmed Elgammal},
62
+ journal={ICLR},
63
+ year={2021}
64
+ }
65
+ ```