AMMICO/build/doctrees/nbsphinx/notebooks/Example summary.ipynb

2111 строки
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-22T12:11:04.207591Z",
"iopub.status.busy": "2023-06-22T12:11:04.207186Z",
"iopub.status.idle": "2023-06-22T12:11:04.216206Z",
"shell.execute_reply": "2023-06-22T12:11:04.215555Z"
}
},
"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-22T12:11:04.219158Z",
"iopub.status.busy": "2023-06-22T12:11:04.218734Z",
"iopub.status.idle": "2023-06-22T12:11:15.236326Z",
"shell.execute_reply": "2023-06-22T12:11:15.235623Z"
},
"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-22T12:11:15.239951Z",
"iopub.status.busy": "2023-06-22T12:11:15.239241Z",
"iopub.status.idle": "2023-06-22T12:11:15.244533Z",
"shell.execute_reply": "2023-06-22T12:11:15.243924Z"
},
"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-22T12:11:15.247324Z",
"iopub.status.busy": "2023-06-22T12:11:15.246957Z",
"iopub.status.idle": "2023-06-22T12:11:15.250214Z",
"shell.execute_reply": "2023-06-22T12:11:15.249531Z"
},
"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-22T12:11:15.253810Z",
"iopub.status.busy": "2023-06-22T12:11:15.253371Z",
"iopub.status.idle": "2023-06-22T12:11:41.289821Z",
"shell.execute_reply": "2023-06-22T12:11:41.288858Z"
},
"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%| | 4.01M/2.50G [00:00<02:31, 17.7MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 1%| | 25.6M/2.50G [00:00<00:27, 96.2MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 2%|▏ | 40.6M/2.50G [00:00<00:22, 117MB/s] "
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 2%|▏ | 63.7M/2.50G [00:00<00:16, 159MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 3%|▎ | 85.6M/2.50G [00:00<00:14, 182MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 4%|▍ | 105M/2.50G [00:00<00:14, 176MB/s] "
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 5%|▍ | 123M/2.50G [00:00<00:14, 174MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 6%|▌ | 144M/2.50G [00:01<00:15, 169MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 7%|▋ | 168M/2.50G [00:01<00:13, 192MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 7%|▋ | 187M/2.50G [00:01<00:14, 172MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 8%|▊ | 204M/2.50G [00:01<00:16, 151MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 9%|▊ | 220M/2.50G [00:01<00:17, 140MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 10%|▉ | 244M/2.50G [00:01<00:14, 169MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 11%|█ | 271M/2.50G [00:01<00:12, 196MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 12%|█▏ | 296M/2.50G [00:01<00:11, 213MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 13%|█▎ | 321M/2.50G [00:01<00:10, 226MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 13%|█▎ | 345M/2.50G [00:02<00:09, 236MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 14%|█▍ | 370M/2.50G [00:02<00:09, 243MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 15%|█▌ | 395M/2.50G [00:02<00:09, 247MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 16%|█▋ | 420M/2.50G [00:02<00:08, 252MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 17%|█▋ | 445M/2.50G [00:02<00:08, 255MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 18%|█▊ | 470M/2.50G [00:02<00:08, 257MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 19%|█▉ | 495M/2.50G [00:02<00:08, 260MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 20%|██ | 520M/2.50G [00:02<00:11, 186MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 21%|██ | 544M/2.50G [00:02<00:10, 201MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 22%|██▏ | 568M/2.50G [00:03<00:11, 189MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 23%|██▎ | 588M/2.50G [00:03<00:15, 138MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 24%|██▍ | 617M/2.50G [00:03<00:11, 170MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 25%|██▍ | 637M/2.50G [00:03<00:13, 153MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 26%|██▌ | 664M/2.50G [00:03<00:12, 155MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 27%|██▋ | 681M/2.50G [00:03<00:13, 149MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 28%|██▊ | 709M/2.50G [00:04<00:10, 180MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 29%|██▊ | 734M/2.50G [00:04<00:09, 201MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 29%|██▉ | 755M/2.50G [00:04<00:10, 181MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 30%|███ | 781M/2.50G [00:04<00:09, 202MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 31%|███▏ | 807M/2.50G [00:04<00:08, 220MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 32%|███▏ | 833M/2.50G [00:04<00:07, 233MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 33%|███▎ | 859M/2.50G [00:04<00:07, 244MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 34%|███▍ | 883M/2.50G [00:04<00:07, 238MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 35%|███▌ | 908M/2.50G [00:04<00:07, 244MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 36%|███▋ | 934M/2.50G [00:05<00:06, 253MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 37%|███▋ | 959M/2.50G [00:05<00:06, 256MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 38%|███▊ | 985M/2.50G [00:05<00:06, 260MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 39%|███▉ | 0.99G/2.50G [00:05<00:06, 264MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 40%|████ | 1.01G/2.50G [00:05<00:08, 179MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 41%|████▏ | 1.04G/2.50G [00:05<00:07, 200MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 42%|████▏ | 1.06G/2.50G [00:05<00:07, 217MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 44%|████▎ | 1.09G/2.50G [00:05<00:06, 242MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 45%|████▍ | 1.12G/2.50G [00:06<00:05, 262MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 46%|████▌ | 1.15G/2.50G [00:06<00:06, 228MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 47%|████▋ | 1.18G/2.50G [00:06<00:05, 246MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 48%|████▊ | 1.20G/2.50G [00:06<00:06, 218MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 49%|████▉ | 1.23G/2.50G [00:06<00:05, 231MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 50%|████▉ | 1.25G/2.50G [00:06<00:05, 227MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 51%|█████ | 1.27G/2.50G [00:06<00:05, 225MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 52%|█████▏ | 1.30G/2.50G [00:06<00:05, 237MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 53%|█████▎ | 1.32G/2.50G [00:06<00:05, 251MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 54%|█████▍ | 1.35G/2.50G [00:07<00:05, 223MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 55%|█████▍ | 1.37G/2.50G [00:07<00:05, 228MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 56%|█████▌ | 1.39G/2.50G [00:07<00:05, 204MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 56%|█████▋ | 1.41G/2.50G [00:07<00:05, 197MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 58%|█████▊ | 1.44G/2.50G [00:07<00:05, 223MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 58%|█████▊ | 1.46G/2.50G [00:07<00:06, 171MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 59%|█████▉ | 1.49G/2.50G [00:07<00:05, 192MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 60%|██████ | 1.51G/2.50G [00:08<00:05, 182MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 61%|██████ | 1.53G/2.50G [00:08<00:05, 197MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 62%|██████▏ | 1.55G/2.50G [00:08<00:04, 210MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 63%|██████▎ | 1.57G/2.50G [00:08<00:04, 207MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 64%|██████▎ | 1.59G/2.50G [00:08<00:04, 200MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 65%|██████▍ | 1.62G/2.50G [00:08<00:04, 215MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 65%|██████▌ | 1.64G/2.50G [00:08<00:04, 223MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 66%|██████▋ | 1.66G/2.50G [00:08<00:06, 138MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 67%|██████▋ | 1.68G/2.50G [00:09<00:05, 152MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 68%|██████▊ | 1.70G/2.50G [00:09<00:05, 165MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 69%|██████▉ | 1.72G/2.50G [00:09<00:04, 187MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 70%|██████▉ | 1.74G/2.50G [00:09<00:04, 189MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 71%|███████ | 1.77G/2.50G [00:09<00:03, 204MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 71%|███████▏ | 1.79G/2.50G [00:09<00:03, 217MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 72%|███████▏ | 1.81G/2.50G [00:09<00:03, 210MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 73%|███████▎ | 1.83G/2.50G [00:09<00:04, 166MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 74%|███████▍ | 1.85G/2.50G [00:10<00:04, 168MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 75%|███████▍ | 1.87G/2.50G [00:10<00:03, 187MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 76%|███████▌ | 1.89G/2.50G [00:10<00:03, 192MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 76%|███████▋ | 1.91G/2.50G [00:10<00:03, 166MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 77%|███████▋ | 1.94G/2.50G [00:10<00:03, 185MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 78%|███████▊ | 1.95G/2.50G [00:10<00:04, 146MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 79%|███████▊ | 1.97G/2.50G [00:10<00:04, 130MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 80%|███████▉ | 1.99G/2.50G [00:10<00:03, 154MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 81%|████████ | 2.02G/2.50G [00:11<00:02, 178MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 81%|████████ | 2.03G/2.50G [00:11<00:02, 173MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 82%|████████▏ | 2.06G/2.50G [00:11<00:02, 188MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 83%|████████▎ | 2.08G/2.50G [00:11<00:02, 204MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 84%|████████▍ | 2.10G/2.50G [00:11<00:03, 109MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 85%|████████▍ | 2.12G/2.50G [00:11<00:03, 120MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 85%|████████▌ | 2.13G/2.50G [00:12<00:03, 125MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 86%|████████▌ | 2.16G/2.50G [00:12<00:03, 115MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 87%|████████▋ | 2.17G/2.50G [00:12<00:03, 102MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 88%|████████▊ | 2.19G/2.50G [00:12<00:02, 125MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 89%|████████▊ | 2.22G/2.50G [00:12<00:02, 150MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 89%|████████▉ | 2.24G/2.50G [00:12<00:01, 169MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 90%|█████████ | 2.26G/2.50G [00:12<00:01, 185MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 91%|█████████ | 2.28G/2.50G [00:13<00:01, 199MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 92%|█████████▏| 2.30G/2.50G [00:13<00:01, 192MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 93%|█████████▎| 2.32G/2.50G [00:13<00:01, 156MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 94%|█████████▎| 2.35G/2.50G [00:13<00:00, 176MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 95%|█████████▍| 2.37G/2.50G [00:13<00:00, 196MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 96%|█████████▌| 2.39G/2.50G [00:13<00:00, 212MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 96%|█████████▋| 2.41G/2.50G [00:13<00:00, 146MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 97%|█████████▋| 2.44G/2.50G [00:14<00:00, 165MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 98%|█████████▊| 2.45G/2.50G [00:15<00:01, 50.1MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 99%|█████████▊| 2.47G/2.50G [00:15<00:00, 60.7MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 99%|█████████▉| 2.48G/2.50G [00:15<00:00, 63.1MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
"100%|█████████▉| 2.50G/2.50G [00:16<00:00, 31.1MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
"100%|██████████| 2.50G/2.50G [00:16<00:00, 161MB/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-22T12:11:41.299285Z",
"iopub.status.busy": "2023-06-22T12:11:41.298628Z",
"iopub.status.idle": "2023-06-22T12:12:21.821480Z",
"shell.execute_reply": "2023-06-22T12:12:21.820712Z"
},
"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-22T12:12:21.826650Z",
"iopub.status.busy": "2023-06-22T12:12:21.826101Z",
"iopub.status.idle": "2023-06-22T12:12:21.830509Z",
"shell.execute_reply": "2023-06-22T12:12:21.829863Z"
},
"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-22T12:12:21.834557Z",
"iopub.status.busy": "2023-06-22T12:12:21.834043Z",
"iopub.status.idle": "2023-06-22T12:12:21.847452Z",
"shell.execute_reply": "2023-06-22T12:12:21.846802Z"
},
"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/106349S_por.png</td>\n",
" <td>a man wearing a face mask while looking at a c...</td>\n",
" <td>[a man wearing a face mask while on the tv, a ...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>data/102141_2_eng.png</td>\n",
" <td>a collage of images including a corona sign, a...</td>\n",
" <td>[the collage of photos includes a person in an...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</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 coats spray disinfection a pa...</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" filename const_image_summary \\\n",
"0 data/106349S_por.png a man wearing a face mask while looking at a c... \n",
"1 data/102141_2_eng.png a collage of images including a corona sign, a... \n",
"2 data/102730_eng.png two people in blue coats spray disinfection a van \n",
"\n",
" 3_non-deterministic summary \n",
"0 [a man wearing a face mask while on the tv, a ... \n",
"1 [the collage of photos includes a person in an... \n",
"2 [two people with coats spray disinfection a pa... "
]
},
"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-22T12:12:21.852726Z",
"iopub.status.busy": "2023-06-22T12:12:21.852166Z",
"iopub.status.idle": "2023-06-22T12:12:21.857838Z",
"shell.execute_reply": "2023-06-22T12:12:21.857195Z"
}
},
"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-22T12:12:21.861171Z",
"iopub.status.busy": "2023-06-22T12:12:21.860654Z",
"iopub.status.idle": "2023-06-22T12:12:21.890964Z",
"shell.execute_reply": "2023-06-22T12:12:21.890145Z"
},
"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 0x7fec6f055ca0>"
]
},
"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-22T12:12:21.895995Z",
"iopub.status.busy": "2023-06-22T12:12:21.895392Z",
"iopub.status.idle": "2023-06-22T12:12:21.899122Z",
"shell.execute_reply": "2023-06-22T12:12:21.898489Z"
}
},
"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-22T12:12:21.902991Z",
"iopub.status.busy": "2023-06-22T12:12:21.902472Z",
"iopub.status.idle": "2023-06-22T12:12:22.417453Z",
"shell.execute_reply": "2023-06-22T12:12:22.416688Z"
}
},
"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 0x7fec6f015a00>"
]
},
"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-22T12:12:22.422614Z",
"iopub.status.busy": "2023-06-22T12:12:22.422095Z",
"iopub.status.idle": "2023-06-22T12:13:14.085259Z",
"shell.execute_reply": "2023-06-22T12:13:14.084361Z"
}
},
"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%| | 15.7M/1.35G [00:00<00:08, 164MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 3%|▎ | 40.4M/1.35G [00:00<00:06, 220MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 5%|▍ | 64.2M/1.35G [00:00<00:05, 233MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 6%|▋ | 87.2M/1.35G [00:00<00:05, 236MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 8%|▊ | 111M/1.35G [00:00<00:05, 241MB/s] "
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 10%|▉ | 135M/1.35G [00:00<00:05, 246MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 12%|█▏ | 159M/1.35G [00:00<00:05, 245MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 13%|█▎ | 182M/1.35G [00:00<00:05, 242MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 15%|█▍ | 205M/1.35G [00:00<00:05, 236MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 17%|█▋ | 231M/1.35G [00:01<00:04, 246MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 19%|█▊ | 256M/1.35G [00:01<00:04, 250MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 20%|██ | 280M/1.35G [00:01<00:04, 249MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 22%|██▏ | 303M/1.35G [00:01<00:04, 248MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 24%|██▎ | 327M/1.35G [00:01<00:04, 239MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 25%|██▌ | 350M/1.35G [00:01<00:04, 237MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 27%|██▋ | 374M/1.35G [00:01<00:04, 242MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 29%|██▉ | 398M/1.35G [00:01<00:04, 244MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 31%|███ | 421M/1.35G [00:01<00:04, 205MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 32%|███▏ | 445M/1.35G [00:01<00:04, 217MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 34%|███▍ | 470M/1.35G [00:02<00:04, 229MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 36%|███▌ | 494M/1.35G [00:02<00:03, 235MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 37%|███▋ | 517M/1.35G [00:02<00:04, 201MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 39%|███▉ | 541M/1.35G [00:02<00:04, 215MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 41%|████ | 566M/1.35G [00:02<00:03, 226MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 43%|████▎ | 588M/1.35G [00:02<00:04, 170MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 44%|████▍ | 613M/1.35G [00:02<00:04, 189MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 46%|████▌ | 636M/1.35G [00:02<00:03, 204MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 48%|████▊ | 660M/1.35G [00:03<00:03, 215MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 49%|████▉ | 682M/1.35G [00:03<00:07, 103MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 51%|█████ | 701M/1.35G [00:03<00:06, 113MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 52%|█████▏ | 717M/1.35G [00:03<00:06, 109MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 53%|█████▎ | 731M/1.35G [00:04<00:06, 106MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 54%|█████▍ | 744M/1.35G [00:04<00:07, 85.4MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 56%|█████▌ | 770M/1.35G [00:04<00:05, 118MB/s] "
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 57%|█████▋ | 792M/1.35G [00:04<00:04, 141MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 59%|█████▊ | 809M/1.35G [00:04<00:04, 135MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 61%|██████ | 836M/1.35G [00:04<00:03, 166MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 62%|██████▏ | 854M/1.35G [00:05<00:04, 124MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 64%|██████▍ | 879M/1.35G [00:05<00:03, 151MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 65%|██████▌ | 898M/1.35G [00:05<00:03, 139MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 67%|██████▋ | 922M/1.35G [00:05<00:02, 165MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 68%|██████▊ | 944M/1.35G [00:05<00:02, 179MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 70%|██████▉ | 964M/1.35G [00:05<00:02, 188MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 72%|███████▏ | 990M/1.35G [00:05<00:01, 209MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 74%|███████▎ | 0.99G/1.35G [00:05<00:01, 223MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 75%|███████▌ | 1.02G/1.35G [00:05<00:01, 233MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 77%|███████▋ | 1.04G/1.35G [00:05<00:01, 237MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 79%|███████▉ | 1.06G/1.35G [00:06<00:01, 244MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 81%|████████ | 1.09G/1.35G [00:06<00:01, 235MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 82%|████████▏ | 1.11G/1.35G [00:06<00:01, 246MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 84%|████████▍ | 1.13G/1.35G [00:06<00:00, 241MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 86%|████████▌ | 1.16G/1.35G [00:06<00:00, 236MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 88%|████████▊ | 1.18G/1.35G [00:06<00:00, 246MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 90%|████████▉ | 1.21G/1.35G [00:06<00:00, 250MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 91%|█████████▏| 1.23G/1.35G [00:06<00:00, 232MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 93%|█████████▎| 1.26G/1.35G [00:06<00:00, 245MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 95%|█████████▌| 1.28G/1.35G [00:07<00:00, 253MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 97%|█████████▋| 1.30G/1.35G [00:07<00:00, 243MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
" 99%|█████████▊| 1.33G/1.35G [00:07<00:00, 245MB/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\r",
"100%|██████████| 1.35G/1.35G [00:07<00:00, 197MB/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-22T12:13:14.090798Z",
"iopub.status.busy": "2023-06-22T12:13:14.089887Z",
"iopub.status.idle": "2023-06-22T12:13:14.097401Z",
"shell.execute_reply": "2023-06-22T12:13:14.096344Z"
}
},
"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-22T12:13:14.102982Z",
"iopub.status.busy": "2023-06-22T12:13:14.102355Z",
"iopub.status.idle": "2023-06-22T12:13:14.116388Z",
"shell.execute_reply": "2023-06-22T12:13:14.115508Z"
}
},
"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/106349S_por.png</td>\n",
" <td>a man wearing a face mask while looking at a c...</td>\n",
" <td>[a man wearing a face mask while on the tv, a ...</td>\n",
" <td>1</td>\n",
" <td>yes</td>\n",
" <td>yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>data/102141_2_eng.png</td>\n",
" <td>a collage of images including a corona sign, a...</td>\n",
" <td>[the collage of photos includes a person in an...</td>\n",
" <td>1</td>\n",
" <td>no</td>\n",
" <td>yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</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 coats spray disinfection a pa...</td>\n",
" <td>2</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/106349S_por.png a man wearing a face mask while looking at a c... \n",
"1 data/102141_2_eng.png a collage of images including a corona sign, a... \n",
"2 data/102730_eng.png two people in blue coats spray disinfection a van \n",
"\n",
" 3_non-deterministic summary \\\n",
"0 [a man wearing a face mask while on the tv, a ... \n",
"1 [the collage of photos includes a person in an... \n",
"2 [two people with coats spray disinfection a pa... \n",
"\n",
" How many persons on the picture? Are there any politicians in the picture? \\\n",
"0 1 yes \n",
"1 1 no \n",
"2 2 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-22T12:13:14.120334Z",
"iopub.status.busy": "2023-06-22T12:13:14.119818Z",
"iopub.status.idle": "2023-06-22T12:13:14.126330Z",
"shell.execute_reply": "2023-06-22T12:13:14.125512Z"
}
},
"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.17"
},
"vscode": {
"interpreter": {
"hash": "f1142466f556ab37fe2d38e2897a16796906208adb09fea90ba58bdf8a56f0ba"
}
}
},
"nbformat": 4,
"nbformat_minor": 4
}