code: def __init__(self, device: torch.device):
      if cv2 is None:
          raise ValueError("`cv2` is needed for `HedAPI`")
      if rearrange is None:
          raise ValueError("`einops` is needed for `HedAPI`")
      model_path = os.path.join(
          OPT.external_dir, "annotators", "ControlNetHED.pth"
      )
      if not os.path.isfile(model_path):
          raise ValueError(
              f"cannot find `ControlNetHED.pth` at {model_path}"
          )
      self.model = ControlNetHED_Apache2()
      self.model.load_state_dict(
          torch.load(model_path, map_location="cpu")
      )
      self.device = device
  
file_path: carefree-learn/cflearn/api/cv/third_party/hed.py
imports: import os
  import torch
  import numpy
  import torch.nn
  from ....parameters import OPT
label_desc: Use image node_id 1 to create a new HedAPI object  with example: obj = HedAPI(device)