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()
  
      file_name = "imagenet_{}.pth".format(args.network)
      if not os.path.exists(file_name):
          model = NETWORKS_MAP.get(args.network)
          model = model()
          torch.save(model, file_name)
          print(
              "PyTorch pretrained model is saved as [{}].".format(
                  file_name
              )
          )
      else:
          print("File [{}] existed!".format(file_name))
          model = torch.load(file_name)
  
      if args.image:
          import numpy as np
  
          func = TestKit.preprocess_func["pytorch"][args.network]
          img = func(args.image)
          img = np.transpose(img, (2, 0, 1))
          img = np.expand_dims(img, 0).copy()
          data = torch.from_numpy(img)
          data = torch.autograd.Variable(data, requires_grad=False)
  
          model.eval()
          predict = model(data).data.numpy()
          predict = np.squeeze(predict)
          top_indices = predict.argsort()[-5:][::-1]
          result = [(i, predict[i]) for i in top_indices]
          print(result)
  
imports: import argparse
  import os
  from six import text_type
  from mmdnn.conversion.examples.imagenet_test import TestKit
  import torch
  import torchvision.models
label_desc: Use image node_id 1 for calling a global function with example usage: _main() without return types