code: def _main():
      parser = argparse.ArgumentParser()
  
      parser.add_argument(
          "-n",
          "--network",
          type=_text_type,
          help="Model Type",
          required=True,
          choices=networks_map.keys(),
      )
  
      parser.add_argument(
          "-i", "--image", type=_text_type, help="Test Image Path"
      )
  
      args = parser.parse_args()
  
      model = networks_map.get(args.network)
      if model is None:
          raise NotImplementedError(
              "Unknown keras application [{}]".format(args.network)
          )
  
      model = model()
      # save network structure as JSON
      json_string = model.to_json()
      with open("imagenet_{}.json".format(args.network), "w") as of:
          of.write(json_string)
  
      print(
          "Network structure is saved as [imagenet_{}.json].".format(
              args.network
          )
      )
  
      model.save_weights("imagenet_{}.h5".format(args.network))
  
      print(
          "Network weights are saved as [imagenet_{}.h5].".format(
              args.network
          )
      )
  
      if args.image:
          import numpy as np
  
          func = TestKit.preprocess_func["keras"][args.network]
          img = func(args.image)
          img = np.expand_dims(img, axis=0)
          predict = model.predict(img)
          predict = np.squeeze(predict)
          top_indices = predict.argsort()[-5:][::-1]
          result = [(i, predict[i]) for i in top_indices]
          print(result)
  
imports: import argparse
  from six import text_type
  import keras
  from mmdnn.conversion.examples.imagenet_test import TestKit
label_desc: Use image node_id 1 for calling a global function with example usage: _main() without return types