code: def extract_mesh(
      input_val,
      params,
      indicators,
      input_holder,
      params_holder,
      points_holder,
      sess,
      args,
  ):
      """Extracting meshes from an indicator function.
  
      Args:
        input_val: np.array, [1, height, width, channel], input image.
        params: tf.Operation, hyperplane parameter hook.
        indicators: tf.Operation, indicator hook.
        input_holder: tf.Placeholder, input image placeholder.
        params_holder: tf.Placeholder, hyperplane parameter placeholder.
        points_holder: tf.Placeholder, query point placeholder.
        sess: tf.Session, running sess.
        args: tf.app.flags.FLAGS, configurations.
  
      Returns:
        mesh: trimesh.Trimesh, the extracted mesh.
      """
      mesh_extractor = mise.MISE(64, 1, args.level_set)
      points = mesh_extractor.query()
      params_val = sess.run(params, {input_holder: input_val})
  
      while points.shape[0] != 0:
          orig_points = points
          points = points.astype(np.float32)
          points = (
              np.expand_dims(points, axis=0) / mesh_extractor.resolution
              - 0.5
          ) * args.vis_scale
          n_points = points.shape[1]
          values = []
          for i in range(
              0, n_points, 100000
          ):  # Add this to prevent OOM.
              value = sess.run(
                  indicators,
                  {
                      params_holder: params_val,
                      points_holder: points[:, i : i + 100000],
                  },
              )
              values.append(value)
          values = np.concatenate(values, axis=1)
          values = values[0, :, 0].astype(np.float64)
          mesh_extractor.update(orig_points, values)
          points = mesh_extractor.query()
  
      value_grid = mesh_extractor.to_dense()
      value_grid = np.pad(
          value_grid, 1, "constant", constant_values=-1e6
      )
      (
          verts,
          faces,
          normals,
          unused_var,
      ) = measure.marching_cubes_lewiner(
          value_grid, min(args.level_set, value_grid.max() * 0.75)
      )
      del normals
      verts -= 1
      verts /= np.array(
          [
              value_grid.shape[0] - 3,
              value_grid.shape[1] - 3,
              value_grid.shape[2] - 3,
          ],
          dtype=np.float32,
      )
      verts = args.vis_scale * (verts - 0.5)
      faces = np.stack(
          [faces[..., 1], faces[..., 0], faces[..., 2]], axis=-1
      )
      return trimesh.Trimesh(vertices=verts, faces=faces)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  from os import path
  import numpy
  import scipy
  from skimage import measure
  import tensorflow.compat.v1
  from tensorflow_graphics.projects.cvxnet.lib import datasets
  from tensorflow_graphics.projects.cvxnet.lib import models
  from tensorflow_graphics.projects.cvxnet.lib.libmise import mise
  import trimesh
label_desc: Use image node_id 3 for calling a global function with example usage: extract_mesh(input_val, params, indicators, input_holder, params_holder, points_holder, sess, args) and returns: trimesh