зеркало из
https://github.com/ssciwr/AMMICO.git
synced 2025-10-29 13:06:04 +02:00
fix: update function calls, remove obsolete stuff
Этот коммит содержится в:
родитель
1f2642f1b4
Коммит
a832142c44
@ -275,7 +275,6 @@ 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
|
||||
print("actions are:", self.actions)
|
||||
if self.actions != []:
|
||||
fresult["result"] = DeepFace.analyze(
|
||||
img_path=face,
|
||||
|
||||
@ -276,8 +276,7 @@
|
||||
"# dump file name\n",
|
||||
"dump_file = \"dump_file.csv\"\n",
|
||||
"# dump every N images\n",
|
||||
"dump_every = 10\n",
|
||||
"print(len(image_dict))"
|
||||
"dump_every = 10"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -395,8 +394,15 @@
|
||||
"model = ammico.MultimodalSummaryModel()\n",
|
||||
"image_summary_detector = ammico.ImageSummaryDetector(\n",
|
||||
" subdict=image_dict, summary_model=model\n",
|
||||
")\n",
|
||||
"\n",
|
||||
")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"for num, key in tqdm(\n",
|
||||
" enumerate(image_dict.keys()), total=len(image_dict)\n",
|
||||
"): # loop through all images\n",
|
||||
@ -470,7 +476,7 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"image_df.to_csv(\"/content/drive/MyDrive/misinformation-data/data_out.csv\")"
|
||||
"image_df.to_csv(\"data_out.csv\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -489,7 +495,7 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"ta = ammico.TextAnalyzer(csv_path=\"../data/ref/test.csv\", column_key=\"text\")"
|
||||
"ta = ammico.TextAnalyzer(csv_path=\"test.csv\", column_key=\"text\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -589,7 +595,7 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# os.environ[\"GOOGLE_APPLICATION_CREDENTIALS\"] = \"/content/drive/MyDrive/misinformation-data/misinformation-campaign-981aa55a3b13.json\"\n"
|
||||
"# os.environ[\"GOOGLE_APPLICATION_CREDENTIALS\"] = \"<path_to_your_service_account_key>.json\"\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -612,13 +618,6 @@
|
||||
"): # loop through all images\n",
|
||||
" image_dict[key] = ammico.TextDetector(\n",
|
||||
" image_dict[key], # analyse image with TextDetector and update dict\n",
|
||||
" analyse_text=True,\n",
|
||||
" model_names=[\n",
|
||||
" \"sshleifer/distilbart-cnn-12-6\",\n",
|
||||
" \"distilbert-base-uncased-finetuned-sst-2-english\",\n",
|
||||
" \"dbmdz/bert-large-cased-finetuned-conll03-english\",\n",
|
||||
" ],\n",
|
||||
" revision_numbers=[\"a4f8f3e\", \"af0f99b\", \"f2482bf\"],\n",
|
||||
" ).analyse_image()\n",
|
||||
"\n",
|
||||
" if (\n",
|
||||
@ -636,7 +635,7 @@
|
||||
"source": [
|
||||
"# write output to csv\n",
|
||||
"image_df = ammico.get_dataframe(image_dict)\n",
|
||||
"image_df.to_csv(\"/content/drive/MyDrive/misinformation-data/data_out.csv\")"
|
||||
"image_df.to_csv(\"data_out.csv\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -1035,7 +1034,7 @@
|
||||
"source": [
|
||||
"# write output to csv\n",
|
||||
"image_df = ammico.get_dataframe(image_dict)\n",
|
||||
"image_df.to_csv(\"/content/drive/MyDrive/misinformation-data/data_out.csv\")"
|
||||
"image_df.to_csv(\"data_out.csv\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -1445,24 +1444,6 @@
|
||||
"The output are N primary colors and their corresponding percentage."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"To check the analysis, you can inspect the analyzed elements here. Loading the results takes a moment, so please be patient. If you are sure of what you are doing, you can skip this and directly export a csv file in the step below.\n",
|
||||
"Here, we display the color detection results provided by `colorgram` and `colour` libraries. Click on the tabs to see the results in the right sidebar. You may need to increment the `port` number if you are already running several notebook instances on the same server."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"analysis_explorer = ammico.AnalysisExplorer(image_dict)\n",
|
||||
"analysis_explorer.run_server(port=8057)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
@ -1525,7 +1506,7 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"df.to_csv(\"/content/drive/MyDrive/misinformation-data/data_out.csv\")"
|
||||
"df.to_csv(\"data_out.csv\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -1533,7 +1514,7 @@
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Further detector modules\n",
|
||||
"Further detector modules exist, also it is possible to carry out a topic analysis on the text data, as well as crop social media posts automatically. These are more experimental features and have their own demonstration notebooks."
|
||||
"Please get in touch or open an issue, if you would like to propose further detector modules."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
Загрузка…
x
Ссылка в новой задаче
Block a user