INNER CODE UNIT · Python

image_hed

Boese0601/MagicDance · model_lib/ControlNet/annotator/hed/__init__.py:105

        image_hed = image_hed / 255.0
        image_hed = rearrange(image_hed, 'h w c -> 1 c h w')
        edge = netNetwork(image_hed)[0]
        edge = (edge.cpu().numpy() * 255.0).clip(0, 255).astype(np.uint8)
        return edge[0]


def nms(x, t, s):
    x = cv2.GaussianBlur(x.astype(np.float32), (0, 0), s)

    f1 = np.array([[0, 0, 0], [1, 1, 1], [0, 0, 0]], dtype=np.uint8)
    f2 = np.array([[0, 1, 0], [0, 1, 0], [0, 1, 0]], dtype=np.uint8)
    f3 = np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]], dtype=np.uint8)
    f4 = np.array([[0, 0, 1], [0, 1, 0], [1, 0, 0]], dtype=np.uint8)

    y = np.zeros_like(x)

    for f in [f1, f2, f3, f4]:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…