def main(): global gl_emotions global gd_setup global gd_config gd_setup, gd_config = helper.load_setup() gl_emotions = gd_config['emotions'] run_main_loop(gd_setup['testSetupPath']) print "Task completed"
def run_all(): d_setup, __ = helper.load_setup() if (len(d_setup)) > 0: print "Creating Evaluation Setup: {0}".format( d_setup['evaluationSetupPath']) evaluation_setup_creator.main() print "Training Classifier: {0}".format(d_setup['classifierPath']) train.main() print "Creating Test Setup: {0}".format(d_setup['testSetupPath']) create_test_setup.main() print "Computing Metrics for: {0}".format(d_setup['classifierPath']) compute_metrics_calculation.main() print 'Task Completed'
def main(): d_setup, __ = helper.load_setup() ll_test_files = glob.glob( path.join(d_setup['evaluationSetupPath'], '*test.csv')) v_dest = d_setup['testSetupPath'] helper.create_directory(v_dest) fold_count = 0 for fold in ll_test_files: v_current_destination = path.join(v_dest, 'fold{0}'.format(fold_count)) helper.create_directory(v_current_destination) copyfile(fold, path.join(v_current_destination, 'all_participants.csv')) fold_count += 1
def main(): global emotions gd_setup, __ = helper.load_setup() emotions = gd_setup['emotionList'] v_basepath = gd_setup['evaluationSetupPath'] v_sourcepath = gd_setup['sourceFilesPath'] v_folds = gd_setup['evaluationFolds'] helper.create_directory((v_basepath)) create_participants_list(pv_basepath=v_basepath, pv_sourcepath=v_sourcepath) # create_participants_list(pv_basepath="test_setup2", pv_sourcepath="Data\\sorted_set_testing2") for i in xrange(v_folds): create_evaluation_setup(pv_basepath=v_basepath, pv_sourcepath=v_sourcepath, pv_fold_number=i, limit_to_min=False) # Update yaml dict yaml_dict['basepath'] = v_basepath yaml_dict['sourcepath'] = v_sourcepath yaml_dict['folds'] = v_folds yaml_dict['emotions'] = emotions save_to_yaml(v_basepath)
import cv2 import predictor import overlay_helper import helper import glob from os import path d_setup, d_config = helper.load_setup() def get_image_list(pv_path): ll_files = [] for img_format in ('*.png', '*.jpg', '*.jpeg'): ll_files.extend(glob.glob(path.join(pv_path, img_format))) return ll_files def process(pv_path): ll_image_files = get_image_list(pv_path) for img_path in ll_image_files: if '_result' in img_path: continue print img_path # Read image img = cv2.imread(img_path) # Predict face emotions on frame b_found, ll_pred, ll_pred_label, llol_pred_prob, landmarks = predictor.predict_image( img)
def main(): global gd_setup gd_setup, __ = helper.load_setup() train(gd_setup['evaluationSetupPath']) fm.json_save_file( path.join(gd_setup['evaluationSetupPath'], 'results.json'), json_dict)