Skip to content

Instantly share code, notes, and snippets.

@chrisnorthcott
Created July 4, 2015 12:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrisnorthcott/4b35d79a471b19533a42 to your computer and use it in GitHub Desktop.
Save chrisnorthcott/4b35d79a471b19533a42 to your computer and use it in GitHub Desktop.
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-6-d4150d0aed19> in <module>()
----> 1 _=deepdream(net, img)
<ipython-input-4-975ec2ad7030> in deepdream(net, base_img, iter_n, octave_n, octave_scale, end, clip, **step_params)
1 def deepdream(net, base_img, iter_n=10, octave_n=4, octave_scale=1.4, end='inception_4c/output', clip=True, **step_params):
2 # prepare base images for all octaves
----> 3 octaves = [preprocess(net, base_img)]
4 for i in xrange(octave_n-1):
5 octaves.append(nd.zoom(octaves[-1], (1, 1.0/octave_scale,1.0/octave_scale), order=1))
<ipython-input-2-9eaacde983ea> in preprocess(net, img)
18 print np.float32(np.rollaxis(img, 2)[::-1])
19 print net.transformer.mean['data']
---> 20 return np.float32(np.rollaxis(img, 2)[::-1]) - net.transformer.mean['data']
21 def deprocess(net, img):
22 return np.dstack((img + net.transformer.mean['data'])[::-1])
ValueError: operands could not be broadcast together with shapes (4,602,915) (3,1,1)
@chrisnorthcott
Copy link
Author

Also:

[[[ 255.  255.  255. ...,  255.  255.  255.]
  [ 255.  255.  255. ...,  255.  255.  255.]
  [ 255.  255.  255. ...,  255.  255.  255.]
  ..., 
  [ 255.  255.  255. ...,  255.  255.  255.]
  [ 255.  255.  255. ...,  255.  255.  255.]
  [ 255.  255.  255. ...,  255.  255.  255.]]

 [[ 179.  183.  180. ...,  178.  181.  180.]
  [ 182.  181.  180. ...,  182.  178.  179.]
  [ 182.  179.  184. ...,  177.  176.  171.]
  ..., 
  [ 103.  103.  102. ...,  144.  133.  130.]
  [  87.  102.  105. ...,  139.  129.  127.]
  [ 100.   96.  106. ...,  133.  150.  149.]]

 [[ 181.  183.  183. ...,  176.  180.  179.]
  [ 184.  181.  183. ...,  180.  176.  178.]
  [ 182.  179.  187. ...,  176.  177.  170.]
  ..., 
  [ 110.  110.  107. ...,  148.  136.  133.]
  [ 101.  111.  114. ...,  142.  133.  128.]
  [ 109.  108.  117. ...,  137.  153.  150.]]

 [[ 203.  203.  200. ...,  189.  195.  190.]
  [ 206.  201.  202. ...,  193.  189.  189.]
  [ 202.  199.  206. ...,  194.  191.  178.]
  ..., 
  [ 113.  113.  108. ...,  154.  142.  139.]
  [ 102.  108.  111. ...,  148.  139.  141.]
  [ 108.  104.  116. ...,  138.  158.  160.]]]
[[[ 104.]]

 [[ 116.]]

 [[ 122.]]]```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment