generated from Hazel/python-project
Compare commits
3 Commits
5baefdcc6f
...
8bd512a0a7
Author | SHA1 | Date | |
---|---|---|---|
8bd512a0a7 | |||
8fc56b887d | |||
edad12841f |
@ -6,5 +6,5 @@ def cli():
|
|||||||
print(f"Running secure_pixelation")
|
print(f"Running secure_pixelation")
|
||||||
|
|
||||||
pixelate("assets/human_detection/test.png", generative_impaint=True)
|
pixelate("assets/human_detection/test.png", generative_impaint=True)
|
||||||
# pixelate("assets/human_detection/humans.png", generative_impaint=False)
|
pixelate("assets/human_detection/humans.png", generative_impaint=False)
|
||||||
# pixelate("assets/human_detection/rev1.png", generative_impaint=False)
|
pixelate("assets/human_detection/rev1.png", generative_impaint=False)
|
||||||
|
@ -62,7 +62,7 @@ def pixelate_regions(raw_image: RawImage, image: Optional[np.ndarray] = None, pi
|
|||||||
return image
|
return image
|
||||||
|
|
||||||
|
|
||||||
def pixelate(to_detect: str, generative_impaint: bool = True, debug_drawings: bool = True):
|
def pixelate(to_detect: str, generative_impaint: bool = True, debug_drawings: bool = False):
|
||||||
raw_image = RawImage(to_detect)
|
raw_image = RawImage(to_detect)
|
||||||
|
|
||||||
step_dir = raw_image.get_dir("steps")
|
step_dir = raw_image.get_dir("steps")
|
||||||
@ -84,9 +84,12 @@ def pixelate(to_detect: str, generative_impaint: bool = True, debug_drawings: bo
|
|||||||
|
|
||||||
if generative_impaint:
|
if generative_impaint:
|
||||||
step_2 = do_generative_impaint(raw_image, image=step_1)
|
step_2 = do_generative_impaint(raw_image, image=step_1)
|
||||||
|
step_2_alt = quick_impaint(raw_image, image=step_1)
|
||||||
else:
|
else:
|
||||||
step_2 = quick_impaint(raw_image, image=step_1)
|
step_2 = quick_impaint(raw_image, image=step_1)
|
||||||
|
step_2_alt = do_generative_impaint(raw_image, image=step_1)
|
||||||
write_image(step_2, "step_2")
|
write_image(step_2, "step_2")
|
||||||
|
write_image(step_2_alt, "step_2_alt")
|
||||||
|
|
||||||
step_3 = pixelate_regions(raw_image, image=step_2)
|
step_3 = pixelate_regions(raw_image, image=step_2)
|
||||||
write_image(step_3, "step_3")
|
write_image(step_3, "step_3")
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import os
|
import os
|
||||||
from typing import Optional
|
from typing import Tuple
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
import cv2
|
import cv2
|
||||||
@ -11,7 +11,7 @@ from huggingface_hub import hf_hub_download
|
|||||||
|
|
||||||
os.environ["HF_HUB_ENABLE_HF_TRANSFER"] = "1"
|
os.environ["HF_HUB_ENABLE_HF_TRANSFER"] = "1"
|
||||||
|
|
||||||
def prepare_img_and_mask(image: np.ndarray, mask: np.ndarray, device: torch.device, pad_out_to_modulo: int = 8, scale_factor: float = 1) -> tuple[torch.Tensor, torch.Tensor]:
|
def prepare_img_and_mask(image: np.ndarray, mask: np.ndarray, device: torch.device, pad_out_to_modulo: int = 8, scale_factor: float = 1) -> Tuple[torch.Tensor, torch.Tensor]:
|
||||||
def get_image(img: np.ndarray):
|
def get_image(img: np.ndarray):
|
||||||
img = img.copy()
|
img = img.copy()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user