code: def train(self):
      g = tf.Graph()
      logging.set_verbosity(10)
  
      with g.as_default():
          # Load datasets.
  
          images, *datas = self._get_data()
          images /= 255.0
  
          # Define model graph.
          with tf.variable_scope("net"):
              with slim.arg_scope(
                  [slim.batch_norm, slim.layers.dropout],
                  is_training=True,
              ):
                  predictions, states = self._build_network(
                      images, datas
                  )
  
                  # custom losses
                  self._build_losses(predictions, states, images, datas)
  
                  # total losses
                  total_loss = slim.losses.get_total_loss()
                  tf.summary.scalar("losses/total loss", total_loss)
  
                  # image summaries
                  self._build_summaries(
                      predictions, states, images, datas
                  )
  
                  # learning rate decay
                  global_step = slim.get_or_create_global_step()
  
                  learning_rate = tf.train.exponential_decay(
                      FLAGS["initial_learning_rate"],
                      global_step,
                      FLAGS["learning_rate_decay_step"]
                      / FLAGS["batch_size"],
                      FLAGS["learning_rate_decay_factor"],
                      staircase=True,
                  )
  
                  tf.summary.scalar("learning rate", learning_rate)
  
                  optimizer = tf.train.AdamOptimizer(learning_rate)
  
      with tf.Session(graph=g) as sess:
          init_fn = self._build_restore_fn(sess)
          train_op = slim.learning.create_train_op(
              total_loss, optimizer, summarize_gradients=True
          )
  
          logging.set_verbosity(1)
  
          slim.learning.train(
              train_op,
              FLAGS["train_dir"],
              save_summaries_secs=60,
              init_fn=init_fn,
              save_interval_secs=600,
          )
  
file_path: insightface/reconstruction/ostec/external/landmark_detector/networks.py
imports: import tensorflow
  from external.landmark_detector import utils, models, data_provider
  from tensorflow.python.platform import tf_logging
  from external.landmark_detector.flags import FLAGS
label_desc: Use image node_id 7 for calling the DeepNetwork obj's underlying member method code with example usage: obj.train() without return types