parameters: (config, dirpath, name_mapping)
return_statement: return seq_name
docstring: Tries to infer the sequence name from the config, or falls back to the parent folder name
docstring_summary: Tries to infer the sequence name from the config, or falls back to the parent folder name
docstring_tokens: Tries to infer the sequence name from the config or falls back to the parent folder name
function: def _infer_sequence_name(config, dirpath, name_mapping):
          """Tries to infer the sequence name from the config, or falls back to the parent folder name"""
          seq_name = ""
          try:
              type = config.batch_run.args["dataset-type"]
              path = config.batch_run.args["dataset-path"]
              seq_name = os.path.basename(path)
              if type == "euroc":
                  if seq_name.startswith("dataset-"):
                      # assume tumvi
                      seq_name = seq_name.replace("dataset-", "tumvi-").split("_")[0]
                  else:
                      # assume euroc
                      s = seq_name.split("_")
                      seq_name = "euroc{}{}".format(s[0], s[1])
              elif type == "kitti":
                  # assume kitti
                  seq_name = "kitti{}".format(seq_name)
          except:
              pass
  
          # Fallback to detecting the sequence name base on the last component of the parent folder. This is intended
          # to work for run folders created with the 'generate-batch-configs' script, assuming the sequence is the
          # last component in '_batch.combinations'.
          if seq_name == "":
              seq_name = os.path.basename(dirpath).split("_")[-1]
  
          # optionally remap the sequence name to something else as defined in the experiments config
          if isinstance(name_mapping, Mapping) and seq_name in name_mapping:
              seq_name = name_mapping[seq_name]
  
          return seq_name
function_tokens: def _infer_sequence_name ( config , dirpath , name_mapping ) : seq_name = "" try : type = config . batch_run . args [ "dataset-type" ] path = config . batch_run . args [ "dataset-path" ] seq_name = os . path . basename ( path ) if type == "euroc" : if seq_name . startswith ( "dataset-" ) : # assume tumvi seq_name = seq_name . replace ( "dataset-" , "tumvi-" ) . split ( "_" ) [ 0 ] else : # assume euroc s = seq_name . split ( "_" ) seq_name = "euroc{}{}" . format ( s [ 0 ] , s [ 1 ] ) elif type == "kitti" : # assume kitti seq_name = "kitti{}" . format ( seq_name ) except : pass # Fallback to detecting the sequence name base on the last component of the parent folder. This is intended # to work for run folders created with the 'generate-batch-configs' script, assuming the sequence is the # last component in '_batch.combinations'. if seq_name == "" : seq_name = os . path . basename ( dirpath ) . split ( "_" ) [ - 1 ] # optionally remap the sequence name to something else as defined in the experiments config if isinstance ( name_mapping , Mapping ) and seq_name in name_mapping : seq_name = name_mapping [ seq_name ] return seq_name