code: def __call__(self, input_image: np.ndarray) -> np.ndarray:
      assert input_image.ndim == 3
      H, W, _ = input_image.shape
      with torch.no_grad():
          image_hed = torch.from_numpy(input_image.copy()).to(
              self.device, self.dtype
          )
          image_hed = rearrange(image_hed, "h w c -> 1 c h w")
          edges = self.model(image_hed)
          edges = [
              e.detach().cpu().numpy().astype(np.float32)[0, 0]
              for e in edges
          ]
          edges = [
              cv2.resize(e, (W, H), interpolation=cv2.INTER_LINEAR)
              for e in edges
          ]
          edges = np.stack(edges, axis=2)
          edge = 1 / (
              1 + np.exp(-np.mean(edges, axis=2).astype(np.float64))
          )
          edge = (edge * 255.0).clip(0, 255).astype(np.uint8)
          return edge
  
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 4 for calling the HedAPI obj's underlying member method code with example usage: obj.__call__(input_image) and returns: edge