pepper.framework.sensor.face module¶
-
class
pepper.framework.sensor.face.
Face
(name, confidence, representation, bounds, image)[source]¶ Bases:
pepper.framework.sensor.obj.Object
Face Object
Parameters: - name (str) – Name of Person
- confidence (float) – Name Confidence
- representation (np.ndarray) – Face Feature Vector
- bounds (Bounds) – Face Bounding Box
- image (AbstractImage) – Image Face was Found in
-
UNKNOWN
= 'Stranger'¶
-
representation
¶ Face Representation
Returns: representation – Face Feature Vector Return type: np.ndarray
-
class
pepper.framework.sensor.face.
FaceClassifier
(people, n_neighbors=20)[source]¶ Classify Faces of People
Parameters: - people (Dict[str, np.ndarray]) – Known People as <name, representations> dictionary
- n_neighbors (int) –
-
NEW
= 'NEW'¶
-
accuracy
()[source]¶ Calculate Classifier Cross Validation Accuracy
Returns: accuracy Return type: float
-
add
(name, vector)[source]¶ Add Person to Face Classifier
Parameters: - name (str) –
- vector (np.ndarray) – Concatenated Representations (float32 array of length 128n)
-
classify
(representation, bounds, image)[source]¶ Classify Face Observation as Particular Person
Parameters: - representation (np.ndarray) – Observed Face Representation (from OpenFace.represent)
- bounds (Bounds) – Face Bounds (relative to Image)
- image (AbstractImage) – Image in which Face was Observed
Returns: person – Classified Person
Return type:
-
classmethod
from_directory
(directory)[source]¶ Construct FaceClassifier from directory of <name>.bin files
Parameters: directory (str) – Returns: face_classifier Return type: FaceClassifier
-
static
load_directory
(directory)[source]¶ Load People from directory of <name>.bin files
Parameters: directory (str) – Returns: people – Dictionary of <name>: <representations> pairs Return type: dict
-
people
¶ People Dictionary
Returns: people Return type: dict
-
class
pepper.framework.sensor.face.
FaceStore
[source]¶ Bases:
object
-
EXTENSION
= '.bin'¶
-
static
load_directory
(directory)[source]¶ Load all faces from directory with <name>.<FaceStore.EXTENSION> files
Parameters: directory (str) – Directory containing Face Data Returns: faces – Dictionary of {name: representation} pairs Return type: Dict[str, np.ndarray]
-
-
class
pepper.framework.sensor.face.
OpenFace
[source]¶ Bases:
object
Perform Face Recognition Using OpenFace
This requires a Docker Image of
`bamos/openface`
and Docker Running, see The Installation Guide- If not yet running, this class will:
- run the bamos/openface container
- copy /util/_openface.py to it
- run the server included within the container
It will then connect a client to this server to request face representations via a socket connection.
-
DOCKER_IMAGE
= 'bamos/openface'¶
-
DOCKER_NAME
= 'openface'¶
-
DOCKER_WORKING_DIRECTORY
= '/root/openface'¶
-
FEATURE_DIM
= 128¶
-
HOST
= '127.0.0.1'¶
-
PORT
= 8989¶
-
SCRIPT_NAME
= '_openface.py'¶
-
SCRIPT_PATH
= 'C:\\Users\\Pepper\\Documents\\Pepper\\pepper\\pepper\\framework\\sensor\\util\\_openface.py'¶