зеркало из
				https://github.com/ssciwr/AMMICO.git
				synced 2025-10-31 22:16:05 +02:00 
			
		
		
		
	
		
			
				
	
	
		
			2375 строки
		
	
	
		
			55 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			2375 строки
		
	
	
		
			55 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| {
 | |
|  "cells": [
 | |
|   {
 | |
|    "attachments": {},
 | |
|    "cell_type": "markdown",
 | |
|    "metadata": {},
 | |
|    "source": [
 | |
|     "# Image summary and visual question answering"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "attachments": {},
 | |
|    "cell_type": "markdown",
 | |
|    "metadata": {},
 | |
|    "source": [
 | |
|     "This notebooks shows how to generate image captions and use the visual question answering with [LAVIS](https://github.com/salesforce/LAVIS). \n",
 | |
|     "\n",
 | |
|     "The first cell is only run on google colab and installs the [ammico](https://github.com/ssciwr/AMMICO) package.\n",
 | |
|     "\n",
 | |
|     "After that, we can import `ammico` and read in the files given a folder path."
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "cell_type": "code",
 | |
|    "execution_count": 1,
 | |
|    "metadata": {
 | |
|     "execution": {
 | |
|      "iopub.execute_input": "2023-06-14T17:57:40.471566Z",
 | |
|      "iopub.status.busy": "2023-06-14T17:57:40.470552Z",
 | |
|      "iopub.status.idle": "2023-06-14T17:57:40.479784Z",
 | |
|      "shell.execute_reply": "2023-06-14T17:57:40.479228Z"
 | |
|     }
 | |
|    },
 | |
|    "outputs": [],
 | |
|    "source": [
 | |
|     "# if running on google colab\n",
 | |
|     "# flake8-noqa-cell\n",
 | |
|     "import os\n",
 | |
|     "\n",
 | |
|     "if \"google.colab\" in str(get_ipython()):\n",
 | |
|     "    # update python version\n",
 | |
|     "    # install setuptools\n",
 | |
|     "    # %pip install setuptools==61 -qqq\n",
 | |
|     "    # install ammico\n",
 | |
|     "    %pip install git+https://github.com/ssciwr/ammico.git -qqq\n",
 | |
|     "    # mount google drive for data and API key\n",
 | |
|     "    from google.colab import drive\n",
 | |
|     "\n",
 | |
|     "    drive.mount(\"/content/drive\")"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "cell_type": "code",
 | |
|    "execution_count": 2,
 | |
|    "metadata": {
 | |
|     "execution": {
 | |
|      "iopub.execute_input": "2023-06-14T17:57:40.482843Z",
 | |
|      "iopub.status.busy": "2023-06-14T17:57:40.482198Z",
 | |
|      "iopub.status.idle": "2023-06-14T17:57:51.419141Z",
 | |
|      "shell.execute_reply": "2023-06-14T17:57:51.418473Z"
 | |
|     },
 | |
|     "tags": []
 | |
|    },
 | |
|    "outputs": [],
 | |
|    "source": [
 | |
|     "import ammico\n",
 | |
|     "from ammico import utils as mutils\n",
 | |
|     "from ammico import display as mdisplay\n",
 | |
|     "import ammico.summary as sm"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "cell_type": "code",
 | |
|    "execution_count": 3,
 | |
|    "metadata": {
 | |
|     "execution": {
 | |
|      "iopub.execute_input": "2023-06-14T17:57:51.422490Z",
 | |
|      "iopub.status.busy": "2023-06-14T17:57:51.421852Z",
 | |
|      "iopub.status.idle": "2023-06-14T17:57:51.426521Z",
 | |
|      "shell.execute_reply": "2023-06-14T17:57:51.425961Z"
 | |
|     },
 | |
|     "tags": []
 | |
|    },
 | |
|    "outputs": [],
 | |
|    "source": [
 | |
|     "# Here you need to provide the path to your google drive folder\n",
 | |
|     "# or local folder containing the images\n",
 | |
|     "images = mutils.find_files(\n",
 | |
|     "    path=\"data/\",\n",
 | |
|     "    limit=10,\n",
 | |
|     ")"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "cell_type": "code",
 | |
|    "execution_count": 4,
 | |
|    "metadata": {
 | |
|     "execution": {
 | |
|      "iopub.execute_input": "2023-06-14T17:57:51.429189Z",
 | |
|      "iopub.status.busy": "2023-06-14T17:57:51.428852Z",
 | |
|      "iopub.status.idle": "2023-06-14T17:57:51.432029Z",
 | |
|      "shell.execute_reply": "2023-06-14T17:57:51.431394Z"
 | |
|     },
 | |
|     "tags": []
 | |
|    },
 | |
|    "outputs": [],
 | |
|    "source": [
 | |
|     "mydict = mutils.initialize_dict(images)"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "attachments": {},
 | |
|    "cell_type": "markdown",
 | |
|    "metadata": {},
 | |
|    "source": [
 | |
|     "## Create captions for images and directly write to csv"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "attachments": {},
 | |
|    "cell_type": "markdown",
 | |
|    "metadata": {},
 | |
|    "source": [
 | |
|     "Here you can choose between two models: \"base\" or \"large\". This will generate the caption for each image and directly put the results in a dataframe. This dataframe can be exported as a csv file.\n",
 | |
|     "\n",
 | |
|     "The results are written into the columns `const_image_summary` - this will always be the same result (as always the same seed will be used). The column `3_non-deterministic summary` displays three different answers generated with different seeds, these are most likely different when you run the analysis again."
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "cell_type": "code",
 | |
|    "execution_count": 5,
 | |
|    "metadata": {
 | |
|     "execution": {
 | |
|      "iopub.execute_input": "2023-06-14T17:57:51.435313Z",
 | |
|      "iopub.status.busy": "2023-06-14T17:57:51.434728Z",
 | |
|      "iopub.status.idle": "2023-06-14T17:58:19.346682Z",
 | |
|      "shell.execute_reply": "2023-06-14T17:58:19.345925Z"
 | |
|     },
 | |
|     "tags": []
 | |
|    },
 | |
|    "outputs": [
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  0%|          | 0.00/2.50G [00:00<?, ?B/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  0%|          | 6.99M/2.50G [00:00<00:36, 73.2MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  1%|          | 15.3M/2.50G [00:00<00:32, 81.2MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  1%|          | 23.0M/2.50G [00:00<00:33, 79.3MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  1%|          | 30.9M/2.50G [00:00<00:32, 80.7MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  2%|▏         | 40.0M/2.50G [00:00<00:32, 82.4MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  2%|▏         | 48.0M/2.50G [00:00<00:33, 78.7MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  2%|▏         | 56.0M/2.50G [00:00<00:33, 78.2MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  3%|▎         | 72.0M/2.50G [00:00<00:29, 89.6MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  3%|▎         | 85.5M/2.50G [00:00<00:25, 104MB/s] "
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  4%|▎         | 95.5M/2.50G [00:01<00:25, 100MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  4%|▍         | 105M/2.50G [00:01<00:37, 69.6MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  5%|▍         | 120M/2.50G [00:01<00:29, 86.3MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  5%|▌         | 136M/2.50G [00:01<00:24, 104MB/s] "
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  6%|▌         | 152M/2.50G [00:01<00:22, 114MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  7%|▋         | 170M/2.50G [00:01<00:19, 132MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  7%|▋         | 184M/2.50G [00:01<00:18, 136MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  8%|▊         | 202M/2.50G [00:02<00:16, 150MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  9%|▊         | 224M/2.50G [00:02<00:14, 171MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  9%|▉         | 241M/2.50G [00:02<00:15, 161MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 10%|█         | 257M/2.50G [00:02<00:14, 163MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 11%|█         | 273M/2.50G [00:02<00:16, 150MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 11%|█         | 287M/2.50G [00:02<00:16, 141MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 12%|█▏        | 301M/2.50G [00:02<00:17, 132MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 13%|█▎        | 322M/2.50G [00:02<00:15, 154MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 13%|█▎        | 337M/2.50G [00:02<00:15, 146MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 14%|█▍        | 359M/2.50G [00:03<00:13, 168MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 15%|█▍        | 376M/2.50G [00:03<00:14, 158MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 16%|█▌        | 398M/2.50G [00:03<00:12, 178MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 16%|█▋        | 417M/2.50G [00:03<00:12, 183MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 17%|█▋        | 438M/2.50G [00:03<00:11, 195MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 18%|█▊        | 457M/2.50G [00:03<00:12, 174MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 19%|█▊        | 479M/2.50G [00:03<00:11, 189MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 20%|█▉        | 501M/2.50G [00:03<00:10, 199MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 20%|██        | 521M/2.50G [00:03<00:10, 204MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 21%|██        | 543M/2.50G [00:04<00:10, 211MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 22%|██▏       | 563M/2.50G [00:04<00:10, 204MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 23%|██▎       | 584M/2.50G [00:04<00:09, 208MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 24%|██▎       | 606M/2.50G [00:04<00:09, 215MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 24%|██▍       | 628M/2.50G [00:04<00:09, 218MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 25%|██▌       | 648M/2.50G [00:04<00:09, 215MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 26%|██▌       | 670M/2.50G [00:04<00:09, 219MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 27%|██▋       | 691M/2.50G [00:04<00:09, 212MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 28%|██▊       | 713M/2.50G [00:04<00:08, 217MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 29%|██▊       | 735M/2.50G [00:04<00:08, 221MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 30%|██▉       | 757M/2.50G [00:05<00:08, 223MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 30%|███       | 778M/2.50G [00:05<00:10, 186MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 31%|███       | 800M/2.50G [00:05<00:09, 197MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 32%|███▏      | 822M/2.50G [00:05<00:08, 205MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 33%|███▎      | 843M/2.50G [00:05<00:08, 211MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 34%|███▍      | 865M/2.50G [00:05<00:08, 217MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 35%|███▍      | 886M/2.50G [00:05<00:09, 195MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 35%|███▌      | 906M/2.50G [00:05<00:10, 169MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 36%|███▌      | 923M/2.50G [00:06<00:10, 171MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 37%|███▋      | 944M/2.50G [00:06<00:09, 184MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 38%|███▊      | 965M/2.50G [00:06<00:08, 195MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 38%|███▊      | 987M/2.50G [00:06<00:08, 204MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 39%|███▉      | 0.98G/2.50G [00:06<00:07, 210MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 40%|████      | 1.01G/2.50G [00:06<00:07, 213MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 41%|████      | 1.03G/2.50G [00:06<00:07, 217MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 42%|████▏     | 1.05G/2.50G [00:06<00:07, 217MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 43%|████▎     | 1.07G/2.50G [00:06<00:06, 222MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 44%|████▎     | 1.09G/2.50G [00:06<00:06, 224MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 44%|████▍     | 1.11G/2.50G [00:07<00:06, 219MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 45%|████▌     | 1.13G/2.50G [00:07<00:06, 213MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 46%|████▌     | 1.15G/2.50G [00:07<00:06, 218MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 47%|████▋     | 1.17G/2.50G [00:07<00:06, 217MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 48%|████▊     | 1.19G/2.50G [00:07<00:06, 218MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 49%|████▊     | 1.21G/2.50G [00:07<00:06, 220MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 49%|████▉     | 1.24G/2.50G [00:07<00:06, 224MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 50%|█████     | 1.26G/2.50G [00:07<00:05, 226MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 51%|█████     | 1.28G/2.50G [00:07<00:05, 227MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 52%|█████▏    | 1.30G/2.50G [00:07<00:05, 227MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 53%|█████▎    | 1.32G/2.50G [00:08<00:05, 215MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 54%|█████▎    | 1.34G/2.50G [00:08<00:05, 217MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 54%|█████▍    | 1.36G/2.50G [00:08<00:05, 218MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 55%|█████▌    | 1.38G/2.50G [00:08<00:05, 221MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 56%|█████▌    | 1.40G/2.50G [00:08<00:05, 221MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 57%|█████▋    | 1.43G/2.50G [00:08<00:05, 221MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 58%|█████▊    | 1.45G/2.50G [00:08<00:05, 222MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 59%|█████▊    | 1.47G/2.50G [00:08<00:04, 224MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 59%|█████▉    | 1.49G/2.50G [00:09<00:09, 120MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 60%|██████    | 1.51G/2.50G [00:09<00:07, 140MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 61%|██████    | 1.53G/2.50G [00:09<00:06, 157MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 62%|██████▏   | 1.55G/2.50G [00:09<00:05, 173MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 63%|██████▎   | 1.57G/2.50G [00:09<00:06, 162MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 64%|██████▎   | 1.59G/2.50G [00:09<00:05, 178MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 64%|██████▍   | 1.61G/2.50G [00:09<00:05, 177MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 65%|██████▌   | 1.63G/2.50G [00:09<00:05, 174MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 66%|██████▌   | 1.65G/2.50G [00:10<00:07, 116MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 67%|██████▋   | 1.67G/2.50G [00:10<00:06, 137MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 67%|██████▋   | 1.69G/2.50G [00:10<00:05, 155MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 68%|██████▊   | 1.70G/2.50G [00:10<00:06, 131MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 69%|██████▊   | 1.72G/2.50G [00:10<00:06, 135MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 69%|██████▉   | 1.73G/2.50G [00:10<00:06, 128MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 70%|███████   | 1.75G/2.50G [00:10<00:05, 151MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 71%|███████   | 1.77G/2.50G [00:11<00:04, 159MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 72%|███████▏  | 1.79G/2.50G [00:11<00:04, 177MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 72%|███████▏  | 1.81G/2.50G [00:11<00:03, 191MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 73%|███████▎  | 1.83G/2.50G [00:11<00:04, 162MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 74%|███████▍  | 1.85G/2.50G [00:11<00:04, 152MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 75%|███████▍  | 1.87G/2.50G [00:11<00:03, 173MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 76%|███████▌  | 1.89G/2.50G [00:11<00:03, 173MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 76%|███████▋  | 1.91G/2.50G [00:11<00:03, 187MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 77%|███████▋  | 1.93G/2.50G [00:12<00:03, 197MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 78%|███████▊  | 1.95G/2.50G [00:12<00:02, 205MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 79%|███████▉  | 1.97G/2.50G [00:12<00:03, 171MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 80%|███████▉  | 1.99G/2.50G [00:12<00:02, 185MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 80%|████████  | 2.01G/2.50G [00:12<00:02, 194MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 81%|████████▏ | 2.04G/2.50G [00:12<00:02, 203MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 82%|████████▏ | 2.06G/2.50G [00:12<00:02, 210MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 83%|████████▎ | 2.08G/2.50G [00:12<00:02, 213MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 84%|████████▍ | 2.10G/2.50G [00:12<00:01, 217MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 85%|████████▍ | 2.12G/2.50G [00:13<00:04, 95.4MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 85%|████████▌ | 2.13G/2.50G [00:13<00:04, 90.8MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 86%|████████▌ | 2.16G/2.50G [00:13<00:03, 113MB/s] "
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 87%|████████▋ | 2.18G/2.50G [00:13<00:02, 134MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 88%|████████▊ | 2.19G/2.50G [00:14<00:02, 115MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 89%|████████▊ | 2.22G/2.50G [00:14<00:02, 136MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 89%|████████▉ | 2.23G/2.50G [00:15<00:05, 52.2MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 90%|████████▉ | 2.25G/2.50G [00:15<00:03, 68.8MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 91%|█████████ | 2.27G/2.50G [00:15<00:03, 70.6MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 91%|█████████▏| 2.29G/2.50G [00:15<00:02, 91.5MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 92%|█████████▏| 2.30G/2.50G [00:15<00:02, 88.5MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 93%|█████████▎| 2.32G/2.50G [00:15<00:01, 112MB/s] "
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 94%|█████████▎| 2.34G/2.50G [00:15<00:01, 131MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 94%|█████████▍| 2.36G/2.50G [00:16<00:01, 118MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 95%|█████████▍| 2.37G/2.50G [00:16<00:01, 110MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 95%|█████████▌| 2.39G/2.50G [00:16<00:01, 65.3MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 96%|█████████▌| 2.40G/2.50G [00:17<00:02, 46.4MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 97%|█████████▋| 2.42G/2.50G [00:17<00:01, 67.7MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 97%|█████████▋| 2.43G/2.50G [00:17<00:01, 65.4MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 98%|█████████▊| 2.45G/2.50G [00:17<00:00, 85.0MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 98%|█████████▊| 2.47G/2.50G [00:17<00:00, 105MB/s] "
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 99%|█████████▉| 2.48G/2.50G [00:17<00:00, 80.0MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "100%|█████████▉| 2.50G/2.50G [00:18<00:00, 104MB/s] "
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "100%|██████████| 2.50G/2.50G [00:18<00:00, 148MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\n"
 | |
|      ]
 | |
|     }
 | |
|    ],
 | |
|    "source": [
 | |
|     "obj = sm.SummaryDetector(mydict)\n",
 | |
|     "summary_model, summary_vis_processors = obj.load_model(model_type=\"base\")\n",
 | |
|     "# summary_model, summary_vis_processors = mutils.load_model(\"large\")"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "cell_type": "code",
 | |
|    "execution_count": 6,
 | |
|    "metadata": {
 | |
|     "execution": {
 | |
|      "iopub.execute_input": "2023-06-14T17:58:19.351111Z",
 | |
|      "iopub.status.busy": "2023-06-14T17:58:19.350697Z",
 | |
|      "iopub.status.idle": "2023-06-14T17:58:53.233661Z",
 | |
|      "shell.execute_reply": "2023-06-14T17:58:53.233035Z"
 | |
|     },
 | |
|     "tags": []
 | |
|    },
 | |
|    "outputs": [],
 | |
|    "source": [
 | |
|     "for key in mydict:\n",
 | |
|     "    mydict[key] = sm.SummaryDetector(mydict[key]).analyse_image(\n",
 | |
|     "        summary_model=summary_model, summary_vis_processors=summary_vis_processors\n",
 | |
|     "    )"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "attachments": {},
 | |
|    "cell_type": "markdown",
 | |
|    "metadata": {
 | |
|     "tags": []
 | |
|    },
 | |
|    "source": [
 | |
|     "Convert the dictionary of dictionarys into a dictionary with lists:"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "cell_type": "code",
 | |
|    "execution_count": 7,
 | |
|    "metadata": {
 | |
|     "execution": {
 | |
|      "iopub.execute_input": "2023-06-14T17:58:53.237164Z",
 | |
|      "iopub.status.busy": "2023-06-14T17:58:53.236674Z",
 | |
|      "iopub.status.idle": "2023-06-14T17:58:53.240506Z",
 | |
|      "shell.execute_reply": "2023-06-14T17:58:53.239983Z"
 | |
|     },
 | |
|     "tags": []
 | |
|    },
 | |
|    "outputs": [],
 | |
|    "source": [
 | |
|     "outdict = mutils.append_data_to_dict(mydict)\n",
 | |
|     "df = mutils.dump_df(outdict)"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "attachments": {},
 | |
|    "cell_type": "markdown",
 | |
|    "metadata": {},
 | |
|    "source": [
 | |
|     "Check the dataframe:"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "cell_type": "code",
 | |
|    "execution_count": 8,
 | |
|    "metadata": {
 | |
|     "execution": {
 | |
|      "iopub.execute_input": "2023-06-14T17:58:53.243495Z",
 | |
|      "iopub.status.busy": "2023-06-14T17:58:53.242775Z",
 | |
|      "iopub.status.idle": "2023-06-14T17:58:53.255014Z",
 | |
|      "shell.execute_reply": "2023-06-14T17:58:53.254472Z"
 | |
|     },
 | |
|     "tags": []
 | |
|    },
 | |
|    "outputs": [
 | |
|     {
 | |
|      "data": {
 | |
|       "text/html": [
 | |
|        "<div>\n",
 | |
|        "<style scoped>\n",
 | |
|        "    .dataframe tbody tr th:only-of-type {\n",
 | |
|        "        vertical-align: middle;\n",
 | |
|        "    }\n",
 | |
|        "\n",
 | |
|        "    .dataframe tbody tr th {\n",
 | |
|        "        vertical-align: top;\n",
 | |
|        "    }\n",
 | |
|        "\n",
 | |
|        "    .dataframe thead th {\n",
 | |
|        "        text-align: right;\n",
 | |
|        "    }\n",
 | |
|        "</style>\n",
 | |
|        "<table border=\"1\" class=\"dataframe\">\n",
 | |
|        "  <thead>\n",
 | |
|        "    <tr style=\"text-align: right;\">\n",
 | |
|        "      <th></th>\n",
 | |
|        "      <th>filename</th>\n",
 | |
|        "      <th>const_image_summary</th>\n",
 | |
|        "      <th>3_non-deterministic summary</th>\n",
 | |
|        "    </tr>\n",
 | |
|        "  </thead>\n",
 | |
|        "  <tbody>\n",
 | |
|        "    <tr>\n",
 | |
|        "      <th>0</th>\n",
 | |
|        "      <td>data/102730_eng.png</td>\n",
 | |
|        "      <td>two people in blue coats spray disinfection a van</td>\n",
 | |
|        "      <td>[two people with blue robes are spraying water...</td>\n",
 | |
|        "    </tr>\n",
 | |
|        "    <tr>\n",
 | |
|        "      <th>1</th>\n",
 | |
|        "      <td>data/106349S_por.png</td>\n",
 | |
|        "      <td>a man wearing a face mask while looking at a c...</td>\n",
 | |
|        "      <td>[an image of a television screen that has a ma...</td>\n",
 | |
|        "    </tr>\n",
 | |
|        "    <tr>\n",
 | |
|        "      <th>2</th>\n",
 | |
|        "      <td>data/102141_2_eng.png</td>\n",
 | |
|        "      <td>a collage of images including a corona sign, a...</td>\n",
 | |
|        "      <td>[a hand holding an empty tube and another phot...</td>\n",
 | |
|        "    </tr>\n",
 | |
|        "  </tbody>\n",
 | |
|        "</table>\n",
 | |
|        "</div>"
 | |
|       ],
 | |
|       "text/plain": [
 | |
|        "                filename                                const_image_summary  \\\n",
 | |
|        "0    data/102730_eng.png  two people in blue coats spray disinfection a van   \n",
 | |
|        "1   data/106349S_por.png  a man wearing a face mask while looking at a c...   \n",
 | |
|        "2  data/102141_2_eng.png  a collage of images including a corona sign, a...   \n",
 | |
|        "\n",
 | |
|        "                         3_non-deterministic summary  \n",
 | |
|        "0  [two people with blue robes are spraying water...  \n",
 | |
|        "1  [an image of a television screen that has a ma...  \n",
 | |
|        "2  [a hand holding an empty tube and another phot...  "
 | |
|       ]
 | |
|      },
 | |
|      "execution_count": 8,
 | |
|      "metadata": {},
 | |
|      "output_type": "execute_result"
 | |
|     }
 | |
|    ],
 | |
|    "source": [
 | |
|     "df.head(10)"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "attachments": {},
 | |
|    "cell_type": "markdown",
 | |
|    "metadata": {},
 | |
|    "source": [
 | |
|     "Write the csv file:"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "cell_type": "code",
 | |
|    "execution_count": 9,
 | |
|    "metadata": {
 | |
|     "execution": {
 | |
|      "iopub.execute_input": "2023-06-14T17:58:53.257953Z",
 | |
|      "iopub.status.busy": "2023-06-14T17:58:53.257445Z",
 | |
|      "iopub.status.idle": "2023-06-14T17:58:53.262544Z",
 | |
|      "shell.execute_reply": "2023-06-14T17:58:53.262010Z"
 | |
|     }
 | |
|    },
 | |
|    "outputs": [],
 | |
|    "source": [
 | |
|     "df.to_csv(\"data_out.csv\")"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "attachments": {},
 | |
|    "cell_type": "markdown",
 | |
|    "metadata": {},
 | |
|    "source": [
 | |
|     "## Manually inspect the summaries\n",
 | |
|     "\n",
 | |
|     "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.\n",
 | |
|     "\n",
 | |
|     "`const_image_summary` - the permanent summarys, which does not change from run to run (analyse_image).\n",
 | |
|     "\n",
 | |
|     "`3_non-deterministic summary` - 3 different summarys examples that change from run to run (analyse_image). "
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "cell_type": "code",
 | |
|    "execution_count": 10,
 | |
|    "metadata": {
 | |
|     "execution": {
 | |
|      "iopub.execute_input": "2023-06-14T17:58:53.265362Z",
 | |
|      "iopub.status.busy": "2023-06-14T17:58:53.264878Z",
 | |
|      "iopub.status.idle": "2023-06-14T17:58:53.311443Z",
 | |
|      "shell.execute_reply": "2023-06-14T17:58:53.310745Z"
 | |
|     },
 | |
|     "tags": []
 | |
|    },
 | |
|    "outputs": [
 | |
|     {
 | |
|      "name": "stdout",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "Dash is running on http://127.0.0.1:8055/\n",
 | |
|       "\n"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "INFO:dash.dash:Dash is running on http://127.0.0.1:8055/\n",
 | |
|       "\n"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "data": {
 | |
|       "text/html": [
 | |
|        "\n",
 | |
|        "        <iframe\n",
 | |
|        "            width=\"100%\"\n",
 | |
|        "            height=\"650\"\n",
 | |
|        "            src=\"http://127.0.0.1:8055/\"\n",
 | |
|        "            frameborder=\"0\"\n",
 | |
|        "            allowfullscreen\n",
 | |
|        "            \n",
 | |
|        "        ></iframe>\n",
 | |
|        "        "
 | |
|       ],
 | |
|       "text/plain": [
 | |
|        "<IPython.lib.display.IFrame at 0x7fea1c7117f0>"
 | |
|       ]
 | |
|      },
 | |
|      "metadata": {},
 | |
|      "output_type": "display_data"
 | |
|     }
 | |
|    ],
 | |
|    "source": [
 | |
|     "analysis_explorer = mdisplay.AnalysisExplorer(mydict, identify=\"summary\")\n",
 | |
|     "analysis_explorer.run_server(port=8055)"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "attachments": {},
 | |
|    "cell_type": "markdown",
 | |
|    "metadata": {},
 | |
|    "source": [
 | |
|     "## Generate answers to free-form questions about images written in natural language. "
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "attachments": {},
 | |
|    "cell_type": "markdown",
 | |
|    "metadata": {},
 | |
|    "source": [
 | |
|     "Set the list of questions as a list of strings:"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "cell_type": "code",
 | |
|    "execution_count": 11,
 | |
|    "metadata": {
 | |
|     "execution": {
 | |
|      "iopub.execute_input": "2023-06-14T17:58:53.314849Z",
 | |
|      "iopub.status.busy": "2023-06-14T17:58:53.314379Z",
 | |
|      "iopub.status.idle": "2023-06-14T17:58:53.317692Z",
 | |
|      "shell.execute_reply": "2023-06-14T17:58:53.317049Z"
 | |
|     }
 | |
|    },
 | |
|    "outputs": [],
 | |
|    "source": [
 | |
|     "list_of_questions = [\n",
 | |
|     "    \"How many persons on the picture?\",\n",
 | |
|     "    \"Are there any politicians in the picture?\",\n",
 | |
|     "    \"Does the picture show something from medicine?\",\n",
 | |
|     "]"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "attachments": {},
 | |
|    "cell_type": "markdown",
 | |
|    "metadata": {},
 | |
|    "source": [
 | |
|     "Explore the analysis using the interface:"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "cell_type": "code",
 | |
|    "execution_count": 12,
 | |
|    "metadata": {
 | |
|     "execution": {
 | |
|      "iopub.execute_input": "2023-06-14T17:58:53.320760Z",
 | |
|      "iopub.status.busy": "2023-06-14T17:58:53.320175Z",
 | |
|      "iopub.status.idle": "2023-06-14T17:58:53.840610Z",
 | |
|      "shell.execute_reply": "2023-06-14T17:58:53.839967Z"
 | |
|     }
 | |
|    },
 | |
|    "outputs": [
 | |
|     {
 | |
|      "name": "stdout",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "Dash is running on http://127.0.0.1:8055/\n",
 | |
|       "\n"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "INFO:dash.dash:Dash is running on http://127.0.0.1:8055/\n",
 | |
|       "\n"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "data": {
 | |
|       "text/html": [
 | |
|        "\n",
 | |
|        "        <iframe\n",
 | |
|        "            width=\"100%\"\n",
 | |
|        "            height=\"650\"\n",
 | |
|        "            src=\"http://127.0.0.1:8055/\"\n",
 | |
|        "            frameborder=\"0\"\n",
 | |
|        "            allowfullscreen\n",
 | |
|        "            \n",
 | |
|        "        ></iframe>\n",
 | |
|        "        "
 | |
|       ],
 | |
|       "text/plain": [
 | |
|        "<IPython.lib.display.IFrame at 0x7fea1c96ae50>"
 | |
|       ]
 | |
|      },
 | |
|      "metadata": {},
 | |
|      "output_type": "display_data"
 | |
|     }
 | |
|    ],
 | |
|    "source": [
 | |
|     "analysis_explorer = mdisplay.AnalysisExplorer(mydict, identify=\"summary\")\n",
 | |
|     "analysis_explorer.run_server(port=8055)"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "attachments": {},
 | |
|    "cell_type": "markdown",
 | |
|    "metadata": {},
 | |
|    "source": [
 | |
|     "## Or directly analyze for further processing\n",
 | |
|     "Instead of inspecting each of the images, you can also directly carry out the analysis and export the result into a csv. This may take a while depending on how many images you have loaded."
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "cell_type": "code",
 | |
|    "execution_count": 13,
 | |
|    "metadata": {
 | |
|     "execution": {
 | |
|      "iopub.execute_input": "2023-06-14T17:58:53.844313Z",
 | |
|      "iopub.status.busy": "2023-06-14T17:58:53.843678Z",
 | |
|      "iopub.status.idle": "2023-06-14T17:59:41.700852Z",
 | |
|      "shell.execute_reply": "2023-06-14T17:59:41.700142Z"
 | |
|     }
 | |
|    },
 | |
|    "outputs": [
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  0%|          | 0.00/1.35G [00:00<?, ?B/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  0%|          | 4.72M/1.35G [00:00<00:29, 49.5MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  1%|          | 16.0M/1.35G [00:00<00:17, 80.5MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  2%|▏         | 25.2M/1.35G [00:00<00:16, 87.5MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  3%|▎         | 40.0M/1.35G [00:00<00:13, 106MB/s] "
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  4%|▍         | 55.9M/1.35G [00:00<00:10, 126MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  5%|▍         | 68.9M/1.35G [00:00<00:10, 129MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  6%|▌         | 85.7M/1.35G [00:00<00:09, 144MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  7%|▋         | 103M/1.35G [00:00<00:08, 157MB/s] "
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "  9%|▊         | 118M/1.35G [00:00<00:08, 149MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 10%|▉         | 134M/1.35G [00:01<00:08, 153MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 11%|█         | 152M/1.35G [00:01<00:08, 143MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 12%|█▏        | 172M/1.35G [00:01<00:07, 161MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 14%|█▍        | 192M/1.35G [00:01<00:07, 176MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 15%|█▌        | 212M/1.35G [00:01<00:06, 185MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 17%|█▋        | 233M/1.35G [00:01<00:06, 193MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 18%|█▊        | 254M/1.35G [00:01<00:05, 201MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 20%|█▉        | 274M/1.35G [00:01<00:05, 206MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 21%|██▏       | 295M/1.35G [00:01<00:05, 210MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 23%|██▎       | 315M/1.35G [00:02<00:05, 209MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 24%|██▍       | 336M/1.35G [00:02<00:05, 211MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 26%|██▌       | 357M/1.35G [00:02<00:05, 214MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 27%|██▋       | 378M/1.35G [00:02<00:04, 214MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 29%|██▉       | 398M/1.35G [00:02<00:04, 215MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 30%|███       | 419M/1.35G [00:02<00:04, 214MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 32%|███▏      | 439M/1.35G [00:02<00:04, 213MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 33%|███▎      | 460M/1.35G [00:02<00:04, 211MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 35%|███▍      | 480M/1.35G [00:02<00:04, 212MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 36%|███▋      | 500M/1.35G [00:02<00:04, 213MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 38%|███▊      | 521M/1.35G [00:03<00:04, 214MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 39%|███▉      | 542M/1.35G [00:03<00:04, 215MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 41%|████      | 562M/1.35G [00:03<00:04, 214MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 42%|████▏     | 583M/1.35G [00:03<00:03, 216MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 44%|████▍     | 604M/1.35G [00:03<00:03, 212MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 45%|████▌     | 624M/1.35G [00:03<00:03, 210MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 47%|████▋     | 644M/1.35G [00:03<00:03, 208MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 48%|████▊     | 664M/1.35G [00:03<00:03, 206MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 50%|████▉     | 684M/1.35G [00:03<00:03, 209MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 51%|█████     | 705M/1.35G [00:03<00:03, 210MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 53%|█████▎    | 725M/1.35G [00:04<00:03, 212MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 54%|█████▍    | 746M/1.35G [00:04<00:03, 210MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 56%|█████▌    | 766M/1.35G [00:04<00:03, 211MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 57%|█████▋    | 786M/1.35G [00:04<00:03, 202MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 58%|█████▊    | 806M/1.35G [00:04<00:02, 203MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 60%|█████▉    | 826M/1.35G [00:04<00:02, 205MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 61%|██████▏   | 845M/1.35G [00:04<00:02, 205MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 63%|██████▎   | 866M/1.35G [00:04<00:02, 210MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 64%|██████▍   | 888M/1.35G [00:04<00:02, 214MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 66%|██████▌   | 909M/1.35G [00:04<00:02, 217MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 67%|██████▋   | 930M/1.35G [00:05<00:02, 218MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 69%|██████▉   | 951M/1.35G [00:05<00:02, 217MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 70%|███████   | 972M/1.35G [00:05<00:01, 217MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 72%|███████▏  | 993M/1.35G [00:05<00:01, 218MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 73%|███████▎  | 0.99G/1.35G [00:05<00:01, 216MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 75%|███████▍  | 1.01G/1.35G [00:05<00:01, 217MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 76%|███████▋  | 1.03G/1.35G [00:05<00:01, 217MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 78%|███████▊  | 1.05G/1.35G [00:05<00:01, 216MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 80%|███████▉  | 1.07G/1.35G [00:05<00:01, 218MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 81%|████████  | 1.09G/1.35G [00:05<00:01, 218MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 83%|████████▎ | 1.11G/1.35G [00:06<00:01, 219MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 84%|████████▍ | 1.13G/1.35G [00:06<00:01, 219MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 86%|████████▌ | 1.15G/1.35G [00:06<00:00, 219MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 87%|████████▋ | 1.17G/1.35G [00:06<00:00, 220MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 89%|████████▊ | 1.19G/1.35G [00:06<00:00, 220MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 90%|█████████ | 1.21G/1.35G [00:06<00:00, 220MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 92%|█████████▏| 1.24G/1.35G [00:06<00:00, 216MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 93%|█████████▎| 1.26G/1.35G [00:06<00:00, 217MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 95%|█████████▍| 1.28G/1.35G [00:06<00:00, 216MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 96%|█████████▋| 1.30G/1.35G [00:06<00:00, 217MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 98%|█████████▊| 1.32G/1.35G [00:07<00:00, 218MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       " 99%|█████████▉| 1.34G/1.35G [00:07<00:00, 217MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\r",
 | |
|       "100%|██████████| 1.35G/1.35G [00:07<00:00, 200MB/s]"
 | |
|      ]
 | |
|     },
 | |
|     {
 | |
|      "name": "stderr",
 | |
|      "output_type": "stream",
 | |
|      "text": [
 | |
|       "\n"
 | |
|      ]
 | |
|     }
 | |
|    ],
 | |
|    "source": [
 | |
|     "for key in mydict:\n",
 | |
|     "    mydict[key] = sm.SummaryDetector(mydict[key]).analyse_questions(list_of_questions)"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "attachments": {},
 | |
|    "cell_type": "markdown",
 | |
|    "metadata": {},
 | |
|    "source": [
 | |
|     "## Convert to dataframe and write csv\n",
 | |
|     "These steps are required to convert the dictionary of dictionarys into a dictionary with lists, that can be converted into a pandas dataframe and exported to a csv file."
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "cell_type": "code",
 | |
|    "execution_count": 14,
 | |
|    "metadata": {
 | |
|     "execution": {
 | |
|      "iopub.execute_input": "2023-06-14T17:59:41.704626Z",
 | |
|      "iopub.status.busy": "2023-06-14T17:59:41.704257Z",
 | |
|      "iopub.status.idle": "2023-06-14T17:59:41.709177Z",
 | |
|      "shell.execute_reply": "2023-06-14T17:59:41.708628Z"
 | |
|     }
 | |
|    },
 | |
|    "outputs": [],
 | |
|    "source": [
 | |
|     "outdict2 = mutils.append_data_to_dict(mydict)\n",
 | |
|     "df2 = mutils.dump_df(outdict2)"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "cell_type": "code",
 | |
|    "execution_count": 15,
 | |
|    "metadata": {
 | |
|     "execution": {
 | |
|      "iopub.execute_input": "2023-06-14T17:59:41.711883Z",
 | |
|      "iopub.status.busy": "2023-06-14T17:59:41.711543Z",
 | |
|      "iopub.status.idle": "2023-06-14T17:59:41.720324Z",
 | |
|      "shell.execute_reply": "2023-06-14T17:59:41.719831Z"
 | |
|     }
 | |
|    },
 | |
|    "outputs": [
 | |
|     {
 | |
|      "data": {
 | |
|       "text/html": [
 | |
|        "<div>\n",
 | |
|        "<style scoped>\n",
 | |
|        "    .dataframe tbody tr th:only-of-type {\n",
 | |
|        "        vertical-align: middle;\n",
 | |
|        "    }\n",
 | |
|        "\n",
 | |
|        "    .dataframe tbody tr th {\n",
 | |
|        "        vertical-align: top;\n",
 | |
|        "    }\n",
 | |
|        "\n",
 | |
|        "    .dataframe thead th {\n",
 | |
|        "        text-align: right;\n",
 | |
|        "    }\n",
 | |
|        "</style>\n",
 | |
|        "<table border=\"1\" class=\"dataframe\">\n",
 | |
|        "  <thead>\n",
 | |
|        "    <tr style=\"text-align: right;\">\n",
 | |
|        "      <th></th>\n",
 | |
|        "      <th>filename</th>\n",
 | |
|        "      <th>const_image_summary</th>\n",
 | |
|        "      <th>3_non-deterministic summary</th>\n",
 | |
|        "      <th>How many persons on the picture?</th>\n",
 | |
|        "      <th>Are there any politicians in the picture?</th>\n",
 | |
|        "      <th>Does the picture show something from medicine?</th>\n",
 | |
|        "    </tr>\n",
 | |
|        "  </thead>\n",
 | |
|        "  <tbody>\n",
 | |
|        "    <tr>\n",
 | |
|        "      <th>0</th>\n",
 | |
|        "      <td>data/102730_eng.png</td>\n",
 | |
|        "      <td>two people in blue coats spray disinfection a van</td>\n",
 | |
|        "      <td>[two people with blue robes are spraying water...</td>\n",
 | |
|        "      <td>2</td>\n",
 | |
|        "      <td>no</td>\n",
 | |
|        "      <td>yes</td>\n",
 | |
|        "    </tr>\n",
 | |
|        "    <tr>\n",
 | |
|        "      <th>1</th>\n",
 | |
|        "      <td>data/106349S_por.png</td>\n",
 | |
|        "      <td>a man wearing a face mask while looking at a c...</td>\n",
 | |
|        "      <td>[an image of a television screen that has a ma...</td>\n",
 | |
|        "      <td>1</td>\n",
 | |
|        "      <td>yes</td>\n",
 | |
|        "      <td>yes</td>\n",
 | |
|        "    </tr>\n",
 | |
|        "    <tr>\n",
 | |
|        "      <th>2</th>\n",
 | |
|        "      <td>data/102141_2_eng.png</td>\n",
 | |
|        "      <td>a collage of images including a corona sign, a...</td>\n",
 | |
|        "      <td>[a hand holding an empty tube and another phot...</td>\n",
 | |
|        "      <td>1</td>\n",
 | |
|        "      <td>no</td>\n",
 | |
|        "      <td>yes</td>\n",
 | |
|        "    </tr>\n",
 | |
|        "  </tbody>\n",
 | |
|        "</table>\n",
 | |
|        "</div>"
 | |
|       ],
 | |
|       "text/plain": [
 | |
|        "                filename                                const_image_summary  \\\n",
 | |
|        "0    data/102730_eng.png  two people in blue coats spray disinfection a van   \n",
 | |
|        "1   data/106349S_por.png  a man wearing a face mask while looking at a c...   \n",
 | |
|        "2  data/102141_2_eng.png  a collage of images including a corona sign, a...   \n",
 | |
|        "\n",
 | |
|        "                         3_non-deterministic summary  \\\n",
 | |
|        "0  [two people with blue robes are spraying water...   \n",
 | |
|        "1  [an image of a television screen that has a ma...   \n",
 | |
|        "2  [a hand holding an empty tube and another phot...   \n",
 | |
|        "\n",
 | |
|        "  How many persons on the picture? Are there any politicians in the picture?  \\\n",
 | |
|        "0                                2                                        no   \n",
 | |
|        "1                                1                                       yes   \n",
 | |
|        "2                                1                                        no   \n",
 | |
|        "\n",
 | |
|        "  Does the picture show something from medicine?  \n",
 | |
|        "0                                            yes  \n",
 | |
|        "1                                            yes  \n",
 | |
|        "2                                            yes  "
 | |
|       ]
 | |
|      },
 | |
|      "execution_count": 15,
 | |
|      "metadata": {},
 | |
|      "output_type": "execute_result"
 | |
|     }
 | |
|    ],
 | |
|    "source": [
 | |
|     "df2.head(10)"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "cell_type": "code",
 | |
|    "execution_count": 16,
 | |
|    "metadata": {
 | |
|     "execution": {
 | |
|      "iopub.execute_input": "2023-06-14T17:59:41.723130Z",
 | |
|      "iopub.status.busy": "2023-06-14T17:59:41.722802Z",
 | |
|      "iopub.status.idle": "2023-06-14T17:59:41.727004Z",
 | |
|      "shell.execute_reply": "2023-06-14T17:59:41.726511Z"
 | |
|     }
 | |
|    },
 | |
|    "outputs": [],
 | |
|    "source": [
 | |
|     "df2.to_csv(\"data_out2.csv\")"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "cell_type": "code",
 | |
|    "execution_count": null,
 | |
|    "metadata": {},
 | |
|    "outputs": [],
 | |
|    "source": []
 | |
|   }
 | |
|  ],
 | |
|  "metadata": {
 | |
|   "kernelspec": {
 | |
|    "display_name": "Python 3 (ipykernel)",
 | |
|    "language": "python",
 | |
|    "name": "python3"
 | |
|   },
 | |
|   "language_info": {
 | |
|    "codemirror_mode": {
 | |
|     "name": "ipython",
 | |
|     "version": 3
 | |
|    },
 | |
|    "file_extension": ".py",
 | |
|    "mimetype": "text/x-python",
 | |
|    "name": "python",
 | |
|    "nbconvert_exporter": "python",
 | |
|    "pygments_lexer": "ipython3",
 | |
|    "version": "3.9.16"
 | |
|   },
 | |
|   "vscode": {
 | |
|    "interpreter": {
 | |
|     "hash": "f1142466f556ab37fe2d38e2897a16796906208adb09fea90ba58bdf8a56f0ba"
 | |
|    }
 | |
|   }
 | |
|  },
 | |
|  "nbformat": 4,
 | |
|  "nbformat_minor": 4
 | |
| }
 | 
