How tensorflow object detection works on testing time

Viewed 304

I used faster R-CNN pre-trained model for tensorflow object detection api link. I want to change softmax classifier into SVM. For this I traverse all files. In session.py file, lastly it calls _do_run function.

  def _do_call(self, fn, *args):
    try:
      return fn(*args)
    except errors.OpError as e:
      message = compat.as_text(e.message)
      m = BaseSession._NODEDEF_NAME_RE.search(message)
      node_def = None
      op = None
      if m is not None:
        node_name = m.group(1)
        try:
          op = self._graph.get_operation_by_name(node_name)
          node_def = op.node_def
        except KeyError:
          pass
      raise type(e)(node_def, op, message)

Then it calls _run_fn function

 def _run_fn(session, feed_dict, fetch_list, target_list, options,
                run_metadata):
      # Ensure any changes to the graph are reflected in the runtime.
      self._extend_graph()
      with errors.raise_exception_on_not_ok_status() as status:
        if self._created_with_new_api:
          return tf_session.TF_SessionRun_wrapper(
              session, options, feed_dict, fetch_list, target_list,
              run_metadata, status)
        else:
          return tf_session.TF_Run(session, options,
                                   feed_dict, fetch_list, target_list,
                                   status, run_metadata)

Last line, it calls TF_Run in pywrap_tensorflow_internal.py file (1131 line) that looks like the following.

def TF_Run(session, run_options, feed_dict, output_names, target_nodes, out_status, run_outputs):
    return _pywrap_tensorflow_internal.TF_Run(session, run_options, feed_dict, output_names, target_nodes, out_status, run_outputs)
TF_Run = _pywrap_tensorflow_internal.TF_Run

Then I searched _pywrap_tensorflow_internal.py file that looks like..

from _pywrap_tensorflow_internal import (AddControlInput, AddStep, 
    AppendToFile, Basename, BufferedInputStream_ReadLineAsString, 
    BufferedInputStream_Seek, BufferedInputStream_Tell, TF_Run)

It just one kind of defined variable. How it calculates CNN and softmax classifier ? There has another file _pywrap_tensorflow_internal.so file. I think it calculates whole procedures. But how can I read that file or edit it? I want to change softmax classifier into SVM at train as well as test time. What file I explore? Please help...

0 Answers
Related