Skip to content

Commit 7d4e0d3

Browse files
authored
Merge pull request #311 from ahmedag91/master
Fix issue #310 #201
2 parents e8286df + 7c994b5 commit 7d4e0d3

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

cycle-gan/CycleGAN_Solution.ipynb

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,18 @@
4040
"\n",
4141
"## Load and Visualize the Data\n",
4242
"\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"
4855
]
4956
},
5057
{
@@ -263,7 +270,7 @@
263270
"def scale(x, feature_range=(-1, 1)):\n",
264271
" ''' Scale takes in an image x and returns that image, scaled\n",
265272
" 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",
267274
" \n",
268275
" # scale from 0-1 to feature_range\n",
269276
" min, max = feature_range\n",
@@ -382,7 +389,8 @@
382389
" self.conv4 = conv(conv_dim*4, conv_dim*8, 4) # (8, 8, 512)\n",
383390
" \n",
384391
" # 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",
386394
"\n",
387395
" def forward(self, x):\n",
388396
" # relu applied to all conv layers but last\n",
@@ -1003,7 +1011,7 @@
10031011
" return torch.mean((D_out-1)**2)\n",
10041012
"\n",
10051013
"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",
10071015
" return torch.mean(D_out**2)\n",
10081016
"\n",
10091017
"def cycle_consistency_loss(real_im, reconstructed_im, lambda_weight):\n",
@@ -1944,7 +1952,7 @@
19441952
],
19451953
"metadata": {
19461954
"kernelspec": {
1947-
"display_name": "Python [default]",
1955+
"display_name": "Python 3",
19481956
"language": "python",
19491957
"name": "python3"
19501958
},
@@ -1958,7 +1966,7 @@
19581966
"name": "python",
19591967
"nbconvert_exporter": "python",
19601968
"pygments_lexer": "ipython3",
1961-
"version": "3.6.4"
1969+
"version": "3.6.3"
19621970
}
19631971
},
19641972
"nbformat": 4,

0 commit comments

Comments
 (0)