Skip to content

Commit

Permalink
Merge pull request google#1 from kylemcdonald/patch-1
Browse files Browse the repository at this point in the history
small typos
  • Loading branch information
znah committed Jul 2, 2015
2 parents b5a6690 + b2a5de3 commit 7704c99
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions dream.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
"source": [
"Making the \"dream\" images is very simple. Essentially it is just a gradient ascent process that tries to maximize the L2 norm of activations of a particular DNN layer. Here are a few simple tricks that we found useful for getting good images:\n",
"* offset image by a random jitter\n",
"* normlize the magnitude of gradient ascent steps\n",
"* normalize the magnitude of gradient ascent steps\n",
"* apply ascent across multiple scales (octaves)\n",
"\n",
"First we implement a basic gradient ascent step function, applying the first two tricks:"
Expand All @@ -136,17 +136,17 @@
"def make_step(net, step_size=1.5, end='inception_4c/output', jitter=32, clip=True):\n",
" '''Basic gradient ascent step.'''\n",
"\n",
" src = net.blobs['data'] # input image is storred in Net's 'data' blob\n",
" src = net.blobs['data'] # input image is stored in Net's 'data' blob\n",
" dst = net.blobs[end]\n",
"\n",
" ox, oy = np.random.randint(-jitter, jitter+1, 2)\n",
" src.data[0] = np.roll(np.roll(src.data[0], ox, -1), oy, -2) # apply jitter shift\n",
" \n",
" net.forward(end=end)\n",
" dst.diff[:] = dst.data # specify the optimiation objective\n",
" dst.diff[:] = dst.data # specify the optimization objective\n",
" net.backward(start=end)\n",
" g = src.diff[0]\n",
" # apply normaized ascent step to the input image\n",
" # apply normalized ascent step to the input image\n",
" src.data[:] += step_size/np.abs(g).mean() * g\n",
"\n",
" src.data[0] = np.roll(np.roll(src.data[0], -ox, -1), -oy, -2) # unshift image\n",
Expand Down Expand Up @@ -348,7 +348,7 @@
"id": "rkzHz9E8OZOb"
},
"source": [
"We encorage readers to experiment with layer selection to see how it affects the results. Execute the next code cell to see the list of different layers. You can modify the `make_step` function to make it follow some different objective, say to select a subset of activations to maximize, or to maximize multiple layers at once. There is a huge design space to explore!"
"We encourage readers to experiment with layer selection to see how it affects the results. Execute the next code cell to see the list of different layers. You can modify the `make_step` function to make it follow some different objective, say to select a subset of activations to maximize, or to maximize multiple layers at once. There is a huge design space to explore!"
]
},
{
Expand Down

0 comments on commit 7704c99

Please sign in to comment.