зеркало из
https://github.com/ssciwr/AMMICO.git
synced 2025-10-29 13:06:04 +02:00
check threshold for emotion and race lies in btw 0 and 100 (#175)
* check threshold for emotion and race liezs in btw 0 and 100 * Update release.yml * correct order of calling args in test display
Этот коммит содержится в:
родитель
721bc98f7a
Коммит
f128fa4754
7
.github/workflows/release.yml
поставляемый
7
.github/workflows/release.yml
поставляемый
@ -1,9 +1,8 @@
|
|||||||
name: release to pypi
|
name: release to pypi
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
release:
|
||||||
branches:
|
types: [published]
|
||||||
- main
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@ -116,4 +115,4 @@ jobs:
|
|||||||
uses: pypa/gh-action-pypi-publish@release/v1
|
uses: pypa/gh-action-pypi-publish@release/v1
|
||||||
with:
|
with:
|
||||||
repository-url: https://test.pypi.org/legacy/
|
repository-url: https://test.pypi.org/legacy/
|
||||||
|
|
||||||
|
|||||||
@ -97,6 +97,11 @@ class EmotionDetector(AnalysisMethod):
|
|||||||
"""
|
"""
|
||||||
super().__init__(subdict)
|
super().__init__(subdict)
|
||||||
self.subdict.update(self.set_keys())
|
self.subdict.update(self.set_keys())
|
||||||
|
# check if thresholds are valid
|
||||||
|
if emotion_threshold < 0 or emotion_threshold > 100:
|
||||||
|
raise ValueError("Emotion threshold must be between 0 and 100.")
|
||||||
|
if race_threshold < 0 or race_threshold > 100:
|
||||||
|
raise ValueError("Race threshold must be between 0 and 100.")
|
||||||
self.emotion_threshold = emotion_threshold
|
self.emotion_threshold = emotion_threshold
|
||||||
self.race_threshold = race_threshold
|
self.race_threshold = race_threshold
|
||||||
self.emotion_categories = {
|
self.emotion_categories = {
|
||||||
|
|||||||
@ -49,9 +49,9 @@ def test_right_output_analysis_emotions(get_AE, get_options):
|
|||||||
get_options[0],
|
get_options[0],
|
||||||
"EmotionDetector",
|
"EmotionDetector",
|
||||||
True,
|
True,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
50,
|
50,
|
||||||
None,
|
|
||||||
None,
|
|
||||||
50,
|
50,
|
||||||
"CIE 1976",
|
"CIE 1976",
|
||||||
"summary_and_questions",
|
"summary_and_questions",
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import ammico.faces as fc
|
import ammico.faces as fc
|
||||||
import json
|
import json
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
def test_set_keys():
|
def test_set_keys():
|
||||||
@ -8,6 +9,14 @@ def test_set_keys():
|
|||||||
assert ed.subdict["multiple_faces"] == "No"
|
assert ed.subdict["multiple_faces"] == "No"
|
||||||
assert ed.subdict["wears_mask"] == ["No"]
|
assert ed.subdict["wears_mask"] == ["No"]
|
||||||
assert ed.subdict["emotion"] == [None]
|
assert ed.subdict["emotion"] == [None]
|
||||||
|
with pytest.raises(ValueError):
|
||||||
|
fc.EmotionDetector({}, emotion_threshold=150)
|
||||||
|
with pytest.raises(ValueError):
|
||||||
|
fc.EmotionDetector({}, emotion_threshold=-50)
|
||||||
|
with pytest.raises(ValueError):
|
||||||
|
fc.EmotionDetector({}, race_threshold=150)
|
||||||
|
with pytest.raises(ValueError):
|
||||||
|
fc.EmotionDetector({}, race_threshold=-50)
|
||||||
|
|
||||||
|
|
||||||
def test_analyse_faces(get_path):
|
def test_analyse_faces(get_path):
|
||||||
|
|||||||
Загрузка…
x
Ссылка в новой задаче
Block a user