From b7c7a5580f892f15a155ccda266a418b4f693e1c Mon Sep 17 00:00:00 2001 From: Sefik Ilkin Serengil Date: Thu, 8 Aug 2024 08:53:56 +0100 Subject: [PATCH] models refactored --- deepface/{extendedmodels => models/demography}/Age.py | 2 +- deepface/{extendedmodels => models/demography}/Emotion.py | 0 deepface/{extendedmodels => models/demography}/Gender.py | 2 +- deepface/{extendedmodels => models/demography}/Race.py | 2 +- deepface/{basemodels => models/demography}/__init__.py | 0 .../{detectors => models/face_detection}/CenterFace.py | 0 deepface/{detectors => models/face_detection}/Dlib.py | 0 .../{detectors => models/face_detection}/FastMtCnn.py | 0 .../{detectors => models/face_detection}/MediaPipe.py | 0 deepface/{detectors => models/face_detection}/MtCnn.py | 0 deepface/{detectors => models/face_detection}/OpenCv.py | 0 .../{detectors => models/face_detection}/RetinaFace.py | 0 deepface/{detectors => models/face_detection}/Ssd.py | 2 +- deepface/{detectors => models/face_detection}/Yolo.py | 0 deepface/{detectors => models/face_detection}/YuNet.py | 0 deepface/{detectors => models/face_detection}/__init__.py | 0 .../{basemodels => models/facial_recognition}/ArcFace.py | 0 .../{basemodels => models/facial_recognition}/DeepID.py | 0 .../{basemodels => models/facial_recognition}/Dlib.py | 0 .../{basemodels => models/facial_recognition}/Facenet.py | 0 .../facial_recognition}/FbDeepFace.py | 0 .../facial_recognition}/GhostFaceNet.py | 0 .../{basemodels => models/facial_recognition}/OpenFace.py | 0 .../{basemodels => models/facial_recognition}/SFace.py | 0 .../{basemodels => models/facial_recognition}/VGGFace.py | 0 .../facial_recognition}/__init__.py | 0 deepface/{spoofmodels => models/spoofing}/FasNet.py | 2 +- .../{spoofmodels => models/spoofing}/FasNetBackbone.py | 0 deepface/{spoofmodels => models/spoofing}/__init__.py | 0 deepface/modules/demography.py | 2 +- deepface/modules/modeling.py | 8 ++++---- 31 files changed, 10 insertions(+), 10 deletions(-) rename deepface/{extendedmodels => models/demography}/Age.py (98%) rename deepface/{extendedmodels => models/demography}/Emotion.py (100%) rename deepface/{extendedmodels => models/demography}/Gender.py (97%) rename deepface/{extendedmodels => models/demography}/Race.py (97%) rename deepface/{basemodels => models/demography}/__init__.py (100%) rename deepface/{detectors => models/face_detection}/CenterFace.py (100%) rename deepface/{detectors => models/face_detection}/Dlib.py (100%) rename deepface/{detectors => models/face_detection}/FastMtCnn.py (100%) rename deepface/{detectors => models/face_detection}/MediaPipe.py (100%) rename deepface/{detectors => models/face_detection}/MtCnn.py (100%) rename deepface/{detectors => models/face_detection}/OpenCv.py (100%) rename deepface/{detectors => models/face_detection}/RetinaFace.py (100%) rename deepface/{detectors => models/face_detection}/Ssd.py (99%) rename deepface/{detectors => models/face_detection}/Yolo.py (100%) rename deepface/{detectors => models/face_detection}/YuNet.py (100%) rename deepface/{detectors => models/face_detection}/__init__.py (100%) rename deepface/{basemodels => models/facial_recognition}/ArcFace.py (100%) rename deepface/{basemodels => models/facial_recognition}/DeepID.py (100%) rename deepface/{basemodels => models/facial_recognition}/Dlib.py (100%) rename deepface/{basemodels => models/facial_recognition}/Facenet.py (100%) rename deepface/{basemodels => models/facial_recognition}/FbDeepFace.py (100%) rename deepface/{basemodels => models/facial_recognition}/GhostFaceNet.py (100%) rename deepface/{basemodels => models/facial_recognition}/OpenFace.py (100%) rename deepface/{basemodels => models/facial_recognition}/SFace.py (100%) rename deepface/{basemodels => models/facial_recognition}/VGGFace.py (100%) rename deepface/{extendedmodels => models/facial_recognition}/__init__.py (100%) rename deepface/{spoofmodels => models/spoofing}/FasNet.py (99%) rename deepface/{spoofmodels => models/spoofing}/FasNetBackbone.py (100%) rename deepface/{spoofmodels => models/spoofing}/__init__.py (100%) diff --git a/deepface/extendedmodels/Age.py b/deepface/models/demography/Age.py similarity index 98% rename from deepface/extendedmodels/Age.py rename to deepface/models/demography/Age.py index e9363a1f..12b4cb86 100644 --- a/deepface/extendedmodels/Age.py +++ b/deepface/models/demography/Age.py @@ -1,7 +1,7 @@ import os import gdown import numpy as np -from deepface.basemodels import VGGFace +from deepface.models.facial_recognition import VGGFace from deepface.commons import package_utils, folder_utils from deepface.models.Demography import Demography from deepface.commons.logger import Logger diff --git a/deepface/extendedmodels/Emotion.py b/deepface/models/demography/Emotion.py similarity index 100% rename from deepface/extendedmodels/Emotion.py rename to deepface/models/demography/Emotion.py diff --git a/deepface/extendedmodels/Gender.py b/deepface/models/demography/Gender.py similarity index 97% rename from deepface/extendedmodels/Gender.py rename to deepface/models/demography/Gender.py index fff8e2dd..e5d0eaca 100644 --- a/deepface/extendedmodels/Gender.py +++ b/deepface/models/demography/Gender.py @@ -6,7 +6,7 @@ import numpy as np # project dependencies -from deepface.basemodels import VGGFace +from deepface.models.facial_recognition import VGGFace from deepface.commons import package_utils, folder_utils from deepface.models.Demography import Demography from deepface.commons.logger import Logger diff --git a/deepface/extendedmodels/Race.py b/deepface/models/demography/Race.py similarity index 97% rename from deepface/extendedmodels/Race.py rename to deepface/models/demography/Race.py index 5e3b3e20..29bfc65e 100644 --- a/deepface/extendedmodels/Race.py +++ b/deepface/models/demography/Race.py @@ -6,7 +6,7 @@ import numpy as np # project dependencies -from deepface.basemodels import VGGFace +from deepface.models.facial_recognition import VGGFace from deepface.commons import package_utils, folder_utils from deepface.models.Demography import Demography from deepface.commons.logger import Logger diff --git a/deepface/basemodels/__init__.py b/deepface/models/demography/__init__.py similarity index 100% rename from deepface/basemodels/__init__.py rename to deepface/models/demography/__init__.py diff --git a/deepface/detectors/CenterFace.py b/deepface/models/face_detection/CenterFace.py similarity index 100% rename from deepface/detectors/CenterFace.py rename to deepface/models/face_detection/CenterFace.py diff --git a/deepface/detectors/Dlib.py b/deepface/models/face_detection/Dlib.py similarity index 100% rename from deepface/detectors/Dlib.py rename to deepface/models/face_detection/Dlib.py diff --git a/deepface/detectors/FastMtCnn.py b/deepface/models/face_detection/FastMtCnn.py similarity index 100% rename from deepface/detectors/FastMtCnn.py rename to deepface/models/face_detection/FastMtCnn.py diff --git a/deepface/detectors/MediaPipe.py b/deepface/models/face_detection/MediaPipe.py similarity index 100% rename from deepface/detectors/MediaPipe.py rename to deepface/models/face_detection/MediaPipe.py diff --git a/deepface/detectors/MtCnn.py b/deepface/models/face_detection/MtCnn.py similarity index 100% rename from deepface/detectors/MtCnn.py rename to deepface/models/face_detection/MtCnn.py diff --git a/deepface/detectors/OpenCv.py b/deepface/models/face_detection/OpenCv.py similarity index 100% rename from deepface/detectors/OpenCv.py rename to deepface/models/face_detection/OpenCv.py diff --git a/deepface/detectors/RetinaFace.py b/deepface/models/face_detection/RetinaFace.py similarity index 100% rename from deepface/detectors/RetinaFace.py rename to deepface/models/face_detection/RetinaFace.py diff --git a/deepface/detectors/Ssd.py b/deepface/models/face_detection/Ssd.py similarity index 99% rename from deepface/detectors/Ssd.py rename to deepface/models/face_detection/Ssd.py index 3dc1c016..c5c0c3fb 100644 --- a/deepface/detectors/Ssd.py +++ b/deepface/models/face_detection/Ssd.py @@ -4,7 +4,7 @@ import cv2 import pandas as pd import numpy as np -from deepface.detectors import OpenCv +from deepface.models.face_detection import OpenCv from deepface.commons import folder_utils from deepface.models.Detector import Detector, FacialAreaRegion from deepface.commons.logger import Logger diff --git a/deepface/detectors/Yolo.py b/deepface/models/face_detection/Yolo.py similarity index 100% rename from deepface/detectors/Yolo.py rename to deepface/models/face_detection/Yolo.py diff --git a/deepface/detectors/YuNet.py b/deepface/models/face_detection/YuNet.py similarity index 100% rename from deepface/detectors/YuNet.py rename to deepface/models/face_detection/YuNet.py diff --git a/deepface/detectors/__init__.py b/deepface/models/face_detection/__init__.py similarity index 100% rename from deepface/detectors/__init__.py rename to deepface/models/face_detection/__init__.py diff --git a/deepface/basemodels/ArcFace.py b/deepface/models/facial_recognition/ArcFace.py similarity index 100% rename from deepface/basemodels/ArcFace.py rename to deepface/models/facial_recognition/ArcFace.py diff --git a/deepface/basemodels/DeepID.py b/deepface/models/facial_recognition/DeepID.py similarity index 100% rename from deepface/basemodels/DeepID.py rename to deepface/models/facial_recognition/DeepID.py diff --git a/deepface/basemodels/Dlib.py b/deepface/models/facial_recognition/Dlib.py similarity index 100% rename from deepface/basemodels/Dlib.py rename to deepface/models/facial_recognition/Dlib.py diff --git a/deepface/basemodels/Facenet.py b/deepface/models/facial_recognition/Facenet.py similarity index 100% rename from deepface/basemodels/Facenet.py rename to deepface/models/facial_recognition/Facenet.py diff --git a/deepface/basemodels/FbDeepFace.py b/deepface/models/facial_recognition/FbDeepFace.py similarity index 100% rename from deepface/basemodels/FbDeepFace.py rename to deepface/models/facial_recognition/FbDeepFace.py diff --git a/deepface/basemodels/GhostFaceNet.py b/deepface/models/facial_recognition/GhostFaceNet.py similarity index 100% rename from deepface/basemodels/GhostFaceNet.py rename to deepface/models/facial_recognition/GhostFaceNet.py diff --git a/deepface/basemodels/OpenFace.py b/deepface/models/facial_recognition/OpenFace.py similarity index 100% rename from deepface/basemodels/OpenFace.py rename to deepface/models/facial_recognition/OpenFace.py diff --git a/deepface/basemodels/SFace.py b/deepface/models/facial_recognition/SFace.py similarity index 100% rename from deepface/basemodels/SFace.py rename to deepface/models/facial_recognition/SFace.py diff --git a/deepface/basemodels/VGGFace.py b/deepface/models/facial_recognition/VGGFace.py similarity index 100% rename from deepface/basemodels/VGGFace.py rename to deepface/models/facial_recognition/VGGFace.py diff --git a/deepface/extendedmodels/__init__.py b/deepface/models/facial_recognition/__init__.py similarity index 100% rename from deepface/extendedmodels/__init__.py rename to deepface/models/facial_recognition/__init__.py diff --git a/deepface/spoofmodels/FasNet.py b/deepface/models/spoofing/FasNet.py similarity index 99% rename from deepface/spoofmodels/FasNet.py rename to deepface/models/spoofing/FasNet.py index 4f2c195d..f1a1caba 100644 --- a/deepface/spoofmodels/FasNet.py +++ b/deepface/models/spoofing/FasNet.py @@ -47,7 +47,7 @@ def __init__(self): ) # guarantees Fasnet imported and torch installed - from deepface.spoofmodels import FasNetBackbone + from deepface.models.spoofing import FasNetBackbone # Fasnet will use 2 distinct models to predict, then it will find the sum of predictions # to make a final prediction diff --git a/deepface/spoofmodels/FasNetBackbone.py b/deepface/models/spoofing/FasNetBackbone.py similarity index 100% rename from deepface/spoofmodels/FasNetBackbone.py rename to deepface/models/spoofing/FasNetBackbone.py diff --git a/deepface/spoofmodels/__init__.py b/deepface/models/spoofing/__init__.py similarity index 100% rename from deepface/spoofmodels/__init__.py rename to deepface/models/spoofing/__init__.py diff --git a/deepface/modules/demography.py b/deepface/modules/demography.py index e33cbced..b68314b9 100644 --- a/deepface/modules/demography.py +++ b/deepface/modules/demography.py @@ -7,7 +7,7 @@ # project dependencies from deepface.modules import modeling, detection, preprocessing -from deepface.extendedmodels import Gender, Race, Emotion +from deepface.models.demography import Gender, Race, Emotion def analyze( diff --git a/deepface/modules/modeling.py b/deepface/modules/modeling.py index efbdfe54..c097c923 100644 --- a/deepface/modules/modeling.py +++ b/deepface/modules/modeling.py @@ -2,7 +2,7 @@ from typing import Any # project dependencies -from deepface.basemodels import ( +from deepface.models.facial_recognition import ( VGGFace, OpenFace, FbDeepFace, @@ -13,7 +13,7 @@ Facenet, GhostFaceNet, ) -from deepface.detectors import ( +from deepface.models.face_detection import ( FastMtCnn, MediaPipe, MtCnn, @@ -25,8 +25,8 @@ YuNet, CenterFace, ) -from deepface.extendedmodels import Age, Gender, Race, Emotion -from deepface.spoofmodels import FasNet +from deepface.models.demography import Age, Gender, Race, Emotion +from deepface.models.spoofing import FasNet def build_model(task: str, model_name: str) -> Any: