- updated notebook and gitignore

This commit is contained in:
2025-12-19 10:53:45 +01:00
parent 10153f2634
commit 862a887cf9
2 changed files with 125 additions and 17 deletions
+124 -17
View File
@@ -32,7 +32,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"id": "5b898116-e9a8-429d-8491-67db5a65d358",
"metadata": {},
"outputs": [
@@ -40,7 +40,7 @@
"name": "stderr",
"output_type": "stream",
"text": [
"51.0%"
"100.0%\n"
]
}
],
@@ -54,7 +54,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"id": "49712fae-dfe6-4b6f-92ea-2e97a965c15c",
"metadata": {},
"outputs": [],
@@ -64,17 +64,28 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 5,
"id": "d783e1a5-3410-4992-88a6-230dd2ec85dd",
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"torch.Size([3, 32, 32])"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"image.size()"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"id": "8ef21399-f2f2-46f4-8268-f60f36bbb533",
"metadata": {},
"outputs": [],
@@ -84,7 +95,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 7,
"id": "192ff676-c4b8-4611-9338-ec9b35a502d5",
"metadata": {},
"outputs": [],
@@ -111,7 +122,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 8,
"id": "f48dd819-9196-4aa5-92c4-ddcc644c6aa9",
"metadata": {},
"outputs": [],
@@ -123,10 +134,77 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 9,
"id": "3a91ce0c-e71d-4bfb-b945-47edfc8ca8d6",
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Training epoch 0...\n",
"Loss: 2.2366\n",
"Training epoch 1...\n",
"Loss: 1.7631\n",
"Training epoch 2...\n",
"Loss: 1.5183\n",
"Training epoch 3...\n",
"Loss: 1.3860\n",
"Training epoch 4...\n",
"Loss: 1.2861\n",
"Training epoch 5...\n",
"Loss: 1.2027\n",
"Training epoch 6...\n",
"Loss: 1.1302\n",
"Training epoch 7...\n",
"Loss: 1.0746\n",
"Training epoch 8...\n",
"Loss: 1.0332\n",
"Training epoch 9...\n",
"Loss: 0.9863\n",
"Training epoch 10...\n",
"Loss: 0.9492\n",
"Training epoch 11...\n",
"Loss: 0.9165\n",
"Training epoch 12...\n",
"Loss: 0.8859\n",
"Training epoch 13...\n",
"Loss: 0.8514\n",
"Training epoch 14...\n",
"Loss: 0.8210\n",
"Training epoch 15...\n",
"Loss: 0.7903\n",
"Training epoch 16...\n",
"Loss: 0.7662\n",
"Training epoch 17...\n",
"Loss: 0.7347\n",
"Training epoch 18...\n",
"Loss: 0.7096\n",
"Training epoch 19...\n",
"Loss: 0.6868\n",
"Training epoch 20...\n",
"Loss: 0.6642\n",
"Training epoch 21...\n",
"Loss: 0.6387\n",
"Training epoch 22...\n",
"Loss: 0.6193\n",
"Training epoch 23...\n",
"Loss: 0.5926\n",
"Training epoch 24...\n",
"Loss: 0.5701\n",
"Training epoch 25...\n",
"Loss: 0.5532\n",
"Training epoch 26...\n",
"Loss: 0.5306\n",
"Training epoch 27...\n",
"Loss: 0.5090\n",
"Training epoch 28...\n",
"Loss: 0.4891\n",
"Training epoch 29...\n",
"Loss: 0.4685\n"
]
}
],
"source": [
"for epoch in range(30):\n",
" print(f'Training epoch {epoch}...')\n",
@@ -148,7 +226,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 10,
"id": "aa5b2497-90a7-44a9-9985-427b920945eb",
"metadata": {},
"outputs": [],
@@ -158,10 +236,21 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 11,
"id": "ff62419f-ead5-4244-9a5e-a21d568bdca8",
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"<All keys matched successfully>"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"net = NeuralNet()\n",
"net.load_state_dict(torch.load('trained_net.pth'))"
@@ -169,10 +258,18 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 12,
"id": "eb1d4385-d4da-454f-9d8c-d844aa7b24df",
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Accuracy: 68.86%\n"
]
}
],
"source": [
"correct = 0\n",
"total = 0\n",
@@ -191,10 +288,20 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 13,
"id": "1a4f098f-b1ea-46b7-a7d6-769f80292f5f",
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Prediction: cat\n",
"Prediction: deer\n",
"Prediction: plane\n"
]
}
],
"source": [
"new_transform = transforms.Compose([\n",
" transforms.Resize((32, 32)), \n",