Data Preprocessing

Preprocessing steps include facial alignment and name normalization using Wikipedia.

src.preprocessing.facial_preprocessing.face_alignment(img, shape, keypoints, blank=0.3, show=False)[source]

Aligns an image according to keypoints.

Parameters
  • img (cv2 Image) – The original image.

  • shape (tuple) – Tuple of two floats that show the target image shape.

  • keypoints (dict) – The coordinates of the detected face. (left_eye, right_eye, mouth_left, mouth_right).

  • blank (float) – Scaling Parameter.

  • show (bool) – Whether the aligned Image should be displayed or not.

Returns

Aligned Image

Return type

img_pixels (cv2 Image)

src.preprocessing.file_preprocessing.name_norm(name_list)[source]

Normalize name based on Wikipedia search.

Parameters

name_list (list) – List of names to be normalized.

Returns

List of normalized names.

Return type

wiki_name (list)

src.preprocessing.file_preprocessing.norm(name, j)[source]

Looks up the Wikipedia name for a dataset name.

Parameters
  • name (str) – The name to normalize.

  • j (int) – Helper variable to identify the origin process.

Returns

Normalized name. j (int): Helper variable to identify the origin process. Number (int): 1 if the lookup succeeded, 0 otherwise.

Return type

name (str)