lucifertrj commited on
Commit
f92e992
•
1 Parent(s): c03038a

add model card

Browse files
Files changed (1) hide show
  1. README.md +55 -1
README.md CHANGED
@@ -1,3 +1,6 @@
 
 
 
1
  ---
2
  license: gpl-2.0
3
  ---
@@ -6,4 +9,55 @@ license: gpl-2.0
6
 
7
  This is an example notebook for Keras sprint prepared by Hugging Face. Keras Sprint aims to reproduce Keras examples and build interactive demos to them. The markdown parts beginning with 🤗 and the following code snippets are the parts added by the Hugging Face team to give you an example of how to host your model and build a demo.
8
 
9
- **Original Author of the DCGAN to generate face images Example:** [fchollet](https://twitter.com/fchollet)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ â–²
3
+ 🙂
4
  ---
5
  license: gpl-2.0
6
  ---
 
9
 
10
  This is an example notebook for Keras sprint prepared by Hugging Face. Keras Sprint aims to reproduce Keras examples and build interactive demos to them. The markdown parts beginning with 🤗 and the following code snippets are the parts added by the Hugging Face team to give you an example of how to host your model and build a demo.
11
 
12
+ **Original Author of the DCGAN to generate face images Example:** [fchollet](https://twitter.com/fchollet)
13
+
14
+ ## Steps to Train the DCGAN
15
+
16
+ 1. Create the discriminator
17
+ - It maps a 64x64 image to a binary classification score.
18
+
19
+ ```py
20
+
21
+ discriminator = keras.Sequential(
22
+ [
23
+ keras.Input(shape=(64, 64, 3)),
24
+ layers.Conv2D(64, kernel_size=4, strides=2, padding="same"),
25
+ layers.LeakyReLU(alpha=0.2),
26
+ layers.Conv2D(128, kernel_size=4, strides=2, padding="same"),
27
+ layers.LeakyReLU(alpha=0.2),
28
+ layers.Conv2D(128, kernel_size=4, strides=2, padding="same"),
29
+ layers.LeakyReLU(alpha=0.2),
30
+ layers.Flatten(),
31
+ layers.Dropout(0.2),
32
+ layers.Dense(1, activation="sigmoid"),
33
+ ],
34
+ name="discriminator",
35
+ )
36
+
37
+ ```
38
+
39
+ 2. Create the generator
40
+ - It mirrors the discriminator, replacing Conv2D layers with Conv2DTranspose layers
41
+
42
+ ```py
43
+
44
+ latent_dim = 128
45
+
46
+ generator = keras.Sequential(
47
+ [
48
+ keras.Input(shape=(latent_dim,)),
49
+ layers.Dense(8 * 8 * 128),
50
+ layers.Reshape((8, 8, 128)),
51
+ layers.Conv2DTranspose(128, kernel_size=4, strides=2, padding="same"),
52
+ layers.LeakyReLU(alpha=0.2),
53
+ layers.Conv2DTranspose(256, kernel_size=4, strides=2, padding="same"),
54
+ layers.LeakyReLU(alpha=0.2),
55
+ layers.Conv2DTranspose(512, kernel_size=4, strides=2, padding="same"),
56
+ layers.LeakyReLU(alpha=0.2),
57
+ layers.Conv2D(3, kernel_size=5, padding="same", activation="sigmoid"),
58
+ ],
59
+ name="generator",
60
+ )
61
+ ```
62
+
63
+ HF Contributor: [Tarun Jain](https://twitter.com/TRJ_0751)