code: def extract(model_file, dataset):
      model = ArcFaceONNX(model_file=model_file)
      model.check()
      feat_mat = np.zeros(shape=(len(dataset), 2 * model.feat_dim))
  
      def batchify_fn(data):
          return mx.nd.concat(*data, dim=0)
  
      data_loader = mx.gluon.data.DataLoader(
          dataset,
          128,
          last_batch="keep",
          num_workers=4,
          thread_pool=True,
          prefetch=16,
          batchify_fn=batchify_fn,
      )
      num_iter = 0
      for batch in data_loader:
          batch = batch.asnumpy()
          feat = model.forward(batch)
          feat = np.reshape(feat, (-1, model.feat_dim * 2))
          feat_mat[
              128 * num_iter : 128 * num_iter + feat.shape[0], :
          ] = feat
          num_iter += 1
          if num_iter % 50 == 0:
              print(num_iter)
      return feat_mat
  
imports: import argparse
  import os
  import pickle
  import timeit
  import cv2
  import mxnet
  import numpy
  import pandas
  import prettytable
  import skimage.transform
  from sklearn.metrics import roc_curve
  from sklearn.preprocessing import normalize
  import insightface
  from insightface.model_zoo import ArcFaceONNX
label_desc: Use image node_id 1 for calling a global function with example usage: extract(model_file, dataset) and returns: feat_mat, mx