update notebook to include proper paths for sample data

Этот коммит содержится в:
Inga Ulusoy 2025-04-10 20:46:55 +02:00
родитель fc32343da8
Коммит a47ecb0575
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: BDC64F2E85CF8272

Просмотреть файл

@ -174,7 +174,7 @@
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
"To process the loaded images using the selected model, use the below code:" "To process the loaded images using the selected model, use the below code and substitute the path to your images:"
] ]
}, },
{ {
@ -184,7 +184,7 @@
"outputs": [], "outputs": [],
"source": [ "source": [
"image_dict = ammico.find_files(\n", "image_dict = ammico.find_files(\n",
" path = \"../../../test-images-politicians\",\n", " path = data_path,\n",
")" ")"
] ]
}, },
@ -221,7 +221,7 @@
" features_image_stacked,\n", " features_image_stacked,\n",
") = my_obj.parsing_images(\n", ") = my_obj.parsing_images(\n",
" model_type, \n", " model_type, \n",
" path_to_save_tensors=\"../../../test-images-politicians\",\n", " path_to_save_tensors=data_path,\n",
" )" " )"
] ]
}, },
@ -277,10 +277,10 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"image_example_query = \"../../../test-images-politicians/5e4c7722-d620-42ab-915e-9b1a048e2992Original.jpg\" \n", "image_example_query = data_path / \"img0.png\" \n",
"\n", "\n",
"search_query = [\n", "search_query = [\n",
" {\"image\": image_example_query}, # This is how looks image query, here `image_example_path` is the path to query image like \"data/test-crop-image.png\"\n", " {\"image\": str(image_example_query)}, # This is how looks image query, here `image_example_path` is the path to query image like \"data/test-crop-image.png\"\n",
"]" "]"
] ]
}, },
@ -388,12 +388,12 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"image_example_query = \"../../../test-images-politicians/5e4c7722-d620-42ab-915e-9b1a048e2992Original.jpg\" # creating the path to the image for the image query example\n", "image_example_query = data_path / \"img0.png\" # creating the path to the image for the image query example\n",
"image_example_query2 = \"../../../test-images-politicians/service-pnp-ppbd-00600-00608_150px.jpg\"\n", "image_example_query2 = data_path / \"img1.png\"\n",
"\n", "\n",
"search_query = [\n", "search_query = [\n",
" {\"image\": image_example_query}, # This is how looks image query, here `image_example_path` is the path to query image like \"data/test-crop-image.png\"\n", " {\"image\": str(image_example_query)}, # This is how looks image query, here `image_example_path` is the path to query image like \"data/test-crop-image.png\"\n",
" {\"image\": image_example_query2},\n", " {\"image\": str(image_example_query2)},\n",
"]" "]"
] ]
}, },
@ -464,7 +464,7 @@
"source": [ "source": [
"# convert to dataframe\n", "# convert to dataframe\n",
"df = ammico.get_dataframe(image_dict)\n", "df = ammico.get_dataframe(image_dict)\n",
"df" "df.head(10)"
] ]
}, },
{ {
@ -474,13 +474,20 @@
"outputs": [], "outputs": [],
"source": [ "source": [
"# save to csv\n", "# save to csv\n",
"df.to_csv(\"../../../test-images-politicians/data_out.csv\")" "df.to_csv(data_path / \"data_out.csv\")"
] ]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
} }
], ],
"metadata": { "metadata": {
"kernelspec": { "kernelspec": {
"display_name": "Python 3 (ipykernel)", "display_name": "ammico",
"language": "python", "language": "python",
"name": "python3" "name": "python3"
}, },
@ -494,7 +501,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.9.21" "version": "3.11.11"
} }
}, },
"nbformat": 4, "nbformat": 4,