Skip to content

Commit

Permalink
Add vggface2 to extraction pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
torzdf committed Oct 10, 2022
1 parent 1f31af2 commit f1e3339
Show file tree
Hide file tree
Showing 16 changed files with 705 additions and 343 deletions.
6 changes: 3 additions & 3 deletions lib/align/detected_face.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def __init__(self,
self.top = top
self.height = height
self._landmarks_xy = landmarks_xy
self._identity: Dict[Literal["vggface2"], np.ndarray] = {}
self._identity: Dict[str, np.ndarray] = {}
self.thumbnail: Optional[np.ndarray] = None
self.mask = {} if mask is None else mask
self._training_masks: Optional[Tuple[bytes, Tuple[int, int, int]]] = None
Expand Down Expand Up @@ -137,7 +137,7 @@ def bottom(self) -> int:
return self.top + self.height

@property
def identity(self) -> Dict[Literal["vggface2"], np.ndarray]:
def identity(self) -> Dict[str, np.ndarray]:
""" dict: Identity mechanism as key, identity embedding as value. """
return self._identity

Expand Down Expand Up @@ -191,7 +191,7 @@ def add_landmarks_xy(self, landmarks: np.ndarray) -> None:
logger.trace("landmarks shape: '%s'", landmarks.shape) # type: ignore
self._landmarks_xy = landmarks

def add_identity(self, name: Literal["vggface2"], embedding: np.ndarray, ) -> None:
def add_identity(self, name: str, embedding: np.ndarray, ) -> None:
""" Add an identity embedding to this detected face. If an identity already exists for the
given :attr:`name` it will be overwritten
Expand Down
7 changes: 7 additions & 0 deletions lib/cli/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,13 @@ def get_optional_arguments() -> List[Dict[str, Any]]:
"more faces at the cost of extraction speed. Pass in a single number to use "
"increments of that size up to 360, or pass in a list of numbers to enumerate "
"exactly what angles to check.")))
argument_list.append(dict(
opts=("-I", "--identity"),
action="store_true",
default=False,
group=_("Plugins"),
help=_("Obtain and store face identity encodings from VGGFace2. Slows down extract a "
"little, but will save time if using 'sort by face'")))
argument_list.append(dict(
opts=("-min", "--min-size"),
action=Slider,
Expand Down
Binary file modified locales/es/LC_MESSAGES/lib.cli.args.mo
Binary file not shown.

0 comments on commit f1e3339

Please sign in to comment.