Renamed techniques by technique category; Added new approach, but without wrapper
This commit is contained in:
Binary file not shown.
@@ -8,22 +8,22 @@ import requests
|
||||
|
||||
|
||||
#NOTE: Run the server with WSL conda obfuscation_platform_p38
|
||||
class Toonify(ObfuscationTechnique):
|
||||
class Style(ObfuscationTechnique):
|
||||
"""
|
||||
Replace face with generated face
|
||||
"""
|
||||
def __init__(self):
|
||||
self.image_processing_path = "C:/Users/bijan/Desktop/obfuscation_platform/project/models/vtoonify/image_cache/"
|
||||
resp = requests.get("http://127.0.0.1:8000/init", timeout=120)
|
||||
resp = requests.get("http://127.0.0.1:8000/init", timeout=180)
|
||||
resp.raise_for_status()
|
||||
|
||||
|
||||
def obfuscate(self, face_roi_img_bgr: np.ndarray) -> np.ndarray:
|
||||
cv2.imwrite(os.path.join(self.image_processing_path, "face.jpg"), face_roi_img_bgr)
|
||||
resp = requests.get("http://127.0.0.1:8000/obfuscate", timeout=120)
|
||||
resp = requests.get("http://127.0.0.1:8000/obfuscate", timeout=180)
|
||||
resp.raise_for_status()
|
||||
obfuscated_face = cv2.imread(os.path.join(self.image_processing_path, "obfuscated_face.jpg"))
|
||||
return obfuscated_face
|
||||
|
||||
def name(self):
|
||||
return "Toonify"
|
||||
return "Style"
|
||||
@@ -7,7 +7,7 @@ from obfuscation.base_obfuscation_technique import ObfuscationTechnique
|
||||
import requests
|
||||
|
||||
#NOTE: Run the server with conda obfuscation_platform_p37
|
||||
class Epic(ObfuscationTechnique):
|
||||
class Swap(ObfuscationTechnique):
|
||||
"""
|
||||
Replace face with generated face
|
||||
"""
|
||||
@@ -26,4 +26,4 @@ class Epic(ObfuscationTechnique):
|
||||
return obfuscated_face
|
||||
|
||||
def name(self):
|
||||
return "Epic"
|
||||
return "Swap"
|
||||
@@ -0,0 +1,29 @@
|
||||
import os
|
||||
|
||||
import numpy as np
|
||||
import cv2
|
||||
|
||||
from obfuscation.base_obfuscation_technique import ObfuscationTechnique
|
||||
import requests
|
||||
|
||||
#NOTE: Run the server with conda obfuscation_platform_p37
|
||||
class Synthetic(ObfuscationTechnique):
|
||||
"""
|
||||
Replace face with generated face
|
||||
"""
|
||||
def __init__(self):
|
||||
print("synthetic not active")
|
||||
# self.image_processing_path = "C:/Users/bijan/Desktop/obfuscation_platform/project/models/face_anon_simple/image_cache/"
|
||||
# resp = requests.get(f"http://127.0.0.1:8000/init", timeout=60)
|
||||
# resp.raise_for_status()
|
||||
|
||||
|
||||
def obfuscate(self, face_roi_img_bgr: np.ndarray) -> np.ndarray:
|
||||
cv2.imwrite(os.path.join(self.image_processing_path, "face.jpg"), face_roi_img_bgr)
|
||||
resp = requests.get(f"http://127.0.0.1:8000/obfuscate", timeout=60)
|
||||
resp.raise_for_status()
|
||||
obfuscated_face = cv2.imread(os.path.join(self.image_processing_path, "obfuscated_face.jpg"))
|
||||
return obfuscated_face
|
||||
|
||||
def name(self):
|
||||
return "Synthetic"
|
||||
Reference in New Issue
Block a user