def METHOD_NAME(input_image, is_safe=False):
    global netNetwork
    if netNetwork is None:
        modelpath = os.path.join(modeldir, "ControlNetHED.pth")
        old_modelpath = os.path.join(old_modeldir, "ControlNetHED.pth")
        if os.path.exists(old_modelpath):
            modelpath = old_modelpath
        elif not os.path.exists(modelpath):
            from basicsr.utils.download_util import load_file_from_url
            load_file_from_url(remote_model_path, model_dir=modeldir)
        netNetwork = ControlNetHED_Apache2().to(devices.get_device_for("controlnet"))
        netNetwork.load_state_dict(torch.load(modelpath, map_location='cpu'))
    netNetwork.to(devices.get_device_for("controlnet")).float().eval()
    assert input_image.ndim == 3
    H, W, C = input_image.shape
    with torch.no_grad():
        image_hed = torch.from_numpy(input_image.copy()).float().to(devices.get_device_for("controlnet"))
        image_hed = rearrange(image_hed, 'h w c -> 1 c h w')
        edges = netNetwork(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)))
        if is_safe:
            edge = safe_step(edge)
        edge = (edge * 255.0).clip(0, 255).astype(np.uint8)
        return edge