def mapper_init(self):

        self.dataset_dir = 'dataset_dir'
        self.output_dir = os.path.join(jobconf_from_env('mapreduce.task.output.dir'), 'faces')

        cascade_cpu = jobconf_from_env('job.settings.cascade_cpu')
        cascade_gpu = jobconf_from_env('job.settings.cascade_gpu')
        colorferet = jobconf_from_env('job.settings.colorferet')
        gpu_or_cpu = jobconf_from_env('job.settings.gpu_or_cpu')

        self.detector = create_detector(gpu_or_cpu, cascade_cpu, cascade_gpu)
        self.recognizer = create_recognizer(colorferet)

        if not os.path.exists(self.output_dir):
            os.makedirs(self.output_dir)

        self.write_results = False
    def __init__(self, file_list, **kwargs):

        self.file_list = file_list
        gpu_or_cpu = kwargs['hardware_type']
        resources_dir = kwargs['resources_dir']
        colorferet_tar = os.path.join(resources_dir, kwargs['colorferet'])
        cascade_cpu = os.path.join(resources_dir, kwargs['cascade_cpu'])
        cascade_gpu = os.path.join(resources_dir, kwargs['cascade_gpu'])

        tar_stem = kwargs['colorferet'].split('.')[0]
        colorferet_dir = os.path.join(resources_dir, tar_stem)

        with tarfile.open(colorferet_tar) as tar:
            tar.extractall(path=colorferet_dir)

        self.detector = create_detector(gpu_or_cpu, cascade_cpu, cascade_gpu)
        self.recognizer = create_recognizer(colorferet_dir)
        shutil.rmtree(colorferet_dir, ignore_errors=True)

        self.timer = Timer()