AMMICO/build/html/notebooks/Example summary.ipynb

2087 строки
49 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-13T11:31:10.925667Z",
"iopub.status.busy": "2023-06-13T11:31:10.925388Z",
"iopub.status.idle": "2023-06-13T11:31:10.934992Z",
"shell.execute_reply": "2023-06-13T11:31:10.934373Z"
}
},
"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-13T11:31:10.938088Z",
"iopub.status.busy": "2023-06-13T11:31:10.937658Z",
"iopub.status.idle": "2023-06-13T11:31:22.127705Z",
"shell.execute_reply": "2023-06-13T11:31:22.126938Z"
},
"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-13T11:31:22.131652Z",
"iopub.status.busy": "2023-06-13T11:31:22.130738Z",
"iopub.status.idle": "2023-06-13T11:31:22.135322Z",
"shell.execute_reply": "2023-06-13T11:31:22.134614Z"
},
"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-13T11:31:22.138429Z",
"iopub.status.busy": "2023-06-13T11:31:22.137975Z",
"iopub.status.idle": "2023-06-13T11:31:22.141416Z",
"shell.execute_reply": "2023-06-13T11:31:22.140706Z"
},
"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-13T11:31:22.145166Z",
"iopub.status.busy": "2023-06-13T11:31:22.144723Z",
"iopub.status.idle": "2023-06-13T11:31:47.380101Z",
"shell.execute_reply": "2023-06-13T11:31:47.379260Z"
},
"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%| | 7.52M/2.50G [00:00<00:34, 78.8MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 1%| | 15.0M/2.50G [00:00<00:34, 78.2MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 1%| | 22.5M/2.50G [00:00<00:34, 77.3MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 1%| | 32.0M/2.50G [00:00<00:34, 77.9MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 2%|▏ | 46.8M/2.50G [00:00<00:25, 104MB/s] "
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 2%|▏ | 56.8M/2.50G [00:00<00:25, 103MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 3%|▎ | 72.0M/2.50G [00:00<00:22, 118MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 3%|▎ | 85.3M/2.50G [00:00<00:20, 124MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 4%|▍ | 97.2M/2.50G [00:00<00:22, 116MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 4%|▍ | 108M/2.50G [00:01<00:25, 101MB/s] "
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 5%|▍ | 125M/2.50G [00:01<00:21, 119MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 6%|▌ | 144M/2.50G [00:01<00:18, 139MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 6%|▋ | 162M/2.50G [00:01<00:16, 152MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 7%|▋ | 179M/2.50G [00:01<00:15, 161MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 8%|▊ | 200M/2.50G [00:01<00:14, 168MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 8%|▊ | 218M/2.50G [00:01<00:14, 173MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 9%|▉ | 242M/2.50G [00:01<00:12, 198MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 10%|█ | 261M/2.50G [00:01<00:12, 191MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 11%|█▏ | 289M/2.50G [00:02<00:10, 218MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 12%|█▏ | 310M/2.50G [00:02<00:11, 210MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 13%|█▎ | 335M/2.50G [00:02<00:10, 227MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 14%|█▍ | 357M/2.50G [00:02<00:11, 207MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 15%|█▍ | 383M/2.50G [00:02<00:10, 225MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 16%|█▌ | 407M/2.50G [00:02<00:09, 232MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 17%|█▋ | 432M/2.50G [00:02<00:09, 240MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 18%|█▊ | 459M/2.50G [00:02<00:08, 253MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 19%|█▉ | 484M/2.50G [00:02<00:08, 255MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 20%|█▉ | 509M/2.50G [00:03<00:08, 256MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 21%|██ | 534M/2.50G [00:03<00:08, 258MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 22%|██▏ | 560M/2.50G [00:03<00:07, 265MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 23%|██▎ | 586M/2.50G [00:03<00:07, 267MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 24%|██▍ | 612M/2.50G [00:03<00:07, 268MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 25%|██▍ | 638M/2.50G [00:03<00:07, 260MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 26%|██▌ | 663M/2.50G [00:03<00:07, 260MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 27%|██▋ | 688M/2.50G [00:03<00:10, 180MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 28%|██▊ | 713M/2.50G [00:03<00:09, 199MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 29%|██▉ | 741M/2.50G [00:04<00:08, 221MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 30%|██▉ | 766M/2.50G [00:04<00:08, 233MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 31%|███ | 794M/2.50G [00:04<00:07, 250MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 32%|███▏ | 821M/2.50G [00:04<00:07, 256MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 33%|███▎ | 846M/2.50G [00:04<00:06, 260MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 34%|███▍ | 873M/2.50G [00:04<00:06, 267MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 35%|███▌ | 901M/2.50G [00:04<00:06, 272MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 36%|███▌ | 929M/2.50G [00:04<00:06, 280MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 37%|███▋ | 956M/2.50G [00:04<00:06, 255MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 38%|███▊ | 981M/2.50G [00:05<00:06, 256MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 39%|███▉ | 0.98G/2.50G [00:05<00:07, 223MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 40%|████ | 1.00G/2.50G [00:05<00:15, 102MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 41%|████ | 1.02G/2.50G [00:05<00:14, 111MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 41%|████▏ | 1.04G/2.50G [00:05<00:12, 125MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 42%|████▏ | 1.06G/2.50G [00:06<00:10, 152MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 43%|████▎ | 1.08G/2.50G [00:06<00:09, 157MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 44%|████▍ | 1.11G/2.50G [00:06<00:08, 183MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 45%|████▌ | 1.13G/2.50G [00:06<00:07, 206MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 46%|████▋ | 1.16G/2.50G [00:06<00:06, 225MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 47%|████▋ | 1.18G/2.50G [00:06<00:06, 236MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 48%|████▊ | 1.21G/2.50G [00:06<00:05, 233MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 49%|████▉ | 1.23G/2.50G [00:06<00:05, 245MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 50%|█████ | 1.26G/2.50G [00:06<00:05, 257MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 51%|█████▏ | 1.28G/2.50G [00:06<00:05, 247MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 52%|█████▏ | 1.31G/2.50G [00:07<00:05, 249MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 53%|█████▎ | 1.33G/2.50G [00:07<00:04, 252MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 54%|█████▍ | 1.36G/2.50G [00:07<00:04, 255MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 55%|█████▌ | 1.38G/2.50G [00:07<00:05, 227MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 56%|█████▌ | 1.40G/2.50G [00:07<00:05, 225MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 57%|█████▋ | 1.42G/2.50G [00:07<00:05, 216MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 58%|█████▊ | 1.44G/2.50G [00:07<00:05, 194MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 59%|█████▊ | 1.47G/2.50G [00:07<00:05, 214MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 60%|█████▉ | 1.50G/2.50G [00:07<00:04, 232MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 61%|██████ | 1.52G/2.50G [00:08<00:05, 206MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 62%|██████▏ | 1.54G/2.50G [00:08<00:04, 218MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 63%|██████▎ | 1.57G/2.50G [00:08<00:04, 231MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 64%|██████▎ | 1.59G/2.50G [00:08<00:04, 238MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 64%|██████▍ | 1.61G/2.50G [00:08<00:04, 226MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 65%|██████▌ | 1.64G/2.50G [00:08<00:03, 235MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 66%|██████▋ | 1.66G/2.50G [00:08<00:03, 227MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 67%|██████▋ | 1.68G/2.50G [00:08<00:03, 241MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 68%|██████▊ | 1.71G/2.50G [00:08<00:03, 230MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 69%|██████▉ | 1.73G/2.50G [00:09<00:03, 242MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 70%|███████ | 1.76G/2.50G [00:09<00:03, 214MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 71%|███████ | 1.78G/2.50G [00:09<00:03, 217MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 72%|███████▏ | 1.80G/2.50G [00:09<00:03, 229MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 73%|███████▎ | 1.82G/2.50G [00:09<00:03, 218MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 74%|███████▎ | 1.84G/2.50G [00:09<00:03, 207MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 75%|███████▍ | 1.87G/2.50G [00:09<00:03, 217MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 75%|███████▌ | 1.89G/2.50G [00:09<00:02, 221MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 76%|███████▋ | 1.91G/2.50G [00:09<00:02, 235MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 77%|███████▋ | 1.94G/2.50G [00:10<00:02, 250MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 78%|███████▊ | 1.96G/2.50G [00:10<00:06, 89.9MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 80%|███████▉ | 1.99G/2.50G [00:10<00:04, 116MB/s] "
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 81%|████████ | 2.02G/2.50G [00:11<00:03, 145MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 82%|████████▏ | 2.05G/2.50G [00:11<00:02, 171MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 83%|████████▎ | 2.07G/2.50G [00:11<00:02, 193MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 84%|████████▎ | 2.10G/2.50G [00:11<00:02, 188MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 85%|████████▍ | 2.12G/2.50G [00:11<00:02, 174MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 86%|████████▌ | 2.15G/2.50G [00:11<00:01, 203MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 87%|████████▋ | 2.17G/2.50G [00:11<00:01, 223MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 88%|████████▊ | 2.20G/2.50G [00:11<00:01, 235MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 89%|████████▉ | 2.22G/2.50G [00:11<00:01, 228MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 90%|████████▉ | 2.24G/2.50G [00:12<00:01, 222MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 91%|█████████ | 2.27G/2.50G [00:12<00:01, 239MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 92%|█████████▏| 2.29G/2.50G [00:12<00:00, 239MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 93%|█████████▎| 2.32G/2.50G [00:12<00:00, 248MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 94%|█████████▎| 2.34G/2.50G [00:12<00:00, 241MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 95%|█████████▍| 2.37G/2.50G [00:12<00:00, 259MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 96%|█████████▌| 2.40G/2.50G [00:12<00:00, 244MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 97%|█████████▋| 2.42G/2.50G [00:12<00:00, 253MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 98%|█████████▊| 2.45G/2.50G [00:12<00:00, 217MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 99%|█████████▊| 2.47G/2.50G [00:13<00:00, 96.6MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 99%|█████████▉| 2.48G/2.50G [00:15<00:00, 33.8MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
"100%|█████████▉| 2.49G/2.50G [00:15<00:00, 38.7MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
"100%|██████████| 2.50G/2.50G [00:15<00:00, 175MB/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-13T11:31:47.384894Z",
"iopub.status.busy": "2023-06-13T11:31:47.384380Z",
"iopub.status.idle": "2023-06-13T11:32:19.017456Z",
"shell.execute_reply": "2023-06-13T11:32:19.016433Z"
},
"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-13T11:32:19.021380Z",
"iopub.status.busy": "2023-06-13T11:32:19.020788Z",
"iopub.status.idle": "2023-06-13T11:32:19.026055Z",
"shell.execute_reply": "2023-06-13T11:32:19.025442Z"
},
"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-13T11:32:19.029340Z",
"iopub.status.busy": "2023-06-13T11:32:19.028992Z",
"iopub.status.idle": "2023-06-13T11:32:19.042808Z",
"shell.execute_reply": "2023-06-13T11:32:19.041843Z"
},
"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 in blue uniforms are spraying fire...</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>[the man is using his cellphone on tv, a tv sc...</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>[some sort of corona sign in different picture...</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 in blue uniforms are spraying fire... \n",
"1 [the man is using his cellphone on tv, a tv sc... \n",
"2 [some sort of corona sign in different picture... "
]
},
"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-13T11:32:19.045876Z",
"iopub.status.busy": "2023-06-13T11:32:19.045452Z",
"iopub.status.idle": "2023-06-13T11:32:19.050741Z",
"shell.execute_reply": "2023-06-13T11:32:19.050149Z"
}
},
"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-13T11:32:19.053337Z",
"iopub.status.busy": "2023-06-13T11:32:19.053110Z",
"iopub.status.idle": "2023-06-13T11:32:19.098271Z",
"shell.execute_reply": "2023-06-13T11:32:19.097503Z"
},
"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 0x7f4267dd2e80>"
]
},
"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-13T11:32:19.102528Z",
"iopub.status.busy": "2023-06-13T11:32:19.101905Z",
"iopub.status.idle": "2023-06-13T11:32:19.105401Z",
"shell.execute_reply": "2023-06-13T11:32:19.104719Z"
}
},
"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-13T11:32:19.108316Z",
"iopub.status.busy": "2023-06-13T11:32:19.107757Z",
"iopub.status.idle": "2023-06-13T11:32:19.626984Z",
"shell.execute_reply": "2023-06-13T11:32:19.626151Z"
}
},
"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 0x7f4267ea4370>"
]
},
"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-13T11:32:19.631107Z",
"iopub.status.busy": "2023-06-13T11:32:19.630431Z",
"iopub.status.idle": "2023-06-13T11:33:08.925968Z",
"shell.execute_reply": "2023-06-13T11:33:08.925083Z"
}
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 0%| | 0.00/1.35G [00:00<?, ?B/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 1%| | 8.01M/1.35G [00:00<00:23, 61.4MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 2%|▏ | 24.0M/1.35G [00:00<00:13, 106MB/s] "
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 3%|▎ | 37.5M/1.35G [00:00<00:11, 120MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 4%|▎ | 49.2M/1.35G [00:00<00:12, 109MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 5%|▍ | 65.0M/1.35G [00:00<00:10, 127MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 6%|▌ | 82.6M/1.35G [00:00<00:09, 145MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 7%|▋ | 102M/1.35G [00:00<00:08, 163MB/s] "
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 9%|▉ | 123M/1.35G [00:00<00:07, 180MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 11%|█ | 145M/1.35G [00:00<00:06, 196MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 12%|█▏ | 168M/1.35G [00:01<00:06, 210MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 14%|█▍ | 194M/1.35G [00:01<00:05, 229MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 16%|█▌ | 219M/1.35G [00:01<00:05, 238MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 18%|█▊ | 242M/1.35G [00:01<00:08, 140MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 19%|█▉ | 260M/1.35G [00:01<00:08, 146MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 21%|██ | 286M/1.35G [00:01<00:06, 174MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 22%|██▏ | 306M/1.35G [00:02<00:10, 108MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 24%|██▍ | 331M/1.35G [00:02<00:08, 135MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 26%|██▌ | 358M/1.35G [00:02<00:06, 163MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 28%|██▊ | 384M/1.35G [00:02<00:05, 188MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 30%|██▉ | 410M/1.35G [00:02<00:04, 204MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 31%|███▏ | 433M/1.35G [00:02<00:05, 178MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 33%|███▎ | 457M/1.35G [00:02<00:04, 196MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 35%|███▍ | 482M/1.35G [00:03<00:04, 211MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 37%|███▋ | 507M/1.35G [00:03<00:04, 224MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 38%|███▊ | 531M/1.35G [00:03<00:03, 231MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 40%|████ | 557M/1.35G [00:03<00:03, 243MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 42%|████▏ | 583M/1.35G [00:03<00:03, 251MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 44%|████▍ | 608M/1.35G [00:03<00:03, 240MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 46%|████▌ | 632M/1.35G [00:03<00:04, 193MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 48%|████▊ | 657M/1.35G [00:03<00:03, 209MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 49%|████▉ | 683M/1.35G [00:03<00:03, 225MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 51%|█████▏ | 708M/1.35G [00:04<00:02, 236MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 53%|█████▎ | 734M/1.35G [00:04<00:02, 246MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 55%|█████▌ | 760M/1.35G [00:04<00:02, 254MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 57%|█████▋ | 785M/1.35G [00:04<00:03, 162MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 59%|█████▊ | 809M/1.35G [00:04<00:03, 181MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 60%|██████ | 833M/1.35G [00:04<00:02, 197MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 62%|██████▏ | 858M/1.35G [00:04<00:02, 214MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 64%|██████▍ | 881M/1.35G [00:05<00:06, 81.7MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 66%|██████▌ | 904M/1.35G [00:05<00:04, 100MB/s] "
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 67%|██████▋ | 929M/1.35G [00:05<00:03, 125MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 69%|██████▉ | 954M/1.35G [00:05<00:03, 148MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 71%|███████ | 978M/1.35G [00:05<00:02, 170MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 73%|███████▎ | 0.98G/1.35G [00:06<00:02, 194MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 75%|███████▍ | 1.01G/1.35G [00:06<00:01, 208MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 76%|███████▋ | 1.03G/1.35G [00:06<00:01, 221MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 78%|███████▊ | 1.05G/1.35G [00:06<00:01, 231MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 80%|████████ | 1.08G/1.35G [00:06<00:01, 190MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 82%|████████▏ | 1.10G/1.35G [00:06<00:01, 207MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 84%|████████▍ | 1.13G/1.35G [00:06<00:01, 224MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 86%|████████▌ | 1.15G/1.35G [00:06<00:00, 238MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 87%|████████▋ | 1.18G/1.35G [00:07<00:00, 192MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 89%|████████▉ | 1.20G/1.35G [00:07<00:00, 209MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 91%|█████████ | 1.23G/1.35G [00:07<00:00, 222MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 93%|█████████▎| 1.25G/1.35G [00:07<00:00, 239MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 95%|█████████▌| 1.28G/1.35G [00:07<00:00, 252MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 97%|█████████▋| 1.31G/1.35G [00:07<00:00, 261MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 99%|█████████▉| 1.33G/1.35G [00:07<00:00, 268MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
"100%|██████████| 1.35G/1.35G [00:07<00:00, 187MB/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-13T11:33:08.930582Z",
"iopub.status.busy": "2023-06-13T11:33:08.929839Z",
"iopub.status.idle": "2023-06-13T11:33:08.936874Z",
"shell.execute_reply": "2023-06-13T11:33:08.936195Z"
}
},
"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-13T11:33:08.941341Z",
"iopub.status.busy": "2023-06-13T11:33:08.940618Z",
"iopub.status.idle": "2023-06-13T11:33:08.951583Z",
"shell.execute_reply": "2023-06-13T11:33:08.950837Z"
}
},
"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 in blue uniforms are spraying fire...</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>[the man is using his cellphone on tv, a tv sc...</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>[some sort of corona sign in different picture...</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 in blue uniforms are spraying fire... \n",
"1 [the man is using his cellphone on tv, a tv sc... \n",
"2 [some sort of corona sign in different picture... \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-13T11:33:08.954820Z",
"iopub.status.busy": "2023-06-13T11:33:08.954219Z",
"iopub.status.idle": "2023-06-13T11:33:08.959309Z",
"shell.execute_reply": "2023-06-13T11:33:08.958643Z"
}
},
"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
}