Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
75ad53082a | ||
|
|
5a5fc5e840 | ||
|
|
74f0c2904d | ||
|
|
cfe5454c76 | ||
|
|
410c485541 | ||
|
|
87e5768da4 | ||
|
|
3ffdef8ced | ||
|
|
6512c00800 | ||
|
|
346ec95a3a | ||
|
|
bb9cefbbe4 | ||
|
|
2b1d8fe587 | ||
|
|
e3b32d8e2a | ||
|
|
588581f8b7 | ||
|
|
6d27f51c7c | ||
|
|
bd6cb64117 | ||
|
|
a2da806d65 | ||
|
|
b01768d2bb | ||
|
|
1105875803 | ||
|
|
ca0af74495 | ||
|
|
fe091bd8ec | ||
|
|
4e2efc2b08 | ||
|
|
fbcdb9b6fa |
+15
-2
@@ -1,5 +1,16 @@
|
||||
# Use PHP with Apache as the base image
|
||||
FROM python:3.9-slim
|
||||
FROM python:latest
|
||||
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
|
||||
# Install Additional System Dependencies
|
||||
RUN apt-get update && apt-get upgrade -y
|
||||
RUN apt-get install -y \
|
||||
libgl1
|
||||
|
||||
# Clear cache
|
||||
RUN apt-get autoremove
|
||||
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
#Copy Project
|
||||
COPY . /app
|
||||
@@ -8,4 +19,6 @@ COPY . /app
|
||||
RUN pip install --no-cache-dir -r /app/requirements.txt
|
||||
|
||||
# Start Anonimization
|
||||
CMD ["python", "/app/app.py"]
|
||||
CMD ["python", "-u", "/app/app.py"]
|
||||
|
||||
WORKDIR /app
|
||||
@@ -7,15 +7,21 @@ import json
|
||||
treashold = float(os.getenv('FACE_TRASHOLD', '0.5'))
|
||||
sever = os.getenv('API_ROOT', 'localhost:8000')
|
||||
root_api_url = 'http://{}/local'.format(sever)
|
||||
base_path = '/data/'
|
||||
base_path = '/app/data/'
|
||||
|
||||
print("API_ROOT: " + str(root_api_url), flush=True)
|
||||
time.sleep(900)
|
||||
|
||||
try:
|
||||
while True:
|
||||
r = requests.get('{}/anonymize'.format(root_api_url))
|
||||
face_cascade = cv2.CascadeClassifier(cv2.data.haarcascades + 'haarcascade_frontalface_default.xml')
|
||||
# print(r.text, flush=True)
|
||||
response = r.json()
|
||||
|
||||
for detection in response:
|
||||
print(str(detection['id']) + " Anonymization Started", flush=True)
|
||||
|
||||
img_path = "{}{}".format(base_path, detection['source_image_path'])
|
||||
|
||||
#Skip Non existing files
|
||||
@@ -27,6 +33,7 @@ try:
|
||||
faces, rejects, weights = face_cascade.detectMultiScale3(gray, 1.1, 4, outputRejectLevels = 1)
|
||||
|
||||
#Count faces is null dont anonimize file
|
||||
print(len(faces) + " Faces Found" , flush=True)
|
||||
if (len(faces) < 0):
|
||||
continue
|
||||
|
||||
@@ -38,7 +45,7 @@ try:
|
||||
blurred_face = cv2.GaussianBlur(face_roi, (99, 99), 50)
|
||||
img[y:y+h, x:x+w] = blurred_face
|
||||
|
||||
print(weights[i])
|
||||
print(weights[i], flush=True)
|
||||
text = "{}".format(weights[i])
|
||||
#cv2.rectangle(img, (x, y), (x+w, y+h), (255, 0, 0), 2)
|
||||
#cv2.putText(img, text, (x, y), cv2.FONT_HERSHEY_SIMPLEX, 0.45, (0, 0, 255), 2)
|
||||
@@ -54,10 +61,15 @@ try:
|
||||
"source_image_path": new_img_path.replace(base_path,"")
|
||||
}
|
||||
response = requests.post('{}/anonymize'.format(root_api_url), json=data)
|
||||
print(str(detection['id']) + " Anonymized" , flush=True)
|
||||
time.sleep(5)
|
||||
|
||||
print("sleep", flush=True)
|
||||
time.sleep(900)
|
||||
|
||||
except Exception as e:
|
||||
print("An exception occurred")
|
||||
print("An exception occurred", flush=True)
|
||||
print(str(e), flush=True)
|
||||
|
||||
data = {"trace": str(e)}
|
||||
response = requests.post('{}/log'.format(root_api_url), json=data)
|
||||
Reference in New Issue
Block a user