mirror of
https://github.com/davisking/dlib.git
synced 2024-11-01 10:14:53 +08:00
Remove outdated comment from DCGAN example (#2048)
* Remove outdated comment That comment was there from when I was using a dnn_trainer to train the discriminator network. * Fix case
This commit is contained in:
parent
237746fc13
commit
5a715fe24d
@ -198,18 +198,18 @@ int main(int argc, char** argv) try
|
|||||||
discriminator.update_parameters(d_solvers, learning_rate);
|
discriminator.update_parameters(d_solvers, learning_rate);
|
||||||
|
|
||||||
// Train the discriminator with fake images
|
// Train the discriminator with fake images
|
||||||
// 1. generate some random noise
|
// 1. Generate some random noise
|
||||||
std::vector<noise_t> noises;
|
std::vector<noise_t> noises;
|
||||||
while (noises.size() < minibatch_size)
|
while (noises.size() < minibatch_size)
|
||||||
{
|
{
|
||||||
noises.push_back(make_noise(rnd));
|
noises.push_back(make_noise(rnd));
|
||||||
}
|
}
|
||||||
// 2. convert noises into a tensor
|
// 2. Convert noises into a tensor
|
||||||
generator.to_tensor(noises.begin(), noises.end(), noises_tensor);
|
generator.to_tensor(noises.begin(), noises.end(), noises_tensor);
|
||||||
// 3. Then forward the noise through the network and convert the outputs into images.
|
// 3. Forward the noise through the network and convert the outputs into images.
|
||||||
const auto fake_samples = get_generated_images(generator.forward(noises_tensor));
|
const auto fake_samples = get_generated_images(generator.forward(noises_tensor));
|
||||||
// 4. finally train the discriminator and wait for the threading to stop. The following
|
// 4. Finally train the discriminator. The following lines are equivalent to calling
|
||||||
// lines are equivalent to calling train_one_step(fake_samples, fake_labels)
|
// train_one_step(fake_samples, fake_labels)
|
||||||
discriminator.to_tensor(fake_samples.begin(), fake_samples.end(), fake_samples_tensor);
|
discriminator.to_tensor(fake_samples.begin(), fake_samples.end(), fake_samples_tensor);
|
||||||
d_loss.add(discriminator.compute_loss(fake_samples_tensor, fake_labels.begin()));
|
d_loss.add(discriminator.compute_loss(fake_samples_tensor, fake_labels.begin()));
|
||||||
discriminator.back_propagate_error(fake_samples_tensor);
|
discriminator.back_propagate_error(fake_samples_tensor);
|
||||||
|
Loading…
Reference in New Issue
Block a user