|
40 | 40 | "\n", |
41 | 41 | "## Load and Visualize the Data\n", |
42 | 42 | "\n", |
43 | | - "We'll first load in and visualize the training data, importing the necessary libraries to do so.\n", |
44 | | - "\n", |
45 | | - "> If you are working locally, you'll need to download the data as a zip file by [clicking here](https://s3.amazonaws.com/video.udacity-data.com/topher/2018/November/5be66e78_summer2winter-yosemite/summer2winter-yosemite.zip).\n", |
46 | | - "\n", |
47 | | - "It may be named `summer2winter-yosemite` with a dash or an underscore, so take note and make sure the below `image_dir` accordingly. Then you can proceed with the following loading code." |
| 43 | + "We'll first load in and visualize the training data, importing the necessary libraries to do so." |
| 44 | + ] |
| 45 | + }, |
| 46 | + { |
| 47 | + "cell_type": "code", |
| 48 | + "execution_count": null, |
| 49 | + "metadata": { |
| 50 | + "collapsed": true |
| 51 | + }, |
| 52 | + "outputs": [], |
| 53 | + "source": [ |
| 54 | + "# !unzip summer2winter_yosemite.zip # can comment out after executing once" |
48 | 55 | ] |
49 | 56 | }, |
50 | 57 | { |
|
263 | 270 | "def scale(x, feature_range=(-1, 1)):\n", |
264 | 271 | " ''' Scale takes in an image x and returns that image, scaled\n", |
265 | 272 | " with a feature_range of pixel values from -1 to 1. \n", |
266 | | - " This function assumes that the input x is already scaled from 0-1.'''\n", |
| 273 | + " This function assumes that the input x is already scaled from 0-255.'''\n", |
267 | 274 | " \n", |
268 | 275 | " # scale from 0-1 to feature_range\n", |
269 | 276 | " min, max = feature_range\n", |
|
382 | 389 | " self.conv4 = conv(conv_dim*4, conv_dim*8, 4) # (8, 8, 512)\n", |
383 | 390 | " \n", |
384 | 391 | " # Classification layer\n", |
385 | | - " self.conv5 = conv(conv_dim*8, 1, 4, stride=1, batch_norm=False)\n", |
| 392 | + " self.conv5 = conv(conv_dim*8, 1, 8, stride=1, padding=0, batch_norm=False)\n", |
| 393 | + " \n", |
386 | 394 | "\n", |
387 | 395 | " def forward(self, x):\n", |
388 | 396 | " # relu applied to all conv layers but last\n", |
|
1003 | 1011 | " return torch.mean((D_out-1)**2)\n", |
1004 | 1012 | "\n", |
1005 | 1013 | "def fake_mse_loss(D_out):\n", |
1006 | | - " # how close is the produced output from being \"fake\"?\n", |
| 1014 | + " # how close is the produced output from being \"false\"?\n", |
1007 | 1015 | " return torch.mean(D_out**2)\n", |
1008 | 1016 | "\n", |
1009 | 1017 | "def cycle_consistency_loss(real_im, reconstructed_im, lambda_weight):\n", |
|
1944 | 1952 | ], |
1945 | 1953 | "metadata": { |
1946 | 1954 | "kernelspec": { |
1947 | | - "display_name": "Python [default]", |
| 1955 | + "display_name": "Python 3", |
1948 | 1956 | "language": "python", |
1949 | 1957 | "name": "python3" |
1950 | 1958 | }, |
|
1958 | 1966 | "name": "python", |
1959 | 1967 | "nbconvert_exporter": "python", |
1960 | 1968 | "pygments_lexer": "ipython3", |
1961 | | - "version": "3.6.4" |
| 1969 | + "version": "3.6.3" |
1962 | 1970 | } |
1963 | 1971 | }, |
1964 | 1972 | "nbformat": 4, |
|
0 commit comments