This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
cs501r_f2016:lab7 [2016/10/10 15:49] wingated |
cs501r_f2016:lab7 [2021/06/30 23:42] (current) |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====WARNING THIS LAB SPEC IS UNDER DEVELOPMENT:==== | ||
| + | |||
| + | |||
| ====Objective:==== | ====Objective:==== | ||
| Line 10: | Line 13: | ||
| For this lab, you will need to implement a generative adversarial | For this lab, you will need to implement a generative adversarial | ||
| - | network (GAN). You will generate images that look like MNIST digits. | + | network (GAN). |
| + | Specifically, we will be using the technique outlined in the paper [[https://arxiv.org/pdf/1704.00028|Improved Training of Wasserstein GANs]]. | ||
| - | You should turn in an iPython notebook that shows a single plot, which | + | You should turn in an iPython notebook that shows a two plots. The first plot should be random samples from the final generator. The second should show interpolation between two faces by interpolating in ''z'' space. |
| - | will be samples from the final GAN. | + | |
| - | An example of my final samples is shown at the right. | + | You must also turn in your code, but your code does not need to be in a notebook, if it's easier to turn it in separately (but please zip your code and notebook together in a single zip file). |
| - | You are welcome to turn in your image and your code separately. | + | An example of my final samples is shown at the right. |
| **NOTE:** this lab is complex. Please read through **the entire | **NOTE:** this lab is complex. Please read through **the entire | ||
| Line 49: | Line 52: | ||
| discriminator and generator separately, we'll need to be able to train | discriminator and generator separately, we'll need to be able to train | ||
| on subsets of variables. | on subsets of variables. | ||
| - | |||
| - | This lab is a bit more complex than some of the others, so we are | ||
| - | providing some scaffold code: | ||
| - | |||
| - | [[http://liftothers.org/byu/lab7_scaffold.py|Lab 7 scaffold code]] | ||
| In the scaffold code, you will find the following: | In the scaffold code, you will find the following: | ||
| Line 122: | Line 120: | ||
| - ''H0'': A 2d convolution on ''imgs'' with 32 filters, followed by a leaky relu | - ''H0'': A 2d convolution on ''imgs'' with 32 filters, followed by a leaky relu | ||
| - ''H1'': A 2d convolution on ''H0'' with 64 filters, followed by a leaky relu | - ''H1'': A 2d convolution on ''H0'' with 64 filters, followed by a leaky relu | ||
| - | - ''H2'': A linear layer from ''H1'' to a 1024 dimensional vector | + | - ''H2'': A linear layer from ''H1'' to a 1024 dimensional vector, followed by a leaky relu |
| - ''H3'': A linear layer mapping ''H2'' to a single scalar (per image) | - ''H3'': A linear layer mapping ''H2'' to a single scalar (per image) | ||
| - The final output should be a sigmoid of ''H3''. | - The final output should be a sigmoid of ''H3''. | ||
| Line 151: | Line 149: | ||
| ---- | ---- | ||
| **Part 4: create your loss functions and training ops** | **Part 4: create your loss functions and training ops** | ||
| + | |||
| + | {{ :cs501r_f2016:lab7_graph.png?200|}} | ||
| You should create two loss functions, one for the discriminator, and | You should create two loss functions, one for the discriminator, and | ||
| Line 186: | Line 186: | ||
| I highly recommend using Tensorboard to visualize your final | I highly recommend using Tensorboard to visualize your final | ||
| - | computation graph to make sure you got this right. | + | computation graph to make sure you got this right. Check out my computation graph image on the right - you can see the two discriminator blocks, and you can see that the same variables are feeding into both of them. |
| ---- | ---- | ||
| Line 202: | Line 202: | ||
| like this: | like this: | ||
| - | '' | + | <code> |
| 0 1.37 0.71 0.88 | 0 1.37 0.71 0.88 | ||
| 10 0.90 0.98 1.00 | 10 0.90 0.98 1.00 | ||
| Line 224: | Line 224: | ||
| ... | ... | ||
| 490 1.25 1.12 0.68 | 490 1.25 1.12 0.68 | ||
| - | '' | + | </code> |
| Note that we see the struggle between the generator and discriminator | Note that we see the struggle between the generator and discriminator | ||
| Line 239: | Line 239: | ||
| 5000 steps, instead of 500. | 5000 steps, instead of 500. | ||
| + | **Hint for debugging**: if you ever see the cost function for the generator going higher and higher, it means that the discriminator is too powerful. | ||