Skip to content

images need to be in color, bw images yeild: #1

@d-grossman

Description

@d-grossman
Recursive level: 0
Processing image: 
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
~/anaconda/lib/python3.6/site-packages/tensorflow/python/client/session.py in __init__(self, fetches, contraction_fn)
    266         self._unique_fetches.append(ops.get_default_graph().as_graph_element(
--> 267             fetch, allow_tensor=True, allow_operation=True))
    268       except TypeError as e:

~/anaconda/lib/python3.6/site-packages/tensorflow/python/framework/ops.py in as_graph_element(self, obj, allow_tensor, allow_operation)
   2583     with self._lock:
-> 2584       return self._as_graph_element_locked(obj, allow_tensor, allow_operation)
   2585 

~/anaconda/lib/python3.6/site-packages/tensorflow/python/framework/ops.py in _as_graph_element_locked(self, obj, allow_tensor, allow_operation)
   2662       if obj.graph is not self:
-> 2663         raise ValueError("Tensor %s is not an element of this graph." % obj)
   2664       return obj

ValueError: Tensor Tensor("gradients_3/conv2d0_pre_relu/conv_grad/Conv2DBackpropInput:0", shape=(?, ?, ?, ?), dtype=float32) is not an element of this graph.

During handling of the above exception, another exception occurred:

ValueError                                Traceback (most recent call last)
<ipython-input-57-5d83fc662529> in <module>()
      1 img_result = recursive_optimize(layer_tensor=layer_tensor, image=image,
      2                  num_iterations=10, step_size=3.0, rescale_factor=0.7,
----> 3                  num_repeats=4, blend=0.2)

<ipython-input-46-f2d8e35fb16c> in recursive_optimize(layer_tensor, image, num_repeats, rescale_factor, blend, num_iterations, step_size, tile_size)
     42                                         num_iterations=num_iterations,
     43                                         step_size=step_size,
---> 44                                         tile_size=tile_size)
     45 
     46         # Upscale the resulting image back to its original size.

<ipython-input-46-f2d8e35fb16c> in recursive_optimize(layer_tensor, image, num_repeats, rescale_factor, blend, num_iterations, step_size, tile_size)
     42                                         num_iterations=num_iterations,
     43                                         step_size=step_size,
---> 44                                         tile_size=tile_size)
     45 
     46         # Upscale the resulting image back to its original size.

<ipython-input-46-f2d8e35fb16c> in recursive_optimize(layer_tensor, image, num_repeats, rescale_factor, blend, num_iterations, step_size, tile_size)
     42                                         num_iterations=num_iterations,
     43                                         step_size=step_size,
---> 44                                         tile_size=tile_size)
     45 
     46         # Upscale the resulting image back to its original size.

<ipython-input-46-f2d8e35fb16c> in recursive_optimize(layer_tensor, image, num_repeats, rescale_factor, blend, num_iterations, step_size, tile_size)
     42                                         num_iterations=num_iterations,
     43                                         step_size=step_size,
---> 44                                         tile_size=tile_size)
     45 
     46         # Upscale the resulting image back to its original size.

<ipython-input-46-f2d8e35fb16c> in recursive_optimize(layer_tensor, image, num_repeats, rescale_factor, blend, num_iterations, step_size, tile_size)
     57                                 num_iterations=num_iterations,
     58                                 step_size=step_size,
---> 59                                 tile_size=tile_size)
     60 
     61     return img_result

<ipython-input-45-e9bbe3685879> in optimize_image(layer_tensor, image, num_iterations, step_size, tile_size, show_gradient)
     31         # This tells us how to change the image so as to
     32         # maximize the mean of the given layer-tensor.
---> 33         grad = tiled_gradient(gradient=gradient, image=img)
     34 
     35         # Blur the gradient with different amounts and add

<ipython-input-44-c9dbd0c7c029> in tiled_gradient(gradient, image, tile_size)
     50 
     51             # Use TensorFlow to calculate the gradient-value.
---> 52             g = session.run(gradient, feed_dict=feed_dict)
     53 
     54             # Normalize the gradient for the tile. This is

~/anaconda/lib/python3.6/site-packages/tensorflow/python/client/session.py in run(self, fetches, feed_dict, options, run_metadata)
    787     try:
    788       result = self._run(None, fetches, feed_dict, options_ptr,
--> 789                          run_metadata_ptr)
    790       if run_metadata:
    791         proto_data = tf_session.TF_GetBuffer(run_metadata_ptr)

~/anaconda/lib/python3.6/site-packages/tensorflow/python/client/session.py in _run(self, handle, fetches, feed_dict, options, run_metadata)
    982     # Create a fetch handler to take care of the structure of fetches.
    983     fetch_handler = _FetchHandler(
--> 984         self._graph, fetches, feed_dict_string, feed_handles=feed_handles)
    985 
    986     # Run request and get response.

~/anaconda/lib/python3.6/site-packages/tensorflow/python/client/session.py in __init__(self, graph, fetches, feeds, feed_handles)
    408     """
    409     with graph.as_default():
--> 410       self._fetch_mapper = _FetchMapper.for_fetch(fetches)
    411     self._fetches = []
    412     self._targets = []

~/anaconda/lib/python3.6/site-packages/tensorflow/python/client/session.py in for_fetch(fetch)
    236         if isinstance(fetch, tensor_type):
    237           fetches, contraction_fn = fetch_fn(fetch)
--> 238           return _ElementFetchMapper(fetches, contraction_fn)
    239     # Did not find anything.
    240     raise TypeError('Fetch argument %r has invalid type %r' %

~/anaconda/lib/python3.6/site-packages/tensorflow/python/client/session.py in __init__(self, fetches, contraction_fn)
    272       except ValueError as e:
    273         raise ValueError('Fetch argument %r cannot be interpreted as a '
--> 274                          'Tensor. (%s)' % (fetch, str(e)))
    275       except KeyError as e:
    276         raise ValueError('Fetch argument %r cannot be interpreted as a '

ValueError: Fetch argument <tf.Tensor 'gradients_3/conv2d0_pre_relu/conv_grad/Conv2DBackpropInput:0' shape=(?, ?, ?, ?) dtype=float32> cannot be interpreted as a Tensor. (Tensor Tensor("gradients_3/conv2d0_pre_relu/conv_grad/Conv2DBackpropInput:0", shape=(?, ?, ?, ?), dtype=float32) is not an element of this graph.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions