update thresholds in notebook and empty actions list (#205)

Этот коммит содержится в:
Inga Ulusoy 2024-06-17 12:56:47 +02:00 коммит произвёл GitHub
родитель b3ba545e4f
Коммит 8db4a399df
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
2 изменённых файлов: 18 добавлений и 7 удалений

Просмотреть файл

@ -268,11 +268,13 @@ class EmotionDetector(AnalysisMethod):
# one dictionary per face that is detected in the image
# since we are only passing a subregion of the image
# that contains one face, the list will only contain one dict
fresult["result"] = DeepFace.analyze(
img_path=face,
actions=self.actions,
silent=True,
)
print("actions are:", self.actions)
if self.actions != []:
fresult["result"] = DeepFace.analyze(
img_path=face,
actions=self.actions,
silent=True,
)
return fresult
def facial_expression_analysis(self) -> dict:

Просмотреть файл

@ -257,8 +257,17 @@
"metadata": {},
"outputs": [],
"source": [
"# set the thresholds for the emotion detection\n",
"emotion_threshold = 50 # this is the default value for the detection confidence\n",
"# the lowest possible value is 0\n",
"# the highest possible value is 100\n",
"race_threshold = 50\n",
"gender_threshold = 50\n",
"for num, key in tqdm(enumerate(image_dict.keys()), total=len(image_dict)): # loop through all images\n",
" image_dict[key] = ammico.EmotionDetector(image_dict[key]).analyse_image() # analyse image with EmotionDetector and update dict\n",
" image_dict[key] = ammico.EmotionDetector(image_dict[key],\n",
" emotion_threshold=emotion_threshold,\n",
" race_threshold=race_threshold,\n",
" gender_threshold=gender_threshold).analyse_image() # analyse image with EmotionDetector and update dict\n",
" if num % dump_every == 0 or num == len(image_dict) - 1: # save results every dump_every to dump_file\n",
" image_df = ammico.get_dataframe(image_dict)\n",
" image_df.to_csv(dump_file)"
@ -1411,7 +1420,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.5"
"version": "3.11.9"
}
},
"nbformat": 4,