Compare commits
33 Commits
s426315-pa
...
master
Author | SHA1 | Date | |
---|---|---|---|
0659c57325 | |||
f462a9dedc | |||
5693adfd20 | |||
f74a2ad226 | |||
b907724bdb | |||
5669e78c7a | |||
707f2eab40 | |||
6ecb5c5bfc | |||
99d39e4f70 | |||
76573de6b5 | |||
8543c9404f | |||
2b914cfcdb | |||
f5962efa0c | |||
2e42033c55 | |||
3c1d749153 | |||
9469a7bb74 | |||
0b7530d08a | |||
1e127fa75a | |||
dfd1d8fe5a | |||
59df09cc2e | |||
17eb74ba6e | |||
eaf98f215a | |||
43f601b218 | |||
|
e886eed90c | ||
d926b8ad8f | |||
62f3ecc25e | |||
49bd3e07d4 | |||
51796b551c | |||
9518f9ddc5 | |||
3c9217c035 | |||
fec10501c0 | |||
57522b8bcf | |||
679d04022d |
21
Biedap/algorytm_uczenia.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#%%
|
||||||
|
|
||||||
|
from detecto import core, utils, visualize
|
||||||
|
import os
|
||||||
|
|
||||||
|
os.chdir(r"C:\Users\pittb\Documents\biedronkapp\BiedronkApp\biedronki_dataset")
|
||||||
|
dataset = core.Dataset('images/')
|
||||||
|
|
||||||
|
model = core.Model(['azjatycka','siedmiokropka'])
|
||||||
|
|
||||||
|
model.fit(dataset)
|
||||||
|
# %%
|
||||||
|
image = utils.read_image('images/4733127105_0a658bd317_c.jpg')
|
||||||
|
predictions = model.predict(image)
|
||||||
|
# %%
|
||||||
|
labels, boxes, scores = predictions
|
||||||
|
print(labels)
|
||||||
|
print(boxes)
|
||||||
|
print(scores)
|
||||||
|
visualize.show_labeled_image(image, boxes, labels)
|
||||||
|
# %%
|
255
Biedap/igiveup.ipynb
Normal file
@ -0,0 +1,255 @@
|
|||||||
|
{
|
||||||
|
"cells": [
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 1,
|
||||||
|
"id": "9083ebd9",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"ename": "KeyboardInterrupt",
|
||||||
|
"evalue": "",
|
||||||
|
"output_type": "error",
|
||||||
|
"traceback": [
|
||||||
|
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
||||||
|
"\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)",
|
||||||
|
"Input \u001b[0;32mIn [1]\u001b[0m, in \u001b[0;36m<cell line: 4>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mpandas\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01mpd\u001b[39;00m \n\u001b[1;32m 3\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mcv2\u001b[39;00m\n\u001b[0;32m----> 4\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mmatplotlib\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mpyplot\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01mplt\u001b[39;00m\n\u001b[1;32m 5\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mtensorflow\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01mtf\u001b[39;00m\n\u001b[1;32m 6\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mtensorflow\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mkeras\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mmodels\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m Sequential\n",
|
||||||
|
"File \u001b[0;32m~/anaconda3/lib/python3.9/site-packages/matplotlib/pyplot.py:49\u001b[0m, in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 47\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mcycler\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m cycler\n\u001b[1;32m 48\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mmatplotlib\u001b[39;00m\n\u001b[0;32m---> 49\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mmatplotlib\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mcolorbar\u001b[39;00m\n\u001b[1;32m 50\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mmatplotlib\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mimage\u001b[39;00m\n\u001b[1;32m 51\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mmatplotlib\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m _api\n",
|
||||||
|
"File \u001b[0;32m~/anaconda3/lib/python3.9/site-packages/matplotlib/colorbar.py:21\u001b[0m, in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 18\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mnumpy\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01mnp\u001b[39;00m\n\u001b[1;32m 20\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mmatplotlib\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01mmpl\u001b[39;00m\n\u001b[0;32m---> 21\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mmatplotlib\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m _api, collections, cm, colors, contour, ticker\n\u001b[1;32m 22\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mmatplotlib\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01martist\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01mmartist\u001b[39;00m\n\u001b[1;32m 23\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mmatplotlib\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mpatches\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01mmpatches\u001b[39;00m\n",
|
||||||
|
"File \u001b[0;32m~/anaconda3/lib/python3.9/site-packages/matplotlib/contour.py:13\u001b[0m, in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 11\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mmatplotlib\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01mmpl\u001b[39;00m\n\u001b[1;32m 12\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mmatplotlib\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m _api, docstring\n\u001b[0;32m---> 13\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mmatplotlib\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mbackend_bases\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m MouseButton\n\u001b[1;32m 14\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mmatplotlib\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mpath\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01mmpath\u001b[39;00m\n\u001b[1;32m 15\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mmatplotlib\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mticker\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01mticker\u001b[39;00m\n",
|
||||||
|
"File \u001b[0;32m~/anaconda3/lib/python3.9/site-packages/matplotlib/backend_bases.py:46\u001b[0m, in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 43\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mnumpy\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01mnp\u001b[39;00m\n\u001b[1;32m 45\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mmatplotlib\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01mmpl\u001b[39;00m\n\u001b[0;32m---> 46\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mmatplotlib\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m (\n\u001b[1;32m 47\u001b[0m _api, backend_tools \u001b[38;5;28;01mas\u001b[39;00m tools, cbook, colors, docstring, textpath,\n\u001b[1;32m 48\u001b[0m tight_bbox, transforms, widgets, get_backend, is_interactive, rcParams)\n\u001b[1;32m 49\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mmatplotlib\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01m_pylab_helpers\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m Gcf\n\u001b[1;32m 50\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mmatplotlib\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mbackend_managers\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m ToolManager\n",
|
||||||
|
"File \u001b[0;32m~/anaconda3/lib/python3.9/site-packages/matplotlib/widgets.py:22\u001b[0m, in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 20\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01m.\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m _api, backend_tools, cbook, colors, ticker\n\u001b[1;32m 21\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mlines\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m Line2D\n\u001b[0;32m---> 22\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mpatches\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m Circle, Rectangle, Ellipse\n\u001b[1;32m 23\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mtransforms\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m TransformedPatchPath\n\u001b[1;32m 26\u001b[0m \u001b[38;5;28;01mclass\u001b[39;00m \u001b[38;5;21;01mLockDraw\u001b[39;00m:\n",
|
||||||
|
"File \u001b[0;32m~/anaconda3/lib/python3.9/site-packages/matplotlib/patches.py:4143\u001b[0m, in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 4138\u001b[0m \u001b[38;5;124;03m\"\"\"Return the `.Bbox`.\"\"\"\u001b[39;00m\n\u001b[1;32m 4139\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m transforms\u001b[38;5;241m.\u001b[39mBbox\u001b[38;5;241m.\u001b[39mfrom_bounds(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_x, \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_y,\n\u001b[1;32m 4140\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_width, \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_height)\n\u001b[0;32m-> 4143\u001b[0m \u001b[38;5;28;01mclass\u001b[39;00m \u001b[38;5;21;01mFancyArrowPatch\u001b[39;00m(Patch):\n\u001b[1;32m 4144\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 4145\u001b[0m \u001b[38;5;124;03m A fancy arrow patch. It draws an arrow using the `ArrowStyle`.\u001b[39;00m\n\u001b[1;32m 4146\u001b[0m \n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 4149\u001b[0m \u001b[38;5;124;03m does not change when the axis is moved or zoomed.\u001b[39;00m\n\u001b[1;32m 4150\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[1;32m 4151\u001b[0m _edge_default \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mTrue\u001b[39;00m\n",
|
||||||
|
"File \u001b[0;32m~/anaconda3/lib/python3.9/site-packages/matplotlib/artist.py:119\u001b[0m, in \u001b[0;36mArtist.__init_subclass__\u001b[0;34m(cls)\u001b[0m\n\u001b[1;32m 117\u001b[0m \u001b[38;5;28mcls\u001b[39m\u001b[38;5;241m.\u001b[39mset\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__name__\u001b[39m \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mset\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 118\u001b[0m \u001b[38;5;28mcls\u001b[39m\u001b[38;5;241m.\u001b[39mset\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__qualname__\u001b[39m \u001b[38;5;241m=\u001b[39m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[38;5;28mcls\u001b[39m\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__qualname__\u001b[39m\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m.set\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m--> 119\u001b[0m \u001b[38;5;28;43mcls\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_update_set_signature_and_docstring\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n",
|
||||||
|
"File \u001b[0;32m~/anaconda3/lib/python3.9/site-packages/matplotlib/artist.py:147\u001b[0m, in \u001b[0;36mArtist._update_set_signature_and_docstring\u001b[0;34m(cls)\u001b[0m\n\u001b[1;32m 137\u001b[0m \u001b[38;5;28mcls\u001b[39m\u001b[38;5;241m.\u001b[39mset\u001b[38;5;241m.\u001b[39m__signature__ \u001b[38;5;241m=\u001b[39m Signature(\n\u001b[1;32m 138\u001b[0m [Parameter(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mself\u001b[39m\u001b[38;5;124m\"\u001b[39m, Parameter\u001b[38;5;241m.\u001b[39mPOSITIONAL_OR_KEYWORD),\n\u001b[1;32m 139\u001b[0m \u001b[38;5;241m*\u001b[39m[Parameter(prop, Parameter\u001b[38;5;241m.\u001b[39mKEYWORD_ONLY, default\u001b[38;5;241m=\u001b[39m_UNSET)\n\u001b[1;32m 140\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m prop \u001b[38;5;129;01min\u001b[39;00m ArtistInspector(\u001b[38;5;28mcls\u001b[39m)\u001b[38;5;241m.\u001b[39mget_setters()\n\u001b[1;32m 141\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m prop \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;129;01min\u001b[39;00m Artist\u001b[38;5;241m.\u001b[39m_PROPERTIES_EXCLUDED_FROM_SET]])\n\u001b[1;32m 142\u001b[0m \u001b[38;5;28mcls\u001b[39m\u001b[38;5;241m.\u001b[39mset\u001b[38;5;241m.\u001b[39m_autogenerated_signature \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mTrue\u001b[39;00m\n\u001b[1;32m 144\u001b[0m \u001b[38;5;28mcls\u001b[39m\u001b[38;5;241m.\u001b[39mset\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__doc__\u001b[39m \u001b[38;5;241m=\u001b[39m (\n\u001b[1;32m 145\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mSet multiple properties at once.\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 146\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mSupported properties are\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m--> 147\u001b[0m \u001b[38;5;241m+\u001b[39m \u001b[43mkwdoc\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mcls\u001b[39;49m\u001b[43m)\u001b[49m)\n",
|
||||||
|
"File \u001b[0;32m~/anaconda3/lib/python3.9/site-packages/matplotlib/artist.py:1749\u001b[0m, in \u001b[0;36mkwdoc\u001b[0;34m(artist)\u001b[0m\n\u001b[1;32m 1731\u001b[0m \u001b[38;5;124mr\u001b[39m\u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 1732\u001b[0m \u001b[38;5;124;03mInspect an `~matplotlib.artist.Artist` class (using `.ArtistInspector`) and\u001b[39;00m\n\u001b[1;32m 1733\u001b[0m \u001b[38;5;124;03mreturn information about its settable properties and their current values.\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 1744\u001b[0m \u001b[38;5;124;03m use in Sphinx) if it is True.\u001b[39;00m\n\u001b[1;32m 1745\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 1746\u001b[0m ai \u001b[38;5;241m=\u001b[39m ArtistInspector(artist)\n\u001b[1;32m 1747\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m (\u001b[38;5;124m'\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;124m'\u001b[39m\u001b[38;5;241m.\u001b[39mjoin(ai\u001b[38;5;241m.\u001b[39mpprint_setters_rest(leadingspace\u001b[38;5;241m=\u001b[39m\u001b[38;5;241m4\u001b[39m))\n\u001b[1;32m 1748\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m mpl\u001b[38;5;241m.\u001b[39mrcParams[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mdocstring.hardcopy\u001b[39m\u001b[38;5;124m'\u001b[39m] \u001b[38;5;28;01melse\u001b[39;00m\n\u001b[0;32m-> 1749\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mProperties:\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;124m'\u001b[39m \u001b[38;5;241m+\u001b[39m \u001b[38;5;124m'\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;124m'\u001b[39m\u001b[38;5;241m.\u001b[39mjoin(\u001b[43mai\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mpprint_setters\u001b[49m\u001b[43m(\u001b[49m\u001b[43mleadingspace\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;241;43m4\u001b[39;49m\u001b[43m)\u001b[49m))\n",
|
||||||
|
"File \u001b[0;32m~/anaconda3/lib/python3.9/site-packages/matplotlib/artist.py:1509\u001b[0m, in \u001b[0;36mArtistInspector.pprint_setters\u001b[0;34m(self, prop, leadingspace)\u001b[0m\n\u001b[1;32m 1506\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;124m'\u001b[39m\u001b[38;5;132;01m%s\u001b[39;00m\u001b[38;5;132;01m%s\u001b[39;00m\u001b[38;5;124m: \u001b[39m\u001b[38;5;132;01m%s\u001b[39;00m\u001b[38;5;124m'\u001b[39m \u001b[38;5;241m%\u001b[39m (pad, prop, accepts)\n\u001b[1;32m 1508\u001b[0m lines \u001b[38;5;241m=\u001b[39m []\n\u001b[0;32m-> 1509\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m prop \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28msorted\u001b[39m(\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget_setters\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m):\n\u001b[1;32m 1510\u001b[0m accepts \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mget_valid_values(prop)\n\u001b[1;32m 1511\u001b[0m name \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39maliased_name(prop)\n",
|
||||||
|
"File \u001b[0;32m~/anaconda3/lib/python3.9/site-packages/matplotlib/artist.py:1435\u001b[0m, in \u001b[0;36mArtistInspector.get_setters\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 1432\u001b[0m \u001b[38;5;28;01mcontinue\u001b[39;00m\n\u001b[1;32m 1433\u001b[0m func \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mgetattr\u001b[39m(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mo, name)\n\u001b[1;32m 1434\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m (\u001b[38;5;129;01mnot\u001b[39;00m callable(func)\n\u001b[0;32m-> 1435\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mlen\u001b[39m(\u001b[43minspect\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msignature\u001b[49m\u001b[43m(\u001b[49m\u001b[43mfunc\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241m.\u001b[39mparameters) \u001b[38;5;241m<\u001b[39m \u001b[38;5;241m2\u001b[39m\n\u001b[1;32m 1436\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mis_alias(func)):\n\u001b[1;32m 1437\u001b[0m \u001b[38;5;28;01mcontinue\u001b[39;00m\n\u001b[1;32m 1438\u001b[0m setters\u001b[38;5;241m.\u001b[39mappend(name[\u001b[38;5;241m4\u001b[39m:])\n",
|
||||||
|
"File \u001b[0;32m~/anaconda3/lib/python3.9/inspect.py:3113\u001b[0m, in \u001b[0;36msignature\u001b[0;34m(obj, follow_wrapped)\u001b[0m\n\u001b[1;32m 3111\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21msignature\u001b[39m(obj, \u001b[38;5;241m*\u001b[39m, follow_wrapped\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m):\n\u001b[1;32m 3112\u001b[0m \u001b[38;5;124;03m\"\"\"Get a signature object for the passed callable.\"\"\"\u001b[39;00m\n\u001b[0;32m-> 3113\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mSignature\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mfrom_callable\u001b[49m\u001b[43m(\u001b[49m\u001b[43mobj\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mfollow_wrapped\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mfollow_wrapped\u001b[49m\u001b[43m)\u001b[49m\n",
|
||||||
|
"File \u001b[0;32m~/anaconda3/lib/python3.9/inspect.py:2862\u001b[0m, in \u001b[0;36mSignature.from_callable\u001b[0;34m(cls, obj, follow_wrapped)\u001b[0m\n\u001b[1;32m 2859\u001b[0m \u001b[38;5;129m@classmethod\u001b[39m\n\u001b[1;32m 2860\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mfrom_callable\u001b[39m(\u001b[38;5;28mcls\u001b[39m, obj, \u001b[38;5;241m*\u001b[39m, follow_wrapped\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m):\n\u001b[1;32m 2861\u001b[0m \u001b[38;5;124;03m\"\"\"Constructs Signature for the given callable object.\"\"\"\u001b[39;00m\n\u001b[0;32m-> 2862\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43m_signature_from_callable\u001b[49m\u001b[43m(\u001b[49m\u001b[43mobj\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43msigcls\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mcls\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2863\u001b[0m \u001b[43m \u001b[49m\u001b[43mfollow_wrapper_chains\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mfollow_wrapped\u001b[49m\u001b[43m)\u001b[49m\n",
|
||||||
|
"File \u001b[0;32m~/anaconda3/lib/python3.9/inspect.py:2325\u001b[0m, in \u001b[0;36m_signature_from_callable\u001b[0;34m(obj, follow_wrapper_chains, skip_bound_arg, sigcls)\u001b[0m\n\u001b[1;32m 2320\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m sig\u001b[38;5;241m.\u001b[39mreplace(parameters\u001b[38;5;241m=\u001b[39mnew_params)\n\u001b[1;32m 2322\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m isfunction(obj) \u001b[38;5;129;01mor\u001b[39;00m _signature_is_functionlike(obj):\n\u001b[1;32m 2323\u001b[0m \u001b[38;5;66;03m# If it's a pure Python function, or an object that is duck type\u001b[39;00m\n\u001b[1;32m 2324\u001b[0m \u001b[38;5;66;03m# of a Python function (Cython functions, for instance), then:\u001b[39;00m\n\u001b[0;32m-> 2325\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43m_signature_from_function\u001b[49m\u001b[43m(\u001b[49m\u001b[43msigcls\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mobj\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2326\u001b[0m \u001b[43m \u001b[49m\u001b[43mskip_bound_arg\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mskip_bound_arg\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 2328\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m _signature_is_builtin(obj):\n\u001b[1;32m 2329\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m _signature_from_builtin(sigcls, obj,\n\u001b[1;32m 2330\u001b[0m skip_bound_arg\u001b[38;5;241m=\u001b[39mskip_bound_arg)\n",
|
||||||
|
"File \u001b[0;32m~/anaconda3/lib/python3.9/inspect.py:2196\u001b[0m, in \u001b[0;36m_signature_from_function\u001b[0;34m(cls, func, skip_bound_arg)\u001b[0m\n\u001b[1;32m 2194\u001b[0m kind \u001b[38;5;241m=\u001b[39m _POSITIONAL_ONLY \u001b[38;5;28;01mif\u001b[39;00m posonly_left \u001b[38;5;28;01melse\u001b[39;00m _POSITIONAL_OR_KEYWORD\n\u001b[1;32m 2195\u001b[0m annotation \u001b[38;5;241m=\u001b[39m annotations\u001b[38;5;241m.\u001b[39mget(name, _empty)\n\u001b[0;32m-> 2196\u001b[0m parameters\u001b[38;5;241m.\u001b[39mappend(\u001b[43mParameter\u001b[49m\u001b[43m(\u001b[49m\u001b[43mname\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mannotation\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mannotation\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2197\u001b[0m \u001b[43m \u001b[49m\u001b[43mkind\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mkind\u001b[49m\u001b[43m)\u001b[49m)\n\u001b[1;32m 2198\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m posonly_left:\n\u001b[1;32m 2199\u001b[0m posonly_left \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m=\u001b[39m \u001b[38;5;241m1\u001b[39m\n",
|
||||||
|
"File \u001b[0;32m~/anaconda3/lib/python3.9/inspect.py:2518\u001b[0m, in \u001b[0;36mParameter.__init__\u001b[0;34m(self, name, kind, default, annotation)\u001b[0m\n\u001b[1;32m 2515\u001b[0m msg \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mname must be a str, not a \u001b[39m\u001b[38;5;132;01m{}\u001b[39;00m\u001b[38;5;124m'\u001b[39m\u001b[38;5;241m.\u001b[39mformat(\u001b[38;5;28mtype\u001b[39m(name)\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__name__\u001b[39m)\n\u001b[1;32m 2516\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mTypeError\u001b[39;00m(msg)\n\u001b[0;32m-> 2518\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[43mname\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;241;43m0\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m==\u001b[39;49m\u001b[43m \u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43m.\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m \u001b[38;5;129;01mand\u001b[39;00m name[\u001b[38;5;241m1\u001b[39m:]\u001b[38;5;241m.\u001b[39misdigit():\n\u001b[1;32m 2519\u001b[0m \u001b[38;5;66;03m# These are implicit arguments generated by comprehensions. In\u001b[39;00m\n\u001b[1;32m 2520\u001b[0m \u001b[38;5;66;03m# order to provide a friendlier interface to users, we recast\u001b[39;00m\n\u001b[1;32m 2521\u001b[0m \u001b[38;5;66;03m# their name as \"implicitN\" and treat them as positional-only.\u001b[39;00m\n\u001b[1;32m 2522\u001b[0m \u001b[38;5;66;03m# See issue 19611.\u001b[39;00m\n\u001b[1;32m 2523\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_kind \u001b[38;5;241m!=\u001b[39m _POSITIONAL_OR_KEYWORD:\n\u001b[1;32m 2524\u001b[0m msg \u001b[38;5;241m=\u001b[39m (\n\u001b[1;32m 2525\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mimplicit arguments must be passed as \u001b[39m\u001b[38;5;124m'\u001b[39m\n\u001b[1;32m 2526\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mpositional or keyword arguments, not \u001b[39m\u001b[38;5;132;01m{}\u001b[39;00m\u001b[38;5;124m'\u001b[39m\n\u001b[1;32m 2527\u001b[0m )\n",
|
||||||
|
"\u001b[0;31mKeyboardInterrupt\u001b[0m: "
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"import numpy as np \n",
|
||||||
|
"import pandas as pd \n",
|
||||||
|
"import cv2\n",
|
||||||
|
"import matplotlib.pyplot as plt\n",
|
||||||
|
"import tensorflow as tf\n",
|
||||||
|
"from tensorflow.keras.models import Sequential\n",
|
||||||
|
"from tensorflow.keras.layers import Dense, Flatten, Dropout, Activation, Conv2D, MaxPooling2D\n",
|
||||||
|
"\n",
|
||||||
|
"# Input data files are available in the \"../input/\" directory.\n",
|
||||||
|
"# For example, running this (by clicking run or pressing Shift+Enter) will list the files in the input directory\n",
|
||||||
|
"\n",
|
||||||
|
"import os\n",
|
||||||
|
"print(os.listdir(\"Biedap/input\"))\n",
|
||||||
|
"\n",
|
||||||
|
"import zipfile\n",
|
||||||
|
"\n",
|
||||||
|
"with zipfile.ZipFile(\"Biedap/input/train.zip\",\"r\") as z:\n",
|
||||||
|
" z.extractall(\".\")\n",
|
||||||
|
" \n",
|
||||||
|
"with zipfile.ZipFile(\"Biedap/input/test1.zip\",\"r\") as z:\n",
|
||||||
|
" z.extractall(\".\")\n",
|
||||||
|
"\n",
|
||||||
|
"# Any results you write to the current directory are saved as output.\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "e1a09825",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"main_dir = \"Biedap\"\n",
|
||||||
|
"train_dir = \"train\"\n",
|
||||||
|
"path = os.path.join(main_dir,train_dir)\n",
|
||||||
|
"\n",
|
||||||
|
"for p in os.listdir(path):\n",
|
||||||
|
" category = p.split(\".\")[0]\n",
|
||||||
|
" img_array = cv2.imread(os.path.join(path,p),cv2.IMREAD_GRAYSCALE)\n",
|
||||||
|
" new_img_array = cv2.resize(img_array, dsize=(80, 80))\n",
|
||||||
|
" plt.imshow(new_img_array,cmap=\"gray\")\n",
|
||||||
|
" break"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "9248ca56",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"X = []\n",
|
||||||
|
"y = []\n",
|
||||||
|
"convert = lambda category : int(category == 'dog')\n",
|
||||||
|
"def create_test_data(path):\n",
|
||||||
|
" for p in os.listdir(path):\n",
|
||||||
|
" category = p.split(\".\")[0]\n",
|
||||||
|
" category = convert(category)\n",
|
||||||
|
" img_array = cv2.imread(os.path.join(path,p),cv2.IMREAD_GRAYSCALE)\n",
|
||||||
|
" new_img_array = cv2.resize(img_array, dsize=(80, 80))\n",
|
||||||
|
" X.append(new_img_array)\n",
|
||||||
|
" y.append(category) "
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "8e9925cc",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"create_test_data(path)\n",
|
||||||
|
"X = np.array(X).reshape(-1, 80,80,1)\n",
|
||||||
|
"y = np.array(y)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "20083f26",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"X = X/255.0"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "bdf7b8df",
|
||||||
|
"metadata": {
|
||||||
|
"scrolled": true
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"model = Sequential()\n",
|
||||||
|
"# Adds a densely-connected layer with 64 units to the model:\n",
|
||||||
|
"model.add(Conv2D(64,(3,3), activation = 'relu', input_shape = X.shape[1:]))\n",
|
||||||
|
"model.add(MaxPooling2D(pool_size = (2,2)))\n",
|
||||||
|
"# Add another:\n",
|
||||||
|
"model.add(Conv2D(64,(3,3), activation = 'relu'))\n",
|
||||||
|
"model.add(MaxPooling2D(pool_size = (2,2)))\n",
|
||||||
|
"\n",
|
||||||
|
"model.add(Flatten())\n",
|
||||||
|
"model.add(Dense(64, activation='relu'))\n",
|
||||||
|
"# Add a softmax layer with 10 output units:\n",
|
||||||
|
"model.add(Dense(1, activation='sigmoid'))\n",
|
||||||
|
"\n",
|
||||||
|
"model.compile(optimizer=\"adam\",\n",
|
||||||
|
" loss='binary_crossentropy',\n",
|
||||||
|
" metrics=['accuracy'])"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "00ffe16a",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"model.fit(X, y, epochs=10, batch_size=32, validation_split=0.2)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "6790491b",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"train_dir = \"test1\"\n",
|
||||||
|
"path = os.path.join(main_dir,train_dir)\n",
|
||||||
|
"#os.listdir(path)\n",
|
||||||
|
"\n",
|
||||||
|
"X_test = []\n",
|
||||||
|
"id_line = []\n",
|
||||||
|
"def create_test1_data(path):\n",
|
||||||
|
" for p in os.listdir(path):\n",
|
||||||
|
" id_line.append(p.split(\".\")[0])\n",
|
||||||
|
" img_array = cv2.imread(os.path.join(path,p),cv2.IMREAD_GRAYSCALE)\n",
|
||||||
|
" new_img_array = cv2.resize(img_array, dsize=(80, 80))\n",
|
||||||
|
" X_test.append(new_img_array)\n",
|
||||||
|
"create_test1_data(path)\n",
|
||||||
|
"X_test = np.array(X_test).reshape(-1,80,80,1)\n",
|
||||||
|
"X_test = X_test/255"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "c73fc88b",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"predictions = model.predict(X_test)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "d28edd26",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"predicted_val = [int(round(p[0])) for p in predictions]"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "861ebb64",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"submission_df = pd.DataFrame({'id':id_line, 'label':predicted_val})"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "58e57ec7",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"submission_df.to_csv(\"submission.csv\", index=False)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "ec9cdc21",
|
||||||
|
"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.12"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nbformat": 4,
|
||||||
|
"nbformat_minor": 5
|
||||||
|
}
|
2
Biedap/readme.md
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
Plik igiveup.ipynb zawiera wczesną wersję algorytmu uczenia maszynowego opracowanego na podstawie jednego z rozwiązań popularnego zagadnienia ,,Dogs vs Cats" umieszczonego na stronie Kaggle.com. Datasety pochodzą ze strony: https://www.kaggle.com/competitions/dogs-vs-cats/data .
|
||||||
|
Plik algorytm_uczenia.py zawiera drugi testowany algorytm uczenia maszynowego. Został on opracowany na podstawie instrukcji ze strony https://towardsdatascience.com/build-a-custom-trained-object-detection-model-with-5-lines-of-code-713ba7f6c0fb.
|
0
Biedap/test1
Normal file
0
Jenkinsfile
vendored
Normal file
@ -1,3 +1 @@
|
|||||||
:)
|
print('hej')
|
||||||
|
|
||||||
:(
|
|
12
README.md
@ -1,6 +1,12 @@
|
|||||||
# BiedronkApp
|
# BiedronkApp
|
||||||
|
|
||||||
Projekt z przedmiotu Systemy informatyczne.
|
## Motywacja rynkowa
|
||||||
|
Rozpoczynając od powodów najbardziej ryzykownych dla utrzymania firmy, chcielibyśmy przedstawić motywację rynkową dla stworzenia naszej innowacji. Biedronki azjatyckie to gatunek chrząszcza z rodziny biedronkowatych, który w Polsce został określony gatunkiem inwazyjnym zagrażającym światowej bioróżnorodności. W Poznaniu, jako po raz pierwszy w Polsce, stwierdzono jego obecność w 2006 roku. W odróżnieniu od innych biedronek (w tym biedronek siedmiokropek - naszych polskich), zauważalny jest wzrost statystyk w przypadku ukąszeń ludzi, które w części przypadków wywołują reakcje alergiczne dotyczące skóry i dróg oddechowych. Jesienią rozpoczyna się przygotowywanie tego gatunku do odbycia hibernacji, dlatego też szukają schronienia w naszych domach, wchodząc nieproszone i pojawiając się w dużych ilościach na ścianach budynków. Z tego powodu co raz częściej Polacy pytają się: w jaki sposób pozbyć się biedronek, które mogą być dla nas szkodliwe?
|
||||||
|
|
||||||
# Opis testowy
|
Na to zapotrzebowanie odpowiada nasza aplikacja. Dzięki najbardziej przyjaznej dla użytkownika drodze - zrobieniu zdjęcia - dostajemy odpowiedź na pytanie czy to jest biedronka azjatycka, czy może inny insekt. Wraz z klasyfikacją otrzymujemy dodatkowe informacje, takie jak zestaw cech różnicujących ten insekt, rozpoznawanie i postępowanie w przypadku reakcji alergicznych.
|
||||||
testtesttesttes
|
|
||||||
|
## Wartość produktowa
|
||||||
|
Przechodząc płynnie do wartości naszego produktu - aplikacji mobilnej działającej na zaimplementowanym modelu różnicującym gatunki biedronek, warto wspomnieć o jego unikalnej propozycji wartości (UVP). Naszą grupą docelową klientów są mieszkańcy miast, którzy najczęściej zmagają się z plagami biedronek azjatyckich, jednocześnie są grupą, która najwięcej korzysta z urządzeń mobilnych, co ułatwia im korzystanie z aplikacji. Kluczowym benefitem funkcjonalności naszej aplikacji jest jej przystępność i łatwość obsługi, brak kosztów dla użytkownika oraz odpowiedź na współczesne problemy dużej części społeczeństwa.
|
||||||
|
|
||||||
|
## Zespół
|
||||||
|
Nasz zespół tworzący BiedronkAPP jest gronem specjalistów w dziedzinie Machine Learning, którzy wraz z współpracą zestawu zdjęć udostępnionych przez biologów stworzył model definiujący rodzaj biedronki, której zdjęcie wstawimy do aplikacji. Płynna znajomość języka angielskiego pozwala nam rozważać wejście na rynek europejski.
|
152
algorytm_biedronki.py
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
#%%
|
||||||
|
|
||||||
|
from tensorflow.keras.layers import Input, Lambda, Dense, Flatten,Dropout
|
||||||
|
from tensorflow.keras.models import Model
|
||||||
|
from tensorflow.keras.applications.vgg19 import VGG19
|
||||||
|
from tensorflow.keras.applications.vgg19 import preprocess_input
|
||||||
|
from tensorflow.keras.preprocessing import image
|
||||||
|
from tensorflow.keras.preprocessing.image import ImageDataGenerator
|
||||||
|
from tensorflow.keras.models import Sequential
|
||||||
|
import numpy as np
|
||||||
|
import pandas as pd
|
||||||
|
import os
|
||||||
|
import cv2
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
# %%
|
||||||
|
os.chdir(r"C:\Users\pittb\Documents\biedronkapp_2.0\BiedronkApp\biedronki_dataset")
|
||||||
|
train_path="train"
|
||||||
|
test_path="test"
|
||||||
|
# %%
|
||||||
|
x_train=[]
|
||||||
|
|
||||||
|
for folder in os.listdir(train_path):
|
||||||
|
|
||||||
|
sub_path=train_path+"/"+folder
|
||||||
|
|
||||||
|
for img in os.listdir(sub_path):
|
||||||
|
image_path=sub_path+"/"+img
|
||||||
|
|
||||||
|
img_arr=cv2.imread(image_path)
|
||||||
|
|
||||||
|
img_arr=cv2.resize(img_arr,(224,224))
|
||||||
|
|
||||||
|
x_train.append(img_arr)
|
||||||
|
|
||||||
|
x_test=[]
|
||||||
|
|
||||||
|
for folder in os.listdir(test_path):
|
||||||
|
|
||||||
|
sub_path=test_path+"/"+folder
|
||||||
|
|
||||||
|
for img in os.listdir(sub_path):
|
||||||
|
|
||||||
|
image_path=sub_path+"/"+img
|
||||||
|
|
||||||
|
img_arr=cv2.imread(image_path)
|
||||||
|
|
||||||
|
img_arr=cv2.resize(img_arr,(224,224))
|
||||||
|
|
||||||
|
x_test.append(img_arr)
|
||||||
|
# %%
|
||||||
|
train_x=np.array(x_train)
|
||||||
|
test_x=np.array(x_test)
|
||||||
|
|
||||||
|
train_x=train_x/255.0
|
||||||
|
test_x=test_x/255.0
|
||||||
|
# %%
|
||||||
|
train_datagen = ImageDataGenerator(rescale = 1./255)
|
||||||
|
test_datagen = ImageDataGenerator(rescale = 1./255)
|
||||||
|
# %%
|
||||||
|
training_set = train_datagen.flow_from_directory(train_path,
|
||||||
|
target_size = (224, 224),
|
||||||
|
batch_size = 32,
|
||||||
|
class_mode = 'sparse')
|
||||||
|
test_set = test_datagen.flow_from_directory(test_path,
|
||||||
|
target_size = (224, 224),
|
||||||
|
batch_size = 32,
|
||||||
|
class_mode = 'sparse')
|
||||||
|
# %%
|
||||||
|
train_y=training_set.classes
|
||||||
|
test_y=test_set.classes
|
||||||
|
|
||||||
|
training_set.class_indices
|
||||||
|
|
||||||
|
train_y.shape,test_y.shape
|
||||||
|
# %%
|
||||||
|
IMAGE_SIZE = [224, 224]
|
||||||
|
|
||||||
|
vgg = VGG19(input_shape=IMAGE_SIZE + [3], weights='imagenet', include_top=False)
|
||||||
|
|
||||||
|
for layer in vgg.layers:
|
||||||
|
layer.trainable = False
|
||||||
|
|
||||||
|
# %%
|
||||||
|
# our layers - you can add more if you want
|
||||||
|
x = Flatten()(vgg.output)
|
||||||
|
|
||||||
|
prediction = Dense(2, activation='softmax')(x)
|
||||||
|
# %%
|
||||||
|
# create a model object
|
||||||
|
model = Model(inputs=vgg.input, outputs=prediction)
|
||||||
|
|
||||||
|
# view the structure of the model
|
||||||
|
model.summary()
|
||||||
|
# %%
|
||||||
|
model.compile(
|
||||||
|
loss='sparse_categorical_crossentropy',
|
||||||
|
optimizer="adam",
|
||||||
|
metrics=['accuracy']
|
||||||
|
)
|
||||||
|
# %%
|
||||||
|
from tensorflow.keras.callbacks import EarlyStopping
|
||||||
|
early_stop=EarlyStopping(monitor='val_loss',mode='min',verbose=1,patience=5)
|
||||||
|
# %%
|
||||||
|
history = model.fit(
|
||||||
|
train_x,
|
||||||
|
train_y,
|
||||||
|
epochs=10,
|
||||||
|
callbacks=[early_stop],
|
||||||
|
batch_size=32,shuffle=True)
|
||||||
|
# %%
|
||||||
|
plt.plot(history.history['loss'], label='train loss')
|
||||||
|
plt.legend()
|
||||||
|
|
||||||
|
plt.savefig('vgg-loss-rps-1.png')
|
||||||
|
plt.show()
|
||||||
|
# %%
|
||||||
|
# accuracies
|
||||||
|
plt.plot(history.history['accuracy'], label='train acc')
|
||||||
|
plt.legend()
|
||||||
|
|
||||||
|
plt.savefig('vgg-acc-rps-1.png')
|
||||||
|
plt.show()
|
||||||
|
# %%
|
||||||
|
model.evaluate(test_x,test_y,batch_size=6)
|
||||||
|
# %%
|
||||||
|
from sklearn.metrics import accuracy_score,classification_report,confusion_matrix
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
y_pred=model.predict(test_x)
|
||||||
|
y_pred=np.argmax(y_pred,axis=1)
|
||||||
|
|
||||||
|
accuracy_score(y_pred,test_y)
|
||||||
|
|
||||||
|
print(classification_report(y_pred,test_y))
|
||||||
|
# %%
|
||||||
|
img_path = r"C:\Users\pittb\Documents\biedronkapp_2.0\BiedronkApp\biedronki_dataset\test\azjatyckie\78687-Biedronki-azjatyckie-Czy-sa-grozne-fot.-cocoparisienne---Pixabay.jpg"
|
||||||
|
|
||||||
|
img_nump = np.array(cv2.imread(img_path))
|
||||||
|
img_nump = cv2.resize(img_nump,(224,224))
|
||||||
|
img_nump = img_nump/255.0
|
||||||
|
img_nump = img_nump[np.newaxis,...]
|
||||||
|
|
||||||
|
pr = model.predict(img_nump)
|
||||||
|
print(pr)
|
||||||
|
print(np.argmax(pr,axis=1))
|
||||||
|
# %%
|
||||||
|
# %%
|
||||||
|
model.save('saved_model/my_model')
|
||||||
|
|
||||||
|
# %%
|
||||||
|
|
||||||
|
# %%
|
119
algorytm_biedronki_wersja_z_wyuczonym_modelem.py
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
#%%
|
||||||
|
from tensorflow.keras.layers import Input, Lambda, Dense, Flatten,Dropout
|
||||||
|
from tensorflow.keras.models import Model
|
||||||
|
from tensorflow.keras.applications.vgg19 import VGG19
|
||||||
|
from tensorflow.keras.applications.vgg19 import preprocess_input
|
||||||
|
from tensorflow.keras.preprocessing import image
|
||||||
|
from tensorflow.keras.preprocessing.image import ImageDataGenerator
|
||||||
|
from tensorflow.keras.models import Sequential
|
||||||
|
import numpy as np
|
||||||
|
import pandas as pd
|
||||||
|
import os
|
||||||
|
import cv2
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
import keras
|
||||||
|
|
||||||
|
# %%
|
||||||
|
os.chdir(r"C:\Users\pittb\Documents\biedronkapp_2.0\BiedronkApp\biedronki_dataset")
|
||||||
|
train_path="train"
|
||||||
|
test_path="test"
|
||||||
|
# %%
|
||||||
|
x_train=[]
|
||||||
|
|
||||||
|
for folder in os.listdir(train_path):
|
||||||
|
|
||||||
|
sub_path=train_path+"/"+folder
|
||||||
|
|
||||||
|
for img in os.listdir(sub_path):
|
||||||
|
image_path=sub_path+"/"+img
|
||||||
|
|
||||||
|
img_arr=cv2.imread(image_path)
|
||||||
|
|
||||||
|
img_arr=cv2.resize(img_arr,(224,224))
|
||||||
|
|
||||||
|
x_train.append(img_arr)
|
||||||
|
|
||||||
|
x_test=[]
|
||||||
|
|
||||||
|
for folder in os.listdir(test_path):
|
||||||
|
|
||||||
|
sub_path=test_path+"/"+folder
|
||||||
|
|
||||||
|
for img in os.listdir(sub_path):
|
||||||
|
|
||||||
|
image_path=sub_path+"/"+img
|
||||||
|
|
||||||
|
img_arr=cv2.imread(image_path)
|
||||||
|
|
||||||
|
img_arr=cv2.resize(img_arr,(224,224))
|
||||||
|
|
||||||
|
x_test.append(img_arr)
|
||||||
|
# %%
|
||||||
|
train_x=np.array(x_train)
|
||||||
|
test_x=np.array(x_test)
|
||||||
|
|
||||||
|
train_x=train_x/255.0
|
||||||
|
test_x=test_x/255.0
|
||||||
|
# %%
|
||||||
|
train_datagen = ImageDataGenerator(rescale = 1./255)
|
||||||
|
test_datagen = ImageDataGenerator(rescale = 1./255)
|
||||||
|
# %%
|
||||||
|
training_set = train_datagen.flow_from_directory(train_path,
|
||||||
|
target_size = (224, 224),
|
||||||
|
batch_size = 32,
|
||||||
|
class_mode = 'sparse')
|
||||||
|
test_set = test_datagen.flow_from_directory(test_path,
|
||||||
|
target_size = (224, 224),
|
||||||
|
batch_size = 32,
|
||||||
|
class_mode = 'sparse')
|
||||||
|
# %%
|
||||||
|
train_y=training_set.classes
|
||||||
|
test_y=test_set.classes
|
||||||
|
|
||||||
|
training_set.class_indices
|
||||||
|
|
||||||
|
train_y.shape,test_y.shape
|
||||||
|
# %%
|
||||||
|
IMAGE_SIZE = [224, 224]
|
||||||
|
|
||||||
|
vgg = VGG19(input_shape=IMAGE_SIZE + [3], weights='imagenet', include_top=False)
|
||||||
|
|
||||||
|
for layer in vgg.layers:
|
||||||
|
layer.trainable = False
|
||||||
|
|
||||||
|
# %%
|
||||||
|
# our layers - you can add more if you want
|
||||||
|
x = Flatten()(vgg.output)
|
||||||
|
|
||||||
|
prediction = Dense(2, activation='softmax')(x)
|
||||||
|
# %%
|
||||||
|
model = keras.models.load_model('saved_model/my_model')
|
||||||
|
|
||||||
|
# %%
|
||||||
|
from sklearn.metrics import accuracy_score,classification_report,confusion_matrix
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
y_pred=model.predict(test_x)
|
||||||
|
y_pred=np.argmax(y_pred,axis=1)
|
||||||
|
|
||||||
|
accuracy_score(y_pred,test_y)
|
||||||
|
|
||||||
|
print(classification_report(y_pred,test_y))
|
||||||
|
|
||||||
|
|
||||||
|
# %%
|
||||||
|
img_path = r"test\azjatyckie\Asian_lady_beetle-(Harmonia-axyridis).jpg"
|
||||||
|
|
||||||
|
img_nump = np.array(cv2.cvtColor(cv2.imread(img_path), cv2.COLOR_BGR2RGB))
|
||||||
|
|
||||||
|
plt.imshow(img_nump)
|
||||||
|
plt.show()
|
||||||
|
|
||||||
|
img_nump = cv2.resize(img_nump,(224,224))
|
||||||
|
img_nump = img_nump/255.0
|
||||||
|
img_nump = img_nump[np.newaxis,...]
|
||||||
|
|
||||||
|
pr = model.predict(img_nump)
|
||||||
|
print('azjatycka: '+str(pr[0][0])+' , siedmiokropka: '+str(pr[0][1]))
|
||||||
|
print(['azjatycka' if np.argmax(pr,axis=1)[0]==0 else 'siedmiokropka'][0])
|
||||||
|
# %%
|
44
biedronki_dataset/saved_model/my_model/keras_metadata.pb
Normal file
BIN
biedronki_dataset/saved_model/my_model/saved_model.pb
Normal file
BIN
biedronki_dataset/saved_model/my_model/variables/variables.index
Normal file
BIN
biedronki_dataset/test/azjatyckie/000AV7CGML62TYDW-C122-F4.jpg
Normal file
After Width: | Height: | Size: 111 KiB |
After Width: | Height: | Size: 143 KiB |
BIN
biedronki_dataset/test/azjatyckie/15218760_15218653.jpg
Normal file
After Width: | Height: | Size: 37 KiB |
BIN
biedronki_dataset/test/azjatyckie/18116722224_60c6596b07_b.jpg
Normal file
After Width: | Height: | Size: 114 KiB |
After Width: | Height: | Size: 62 KiB |
BIN
biedronki_dataset/test/azjatyckie/3131.jpg
Normal file
After Width: | Height: | Size: 1.8 MiB |
BIN
biedronki_dataset/test/azjatyckie/3530.jpg
Normal file
After Width: | Height: | Size: 92 KiB |
BIN
biedronki_dataset/test/azjatyckie/49855792553_7efeaa9659_b.jpg
Normal file
After Width: | Height: | Size: 181 KiB |
BIN
biedronki_dataset/test/azjatyckie/5212.jpg
Normal file
After Width: | Height: | Size: 5.1 KiB |
After Width: | Height: | Size: 111 KiB |
BIN
biedronki_dataset/test/azjatyckie/565154.jpg
Normal file
After Width: | Height: | Size: 5.7 KiB |
BIN
biedronki_dataset/test/azjatyckie/5f9149ec83e43_o_large.jpg
Normal file
After Width: | Height: | Size: 47 KiB |
After Width: | Height: | Size: 592 KiB |
BIN
biedronki_dataset/test/azjatyckie/8maya_22_ostr_19.jpg
Normal file
After Width: | Height: | Size: 144 KiB |
After Width: | Height: | Size: 83 KiB |
After Width: | Height: | Size: 92 KiB |
After Width: | Height: | Size: 71 KiB |
After Width: | Height: | Size: 518 KiB |
After Width: | Height: | Size: 165 KiB |
After Width: | Height: | Size: 77 KiB |
After Width: | Height: | Size: 176 KiB |
After Width: | Height: | Size: 218 KiB |
BIN
biedronki_dataset/test/azjatyckie/Harmonia-axyridis.jpg
Normal file
After Width: | Height: | Size: 563 KiB |
BIN
biedronki_dataset/test/azjatyckie/Harmonia.axyridis8b.jpg
Normal file
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 86 KiB |
After Width: | Height: | Size: 6.5 MiB |
After Width: | Height: | Size: 85 KiB |
BIN
biedronki_dataset/test/azjatyckie/Image2EY5large.jpg
Normal file
After Width: | Height: | Size: 43 KiB |
BIN
biedronki_dataset/test/azjatyckie/asian-lady-beetle-500x500.jpg
Normal file
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 260 KiB |
After Width: | Height: | Size: 542 KiB |
After Width: | Height: | Size: 18 KiB |
BIN
biedronki_dataset/test/azjatyckie/harmonia-axyridis-1.jpg
Normal file
After Width: | Height: | Size: 32 KiB |
BIN
biedronki_dataset/test/azjatyckie/harmonia-axyridis-2008_062.jpg
Normal file
After Width: | Height: | Size: 108 KiB |
After Width: | Height: | Size: 211 KiB |
After Width: | Height: | Size: 124 KiB |
After Width: | Height: | Size: 166 KiB |
BIN
biedronki_dataset/test/azjatyckie/harnax01.jpeg
Normal file
After Width: | Height: | Size: 38 KiB |
BIN
biedronki_dataset/test/azjatyckie/images.jpg
Normal file
After Width: | Height: | Size: 5.7 KiB |
BIN
biedronki_dataset/test/azjatyckie/images2.jpg
Normal file
After Width: | Height: | Size: 8.1 KiB |
BIN
biedronki_dataset/test/azjatyckie/images8955465656.jpg
Normal file
After Width: | Height: | Size: 7.4 KiB |
BIN
biedronki_dataset/test/azjatyckie/imago2.jpg
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
biedronki_dataset/test/azjatyckie/indeks.jpg
Normal file
After Width: | Height: | Size: 9.8 KiB |
After Width: | Height: | Size: 37 KiB |
After Width: | Height: | Size: 24 KiB |
After Width: | Height: | Size: 98 KiB |
After Width: | Height: | Size: 189 KiB |
After Width: | Height: | Size: 62 KiB |
BIN
biedronki_dataset/test/azjatyckie/large.jpg
Normal file
After Width: | Height: | Size: 150 KiB |
BIN
biedronki_dataset/test/azjatyckie/pexels-photo-6313159.jpeg
Normal file
After Width: | Height: | Size: 5.6 MiB |
After Width: | Height: | Size: 272 KiB |
After Width: | Height: | Size: 308 KiB |
After Width: | Height: | Size: 127 KiB |
After Width: | Height: | Size: 104 KiB |
BIN
biedronki_dataset/test/siedmiokropki/24a-7spot-ladybird.jpg
Normal file
After Width: | Height: | Size: 584 KiB |
BIN
biedronki_dataset/test/siedmiokropki/3303170.jpg
Normal file
After Width: | Height: | Size: 49 KiB |
BIN
biedronki_dataset/test/siedmiokropki/3366.jpg
Normal file
After Width: | Height: | Size: 205 KiB |
BIN
biedronki_dataset/test/siedmiokropki/3367.jpg
Normal file
After Width: | Height: | Size: 187 KiB |
BIN
biedronki_dataset/test/siedmiokropki/3368.jpg
Normal file
After Width: | Height: | Size: 234 KiB |
BIN
biedronki_dataset/test/siedmiokropki/378515.fig.001.jpg
Normal file
After Width: | Height: | Size: 187 KiB |
After Width: | Height: | Size: 282 KiB |
After Width: | Height: | Size: 64 KiB |
After Width: | Height: | Size: 91 KiB |
BIN
biedronki_dataset/test/siedmiokropki/7-spot-ladybird-c-6449.JPG
Normal file
After Width: | Height: | Size: 532 KiB |
After Width: | Height: | Size: 224 KiB |
After Width: | Height: | Size: 99 KiB |
After Width: | Height: | Size: 363 KiB |
After Width: | Height: | Size: 210 KiB |
After Width: | Height: | Size: 1.1 MiB |
BIN
biedronki_dataset/test/siedmiokropki/7spot2.jpg
Normal file
After Width: | Height: | Size: 50 KiB |
After Width: | Height: | Size: 239 KiB |
After Width: | Height: | Size: 199 KiB |
After Width: | Height: | Size: 108 KiB |
After Width: | Height: | Size: 198 KiB |
BIN
biedronki_dataset/test/siedmiokropki/Ladybird.jpg
Normal file
After Width: | Height: | Size: 24 KiB |
BIN
biedronki_dataset/test/siedmiokropki/Seven-spot_ladybird_2.jpg
Normal file
After Width: | Height: | Size: 630 KiB |
After Width: | Height: | Size: 925 KiB |
BIN
biedronki_dataset/test/siedmiokropki/aDSCF1093k.jpg
Normal file
After Width: | Height: | Size: 121 KiB |
After Width: | Height: | Size: 29 KiB |
After Width: | Height: | Size: 476 KiB |
BIN
biedronki_dataset/test/siedmiokropki/biedronka-azjatycka.jpg
Normal file
After Width: | Height: | Size: 80 KiB |
After Width: | Height: | Size: 30 KiB |
After Width: | Height: | Size: 31 KiB |
BIN
biedronki_dataset/test/siedmiokropki/dgwyjf38ezgyuigq7czp.jpg
Normal file
After Width: | Height: | Size: 236 KiB |
After Width: | Height: | Size: 27 KiB |
After Width: | Height: | Size: 21 KiB |
BIN
biedronki_dataset/test/siedmiokropki/ladybird-00001.jpg
Normal file
After Width: | Height: | Size: 47 KiB |