facial tremor testing
This commit is contained in:
@@ -7,7 +7,7 @@ created: 2020-20-07
|
|||||||
from dbm_lib.dbm_features.raw_features.audio import intensity, pitch_freq, hnr, gne, voice_frame_score, formant_freq
|
from dbm_lib.dbm_features.raw_features.audio import intensity, pitch_freq, hnr, gne, voice_frame_score, formant_freq
|
||||||
from dbm_lib.dbm_features.raw_features.audio import pause_segment, jitter, shimmer, mfcc
|
from dbm_lib.dbm_features.raw_features.audio import pause_segment, jitter, shimmer, mfcc
|
||||||
from dbm_lib.dbm_features.raw_features.video import face_asymmetry, face_au, face_emotion_expressivity, face_landmark
|
from dbm_lib.dbm_features.raw_features.video import face_asymmetry, face_au, face_emotion_expressivity, face_landmark
|
||||||
from dbm_lib.dbm_features.raw_features.movement import head_motion, eye_blink, voice_tremor
|
from dbm_lib.dbm_features.raw_features.movement import head_motion, eye_blink, voice_tremor, facial_tremor
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import logging
|
import logging
|
||||||
@@ -120,6 +120,7 @@ def process_movement(video_uri, out_dir, dbm_group, r_config, dlib_model):
|
|||||||
return
|
return
|
||||||
|
|
||||||
logger.info('Processing movement variables from data in {}'.format(video_uri))
|
logger.info('Processing movement variables from data in {}'.format(video_uri))
|
||||||
|
|
||||||
logger.info('processing head movement....')
|
logger.info('processing head movement....')
|
||||||
head_motion.run_head_movement(video_uri, out_dir, r_config)
|
head_motion.run_head_movement(video_uri, out_dir, r_config)
|
||||||
|
|
||||||
@@ -129,6 +130,9 @@ def process_movement(video_uri, out_dir, dbm_group, r_config, dlib_model):
|
|||||||
logger.info('processing voice tremor....')
|
logger.info('processing voice tremor....')
|
||||||
voice_tremor.run_vtremor(video_uri, out_dir, r_config)
|
voice_tremor.run_vtremor(video_uri, out_dir, r_config)
|
||||||
|
|
||||||
|
logger.info('processing facial tremor....')
|
||||||
|
face_tremor.fac_tremor_process(video_uri, out_dir, r_config, model_output=True)
|
||||||
|
|
||||||
def remove_file(file_path):
|
def remove_file(file_path):
|
||||||
"""
|
"""
|
||||||
removing wav file
|
removing wav file
|
||||||
|
|||||||
@@ -13,3 +13,4 @@ import os
|
|||||||
DBMLIB_PATH = os.path.dirname(__file__)
|
DBMLIB_PATH = os.path.dirname(__file__)
|
||||||
DBMLIB_VTREMOR_LIB = os.path.abspath(os.path.join(DBMLIB_PATH,
|
DBMLIB_VTREMOR_LIB = os.path.abspath(os.path.join(DBMLIB_PATH,
|
||||||
'../../../../resources/libraries/voice_tremor.praat'))
|
'../../../../resources/libraries/voice_tremor.praat'))
|
||||||
|
DBMLIB_FTREMOR_CONFIG = os.path.abspath(os.path.join(DBMLIB_PATH, '../resources/features/facial/config.json'))
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ from dbm_lib.dbm_features.raw_features.util import util as ut
|
|||||||
logging.basicConfig(level=logging.INFO)
|
logging.basicConfig(level=logging.INFO)
|
||||||
logger=logging.getLogger()
|
logger=logging.getLogger()
|
||||||
|
|
||||||
def batch_open_face(filepaths,video_url, input_dir, out_dir, of_path):
|
def batch_open_face(filepaths,video_url, input_dir, out_dir, of_path,video_tracking=False):
|
||||||
""" Computes open_face features for the files in filepaths
|
""" Computes open_face features for the files in filepaths
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@@ -32,8 +32,11 @@ def batch_open_face(filepaths,video_url, input_dir, out_dir, of_path):
|
|||||||
--------
|
--------
|
||||||
(itreable[str]) list of .csv files
|
(itreable[str]) list of .csv files
|
||||||
"""
|
"""
|
||||||
|
if video_tracking:
|
||||||
|
suffix = '_OF_video_features/'
|
||||||
|
else:
|
||||||
|
suffix = '_OF_features'
|
||||||
|
|
||||||
suffix = '_OF_features'
|
|
||||||
csv_files = []
|
csv_files = []
|
||||||
|
|
||||||
for fp in filepaths:
|
for fp in filepaths:
|
||||||
@@ -50,7 +53,7 @@ def batch_open_face(filepaths,video_url, input_dir, out_dir, of_path):
|
|||||||
|
|
||||||
return csv_files
|
return csv_files
|
||||||
|
|
||||||
def process_open_face(video_uri, input_dir, out_dir, of_path, dbm_group):
|
def process_open_face(video_uri, input_dir, out_dir, of_path, dbm_group,video_tracking):
|
||||||
"""
|
"""
|
||||||
Processing all patient's for fetching emotion expressivity
|
Processing all patient's for fetching emotion expressivity
|
||||||
-------------------
|
-------------------
|
||||||
@@ -66,7 +69,7 @@ def process_open_face(video_uri, input_dir, out_dir, of_path, dbm_group):
|
|||||||
return
|
return
|
||||||
|
|
||||||
filepaths = [video_uri]
|
filepaths = [video_uri]
|
||||||
csv_filepaths = batch_open_face(filepaths, video_uri, input_dir, out_dir, of_path)
|
csv_filepaths = batch_open_face(filepaths, video_uri, input_dir, out_dir, of_path,video_tracking)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error('Failed to process video file')
|
logger.error('Failed to process video file')
|
||||||
@@ -19,6 +19,8 @@ import time
|
|||||||
logging.basicConfig(level=logging.INFO)
|
logging.basicConfig(level=logging.INFO)
|
||||||
logger=logging.getLogger()
|
logger=logging.getLogger()
|
||||||
|
|
||||||
|
#for ftremor
|
||||||
|
OPENFACE_PATH_VIDEO = '/pkg/OpenFace/build/bin/FaceLandmarkVid'
|
||||||
OPENFACE_PATH = 'pkg/OpenFace/build/bin/FeatureExtraction'
|
OPENFACE_PATH = 'pkg/OpenFace/build/bin/FeatureExtraction'
|
||||||
DLIB_SHAPE_MODEL = 'pkg/shape_detector/shape_predictor_68_face_landmarks.dat'
|
DLIB_SHAPE_MODEL = 'pkg/shape_detector/shape_predictor_68_face_landmarks.dat'
|
||||||
|
|
||||||
@@ -35,6 +37,7 @@ def common_video(video_file, args, r_config):
|
|||||||
of.process_open_face(video_file, os.path.dirname(video_file), out_path, OPENFACE_PATH, args.dbm_group)
|
of.process_open_face(video_file, os.path.dirname(video_file), out_path, OPENFACE_PATH, args.dbm_group)
|
||||||
pf.process_facial(video_file, out_path, args.dbm_group, r_config)
|
pf.process_facial(video_file, out_path, args.dbm_group, r_config)
|
||||||
pf.process_acoustic(video_file, out_path, args.dbm_group, r_config)
|
pf.process_acoustic(video_file, out_path, args.dbm_group, r_config)
|
||||||
|
of.process_open_face(video_file, os.path.dirname(video_file), out_path, OPENFACE_PATH_VIDEO, args.dbm_group,video_tracking=True)
|
||||||
pf.process_movement(video_file, out_path, args.dbm_group, r_config, DLIB_SHAPE_MODEL)
|
pf.process_movement(video_file, out_path, args.dbm_group, r_config, DLIB_SHAPE_MODEL)
|
||||||
pf.remove_file(video_file)
|
pf.remove_file(video_file)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user