-
Notifications
You must be signed in to change notification settings - Fork 775
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EFSR-885 gender age plugins #281
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
f1e5aee
EFRS-885 Add age/gender recognition as an independent plugin
z268 0a6aa79
EFRS-885 Import improvements
z268 3d81d75
EFRS-885 Fix misprint and env variables
z268 7904f29
EFRS-885 Update links to ML models
z268 d3a40f7
EFRS-885 Remove rude-carnie age/gender detection
z268 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this swagger file? Then I don't see descriptions of gender and age plugins
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's just a fix of wrong name. Swagger description updated in PR #302