Esempio n. 1
0
#Import helper functions
from DataRow import DataRow, ErrorAcum, Predictor, getGitRepFolder, createDataRowsFromCSV, getValidWithBBox, writeHD5

###########################    PATHS TO SET   ####################
# Either define CAFFE_ROOT in your enviroment variables or set it here
CAFFE_ROOT = os.environ.get('CAFFE_ROOT','~/caffe/distribute')
sys.path.append(CAFFE_ROOT+'/python')  # Add caffe python path so we can import it
import caffe

# Make sure dlib python path exists on PYTHONPATH else "pip install dlib" if needed.
import dlib
detector=dlib.get_frontal_face_detector() # Load dlib's face detector



ROOT = getGitRepFolder()  # ROOT is the git root folder .
sys.path.append(os.path.join(ROOT, 'python'))  # Assume git root directory
DATA_PATH = os.path.join(ROOT, 'data')
CSV_TEST  = os.path.join(ROOT, 'data', 'testImageList.txt')
CSV_TRAIN = os.path.join(ROOT, 'data', 'trainImageList.txt')

MEAN_TRAIN_SET = cv2.imread(os.path.join(ROOT, 'trainMean.png')).astype('f4')
STD_TRAIN_SET  = cv2.imread(os.path.join(ROOT, 'trainSTD.png')).astype('f4')

AFW_DATA_PATH = os.path.join(ROOT, 'data', 'testimages')
AFW_MAT_PATH = os.path.join(ROOT, 'data', 'anno-v7.mat')

PATH_TO_WEIGHTS  = os.path.join(ROOT, 'ZOO', 'vanillaCNN.caffemodel')
PATH_TO_DEPLOY_TXT = os.path.join(ROOT, 'ZOO', 'vanilla_deploy.prototxt')

detector=dlib.get_frontal_face_detector()
Esempio n. 2
0
#Import helper functions
from DataRow import DataRow, ErrorAcum, Predictor, getGitRepFolder, createDataRowsFromCSV, getValidWithBBox, cropFace

###########################    PATHS TO SET   ####################

# Either define CAFFE_ROOT in your enviroment variables or set it here
CAFFE_ROOT = os.environ.get('CAFFE_ROOT','~/caffe/distribute')
sys.path.append(CAFFE_ROOT+'/python')  # Add caffe python path so we can import it
import caffe

# Make sure dlib python path exists on PYTHONPATH else "pip install dlib" if needed.
import dlib
detector=dlib.get_frontal_face_detector() # Load dlib's face detector

ROOT = getGitRepFolder()  # ROOT is the git root folder .
sys.path.append(os.path.join(ROOT, 'python'))  # Assume git root directory
DATA_PATH = os.path.join(ROOT, 'data')
AFLW_CSV_TEST  = os.path.join(ROOT, 'data', 'testImageList.txt')
AFLW_CSV_TRAIN = os.path.join(ROOT, 'data', 'trainImageList.txt')

AFW_DATA_PATH = os.path.join(ROOT, 'data', 'testimages')
PATH_TO_WEIGHTS  = os.path.join(ROOT, 'model', 'vanillaCNN.caffemodel')
PATH_TO_DEPLOY_TXT = os.path.join(ROOT, 'model', 'vanilla_deploy.prototxt')


###########################    STEPS TO RUN       ####################
#STEPS =['trainSetHD5', 'calcTrainSetMean'] # AFLW_STEPS+AFW_STEPS # Run AFLW and AFW steps
#STEPS = ['downloadAFLW', 'makeAFLWTestSet', 'makeAFLWTrainSet']
STEPS = ['downloadAFLW', 'makeAFLWTrainSet', 'makeAFLWTestSet']