add private module to create model object for library api
This commit is contained in:
1
opendbm/api_lib/facial_activity/__init__.py
Normal file
1
opendbm/api_lib/facial_activity/__init__.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
from opendbm.api_lib.facial_activity.api import FacialActivity
|
||||||
49
opendbm/api_lib/facial_activity/_action_unit.py
Normal file
49
opendbm/api_lib/facial_activity/_action_unit.py
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
import tempfile
|
||||||
|
|
||||||
|
from opendbm.api_lib.model import VideoModel
|
||||||
|
from opendbm.dbm_lib.dbm_features.raw_features.video.face_au import run_face_au
|
||||||
|
|
||||||
|
|
||||||
|
class ActionUnit(VideoModel):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
self._params = [
|
||||||
|
"fac_AU01int",
|
||||||
|
"fac_AU02int",
|
||||||
|
"fac_AU04int",
|
||||||
|
"fac_AU05int",
|
||||||
|
"fac_AU06int",
|
||||||
|
"fac_AU07int",
|
||||||
|
"fac_AU09int",
|
||||||
|
"fac_AU10int",
|
||||||
|
"fac_AU12int",
|
||||||
|
"fac_AU14int",
|
||||||
|
"fac_AU15int",
|
||||||
|
"fac_AU17int",
|
||||||
|
"fac_AU20int",
|
||||||
|
"fac_AU23int",
|
||||||
|
"fac_AU25int",
|
||||||
|
"fac_AU26int",
|
||||||
|
"fac_AU45int",
|
||||||
|
"fac_AU01pres",
|
||||||
|
"fac_AU02pres",
|
||||||
|
"fac_AU04pres",
|
||||||
|
"fac_AU05pres",
|
||||||
|
"fac_AU06pres",
|
||||||
|
"fac_AU07pres",
|
||||||
|
"fac_AU09pres",
|
||||||
|
"fac_AU10pres",
|
||||||
|
"fac_AU12pres",
|
||||||
|
"fac_AU14pres",
|
||||||
|
"fac_AU15pres",
|
||||||
|
"fac_AU17pres",
|
||||||
|
"fac_AU20pres",
|
||||||
|
"fac_AU23pres",
|
||||||
|
"fac_AU25pres",
|
||||||
|
"fac_AU26pres",
|
||||||
|
"fac_AU28pres",
|
||||||
|
"fac_AU45pres",
|
||||||
|
]
|
||||||
|
|
||||||
|
def _fit_transform(self, path):
|
||||||
|
return run_face_au(path, f"{tempfile.gettempdir()}/", self.r_config, save=False)
|
||||||
20
opendbm/api_lib/facial_activity/_asymmetry.py
Normal file
20
opendbm/api_lib/facial_activity/_asymmetry.py
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import tempfile
|
||||||
|
|
||||||
|
from opendbm.api_lib.model import VideoModel
|
||||||
|
from opendbm.dbm_lib import run_face_asymmetry
|
||||||
|
|
||||||
|
|
||||||
|
class Asymmetry(VideoModel):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
self._params = [
|
||||||
|
"fac_asymmaskmouth",
|
||||||
|
"fac_asymmaskeye",
|
||||||
|
"fac_asymmaskeyebrow",
|
||||||
|
"fac_asymmaskcom",
|
||||||
|
]
|
||||||
|
|
||||||
|
def _fit_transform(self, path):
|
||||||
|
return run_face_asymmetry(
|
||||||
|
path, f"{tempfile.gettempdir()}/", self.r_config, save=False
|
||||||
|
)
|
||||||
89
opendbm/api_lib/facial_activity/_expressivity.py
Normal file
89
opendbm/api_lib/facial_activity/_expressivity.py
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
import tempfile
|
||||||
|
|
||||||
|
from opendbm.api_lib.model import VideoModel
|
||||||
|
from opendbm.dbm_lib.dbm_features.raw_features.video import face_emotion_expressivity
|
||||||
|
|
||||||
|
|
||||||
|
class Expressivity(VideoModel):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
self._params = [
|
||||||
|
" AU01_r",
|
||||||
|
" AU02_r",
|
||||||
|
" AU04_r",
|
||||||
|
" AU05_r",
|
||||||
|
" AU06_r",
|
||||||
|
" AU07_r",
|
||||||
|
" AU09_r",
|
||||||
|
" AU10_r",
|
||||||
|
" AU12_r",
|
||||||
|
" AU14_r",
|
||||||
|
" AU15_r",
|
||||||
|
" AU17_r",
|
||||||
|
" AU20_r",
|
||||||
|
" AU25_r",
|
||||||
|
" AU26_r",
|
||||||
|
" AU45_r",
|
||||||
|
" AU01_c",
|
||||||
|
" AU02_c",
|
||||||
|
" AU04_c",
|
||||||
|
" AU05_c",
|
||||||
|
" AU06_c",
|
||||||
|
" AU07_c",
|
||||||
|
" AU10_c",
|
||||||
|
" AU12_c",
|
||||||
|
" AU14_c",
|
||||||
|
" AU15_c",
|
||||||
|
" AU17_c",
|
||||||
|
" AU20_c",
|
||||||
|
" AU23_c",
|
||||||
|
" AU25_c",
|
||||||
|
" AU26_c",
|
||||||
|
" AU28_c",
|
||||||
|
" AU45_c",
|
||||||
|
" AU09_c",
|
||||||
|
" AU23_r",
|
||||||
|
"s_confidence",
|
||||||
|
"fac_hapintsoft",
|
||||||
|
"fac_sadintsoft",
|
||||||
|
"fac_surintsoft",
|
||||||
|
"fac_feaintsoft",
|
||||||
|
"fac_angintsoft",
|
||||||
|
"fac_disintsoft",
|
||||||
|
"fac_conintsoft",
|
||||||
|
"fac_paiintsoft",
|
||||||
|
"fac_negintsoft",
|
||||||
|
"fac_posintsoft",
|
||||||
|
"neu_exp",
|
||||||
|
"fac_comlowintsoft",
|
||||||
|
"fac_comuppintsoft",
|
||||||
|
"cai_exp",
|
||||||
|
"fac_comintsoft",
|
||||||
|
"fac_happres",
|
||||||
|
"fac_sadpres",
|
||||||
|
"fac_surpres",
|
||||||
|
"fac_feapres",
|
||||||
|
"fac_angpres",
|
||||||
|
"fac_dispres",
|
||||||
|
"fac_conpres",
|
||||||
|
"fac_hapinthard",
|
||||||
|
"fac_sadinthard",
|
||||||
|
"fac_surinthard",
|
||||||
|
"fac_feainthard",
|
||||||
|
"fac_anginthard",
|
||||||
|
"fac_disinthard",
|
||||||
|
"fac_coninthard",
|
||||||
|
"fac_paiinthard",
|
||||||
|
"fac_neginthard",
|
||||||
|
"fac_posinthard",
|
||||||
|
"neu_exp_full",
|
||||||
|
"cai_exp_full",
|
||||||
|
"fac_comlowinthard",
|
||||||
|
"fac_comuppinthard",
|
||||||
|
"fac_cominthard",
|
||||||
|
]
|
||||||
|
|
||||||
|
def _fit_transform(self, path):
|
||||||
|
return face_emotion_expressivity.run_face_expressivity(
|
||||||
|
path, f"{tempfile.gettempdir()}/", self.r_config, save=False
|
||||||
|
)
|
||||||
24
opendbm/api_lib/facial_activity/_landmark.py
Normal file
24
opendbm/api_lib/facial_activity/_landmark.py
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
import tempfile
|
||||||
|
|
||||||
|
from opendbm.api_lib.model import VideoModel
|
||||||
|
from opendbm.dbm_lib import run_face_landmark
|
||||||
|
|
||||||
|
|
||||||
|
def r_num_fmt(fmt, rnum):
|
||||||
|
return list(map(lambda x: fmt.format(i="%02d" % x), rnum))
|
||||||
|
|
||||||
|
|
||||||
|
lcols = []
|
||||||
|
for vr in ["r", "c", "X", "Y", "Z"]:
|
||||||
|
lcols += r_num_fmt(f"fac_LMK{{i}}{vr}", range(68))
|
||||||
|
|
||||||
|
|
||||||
|
class Landmark(VideoModel):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
self._params = lcols
|
||||||
|
|
||||||
|
def _fit_transform(self, path):
|
||||||
|
return run_face_landmark(
|
||||||
|
path, f"{tempfile.gettempdir()}/", self.r_config, save=False
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user