diff options
| author | Adam Harvey <adam@ahprojects.com> | 2019-01-07 18:49:09 +0100 |
|---|---|---|
| committer | Adam Harvey <adam@ahprojects.com> | 2019-01-07 18:49:09 +0100 |
| commit | c67a3c23190287f747989e5dc7725e1657edf8f1 (patch) | |
| tree | 5ff47ab72e6fb146f66730db06fc3b91265dd769 /megapixels/app/processors/face_recognition.py | |
| parent | 55b9734d131a197166156566d1b999a8bb59169b (diff) | |
add age, gender, emotion stubs
Diffstat (limited to 'megapixels/app/processors/face_recognition.py')
| -rw-r--r-- | megapixels/app/processors/face_recognition.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/megapixels/app/processors/face_recognition.py b/megapixels/app/processors/face_recognition.py index a56b1634..76f00aa1 100644 --- a/megapixels/app/processors/face_recognition.py +++ b/megapixels/app/processors/face_recognition.py @@ -54,6 +54,15 @@ class RecognitionDLIB: #vec = self.facerec.compute_face_descriptor(im, face_shape) return vec + def flatten(self, vec): + '''Converts 128D vector into a flattened list for CSV + :param points: (list) a feature vector as list of floats + :returns dict item for each point (eg {'d1':0.28442156, 'd1': 0.1868632}) + ''' + vec_flat = {} + for idx, val in enumerate(vec, 1): + vec_flat[f'd{idx}'] = val + return vec_flat def similarity(self, query_enc, known_enc): return np.linalg.norm(query_enc - known_enc, axis=1) |
