This commit is contained in:
Sasza Stanczew 2025-05-20 12:57:26 +02:00
parent 1dfffa4acf
commit 714f2dbebf

View file

@ -1897,7 +1897,9 @@
{
"cell_type": "markdown",
"id": "2c041416-51ff-4b9e-bb4d-c3431fa870e7",
"metadata": {},
"metadata": {
"jp-MarkdownHeadingCollapsed": true
},
"source": [
"# Dzień 6 - 20.05.2025"
]
@ -1905,7 +1907,9 @@
{
"cell_type": "markdown",
"id": "cd20cae1-be7f-49ee-b112-15f4cd9cfc6f",
"metadata": {},
"metadata": {
"jp-MarkdownHeadingCollapsed": true
},
"source": [
"# CNN - Convolutional Neural Network\n",
"## zalety \n",
@ -2364,7 +2368,9 @@
{
"cell_type": "markdown",
"id": "44cc5989-0cf6-49d1-8307-b9e4d2a1bbd5",
"metadata": {},
"metadata": {
"jp-MarkdownHeadingCollapsed": true
},
"source": [
"# PyTorch"
]
@ -2677,7 +2683,9 @@
{
"cell_type": "markdown",
"id": "01db7828-0e98-45b9-b332-9d86a148f3cc",
"metadata": {},
"metadata": {
"jp-MarkdownHeadingCollapsed": true
},
"source": [
"# Sieć YOLO\n",
"algorytm/sieć YOLO służy do rozpoznawania obiektów znajdujących się na zdjęciach\n",
@ -2690,6 +2698,95 @@
"id": "a27ad14f-3a79-46d0-bfa6-154f85e9513a",
"metadata": {},
"outputs": [],
"source": [
"from ultralytics import YOLO\n",
"\n",
"model = YOLO(\"yolo11n.pt\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "031a2a4a-bf53-4c6a-84dd-1e8cacb8ca94",
"metadata": {},
"outputs": [],
"source": [
"result = model.predict('https://shropshiremammalgroup.com/wp-content/uploads/2020/05/wild-boar-forest-of-dean-robin-bennett-3.jpg?w=1024')\n",
"print(result)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6ddb0744-22b9-4c2c-bc53-d6d8c02bd83c",
"metadata": {},
"outputs": [],
"source": [
"from PIL import Image\n",
"\n",
"Image.fromarray(result[0].plot())"
]
},
{
"cell_type": "markdown",
"id": "ec06874f-c48a-43ce-b44e-364e4ed5ee37",
"metadata": {},
"source": [
"# RNN - Recurrent Neural Network"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "9bde4f30-f26c-4b37-bfa6-8b64460fe13d",
"metadata": {},
"outputs": [],
"source": [
"import tensorflow as tf\n",
"from tensorflow.keras.models import Sequential\n",
"from tensorflow.keras.layers import SimpleRNN, Embedding, Dense"
]
},
{
"cell_type": "code",
"execution_count": 13,
"id": "d2e9da87-1912-466f-b902-e45130d8fd32",
"metadata": {},
"outputs": [],
"source": [
"vocab_size = 10000\n",
"embedding_dim = 64\n",
"sequence_length = 100"
]
},
{
"cell_type": "code",
"execution_count": 16,
"id": "88156e8c-3c2a-467e-a018-a09c0f292de0",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/home/sasza/.local/share/virtualenvs/JupyterLab-9JRWupKp/lib/python3.12/site-packages/keras/src/layers/core/embedding.py:97: UserWarning: Argument `input_length` is deprecated. Just remove it.\n",
" warnings.warn(\n"
]
}
],
"source": [
"model = Sequential()\n",
"model.add(Embedding(vocab_size, embedding_dim, input_length=sequence_length))\n",
"model.add(SimpleRNN(128))\n",
"model.add(Dense(1,activation='sigmoid'))"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f976e119-8888-4316-a1b8-2352f74c42e8",
"metadata": {},
"outputs": [],
"source": []
}
],