(_)
main func
main func
main func
def main(_):
  ''' main func '''
  FLAGS = app.flags.FLAGS  #pylint: disable=invalid-name
  logging.info("config: {}".format(FLAGS.config))
  logging.info("mode: {}".format(FLAGS.mode))
  logging.info("gpu_visible: {}".format(FLAGS.gpu))
  assert FLAGS.config, 'pls give a config.yaml'
  assert FLAGS.mode, 'pls give mode [eval|infer|eval_and_infer]'
  os.environ["CUDA_VISIBLE_DEVICES"] = FLAGS.gpu  #selects a specific device

  #create dataset
  mode = utils.INFER if FLAGS.mode == 'infer' else utils.EVAL

  # load config
  config = utils.load_config(FLAGS.config)

  # process config
  import_all_modules_for_register()
  solver_name = config['solver']['name']
  logging.info(f"sovler: {solver_name}")
  solver = registers.solver[solver_name](config)
  config = solver.config

  # Evaluate
  evaluate_name = config['serving']['name']
  logging.info(f"evaluate: {evaluate_name}")
  evaluate = registers.serving[evaluate_name](
      config, gpu_str=FLAGS.gpu, mode=mode)

  if FLAGS.debug:
    evaluate.debug()
  evaluate.predict()
def main ( _ ) : FLAGS = app . flags . FLAGS #pylint: disable=invalid-name logging . info ( "config: {}" . format ( FLAGS . config ) ) logging . info ( "mode: {}" . format ( FLAGS . mode ) ) logging . info ( "gpu_visible: {}" . format ( FLAGS . gpu ) ) assert FLAGS . config , 'pls give a config.yaml' assert FLAGS . mode , 'pls give mode [eval|infer|eval_and_infer]' os . environ [ "CUDA_VISIBLE_DEVICES" ] = FLAGS . gpu #selects a specific device #create dataset mode = utils . INFER if FLAGS . mode == 'infer' else utils . EVAL # load config config = utils . load_config ( FLAGS . config ) # process config import_all_modules_for_register ( ) solver_name = config [ 'solver' ] [ 'name' ] logging . info ( f"sovler: {solver_name}" ) solver = registers . solver [ solver_name ] ( config ) config = solver . config # Evaluate evaluate_name = config [ 'serving' ] [ 'name' ] logging . info ( f"evaluate: {evaluate_name}" ) evaluate = registers . serving [ evaluate_name ] ( config , gpu_str = FLAGS . gpu , mode = mode ) if FLAGS . debug : evaluate . debug ( ) evaluate . predict ( )