-
Notifications
You must be signed in to change notification settings - Fork 792
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* EFRS-885 Add age/gender recognition as an independent plugin
- Loading branch information
Showing
330 changed files
with
732 additions
and
88,694 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ cached-property==1.5.2 | |
colour==0.1.5 | ||
flasgger==0.9.5 | ||
Flask==1.1.2 | ||
gdown~=3.12 | ||
Werkzeug==1.0.1 | ||
|
||
# tests | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import attr | ||
from typing import Tuple, List, Optional, Dict | ||
|
||
from src.services.dto.bounding_box import BoundingBoxDTO | ||
from src.services.dto.json_encodable import JSONEncodable | ||
from src.services.imgtools.types import Array1D, Array3D | ||
|
||
|
||
class PluginResultDTO(JSONEncodable): | ||
def to_json(self) -> dict: | ||
""" Serialize only public properties """ | ||
return {k: v for k, v in self.__dict__.items() if not k.startswith('_')} | ||
|
||
|
||
@attr.s(auto_attribs=True, frozen=True) | ||
class EmbeddingDTO(PluginResultDTO): | ||
embedding: Array1D | ||
|
||
|
||
@attr.s(auto_attribs=True, frozen=True) | ||
class GenderDTO(PluginResultDTO): | ||
gender: str | ||
gender_probability: float = attr.ib(converter=float, default=None) | ||
|
||
|
||
@attr.s(auto_attribs=True, frozen=True) | ||
class AgeDTO(PluginResultDTO): | ||
age: Tuple[int, int] | ||
age_probability: float = attr.ib(converter=float, default=None) | ||
|
||
|
||
@attr.s(auto_attribs=True) | ||
class FaceDTO(PluginResultDTO): | ||
box: BoundingBoxDTO | ||
_img: Optional[Array3D] | ||
_face_img: Optional[Array3D] | ||
_plugins_dto: List[PluginResultDTO] = attr.Factory(list) | ||
execution_time: Dict[str, float] = attr.Factory(dict) | ||
|
||
def to_json(self): | ||
data = super().to_json() | ||
for plugin_dto in self._plugins_dto: | ||
data.update(plugin_dto.to_json()) | ||
return data | ||
|
||
@property | ||
def embedding(self): | ||
for dto in self._plugins_dto: | ||
if isinstance(dto, EmbeddingDTO): | ||
return dto.embedding |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.