Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Fidle
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Talks
Fidle
Commits
1f0df5ff
"IMDB/05-LSTM-Keras.ipynb" did not exist on "223fea7787e2af4e3a2330e5f402a56a2369844d"
Commit
1f0df5ff
authored
3 years ago
by
Jean-Luc Parouty
Browse files
Options
Downloads
Patches
Plain Diff
Update DCGAN
parent
30323274
No related branches found
No related tags found
No related merge requests found
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
DCGAN/01-DCGAN-Draw-me-a-sheep.ipynb
+372
-47
372 additions, 47 deletions
DCGAN/01-DCGAN-Draw-me-a-sheep.ipynb
DCGAN/modules/models/DCGAN.py
+7
-4
7 additions, 4 deletions
DCGAN/modules/models/DCGAN.py
with
379 additions
and
51 deletions
DCGAN/01-DCGAN-Draw-me-a-sheep.ipynb
+
372
−
47
View file @
1f0df5ff
This diff is collapsed.
Click to expand it.
DCGAN/modules/models/DCGAN.py
+
7
−
4
View file @
1f0df5ff
...
@@ -71,6 +71,9 @@ class DCGAN(keras.Model):
...
@@ -71,6 +71,9 @@ class DCGAN(keras.Model):
loss_function : Loss function
loss_function : Loss function
'''
'''
super
(
DCGAN
,
self
).
compile
()
super
(
DCGAN
,
self
).
compile
()
self
.
discriminator
.
compile
(
optimizer
=
discriminator_optimizer
,
loss
=
loss_function
)
self
.
generator
.
compile
(
optimizer
=
generator_optimizer
,
loss
=
loss_function
)
self
.
d_optimizer
=
discriminator_optimizer
self
.
d_optimizer
=
discriminator_optimizer
self
.
g_optimizer
=
generator_optimizer
self
.
g_optimizer
=
generator_optimizer
self
.
loss_fn
=
loss_function
self
.
loss_fn
=
loss_function
...
@@ -121,11 +124,11 @@ class DCGAN(keras.Model):
...
@@ -121,11 +124,11 @@ class DCGAN(keras.Model):
combined_images
=
tf
.
concat
(
[
generated_images
,
real_images
],
axis
=
0
)
combined_images
=
tf
.
concat
(
[
generated_images
,
real_images
],
axis
=
0
)
# Creation of labels corresponding to real or fake images
# Creation of labels corresponding to real or fake images
#
1
is generated,
0
is real
#
0
is generated,
1
is real
labels
=
tf
.
concat
(
[
tf
.
one
s
((
batch_size
,
1
)),
tf
.
zero
s
((
batch_size
,
1
))],
axis
=
0
)
labels
=
tf
.
concat
(
[
tf
.
zero
s
((
batch_size
,
1
)),
tf
.
one
s
((
batch_size
,
1
))],
axis
=
0
)
# Add random noise to the labels - important trick !
# Add random noise to the labels - important trick !
labels
+=
0.05
*
tf
.
random
.
uniform
(
tf
.
shape
(
labels
))
#
labels += 0.05 * tf.random.uniform(tf.shape(labels))
# ---- Train the discriminator -----------------------------
# ---- Train the discriminator -----------------------------
# ----------------------------------------------------------
# ----------------------------------------------------------
...
@@ -155,7 +158,7 @@ class DCGAN(keras.Model):
...
@@ -155,7 +158,7 @@ class DCGAN(keras.Model):
random_latent_vectors
=
tf
.
random
.
normal
(
shape
=
(
batch_size
,
self
.
latent_dim
))
random_latent_vectors
=
tf
.
random
.
normal
(
shape
=
(
batch_size
,
self
.
latent_dim
))
# Assemble labels that say all images are real, yes it's a lie ;-)
# Assemble labels that say all images are real, yes it's a lie ;-)
misleading_labels
=
tf
.
zero
s
((
batch_size
,
1
))
misleading_labels
=
tf
.
one
s
((
batch_size
,
1
))
# ---- Train the generator ---------------------------------
# ---- Train the generator ---------------------------------
# ----------------------------------------------------------
# ----------------------------------------------------------
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment