Skip to content

Commit

Permalink
wording changes, install all requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
iulusoy committed Oct 7, 2024
1 parent 19beaaf commit d17d440
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
brew install ffmpeg
brew install openblas
- name: install openblas on linux
if: matrix.os == 'ubuntu-22.04'
if: matrix.os == 'ubuntu-24.04'
run: |
sudo apt-get install libopenblas-dev
- name: Install dependencies
Expand Down
7 changes: 6 additions & 1 deletion FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,10 @@ Some features of ammico require internet access; a general answer to this questi
- Color analysis: The `color` module does not require an internet connection.
## Why don't I get probabilistic assessments of age, gender and race when running the Emotion Detector?
Due to well documented biases in the detection of minorities with computer vision tools, and to the ethical implications of such detection, these parts of the tool are not directly made available to users. To access these capabilities, users must first agree with a ethical disclosure statement that reads: "The Emotion Detector uses RetinaFace to probabilistically assess the gender, age and race of the detected faces. Such assessments may not reflect how the individuals identified by the tool view themselves. Additionally, the classification is carried out in simplistic categories and contains only the most basic classes, for example “male” and “female” for gender. By continuing to use the tool, you certify that you understand the ethical implications such assessments have for the interpretation of the results."
Due to well documented biases in the detection of minorities with computer vision tools, and to the ethical implications of such detection, these parts of the tool are not directly made available to users. To access these capabilities, users must first agree with a ethical disclosure statement that reads:
"DeepFace and RetinaFace provide wrappers to trained models in face recognition and emotion detection. Age, gender and race/ethnicity models were trained on the backbone of VGG-Face with transfer learning.
ETHICAL DISCLOSURE STATEMENT:
The Emotion Detector uses DeepFace and RetinaFace to probabilistically assess the gender, age and race of the detected faces. Such assessments may not reflect how the individuals identify. Additionally, the classification is carried out in simplistic categories and contains only the most basic classes (for example, “male” and “female” for gender, and seven non-overlapping categories for ethnicity). To access these probabilistic assessments, you must therefore agree with the following statement: “I understand the ethical and privacy implications such assessments have for the interpretation of the results and that this analysis may result in personal and possibly sensitive data, and I wish to proceed.”
This disclosure statement is included as a separate line of code early in the flow of the Emotion Detector. Once the user has agreed with the statement, further data analyses will also include these assessments.
28 changes: 16 additions & 12 deletions ammico/faces.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,22 @@ def _processor(fname, action, pooch):
),
)

ETHICAL_STATEMENT = """This analysis uses the DeepFace and RetinaFace libraries.
DeepFace and RetinaFace provide wrappers to trained models in face recognition and
emotion detection. Age, gender and race / ethnicity models were trained
on the backbone of VGG-Face with transfer learning.
ETHICAL DISCLOSURE STATEMENT:
The Emotion Detector uses RetinaFace to probabilistically assess the gender, age and
race of the detected faces. Such assessments may not reflect how the individuals
identify. Additionally, the classification is carried
out in simplistic categories and contains only the most basic classes, for example
“male” and “female” for gender. By continuing to use the tool, you certify that you
understand the ethical implications such assessments have for the interpretation of
the results."""
ETHICAL_STATEMENT = """DeepFace and RetinaFace provide wrappers to trained models in face
recognition and emotion detection. Age, gender and race/ethnicity models were trained on
the backbone of VGG-Face with transfer learning.
ETHICAL DISCLOSURE STATEMENT:
The Emotion Detector uses DeepFace and RetinaFace to probabilistically assess the gender,
age and race of the detected faces. Such assessments may not reflect how the individuals
identify. Additionally, the classification is carried out in simplistic categories and
contains only the most basic classes (for example, "male" and "female" for gender, and seven
non-overlapping categories for ethnicity). To access these probabilistic assessments, you
must therefore agree with the following statement: "I understand the ethical and privacy
implications such assessments have for the interpretation of the results and that this
analysis may result in personal and possibly sensitive data, and I wish to proceed."
Please type your answer in the adjacent box: "YES" for "I agree with the statement" or "NO"
for "I disagree with the statement."
"""


def ethical_disclosure(accept_disclosure: str = "DISCLOSURE_AMMICO"):
Expand Down
3 changes: 2 additions & 1 deletion ammico/notebooks/DemoNotebook_ammico.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
"metadata": {},
"source": [
"## Use a test dataset\n",
"You can download a dataset for test purposes. Skip this step if you use your own data."
"\n",
"You can download this dataset for test purposes. Skip this step if you use your own data. If the data set on Hugging Face is gated or private, Hugging Face will ask you for a login token. However, for the default dataset in this notebook you do not need to provide one."
]
},
{
Expand Down
16 changes: 7 additions & 9 deletions ammico/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,13 @@
from bertopic import BERTopic
from transformers import pipeline

PRIVACY_STATEMENT = """PRIVACY STATEMENT: The Text Detector uses Google Services
for text extraction and translation, and requires a Google Cloud Vision API Key
to work. Instructions about how to get such a key are provided here:
https://ssciwr.github.io/AMMICO/build/html/notebooks/DemoNotebook_
ammico.html#Step-0:-Create-and-set-a-Google-Cloud-Vision-Key.
Google's privacy policy can be read here:
https://policies.google.com/privacy. By continuing to use this Detector,
you agree to send the data you want analyzed to the Google servers for
extraction and translation. """
PRIVACY_STATEMENT = """The Text Detector uses Google Cloud Vision
and Google Translate. Detailed information about how information
is being processed is provided here:
https://ssciwr.github.io/AMMICO/build/html/readme_link.html#faq.
Google’s privacy policy can be read here: https://policies.google.com/privacy.
By continuing to use this Detector, you agree to send the data you want analyzed
to the Google servers for extraction and translation."""


def privacy_disclosure(accept_privacy: str = "PRIVACY_AMMICO"):
Expand Down
8 changes: 7 additions & 1 deletion docs/source/notebooks/DemoNotebook_ammico.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,15 @@
"metadata": {},
"source": [
"## Use a test dataset\n",
"You can download a dataset for test purposes. Skip this step if you use your own data."
"\n",
"You can download this dataset for test purposes. Skip this step if you use your own data. If the data set on Hugging Face is gated or private, Hugging Face will ask you for a login token. However, for the default dataset in this notebook you do not need to provide one."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
},
{
"cell_type": "code",
"execution_count": null,
Expand Down
23 changes: 23 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,41 @@ classifiers = [
]

dependencies = [
"bertopic<=0.14.1",
"dash>=2.11.0",
"datasets",
"deepface<=0.0.92",
"googletrans==4.0.0rc1",
"google-cloud-vision",
"grpcio",
"importlib_metadata",
"importlib_resources",
"ipython",
"jupyter",
"jupyter_dash",
"matplotlib",
"numpy<=1.23.4",
"pandas",
"Pillow",
"pooch",
"protobuf",
"pytest",
"pytest-cov",
"Requests",
"retina_face",
"ammico-lavis>=1.0.2.3",
"setuptools",
"spacy",
"tensorflow>=2.13.0",
"torch<2.4.0",
"transformers",
"google-cloud-vision",
"dash_bootstrap_components",
"colorgram.py",
"webcolors>1.13",
"colour-science",
"scikit-learn>1.3.0",
"tqdm"
]

[project.scripts]
Expand Down

0 comments on commit d17d440

Please sign in to comment.