code: def caffe_emit(
      original_framework,
      architecture_name,
      architecture_path,
      weight_path,
      test_input_path,
  ):
      try:
          import caffe
          from mmdnn.conversion.caffe.caffe_emitter import CaffeEmitter
  
          # IR to code
          converted_file = (
              TestModels.tmpdir
              + original_framework
              + "_caffe_"
              + architecture_name
              + "_converted"
          )
          converted_file = converted_file.replace(".", "_")
          emitter = CaffeEmitter((architecture_path, weight_path))
          emitter.run(
              converted_file + ".py", converted_file + ".npy", "test"
          )
          del emitter
          del CaffeEmitter
  
          # import converted model
          imported = imp.load_source(
              "CaffeModel", converted_file + ".py"
          )
  
          imported.make_net(converted_file + ".prototxt")
          imported.gen_weight(
              converted_file + ".npy",
              converted_file + ".caffemodel",
              converted_file + ".prototxt",
          )
          model_converted = caffe.Net(
              converted_file + ".prototxt",
              converted_file + ".caffemodel",
              caffe.TEST,
          )
  
          original_framework = checkfrozen(original_framework)
          func = TestKit.preprocess_func[original_framework][
              architecture_name
          ]
          img = func(test_input_path)
          img = np.transpose(img, [2, 0, 1])
          input_data = np.expand_dims(img, 0)
  
          model_converted.blobs[model_converted.inputs[0]].data[
              ...
          ] = input_data
          predict = model_converted.forward()[
              model_converted.outputs[-1]
          ]
          converted_predict = np.squeeze(predict)
  
          del model_converted
          del sys.modules["CaffeModel"]
          del caffe
          os.remove(converted_file + ".py")
          os.remove(converted_file + ".npy")
          os.remove(converted_file + ".prototxt")
          os.remove(converted_file + ".caffemodel")
  
          return converted_predict
  
      except ImportError:
          print("Cannot import Caffe. Caffe Emit is not tested.")
          return None
  
imports: from __future__ import absolute_import
  from __future__ import print_function
  import os
  import sys
  import imp
  import numpy
  from mmdnn.conversion.examples.imagenet_test import TestKit
  import utils
  from utils import *
  from datetime import datetime
label_desc: Use image node_id 17 for calling the TestModels obj's underlying member method code with example usage: obj.caffe_emit(original_framework, architecture_name, architecture_path, weight_path, test_input_path) and returns: converted_predict, None