code: def get_detector(
      trained_model, device="cpu", quantize=True, cudnn_benchmark=False
  ):
      net = CRAFT()
  
      if device == "cpu":
          net.load_state_dict(
              copyStateDict(
                  torch.load(trained_model, map_location=device)
              )
          )
          if quantize:
              try:
                  torch.quantization.quantize_dynamic(
                      net, dtype=torch.qint8, inplace=True
                  )
              except:
                  pass
      else:
          net.load_state_dict(
              copyStateDict(
                  torch.load(trained_model, map_location=device)
              )
          )
          net = torch.nn.DataParallel(net).to(device)
          cudnn.benchmark = cudnn_benchmark
  
      net.eval()
      return net
  
file_path: EasyOCR/easyocr/detection.py
imports: import torch
  import torch.backends.cudnn
  from torch.autograd import Variable
  from PIL import Image
  from collections import OrderedDict
  import cv2
  import numpy
  from .craft_utils import getDetBoxes, adjustResultCoordinates
  from .imgproc import resize_aspect_ratio, normalizeMeanVariance
  from .craft import CRAFT
label_desc: Use image node_id 3 for calling a global function with example usage: get_detector(trained_model, device, quantize, cudnn_benchmark) and returns: net