code: def lms_to_heatmap(lms, h, w, n_landmarks, marked_index, sigma=5):
      xs, ys = tf.meshgrid(
          tf.range(0.0, tf.to_float(w)), tf.range(0.0, tf.to_float(h))
      )
      gaussian = 1.0 / (sigma * np.sqrt(2.0 * np.pi))
      marked_index = tf.to_int32(marked_index)
  
      def gaussian_fn(lms):
          y, x, idx = tf.unstack(lms)
          idx = tf.to_int32(idx)
  
          def run_true():
              return (
                  tf.exp(
                      -0.5
                      * (tf.pow(ys - y, 2) + tf.pow(xs - x, 2))
                      * tf.pow(1.0 / sigma, 2.0)
                  )
                  * gaussian
                  * 17.0
              )
  
          def run_false():
              return tf.zeros((h, w))
  
          return tf.cond(
              tf.reduce_any(tf.equal(marked_index, idx)),
              run_true,
              run_false,
          )
  
      img_hm = tf.stack(
          tf.map_fn(
              gaussian_fn,
              tf.concat(
                  [
                      lms,
                      tf.to_float(tf.range(0, n_landmarks))[..., None],
                  ],
                  1,
              ),
          )
      )
  
      return img_hm
  
file_path: insightface/reconstruction/ostec/external/landmark_detector/data_provider.py
imports: import tensorflow
  import numpy
  from menpo.transform import Translation
  from external.landmark_detector.flags import FLAGS
label_desc: Use image node_id 4 for calling a global function with example usage: lms_to_heatmap(lms, h, w, n_landmarks, marked_index, sigma) and returns: img_hm, tf, unknown, tf