зеркало из
https://github.com/ssciwr/AMMICO.git
synced 2025-10-29 05:04:14 +02:00
update thresholds in notebook and empty actions list (#205)
Этот коммит содержится в:
родитель
b3ba545e4f
Коммит
8db4a399df
@ -268,11 +268,13 @@ class EmotionDetector(AnalysisMethod):
|
|||||||
# one dictionary per face that is detected in the image
|
# one dictionary per face that is detected in the image
|
||||||
# since we are only passing a subregion of the image
|
# since we are only passing a subregion of the image
|
||||||
# that contains one face, the list will only contain one dict
|
# that contains one face, the list will only contain one dict
|
||||||
fresult["result"] = DeepFace.analyze(
|
print("actions are:", self.actions)
|
||||||
img_path=face,
|
if self.actions != []:
|
||||||
actions=self.actions,
|
fresult["result"] = DeepFace.analyze(
|
||||||
silent=True,
|
img_path=face,
|
||||||
)
|
actions=self.actions,
|
||||||
|
silent=True,
|
||||||
|
)
|
||||||
return fresult
|
return fresult
|
||||||
|
|
||||||
def facial_expression_analysis(self) -> dict:
|
def facial_expression_analysis(self) -> dict:
|
||||||
|
|||||||
@ -257,8 +257,17 @@
|
|||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"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",
|
"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",
|
" 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 = ammico.get_dataframe(image_dict)\n",
|
||||||
" image_df.to_csv(dump_file)"
|
" image_df.to_csv(dump_file)"
|
||||||
@ -1411,7 +1420,7 @@
|
|||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.11.5"
|
"version": "3.11.9"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nbformat": 4,
|
"nbformat": 4,
|
||||||
|
|||||||
Загрузка…
x
Ссылка в новой задаче
Block a user