зеркало из
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
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
release:
|
||||
types: [published]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
@ -116,4 +115,4 @@ jobs:
|
||||
uses: pypa/gh-action-pypi-publish@release/v1
|
||||
with:
|
||||
repository-url: https://test.pypi.org/legacy/
|
||||
|
||||
|
||||
|
||||
@ -97,6 +97,11 @@ class EmotionDetector(AnalysisMethod):
|
||||
"""
|
||||
super().__init__(subdict)
|
||||
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.race_threshold = race_threshold
|
||||
self.emotion_categories = {
|
||||
|
||||
@ -49,9 +49,9 @@ def test_right_output_analysis_emotions(get_AE, get_options):
|
||||
get_options[0],
|
||||
"EmotionDetector",
|
||||
True,
|
||||
None,
|
||||
None,
|
||||
50,
|
||||
None,
|
||||
None,
|
||||
50,
|
||||
"CIE 1976",
|
||||
"summary_and_questions",
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import ammico.faces as fc
|
||||
import json
|
||||
import pytest
|
||||
|
||||
|
||||
def test_set_keys():
|
||||
@ -8,6 +9,14 @@ def test_set_keys():
|
||||
assert ed.subdict["multiple_faces"] == "No"
|
||||
assert ed.subdict["wears_mask"] == ["No"]
|
||||
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):
|
||||
|
||||
Загрузка…
x
Ссылка в новой задаче
Block a user