code: def validate_caffe_model(
      platform,
      device_type,
      model_file,
      input_file,
      mace_out_file,
      weight_file,
      input_names,
      input_shapes,
      input_data_formats,
      output_names,
      output_shapes,
      output_data_formats,
      validation_threshold,
      log_file,
  ):
      os.environ[
          "GLOG_minloglevel"
      ] = "1"  # suprress Caffe verbose prints
      import caffe
  
      if not os.path.isfile(model_file):
          common.MaceLogger.error(
              VALIDATION_MODULE,
              "Input graph file '" + model_file + "' does not exist!",
          )
      if not os.path.isfile(weight_file):
          common.MaceLogger.error(
              VALIDATION_MODULE,
              "Input weight file '" + weight_file + "' does not exist!",
          )
  
      caffe.set_mode_cpu()
  
      net = caffe.Net(model_file, caffe.TEST, weights=weight_file)
  
      for i in range(len(input_names)):
          input_value = load_data(
              common.formatted_file_name(input_file, input_names[i])
          )
          input_value = input_value.reshape(input_shapes[i])
          if (
              input_data_formats[i] == common.DataFormat.NHWC
              and len(input_shapes[i]) == 4
          ):
              input_value = input_value.transpose((0, 3, 1, 2))
          input_blob_name = input_names[i]
          try:
              if input_names[i] in net.top_names:
                  input_blob_name = net.top_names[input_names[i]][0]
          except ValueError:
              pass
          new_shape = input_value.shape
          net.blobs[input_blob_name].reshape(*new_shape)
          for index in range(input_value.shape[0]):
              net.blobs[input_blob_name].data[index] = input_value[
                  index
              ]
  
      net.forward()
  
      for i in range(len(output_names)):
          value = net.blobs[output_names[i]].data
          output_file_name = common.formatted_file_name(
              mace_out_file, output_names[i]
          )
          mace_out_value = load_data(output_file_name)
          (
              mace_out_value,
              real_output_shape,
              real_output_data_format,
          ) = get_real_out_value_shape_df(
              platform,
              mace_out_value,
              output_shapes[i],
              output_data_formats[i],
          )
          compare_output(
              platform,
              device_type,
              output_names[i],
              mace_out_value,
              value,
              validation_threshold,
              log_file,
              real_output_shape,
              real_output_data_format,
          )
  
imports: import argparse
  import sys
  import os
  import os.path
  import numpy
  import six
  import common
label_desc: Use image node_id 11 for calling a global function with example usage: validate_caffe_model(platform, device_type, model_file, input_file, mace_out_file, weight_file, input_names, input_shapes, input_data_formats, output_names, output_shapes, output_data_formats, validation_threshold, log_file) without return types