зеркало из
https://github.com/ssciwr/AMMICO.git
synced 2025-10-29 21:16:06 +02:00
maintain+bug: fix python version due to deepface, fix deepface memory leak
Этот коммит содержится в:
родитель
f399559e50
Коммит
183dfb1717
2
.github/workflows/ci.yml
поставляемый
2
.github/workflows/ci.yml
поставляемый
@ -16,7 +16,7 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest]
|
os: [ubuntu-latest]
|
||||||
python-version: [3.9, 3.10, 3.11, 3.12, 3.13]
|
python-version: ['3.9', '3.11']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|||||||
@ -6,12 +6,17 @@ import pathlib
|
|||||||
from tensorflow.keras.models import load_model
|
from tensorflow.keras.models import load_model
|
||||||
from tensorflow.keras.applications.mobilenet_v2 import preprocess_input
|
from tensorflow.keras.applications.mobilenet_v2 import preprocess_input
|
||||||
from tensorflow.keras.preprocessing.image import img_to_array
|
from tensorflow.keras.preprocessing.image import img_to_array
|
||||||
|
import keras.backend as K
|
||||||
from deepface import DeepFace
|
from deepface import DeepFace
|
||||||
from retinaface import RetinaFace
|
from retinaface import RetinaFace
|
||||||
from ammico.utils import DownloadResource, AnalysisMethod
|
from ammico.utils import DownloadResource, AnalysisMethod
|
||||||
|
|
||||||
|
|
||||||
DEEPFACE_PATH = ".deepface"
|
DEEPFACE_PATH = ".deepface"
|
||||||
|
# alternative solution to the memory leaks
|
||||||
|
# cfg = K.tf.compat.v1.ConfigProto()
|
||||||
|
# cfg.gpu_options.allow_growth = True
|
||||||
|
# K.set_session(K.tf.compat.v1.Session(config=cfg))
|
||||||
|
|
||||||
|
|
||||||
def deepface_symlink_processor(name):
|
def deepface_symlink_processor(name):
|
||||||
@ -305,6 +310,8 @@ class EmotionDetector(AnalysisMethod):
|
|||||||
for i, face in enumerate(faces[:3]):
|
for i, face in enumerate(faces[:3]):
|
||||||
result[f"person{i+1}"] = self.analyze_single_face(face)
|
result[f"person{i+1}"] = self.analyze_single_face(face)
|
||||||
self.clean_subdict(result)
|
self.clean_subdict(result)
|
||||||
|
# release memory
|
||||||
|
K.clear_session()
|
||||||
return self.subdict
|
return self.subdict
|
||||||
|
|
||||||
def clean_subdict(self, result: dict) -> dict:
|
def clean_subdict(self, result: dict) -> dict:
|
||||||
|
|||||||
@ -11,7 +11,7 @@ maintainers = [
|
|||||||
{ name = "Inga Ulusoy", email = "ssc@iwr.uni-heidelberg.de" },
|
{ name = "Inga Ulusoy", email = "ssc@iwr.uni-heidelberg.de" },
|
||||||
{ name = "Dmitrii Kapitan", email = "ssc@iwr.uni-heidelberg.de" },
|
{ name = "Dmitrii Kapitan", email = "ssc@iwr.uni-heidelberg.de" },
|
||||||
]
|
]
|
||||||
requires-python = ">=3.9"
|
requires-python = ">=3.9, <3.12"
|
||||||
license = { text = "MIT" }
|
license = { text = "MIT" }
|
||||||
classifiers = [
|
classifiers = [
|
||||||
"Programming Language :: Python :: 3",
|
"Programming Language :: Python :: 3",
|
||||||
|
|||||||
Загрузка…
x
Ссылка в новой задаче
Block a user