Created
January 27, 2024 17:37
-
-
Save j4p3/2963d6ab650ba2a468c326f1b074ce41 to your computer and use it in GitHub Desktop.
sample nightshade img2img countermeasure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import cv2 | |
from cv2.ximgproc import guidedFilter | |
img = cv2.imread('input.png').astype(np.float32) | |
y = img.copy() | |
for _ in range(64): | |
y = cv2.bilateralFilter(y, 5, 8, 8) | |
for _ in range(4): | |
y = guidedFilter(img, y, 4, 16) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment