9 Commits
Author SHA1 Message Date
Haitem 38e13d94dd Update file path 2025-06-30 15:20:19 +02:00
Jonatan Rek d4a5bc5476 Change Work Times 2025-01-02 12:29:52 +01:00
haitem d9bdc50cf1 Merge pull request 'PK-163-kontrolovat-misto-pri-anonymizaci' (#2) from PK-163-kontrolovat-misto-pri-anonymizaci into main
Reviewed-on: #2
2024-12-30 14:39:29 +00:00
Haitem 1d3a752df1 #PK-163 - Kontrolovat místo při anonymizaci
Fix edit path
2024-12-30 14:52:02 +01:00
Haitem 10e9b33a99 #PK-163 - Kontrolovat místo při anonymizaci
Repair function on check size on disc
2024-12-30 14:48:00 +01:00
JonatanRek 6b99a88fab Possible Fixes 2024-12-24 01:50:33 +01:00
JonatanRek 9024c75e19 Fix Examples 2024-12-24 00:49:02 +01:00
JonatanRek e1af934979 Add nano 2024-12-24 00:46:21 +01:00
JonatanRek fb17d6185f fix python v 2024-12-24 00:45:17 +01:00
4 changed files with 33 additions and 11 deletions
+3 -2
View File
@@ -1,12 +1,13 @@
# Use PHP with Apache as the base image # Use PHP with Apache as the base image
FROM python:latest FROM python:3.9
ENV PYTHONUNBUFFERED=1 ENV PYTHONUNBUFFERED=1
# Install Additional System Dependencies # Install Additional System Dependencies
RUN apt-get update && apt-get upgrade -y RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y \ RUN apt-get install -y \
libgl1 libgl1 \
nano
# Clear cache # Clear cache
RUN apt-get autoremove RUN apt-get autoremove
+2 -2
View File
@@ -7,14 +7,14 @@ $tag = ("0.0.4").Trim(); git reset --hard; git pull origin master; git tag $tag;
#### Docker Build - Bash (One Line) #### Docker Build - Bash (One Line)
```bash ```bash
export TAG="0.0.4" && sudo docker build -t git.steelants.cz/steelants/py_ck:"$TAG" . && sudo docker push git.steelants.cz/steelants/py_ck:"$TAG" && sudo docker build -t git.steelants.cz/steelants/py_ck:latest . && sudo docker push git.steelants.cz/steelants/py_ck:latest export TAG="0.0.5" && sudo docker build -t git.steelants.cz/steelants/py_ck:"$TAG" . && sudo docker push git.steelants.cz/steelants/py_ck:"$TAG" && sudo docker build -t git.steelants.cz/steelants/py_ck:latest . && sudo docker push git.steelants.cz/steelants/py_ck:latest
``` ```
#### Docker Stack Setup #### Docker Stack Setup
```yaml ```yaml
services: services:
ck-anonym: ck-anonym:
image: git.steelants.cz/steelants/lar_py:latest image: git.steelants.cz/steelants/py_ck:latest
restart: unless-stopped restart: unless-stopped
environment: environment:
API_ROOT: http://ck:8080 API_ROOT: http://ck:8080
+27 -7
View File
@@ -3,21 +3,39 @@ import time
import os import os
import requests import requests
import json import json
import gc
import shutil
from retinaface import RetinaFace from retinaface import RetinaFace
treashold = float(os.getenv('FACE_TRASHOLD', '0.9')) treashold = float(os.getenv('FACE_TRASHOLD', '0.9'))
sever = os.getenv('API_ROOT', 'localhost:8000') sever = os.getenv('API_ROOT', 'localhost:8000')
disk_treashold = os.getenv('DISK_FREE_TRASHOLD', 10)
root_api_url = 'http://{}/local'.format(sever) root_api_url = 'http://{}/local'.format(sever)
base_path = '/app/data/' base_path = '/app/data/'
print("API_ROOT: " + str(root_api_url), flush=True) print("API_ROOT: " + str(root_api_url), flush=True)
print("FACE_TRASHOLD: " + str(treashold), flush=True) print("FACE_TRASHOLD: " + str(treashold), flush=True)
print("DISK_FREE_TRASHOLD: " + str(disk_treashold), flush=True)
try: try:
while True: while True:
print("LOOP Started !!!", flush=True) print("LOOP Started !!!", flush=True)
#Chesk if there is enought free space at destination path
while True:
total, used, free = shutil.disk_usage(base_path)
if (free // (2**30)) > ((total / 100) * disk_treashold) // (2**30):
break
data = {"trace": "not enought free space at destination" + str(base_path) + " trashold is: " + str(disk_treashold) + "%"}
response = requests.post('{}/log'.format(root_api_url), json=data)
print("sleep", flush=True)
time.sleep(900)
# Load Records to be anonimized
r = requests.get('{}/anonymize'.format(root_api_url)) r = requests.get('{}/anonymize'.format(root_api_url))
# print(r.text, flush=True) # print(r.text, flush=True)
response = r.json() response = r.json()
@@ -25,7 +43,7 @@ try:
for detection in response: for detection in response:
print(str(detection['id']) + " Anonymization Started", flush=True) print(str(detection['id']) + " Anonymization Started", flush=True)
img_path = "{}{}".format(base_path, detection['source_image_path']) img_path = "{}{}".format(base_path, detection['path'])
#print(img_path, flush=True) #print(img_path, flush=True)
#Skip Non existing files #Skip Non existing files
if (not os.path.exists(img_path)): if (not os.path.exists(img_path)):
@@ -39,7 +57,7 @@ try:
if (len(faces) <= 0): if (len(faces) <= 0):
data = { data = {
"id": detection['id'], "id": detection['id'],
"source_image_path": img_path.replace(base_path,""), "path": img_path.replace(base_path,""),
"face_found": 0, "face_found": 0,
} }
response = requests.post('{}/anonymize'.format(root_api_url), json=data) response = requests.post('{}/anonymize'.format(root_api_url), json=data)
@@ -75,15 +93,17 @@ try:
data = { data = {
"id": detection['id'], "id": detection['id'],
"source_image_path": new_img_path.replace(base_path,""), "path": new_img_path.replace(base_path,""),
"face_found": len(faces), "face_found": len(faces),
} }
response = requests.post('{}/anonymize'.format(root_api_url), json=data) response = requests.post('{}/anonymize'.format(root_api_url), json=data)
print(str(detection['id']) + " Anonymized" , flush=True) print(str(detection['id']) + " Anonymized" , flush=True)
time.sleep(10) time.sleep(5)
print("Clearing Memory", flush=True)
gc.collect()
print("sleep", flush=True) print("sleep", flush=True)
time.sleep(900) time.sleep(300)
except Exception as e: except Exception as e:
print("An exception occurred", flush=True) print("An exception occurred", flush=True)
+1
View File
@@ -1,4 +1,5 @@
opencv-python opencv-python
requests
numpy numpy
requests requests
retina-face retina-face