Projects.FaceRecognition package

Submodules

Projects.FaceRecognition.FaceRecognition module

class Projects.FaceRecognition.FaceRecognition.FaceRecognition(config: dict, do_extraction: bool = False, do_recognition: bool = False)[source]

Bases: object

Perform face recognition on images.

domain

Name of the group of people to recognize.

Type:

str

unknown_label

Name to set when a face is not recognized.

Type:

str

Initialize the models.

Parameters:
  • config (dict) – Configuration dict.

  • do_extraction (bool) – Enable the prediction of features. Defaults to False.

  • do_recognition (bool) – Enable the recognition of features. Defaults to False.

property do_extraction: bool
property do_recognition: bool
load_dataset(path: Path)[source]

Load the dataset features from a pickle file.

Parameters:

path (Path) – Path to the dataset .pkl file.

predict(image: Image) List[Face][source]

Extract features from an image, but do not recognize it.

Parameters:

image (toolbox.Structures.Image) – An Image object.

Returns:

A list of Face objects.

Return type:

List[DataModels.Face]

recognize(face: Face) Face[source]

Recognize the features of a Face data model.

Parameters:

face (DataModels.Face) – A Face data model object.

Returns:

A copy of the Face data model with the

recognition data updated.

Return type:

DataModels.Face

register_features(face: Face, name: str)[source]

Register the features of a Face data model to the given name.

Parameters:
  • face (DataModels.Face) – A Face object with the predicted features.

  • name (str) – The name to which assign the given features.

save_dataset(path: Path)[source]

Save the current face features dataset to a file.

Parameters:

path (Path) – Output pickle file path, ending in “.pkl”.

update_face(image: Image, face: Face) Face[source]

Extract and update the features attributes of a Face data model.

Parameters:
  • image (toolbox.Structures.Image) – An Image object.

  • face (DataModels.Face) – A DataModels.Face object.

Returns:

The same Face data model with the features

attributes updated.

Return type:

DataModels.Face

Projects.FaceRecognition.api module

class Projects.FaceRecognition.api.FaceRecognitionApi[source]

Bases: ApiBase

Initialize the API.

Parameters:

base_dm (Optional[Type, optional) – Data model class that will be sent. Defaults to None.

TITLE = 'Face Recognition API'
Projects.FaceRecognition.api.main()[source]

Projects.FaceRecognition.dataset_creator module

Projects.FaceRecognition.dataset_creator.main(config_path: Path, image_path: Path, dataset_path: Path | None, output_path: Path)[source]
Projects.FaceRecognition.dataset_creator.parse_args() Namespace[source]

Projects.FaceRecognition.demo module

class Projects.FaceRecognition.demo.Demo[source]

Bases: DemoBase

Initialize the demo.

Projects.FaceRecognition.demo.main()[source]

Module contents