code: def image_activations(model, image, layer_names=None):
      if layer_names is None:
          layer_names = [
              layer["name"]
              for layer in model.layers
              if "conv" in layer.tags
          ]
  
      resized_image = resize(image, model.image_shape[:2])
  
      with tf.Graph().as_default() as graph, tf.Session() as sess:
          image_t = tf.placeholder_with_default(
              resized_image, shape=model.image_shape
          )
          model.import_graph(image_t, scope="import")
          layer_ts = {}
          for layer_name in layer_names:
              name = (
                  layer_name
                  if layer_name.endswith(":0")
                  else layer_name + ":0"
              )
              layer_t = graph.get_tensor_by_name(
                  "import/{}".format(name)
              )[0]
              layer_ts[layer_name] = layer_t
          activations = sess.run(layer_ts)
  
      return activations
  
file_path: lucid/lucid/recipes/image_activations.py
imports: from timeit import default_timer
  import tensorflow
  from lucid.optvis import render
  from lucid.optvis import param
  from lucid.optvis import transform
  from lucid.optvis import objectives
  from lucid.optvis import overrides
  from lucid.misc.io import show, load
  from lucid.misc.ndimage_utils import resize
label_desc: Use image node_id 1 for calling a global function with example usage: image_activations(model, image, layer_names) and returns: activations