Пример #1
0
    def __init__(self, cfg):
        BaseComponent.__init__(self, cfg)

        params = cfg['params']

        self.detector = cv2.CascadeClassifier(params['model'])
        self.scaledown_factor = params.get('scaledown_factor', 1.1)
        self.min_neighbors = params.get('min_neighbors', 3)
        self.output_label = params['outputlabel']
Пример #2
0
    def __init__(self, cfg):
        BaseComponent.__init__(self, cfg)

        params = self.cfg['params']

        tfnet_cfg = {
            "model": params['model'],
            "load": params['weights'],
            "config": '/root/darkflow/cfg',
            "verbalise": True,
            "threshold": 0.1
        }

        self.nn = TFNet(tfnet_cfg)
Пример #3
0
    def __init__(self, cfg):
        BaseComponent.__init__(self, cfg)

        params = cfg['params']

        models_dir = params['model']
        if not os.path.exists(models_dir):
            raise "Error: Invalid face recognizer model directory path " + models_dir

        strategies = params['strategies']
        if not strategies:
            raise "Error: Invalid pipeline file. Recognizer should specify atleast 1 strategy: eigen|fischer|lbp"

        self.output_label = params['outputlabel']

        if 'eigen' in strategies:
            self.eigen = face.createEigenFaceRecognizer()
            self.eigen.load(os.path.join(models_dir, 'eigen.yml'))
        else:
            if 'eigen' in self.output_label:
                raise "Error: Invalid pipeline file. Recognizer has eigen in output label but not in strategies"

            self.eigen = None

        if 'fischer' in strategies:
            self.fischer = face.createFisherFaceRecognizer()
            self.fischer.load(os.path.join(models_dir, 'fischer.yml'))
        else:
            if 'fischer' in self.output_label:
                raise "Error: Invalid pipeline file. Recognizer has fischer in output label but not in strategies"

            self.fischer = None

        if 'lbp' in strategies:
            self.lbp = face.createLBPHFaceRecognizer()
            self.lbp.load(os.path.join(models_dir, 'lbp.yml'))
        else:
            if 'lbp' in self.output_label:
                raise "Error: Invalid pipeline file. Recognizer has lbp in output label but not in strategies"

            self.lbp = None

        with open(os.path.join(models_dir, 'model.json'), 'r') as model_file:
            self.model = json.load(model_file)
            self.train_img_size = (self.model['height'], self.model['width'])
            self.labels = self.model['labels']

        self.equalize_hist = params.get('equalizehist', False)
Пример #4
0
    def __init__(self, cfg):
        BaseComponent.__init__(self, cfg)

        self.output_video = None
        self.output_filepath = None
 def __init__(self, cfg):
     BaseComponent.__init__(self, cfg)
Пример #6
0
    def __init__(self, cfg):
        BaseComponent.__init__(self, cfg)

        self.full_report = None