adding floorplans, detail json, refactored the folders

This commit is contained in:
Kadir 2024-03-07 22:02:09 +00:00
parent e2f7998ee9
commit 46bb641026
215 changed files with 481 additions and 23 deletions

View file

@ -16,19 +16,20 @@
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/kadir/code/vqa/venv/lib/python3.12/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
"/Users/kadir/code/realestate/vqa/venv/lib/python3.12/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
" from .autonotebook import tqdm as notebook_tqdm\n"
]
}
],
"source": [
"from transformers import Pix2StructProcessor, Pix2StructForConditionalGeneration\n",
"from PIL import Image\n"
"from PIL import Image\n",
"import pandas as pd"
]
},
{
"cell_type": "code",
"execution_count": 45,
"execution_count": 2,
"id": "74e4a41f-2dfc-428e-8bca-4e9cc1c076c6",
"metadata": {},
"outputs": [],
@ -39,7 +40,7 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 3,
"id": "c24b1560-563b-4ff2-8744-4591ac1cc57b",
"metadata": {
"editable": true,
@ -59,7 +60,7 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": 11,
"id": "ea990e1f-a660-4efb-be48-d095ab05b50d",
"metadata": {
"editable": true,
@ -70,19 +71,61 @@
},
"outputs": [
{
"data": {
"text/plain": [
"'TITLE | <0x0A> Fifth Floor<0x0A>Floor Area 642 Sq Ft - 59.64 Sq M | Licence<0x0A>Remung<0x0A>Floor Area 642 Sq Ft - 59.64 Sq M <0x0A> Reception Room<0x0A>1210 x 12.10%<0x0A>39 x 39m | 1280 <0x0A> Balcony<0x0A>Reception Room<0x0A>1210 x 12.10%<0x0A>39 x 39m | 1280 <0x0A> Property<0x0A>Measurer | 1280 <0x0A> Ipaplus.com | 1280'"
]
},
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
"name": "stdout",
"output_type": "stream",
"text": [
"TITLE | <0x0A> Fifth Floor<0x0A>Floor Area 642 Sq Ft - 59.64 Sq M | LUX<0x0A>Floor Area 642 Sq Ft - 59.64 Sq M<0x0A>Reception Room<0x0A>1210×1210<0x0A>3.9×3.9m | 12.10×1210<0x0A>Reception Room<0x0A>3.9×3.9m | 12.10×1210<0x0A>Balcony<0x0A>1.5×4.5 | 1.5×4.5 <0x0A> Bathroom<0x0A>131°×102°<0x0A>4.0×3.1m | 1.40×2.7m | 1.40×2.7m <0x0A> Kitchen<0x0A>102°×710°<0x0A>3.1×2.4m | 1.10×3.1m | 1.00×3.1m <0x0A> Bedroom<0x0A>131°×810<0x0A>4.0×2.7m | 1.00×3.1m | 1.00×3.1m <0x0A> Kitchen<0x0A>102°×710<0x0A>3.1×2.4m | 1.00×3.1m | 1.00×3.1m <0x0A> Reception Room<0x0A>1210×1210<0x0A>3.9×3.9m | 1.50×4.5 | 1.00×3.5m <0x0A> Balcony<0x0A>1.5×4.5 | 1.50×4.5 | 1.00×3.5m\n"
]
}
],
"source": [
"x = processor.decode(predictions[0], skip_special_tokens=True)\n",
"x"
"print(x)"
]
},
{
"cell_type": "code",
"execution_count": 19,
"id": "b4a8b5fb-7cc5-441d-ad60-cff7c03a103e",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"TITLE | \n",
" Fifth Floor\n",
"Floor Area 642 Sq Ft - 59.64 Sq M | LUX\n",
"Floor Area 642 Sq Ft - 59.64 Sq M\n",
"Reception Room\n",
"1210×1210\n",
"3.9×3.9m | 12.10×1210\n",
"Reception Room\n",
"3.9×3.9m | 12.10×1210\n",
"Balcony\n",
"1.5×4.5 | 1.5×4.5 \n",
" Bathroom\n",
"131°×102°\n",
"4.0×3.1m | 1.40×2.7m | 1.40×2.7m \n",
" Kitchen\n",
"102°×710°\n",
"3.1×2.4m | 1.10×3.1m | 1.00×3.1m \n",
" Bedroom\n",
"131°×810\n",
"4.0×2.7m | 1.00×3.1m | 1.00×3.1m \n",
" Kitchen\n",
"102°×710\n",
"3.1×2.4m | 1.00×3.1m | 1.00×3.1m \n",
" Reception Room\n",
"1210×1210\n",
"3.9×3.9m | 1.50×4.5 | 1.00×3.5m \n",
" Balcony\n",
"1.5×4.5 | 1.50×4.5 | 1.00×3.5m\n"
]
}
],
"source": [
"x = r'\\d+.\\d*'"
]
},
{
@ -274,6 +317,103 @@
"\n",
"print(processor.batch_decode(generated_ids, skip_special_tokens=True))"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8b5b4fd0-1152-4834-9e3f-89be944bad16",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "4fef9f95-22c3-4fd9-907d-471520494533",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "1e56a1f7-c10f-4169-a7c1-a862937c22ba",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"id": "b6eec969-ebd6-4dac-8ca6-17569a9a3f8a",
"metadata": {},
"source": [
"# asd"
]
},
{
"cell_type": "code",
"execution_count": 16,
"id": "7c0a2360-5de2-475b-9d10-d84bb5bede17",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"a diagram of a floor plan of a two bedroom apartment\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/kadir/code/realestate/vqa/venv/lib/python3.12/site-packages/transformers/generation/configuration_utils.py:410: UserWarning: `do_sample` is set to `False`. However, `temperature` is set to `1.2` -- this flag is only used in sample-based generation modes. You should set `do_sample=True` or unset `temperature`.\n",
" warnings.warn(\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"this is an image of a floor plan of a two bedroom apartment\n"
]
}
],
"source": [
"from transformers import BlipProcessor, BlipForConditionalGeneration\n",
"\n",
"processor = BlipProcessor.from_pretrained(\"Salesforce/blip-image-captioning-large\")\n",
"model = BlipForConditionalGeneration.from_pretrained(\"Salesforce/blip-image-captioning-large\")\n",
"\n",
"# conditional image captioning\n",
"text = \"\"\n",
"inputs = processor(image, text, return_tensors=\"pt\")\n",
"\n",
"out = model.generate(**inputs)\n",
"print(processor.decode(out[0], skip_special_tokens=True))\n",
"\n",
"# unconditional image captioning\n",
"inputs = processor(image, return_tensors=\"pt\")\n",
"\n",
"out = model.generate(**inputs)\n",
"print(processor.decode(out[0], skip_special_tokens=True))"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "9f5a7d57-30f3-4b1b-bc07-dbf076d41792",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "41c23bf0-cf64-4c71-9bc0-57f78af609b4",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {