diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 90486eee..f48823b7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/FAQ.md b/FAQ.md index c58377fe..caffea1c 100644 --- a/FAQ.md +++ b/FAQ.md @@ -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. diff --git a/ammico/faces.py b/ammico/faces.py index d6990c10..d731c2a0 100644 --- a/ammico/faces.py +++ b/ammico/faces.py @@ -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"): diff --git a/ammico/notebooks/DemoNotebook_ammico.ipynb b/ammico/notebooks/DemoNotebook_ammico.ipynb index 90087f44..1c6a8589 100644 --- a/ammico/notebooks/DemoNotebook_ammico.ipynb +++ b/ammico/notebooks/DemoNotebook_ammico.ipynb @@ -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." ] }, { diff --git a/ammico/text.py b/ammico/text.py index 139f245b..7481c462 100644 --- a/ammico/text.py +++ b/ammico/text.py @@ -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"): diff --git a/docs/source/notebooks/DemoNotebook_ammico.ipynb b/docs/source/notebooks/DemoNotebook_ammico.ipynb index e5cdc4b8..90c3f8aa 100644 --- a/docs/source/notebooks/DemoNotebook_ammico.ipynb +++ b/docs/source/notebooks/DemoNotebook_ammico.ipynb @@ -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, diff --git a/pyproject.toml b/pyproject.toml index f69a9c79..138f967e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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]