Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix issue 80 #86

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions pix2pix/pix2pix.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ def __init__(self):
self.data_loader = DataLoader(dataset_name=self.dataset_name,
img_res=(self.img_rows, self.img_cols))


# Calculate output shape of D (PatchGAN)
patch = int(self.img_rows / 2**4)
self.disc_patch = (patch, patch, 1)
Expand All @@ -56,18 +55,17 @@ def __init__(self):

# Input images and their conditioning images
img_A = Input(shape=self.img_shape)
img_B = Input(shape=self.img_shape)

# By conditioning on B generate a fake version of A
fake_A = self.generator(img_B)
fake_A = self.generator(img_A)

# For the combined model we will only train the generator
self.discriminator.trainable = False

# Discriminators determines validity of translated images / condition pairs
valid = self.discriminator([fake_A, img_B])
valid = self.discriminator([fake_A, img_A])

self.combined = Model(inputs=[img_A, img_B], outputs=[valid, fake_A])
self.combined = Model(inputs=img_A, outputs=[valid, fake_A])
self.combined.compile(loss=['mse', 'mae'],
loss_weights=[1, 100],
optimizer=optimizer)
Expand Down Expand Up @@ -171,7 +169,7 @@ def train(self, epochs, batch_size=1, sample_interval=50):
# -----------------

# Train the generators
g_loss = self.combined.train_on_batch([imgs_A, imgs_B], [valid, imgs_A])
g_loss = self.combined.train_on_batch(imgs_B, [valid, imgs_A])

elapsed_time = datetime.datetime.now() - start_time
# Plot the progress
Expand Down