code: def parse_prob_logs(exp_dir, key="accuracy", output="output"):
      train_prob_files = "%s/log/compute_prob_train.*.log" % (exp_dir)
      valid_prob_files = "%s/log/compute_prob_valid.*.log" % (exp_dir)
      train_prob_strings = common_lib.get_command_stdout(
          "grep -e {0} {1}".format(key, train_prob_files)
      )
      valid_prob_strings = common_lib.get_command_stdout(
          "grep -e {0} {1}".format(key, valid_prob_files)
      )
  
      # LOG
      # (nnet3-chain-compute-prob:PrintTotalStats():nnet-chain-diagnostics.cc:149)
      # Overall log-probability for 'output' is -0.399395 + -0.013437 = -0.412832
      # per frame, over 20000 fra
  
      # LOG
      # (nnet3-chain-compute-prob:PrintTotalStats():nnet-chain-diagnostics.cc:144)
      # Overall log-probability for 'output' is -0.307255 per frame, over 20000
      # frames.
  
      parse_regex = re.compile(
          ".*compute_prob_.*\.([0-9]+).log:LOG "
          ".nnet3.*compute-prob.*:PrintTotalStats..:"
          "nnet.*diagnostics.cc:[0-9]+. Overall ([a-zA-Z\-]+) for "
          "'{output}'.*is ([0-9.\-e]+) .*per frame".format(
              output=output
          )
      )
  
      train_objf = {}
      valid_objf = {}
  
      for line in train_prob_strings.split("\n"):
          mat_obj = parse_regex.search(line)
          if mat_obj is not None:
              groups = mat_obj.groups()
              if groups[1] == key:
                  train_objf[int(groups[0])] = groups[2]
      if not train_objf:
          raise KaldiLogParseException(
              "Could not find any lines with {k} in "
              " {l}".format(k=key, l=train_prob_files)
          )
  
      for line in valid_prob_strings.split("\n"):
          mat_obj = parse_regex.search(line)
          if mat_obj is not None:
              groups = mat_obj.groups()
              if groups[1] == key:
                  valid_objf[int(groups[0])] = groups[2]
  
      if not valid_objf:
          raise KaldiLogParseException(
              "Could not find any lines with {k} in "
              " {l}".format(k=key, l=valid_prob_files)
          )
  
      iters = list(
          set(valid_objf.keys()).intersection(list(train_objf.keys()))
      )
      if not iters:
          raise KaldiLogParseException(
              "Could not any common iterations with"
              " key {k} in both {tl} and {vl}".format(
                  k=key, tl=train_prob_files, vl=valid_prob_files
              )
          )
      iters.sort()
      return list(
          [
              (int(x), float(train_objf[x]), float(valid_objf[x]))
              for x in iters
          ]
      )
  
imports: from __future__ import division
  from __future__ import print_function
  import traceback
  import datetime
  import logging
  import re
  import libs.common
label_desc: Use image node_id 7 for calling a global function with example usage: parse_prob_logs(exp_dir, key, output) and returns: list