486 lines
737 KiB
Plaintext
Raw Normal View History

2025-01-07 17:40:35 +01:00
{
"cells": [
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABW4AAAPdCAYAAAAauvH/AAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjAsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvlHJYcgAAAAlwSFlzAAAPYQAAD2EBqD+naQABAABJREFUeJzs3Xd4FNX6wPHv7qb33kilSe+E3pQSQRS9KIoCoYiCivywgJUmImABVLgWqmDX67UgGBRELkhoQSCoYBJCSQikEtI2u/P7Y5Ilm01IAum8n+eZh92zZ2bOHFJm37z7Ho2iKApCCCGEEEIIIYQQQggh6g1tXQ9ACCGEEEIIIYQQQgghhDkJ3AohhBBCCCGEEEIIIUQ9I4FbIYQQQgghhBBCCCGEqGckcCuEEEIIIYQQQgghhBD1jARuhRBCCCGEEEIIIYQQop6RwK0QQgghhBBCCCGEEELUMxK4FUIIIYQQQgghhBBCiHpGArdCCCGEEEIIIYQQQghRz0jgVgghhBBCCCGEEEIIIeoZCdwKIRq8y5cv8+yzzzJ06FC8vb3RaDTMmzev0vvHxMQwYsQIgoODsbe3x8PDg169erFp06ZK7b9z5040Gk2Z2++//36dV2UuNDSUO+64o1qOBXD+/HnmzZtHTExMtR2zsRo4cCADBw6s62EIIYQQN7X169ej0WhISEio8r7F92pffvlltY2n+Jg7d+6stmPWlXnz5qHRaOp6GKIC1fk1N3DgQNq1a3fjgyqSk5PDvHnzGsX3gxD1jVVdD0AIIW5Uamoq77//Ph07dmTUqFF8+OGHVdo/IyODoKAgHnjgAZo0acKVK1fYvHkz48aNIyEhgRdffLFSx3n11VcZNGiQWVt13hBVp/PnzzN//nxCQ0Pp1KlTXQ9HCCGEEOKaRowYwd69e/H396/roQghSsnJyWH+/PkAkvAgRDWTwK0QosELCQkhPT0djUbDpUuXqhy4LSuj8o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vvsiIESMACAwMrNJ4yqLX67nzzjuZPHkyTz31FLt27WLhwoW4urry8ssvA+qbpkGDBvHPP/8wf/58OnTowG+//cbixYuJiYmxuMn95ptv+O2333j55Zfx8/PDx8eH/fv3AzBlyhTuuecePv30Uw4fPszzzz9PYWEhf/31F/fccw9Tp05l+/btLFmyhICAAGbNmmU6bkJCAo888gjBwcEA/P777zzxxBOcO3fONFYhhBBC1G/Jyck8+OCDPPXUU8ydO5f//Oc/PPfccwQEBDB+/Hizvs8//zxdunThww8/JDMzk3nz5jFw4EAOHz5M06ZNAfX+4JZbbuH+++/Hw8ODpKQkVq9eTffu3YmNjcXLy6vcsVR13ylTpjBixAg+/vhjzpw5wzPPPMNDDz3EL7/8Yurz8ssvs3DhQu655x6eeuopXF1dOXbsmFkweNOmTYwfP5677rqLDRs2YG1tzXvvvcewYcPYtm0bt912GwA///wzd911F7169eLTTz813e9duHDhhv8fynO992rVcb8YGxtL7969CQ4O5o033sDPz49t27YxY8YMLl26xNy5c8sdt9FoZOTIkRw4cIB58+bRpUsX9u7dS0REhEXfX3/9lSFDhtChQwfWrFmDra0tq1atYuTIkXzyySeMGTMGqNx9OsCFCxcYMGAA1tbWrFq1Cl9fXzZv3szjjz9eqTkfN24chw4dYtGiRbRs2ZKMjAwOHTpEamqqWb/KfO9cvHiR3r17U1BQwMKFCwkNDeX777/n6aef5p9//mHVqlX4+/uzdetWIiIimDx5MlOmTAEwBXMrOx4hRDkUIYRoRC5evKgAyty5c6u87yOPPKIACqDY2Ngoq1atqtR+hw4dUp588knlP//5j7Jr1y5l7dq1SuvWrRWdTqds3br1mvteunRJAZTly5dfs19ISIhiZ2ennD592tSWm5ureHh4KI888oip7f7771dsbW2VxMREs/1vv/12xcHBQcnIyFAURVH279+vAMq6deuuazxlmTBhggIon3/+uVn78OHDlVtuucX0/N///neZ/ZYsWaIAyk8//WRqAxRXV1clLS3NrO+6desUQHniiSfM2keNGqUAyptvvmnW3qlTJ6VLly7ljt1gMCh6vV5ZsGCB4unpqRiNRtNrAwYMUAYMGHDtixdCCCFEjSr+3R8fH29qGzBggAIo+/btM+vbpk0bZdiwYabnO3bsUAClS5cuZr/jExISFGtra2XKlCnlnrewsFDJzs5WHB0dlRUrVlgcc8eOHVXet/hapk+fbtZ/6dKlCqAkJSUpiqIocXFxik6nUx588MFyz3HlyhXFw8NDGTlypFm7wWBQOnbsqISHh5vaevTooQQEBCi5ubmmtqysLMXDw0Op7tDAjd6rVcf94rBhw5TAwEAlMzPTrP3xxx9X7OzsLPqX9MMPPyiAsnr1arP2xYsXW7zX6Nmzp+Lj46NcvnzZ1FZYWKi0a9dOCQwMNH3NVfY+ffbs2YpGo1FiYmLM+g0ZMqTCrzlFURQnJydl5syZ1+xT2e+dOXPmlNlv2rRpikajUf766y9FUa79Hqwy4xFClE9KJQghRJHnn3+e/fv388MPPzBp0iQef/zxSn18rHPnzixfvpxRo0bRr18/Jk6cyJ49e/D39zf95bw8Hh4eNGvWjGXLlvHmm29y+PDhMj/aB9CpUydTdiiAnZ0dLVu2NMu4+OWXX7jtttsICgoy2zcyMpKcnBz27t1bbeMpi0ajYeTIkWZtHTp0sBijo6Mjo0ePthgjYPGxvltvvRV3d/cyz3fHHXeYPW/dujWAKYu4ZHvpjyn+8ssvDB48GFdXV3Q6HdbW1rz88sukpqaSkpJSwZUKIYQQoj7w8/MjPDzcrK30vUexsWPHmpXXCgkJoXfv3uzYscPUlp2dzezZs2nevDlWVlZYWVnh5OTElStXOHHixDXHUtV977zzTotxA6axR0VFYTAYeOyxx8o9554
"text/plain": [
"<Figure size 1400x1000 with 6 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import matplotlib.pyplot as plt\n",
"\n",
"# Define data\n",
"bottle_data = {\n",
" \"ResNet50\": {\n",
" \"1,3,5 shots normal\": [0.5892857142857143, 0.7321428571428571, 0.75],\n",
" \"inbalanced - more good shots\": [0.75, 0.732, 0.696, 0.696],\n",
" \"2 ways only detect if faulty or not\": [0.8395, 0.8315, 0.8031],\n",
" \"inbalance 2 way\": [0.8031, 0.81893, 0.8336, 0.8031],\n",
" \"only faulty class detect\": [0.7638, 0.7428, 0.787]\n",
" },\n",
" \"P>M>F\": {\n",
" \"1,3,5 shots normal\": [0.67910401, 0.71710526, 0.78860294],\n",
" \"inbalanced - more good shots\": [0.78768382, 0.78860294, 0.75827206, 0.74356618],\n",
" \"2 ways only detect if faulty or not\": [0.86422306, 0.93201754, 0.93933824],\n",
" \"inbalance 2 way\": [0.92371324, 0.87867647, 0.86397059, 0.87775735],\n",
" \"only faulty class detect\": [0.57380952, 0.76705653, 0.84191176]\n",
" },\n",
" \"CAML\": {\n",
" \"1,3,5 shots normal\": [0.40740741, 0.39726027, 0.30769231],\n",
" \"2 ways only detect if faulty or not\": [0.79012346, 0.84415584, 0.87671233],\n",
" \"only faulty class detect\": [0.58064516, 0.51785714, 0.52]\n",
" }\n",
"}\n",
"\n",
"cable_data = {\n",
" \"ResNet50\": {\n",
" \"1,3,5 shots normal\": [0.21808, 0.43815, 0.4321478],\n",
" \"inbalanced - more good shots\": [0.4321478, 0.432986, 0.42340, 0.4464635],\n",
" \"2 ways only detect if faulty or not\": [0.8592, 0.8772, 0.8495],\n",
" \"inbalance 2 way\": [0.8495, 0.8180, 0.7460, 0.6846],\n",
" \"only faulty class detect\": [0.240, 0.4740, 0.4805]\n",
" },\n",
" \"P>M>F\": {\n",
" \"1,3,5 shots normal\": [0.25199021, 0.44388328, 0.46975059],\n",
" \"inbalanced - more good shots\": [0.50425859, 0.48023277, 0.43118282, 0.41842534],\n",
" \"2 ways only detect if faulty or not\": [0.79263485, 0.8707712, 0.86756514],\n",
" \"inbalance 2 way\": [0.86966158, 0.80142425, 0.80961366, 0.66028834],\n",
" \"only faulty class detect\": [0.24383256, 0.43800505, 0.51304563]\n",
" },\n",
" \"CAML\": {\n",
" \"1,3,5 shots normal\": [0.24031008, 0.19834711, 0.15929204],\n",
" \"2 ways only detect if faulty or not\": [0.57364341, 0.54545455, 0.59292035],\n",
" \"only faulty class detect\": [0.12962963, 0.36363636, 0.58823529]\n",
" }\n",
"}\n",
"# Prepare the data\n",
"measurement_types = [\n",
" \"1,3,5 shots normal\",\n",
" \"inbalanced - more good shots\",\n",
" \"2 ways only detect if faulty or not\",\n",
" \"inbalance 2 way\",\n",
" \"only faulty class detect\"\n",
"]\n",
"\n",
"models = [\"ResNet50\", \"P>M>F\", \"CAML\"]\n",
"\n",
"# Create subplots\n",
"fig, axes = plt.subplots(3, 2, figsize=(14, 10))\n",
"axes = axes.flatten()\n",
"\n",
"# Loop through each measurement type\n",
"for i, measurement in enumerate(measurement_types):\n",
" ax = axes[i]\n",
" for model in models:\n",
" # Get the bottle and cable data for the current measurement and model\n",
" bottle_accuracy = bottle_data[model].get(measurement, [])\n",
" cable_accuracy = cable_data[model].get(measurement, [])\n",
" \n",
" # Plot both bottle and cable data\n",
" ax.plot(bottle_accuracy, marker='o', label=f'{model} - Bottle', linestyle='-')\n",
" \n",
" ax.set_title(measurement)\n",
" ax.set_xlabel(\"Shots / Samples\")\n",
" ax.set_ylabel(\"Accuracy\")\n",
" ax.legend()\n",
" ax.grid(True)\n",
"\n",
"# Adjust layout\n",
"plt.tight_layout()\n",
"plt.show()\n"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAnYAAAHWCAYAAAD6oMSKAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/GU6VOAAAACXBIWXMAAA9hAAAPYQGoP6dpAAB7IUlEQVR4nO3dd3gU1eLG8e+mJ6RAAqRACKETQgfpRXovIuWKUixX5Soi2FCRovdiV9QfqChFRKlSVESCSBEQaaEF6RBKINQkQEhCMr8/BlZCCgkkbLK8n+c5D+zsmZmzu7B5c+acMxbDMAxEREREpNBzsHUDRERERCRvKNiJiIiI2AkFOxERERE7oWAnIiIiYicU7ERERETshIKdiIiIiJ1QsBMRERGxEwp2IiIiInZCwU5ERETETijYiUi+mTZtGhaLxVqcnJwoXbo0gwcP5vjx43d8/JUrV1qPPW3atEzrtGrVCovFQtmyZe/4fABly5ZN95puLBcvXsyTc+S1MWPGYLFYOHPmzC3rtmzZkpYtW+Z/o0QkXzjZugEiYv+mTp1KlSpVSExMZPXq1YwfP55Vq1axY8cOihQpcsfH9/Ly4uuvv2bQoEHpth86dIiVK1fi7e19x+e4UZMmTXj//fczbPfw8MjT84iI5JaCnYjku/DwcOrVqwfA/fffT2pqKm+++SYLFy6kf//+JCYmcubMGYKDg2/r+H379uWrr75i3759VKxY0bp9ypQplCpViurVqxMVFZVun3379lGhQgUsFkuuz1e0aFEaNmx4W20VEclPuhQrInfd9VB05MgRAE6dOkVISAjNmzdn0qRJObpkeKO2bdsSHBzMlClTrNvS0tKYPn06AwcOxMEh41fdE088QUhICC+99BJbt269g1eTf7777jsaNWqEp6cnnp6e1KpVi6+//tr6fEREBN27d6d06dK4ublRoUIFnnzyySzfv6NHj/LAAw/g7e2Nj48PDz/8MKdPn75lO5KTk3nrrbeoUqUKrq6ulChRgsGDB+doXxG5uxTsROSu279/PwAlSpQAIDg4mAULFlCqVClefPFFAgMD6dSpEzNmzCAhIeGWx3NwcGDQoEF88803pKamArBs2TKOHTvG4MGDM91n4sSJPPzww8yfP586depQtWpVxo0bx759+255PsMwuHr1arqSlpaW05efI2+88Qb9+/cnKCiIadOmsWDBAgYOHGgNwwAHDhygUaNGTJo0iWXLlvHGG2+wYcMGmjZtSkpKSoZj9uzZkwoVKjBv3jzGjBnDwoULad++faZ1r0tLS6N79+68/fbbPPTQQ/z888+8/fbbRERE0LJlSxITE/P0dYvIHTJERPLJ1KlTDcD4888/jZSUFCMhIcH46aefjBIlShheXl7GyZMnM+xz6dIlY/bs2UbPnj0NNzc3w93d3ejdu7fxww8/GFeuXElX9/fffzcAY+7cucbBgwcNi8Vi/PTTT4ZhGEbv3r2Nli1b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FQmpqKgAuLi42bomISN67/gtrSkrKHR1HwU5EChXd41lE7FFefbcp2ImIiIjYCQW7rKSlYjnyB6XOrcdy5A9IS7V1i0TkHmGxWFi4cOEdHWPMmDHUqlUrT9qTnw4fPozFYiEyMjLbenv27CEgIICEhIS707BCLKfvaVZatmzJsGHD8rRNOVG/fn1++OGHu35ee6Ngl5moxfBxOE7f9qDekUk4fdsDPg43t4tIoZaaZrD+wFkWRR5n/YGzpKYZ+Xq+QYMG0aNHj3w9x73gtdde4z//+U+OboIutnc7v1iMGjWKV155JU+WMzp16hSDBg2yTrbq0KED+/btu+PjFgYKdjeLWgxzBkD8ifTb42PM7Qp
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# Create subplots\n",
"fig, ax = plt.subplots()\n",
"\n",
"# Loop through each measurement type\n",
"model = \"P>M>F\"\n",
"data = cable_data\n",
"imgclass = \"cable\"\n",
"\n",
"# Plot both bottle and cable data\n",
"ax.plot([5,10,15, 30], data[model].get(\"inbalanced - more good shots\", []), marker='o', label=f'Inbalanced (more good shots) - 9 way', linestyle='-')\n",
"ax.plot([5,10,15, 30], data[model].get(\"inbalance 2 way\", []), marker='o', label=f'faulty or not - 2 way', linestyle='-')\n",
"\n",
"ax.set_title(f'{model} - {imgclass}')\n",
"ax.set_xlabel(\"Shots per class\")\n",
"ax.set_ylabel(\"Accuracy\")\n",
"ax.legend()\n",
"ax.grid(True)\n",
"\n",
"ax.set(xlim=(4.5, 30.5), xticks=[5,10,15, 30])\n",
"\n",
"# Adjust layout\n",
"plt.tight_layout()\n",
"plt.savefig(f\"{model}-{imgclass}-inbalanced.png\")"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAnYAAAHWCAYAAAD6oMSKAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMywgaHR0cHM6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p63MuXLhQbS/+riy1Ws2uXbvo169fpd+LKYSom+R5FqLhMOTznJWVhbe3d7mv97udBLtylHa/2tnZGSTYWVlZYWdnJ78IhKjn5HkWouGoC89zZYaHGXzyxKpVq/Dz88PCwoLOnTuzZ8+eCst/8MEHtGnTBktLS1q1asWmTZv09kdGRqJSqcp8FBQU1ORtCCGEEEIYnEFb7LZt28bEiRNZtWoVPXv2ZM2aNTz66KMkJibSpEmTMuVXr17N9OnTWbduHV26dGH//v289NJLODg4MHjwYF05Ozs7/vrrL71jLSwsavx+hBBCCCEMyaDBbtmyZYwePZoxY8YAsHz5cn788UdWr17N/Pnzy5T/+OOP+ec//0l4eDgATZs25ddff2XhwoV6wU6lUuHu7l47NyGEEEIIUUcYrCu2qKiIQ4cO0a9fP73t/fr1Y9++feUeU1hYWKblzdLSkv3796NWq3XbcnJy8PHxwcvLi0GDBnHkyJHqvwEhhBBCiDrGYC126enpaDQa3Nzc9La7ubmRmppa7jH9+/fnww8/ZNiwYXTq1IlDhw6xYcMG1Go16enpeHh40Lp1ayIjI2nXrh1ZWVm8//779OzZk6NHj9KiRYtyz1tYWEhhYaHu86ysLKBkoOStgbE2lF6vtq8rhKh+8jw
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# Create subplots\n",
"fig, ax = plt.subplots()\n",
"\n",
"# Loop through each measurement type\n",
"model = \"P>M>F\"\n",
"data = bottle_data\n",
"imgclass = \"bottle\"\n",
"\n",
"# Plot both bottle and cable data\n",
"ax.plot([1,3,5], data[model].get(\"1,3,5 shots normal\", []), marker='o', label=f'Normal all classes - 4 way', linestyle='-')\n",
"ax.plot([1,3,5], data[model].get(\"2 ways only detect if faulty or not\", []), marker='o', label=f'faulty or not - 2 way', linestyle='-')\n",
"ax.plot([1,3,5], data[model].get(\"only faulty class detect\", []), marker='o', label=f'faulty classes - 3 way', linestyle='-')\n",
"\n",
"ax.set_title(f'{model} - {imgclass}')\n",
"ax.set_xlabel(\"Shots per class\")\n",
"ax.set_ylabel(\"Accuracy\")\n",
"ax.legend()\n",
"ax.grid(True)\n",
"\n",
"ax.set(xlim=(0.75, 5.25), xticks=[1,3,5])\n",
"\n",
"# Adjust layout\n",
"plt.tight_layout()\n",
"plt.savefig(f\"{model}-{imgclass}.png\")"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"ename": "ValueError",
"evalue": "x and y must have same first dimension, but have shapes (3,) and (4,)",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[2], line 10\u001b[0m\n\u001b[1;32m 7\u001b[0m imgclass \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mbottle\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 9\u001b[0m \u001b[38;5;66;03m# Plot both bottle and cable data\u001b[39;00m\n\u001b[0;32m---> 10\u001b[0m \u001b[43max\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mplot\u001b[49m\u001b[43m(\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;241;43m1\u001b[39;49m\u001b[43m,\u001b[49m\u001b[38;5;241;43m3\u001b[39;49m\u001b[43m,\u001b[49m\u001b[38;5;241;43m5\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdata\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mResNet50\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m]\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43minbalanced - more good shots\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m[\u001b[49m\u001b[43m]\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmarker\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mo\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mlabel\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43mf\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mResNet50\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mlinestyle\u001b[49m\u001b[38;5;241;43m=\u001b[39;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[43m)\u001b[49m\n\u001b[1;32m 11\u001b[0m ax\u001b[38;5;241m.\u001b[39mplot([\u001b[38;5;241m1\u001b[39m,\u001b[38;5;241m3\u001b[39m,\u001b[38;5;241m5\u001b[39m], data[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mP>M>F\u001b[39m\u001b[38;5;124m\"\u001b[39m]\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124minbalanced - more good shots\u001b[39m\u001b[38;5;124m\"\u001b[39m, []), marker\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mo\u001b[39m\u001b[38;5;124m'\u001b[39m, label\u001b[38;5;241m=\u001b[39m\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mP>M>F\u001b[39m\u001b[38;5;124m'\u001b[39m, linestyle\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m-\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[1;32m 12\u001b[0m ax\u001b[38;5;241m.\u001b[39mplot([\u001b[38;5;241m1\u001b[39m,\u001b[38;5;241m3\u001b[39m,\u001b[38;5;241m5\u001b[39m], data[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mCAML\u001b[39m\u001b[38;5;124m\"\u001b[39m]\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124minbalanced - more good shots\u001b[39m\u001b[38;5;124m\"\u001b[39m, []), marker\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mo\u001b[39m\u001b[38;5;124m'\u001b[39m, label\u001b[38;5;241m=\u001b[39m\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mCAML\u001b[39m\u001b[38;5;124m'\u001b[39m, linestyle\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m-\u001b[39m\u001b[38;5;124m'\u001b[39m)\n",
"File \u001b[0;32m/usr/lib/python3.13/site-packages/matplotlib/axes/_axes.py:1777\u001b[0m, in \u001b[0;36mAxes.plot\u001b[0;34m(self, scalex, scaley, data, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1534\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 1535\u001b[0m \u001b[38;5;124;03mPlot y versus x as lines and/or markers.\u001b[39;00m\n\u001b[1;32m 1536\u001b[0m \n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 1774\u001b[0m \u001b[38;5;124;03m(``'green'``) or hex strings (``'#008000'``).\u001b[39;00m\n\u001b[1;32m 1775\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 1776\u001b[0m kwargs \u001b[38;5;241m=\u001b[39m cbook\u001b[38;5;241m.\u001b[39mnormalize_kwargs(kwargs, mlines\u001b[38;5;241m.\u001b[39mLine2D)\n\u001b[0;32m-> 1777\u001b[0m lines \u001b[38;5;241m=\u001b[39m [\u001b[38;5;241m*\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_get_lines(\u001b[38;5;28mself\u001b[39m, \u001b[38;5;241m*\u001b[39margs, data\u001b[38;5;241m=\u001b[39mdata, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs)]\n\u001b[1;32m 1778\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m line \u001b[38;5;129;01min\u001b[39;00m lines:\n\u001b[1;32m 1779\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39madd_line(line)\n",
"File \u001b[0;32m/usr/lib/python3.13/site-packages/matplotlib/axes/_base.py:297\u001b[0m, in \u001b[0;36m_process_plot_var_args.__call__\u001b[0;34m(self, axes, data, return_kwargs, *args, **kwargs)\u001b[0m\n\u001b[1;32m 295\u001b[0m this \u001b[38;5;241m+\u001b[39m\u001b[38;5;241m=\u001b[39m args[\u001b[38;5;241m0\u001b[39m],\n\u001b[1;32m 296\u001b[0m args \u001b[38;5;241m=\u001b[39m args[\u001b[38;5;241m1\u001b[39m:]\n\u001b[0;32m--> 297\u001b[0m \u001b[38;5;28;01myield from\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_plot_args\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 298\u001b[0m \u001b[43m \u001b[49m\u001b[43maxes\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mthis\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mkwargs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mambiguous_fmt_datakey\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mambiguous_fmt_datakey\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 299\u001b[0m \u001b[43m \u001b[49m\u001b[43mreturn_kwargs\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mreturn_kwargs\u001b[49m\n\u001b[1;32m 300\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n",
"File \u001b[0;32m/usr/lib/python3.13/site-packages/matplotlib/axes/_base.py:494\u001b[0m, in \u001b[0;36m_process_plot_var_args._plot_args\u001b[0;34m(self, axes, tup, kwargs, return_kwargs, ambiguous_fmt_datakey)\u001b[0m\n\u001b[1;32m 491\u001b[0m axes\u001b[38;5;241m.\u001b[39myaxis\u001b[38;5;241m.\u001b[39mupdate_units(y)\n\u001b[1;32m 493\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m x\u001b[38;5;241m.\u001b[39mshape[\u001b[38;5;241m0\u001b[39m] \u001b[38;5;241m!=\u001b[39m y\u001b[38;5;241m.\u001b[39mshape[\u001b[38;5;241m0\u001b[39m]:\n\u001b[0;32m--> 494\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mx and y must have same first dimension, but \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 495\u001b[0m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mhave shapes \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mx\u001b[38;5;241m.\u001b[39mshape\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m and \u001b[39m\u001b[38;5;132;01m{\u001b[39;00my\u001b[38;5;241m.\u001b[39mshape\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m 496\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m x\u001b[38;5;241m.\u001b[39mndim \u001b[38;5;241m>\u001b[39m \u001b[38;5;241m2\u001b[39m \u001b[38;5;129;01mor\u001b[39;00m y\u001b[38;5;241m.\u001b[39mndim \u001b[38;5;241m>\u001b[39m \u001b[38;5;241m2\u001b[39m:\n\u001b[1;32m 497\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mx and y can be no greater than 2D, but have \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 498\u001b[0m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mshapes \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mx\u001b[38;5;241m.\u001b[39mshape\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m and \u001b[39m\u001b[38;5;132;01m{\u001b[39;00my\u001b[38;5;241m.\u001b[39mshape\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m)\n",
"\u001b[0;31mValueError\u001b[0m: x and y must have same first dimension, but have shapes (3,) and (4,)"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAi4AAAGiCAYAAADA0E3hAAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjAsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvlHJYcgAAAAlwSFlzAAAPYQAAD2EBqD+naQAAHLtJREFUeJzt3W9sleX9+PFPaWmrbq0RtBZBBKcTJepoA6OsGp3WoNGQbJHFRdRpYrM5hE6njEWGMWl00X11Cm4KGhN0REXng87RBxtWcX9gxRghcRFmQVtJMbaoWxlw/x4Y+lvX4ji1f7ja1yu5H5zL+z7nOrms5+19nz95WZZlAQCQgDHDPQEAgCMlXACAZAgXACAZwgUASIZwAQCSIVwAgGQIFwAgGcIFAEiGcAEAkiFcAIBk5Bwur7zySlx55ZUxYcKEyMvLixdffPF/HrNhw4aoqKiI4uLimDp1ajz66KP9mSsAMMrlHC6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ZDr7HBQDSM+zf4wIAMJyECwCQDOECACRDuAAAyRAuAEAyhAsAkAzhAgAkQ7gAAMkQLgBAMoQLAJAM4QIAJEO4AADJEC4AQDKECwCQDOECACRDuAAAyRAuAEAyhAsAkAzhAgAkQ7gAAMkQLgBAMoQLAJAM4QIAJEO4AADJEC4AQDKECwCQDOECACRDuAAAyRAuAEAyhAsAkAzhAgAkQ7gAAMkQLgBAMoQLAJAM4QIAJEO4AADJEC4AQDKECwCQDOECACRDuAAAyRAuAEAyhAsAkAzhAgA
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# Create subplots\n",
"fig, ax = plt.subplots()\n",
"\n",
"# Loop through each measurement type\n",
"model = \"P>M>F\"\n",
"data = bottle_data\n",
"imgclass = \"bottle\"\n",
"\n",
"# Plot both bottle and cable data\n",
"ax.plot([1,3,5], data[\"ResNet50\"].get(\"1,3,5 shots normal\", []), marker='o', label=f'ResNet50', linestyle='-')\n",
"ax.plot([1,3,5], data[\"P>M>F\"].get(\"1,3,5 shots normal\", []), marker='o', label=f'P>M>F', linestyle='-')\n",
"ax.plot([1,3,5], data[\"CAML\"].get(\"1,3,5 shots normal\", []), marker='o', label=f'CAML', linestyle='-')\n",
"\n",
"ax.set_title(f'{model} - {imgclass}')\n",
"ax.set_xlabel(\"Shots per class\")\n",
"ax.set_ylabel(\"Accuracy\")\n",
"ax.legend()\n",
"ax.grid(True)\n",
"\n",
"ax.set(xlim=(0.75, 5.25), xticks=[1,3,5])\n",
"\n",
"# Adjust layout\n",
"plt.tight_layout()\n",
"plt.savefig(f\"{model}-{imgclass}.png\")"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABW0AAAPdCAYAAADxjUr8AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMywgaHR0cHM6Ly9tYXRwbG90bGliL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FCpUSImNjTWVRUVFKR4eHkpGRwLpPX/LiHPIVq1aKUWKFFEiIyPNyocMGaI4ODhYrP+sDRs2KICyaNEis/Lp06dbfP6oU6eOUrBgQSU6OtpUlpCQoAQGBipFihQxveZSe+4+ZswYRaPRKEePHjVbr0WLFim+5hRFUVxcXJThw4cnu05qf3fGjh1rdb133nlH0Wg0yunTpxVFSf5zWWraI4RInkyPIITIUz788EMOHjzIhg0b6NevH0OGDEnV5WFVq1Zl3rx5dOrUiQYNGvDmm2+yd+9efH19Td+OJ8XDw4MSJUowa9Ys5syZw5EjR6xeugdQpUoV06hQAAcHB0qXLm02qmLbtm00a9aMokWLmm3bt29fHj9+zL59+zKsPdZoNBo6dOhgVlapUiWLNjo7O9O1a1eLNgIWl+01bdqU/PnzW91f+/btzR6XK1cOwDR6+Nny5y9D3LZtG82bN8fd3R2dToetrS0ff/wx9+7d4/bt2ykcqRBCCCFyKh8fH2rVqmVW9vz5SKKePXuaTbPl5+dH3bp12b59u6ksJiaGMWPGULJkSWxsbLCxscHFxYVHjx5x8uTJZNuS1m1feeUVi3YDpraHhoZiMBh49913k9zn3r17uX//Pn369CEhIcG
"text/plain": [
"<Figure size 1400x1000 with 6 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# Create subplots\n",
"fig, axes = plt.subplots(3, 2, figsize=(14, 10))\n",
"axes = axes.flatten()\n",
"\n",
"# Loop through each measurement type\n",
"for i, measurement in enumerate(measurement_types):\n",
" ax = axes[i]\n",
" for model in models:\n",
" # Get the bottle and cable data for the current measurement and model\n",
" bottle_accuracy = bottle_data[model].get(measurement, [])\n",
" cable_accuracy = cable_data[model].get(measurement, [])\n",
" \n",
" # Plot both bottle and cable data\n",
" ax.plot(cable_accuracy, marker='o', label=f'{model} - Cable', linestyle='-')\n",
" \n",
" ax.set_title(measurement)\n",
" ax.set_xlabel(\"Shots / Samples\")\n",
" ax.set_ylabel(\"Accuracy\")\n",
" ax.legend()\n",
" ax.grid(True)\n",
"\n",
"# Adjust layout\n",
"plt.tight_layout()\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAnYAAAHWCAYAAAD6oMSKAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/GU6VOAAAACXBIWXMAAA9hAAAPYQGoP6dpAABzXUlEQVR4nO3deVxU5eIG8OfMwrAPAsqwiaiksrhvaJpW4lJuLVqZmUtlm3lp05s3t7pq91YuN/m1qKRWWplmXTKxcruaprlj5pbKLigM6zDL+f0xMDDOgDM4MDA+3z7zwTnnPee8ox14eN/zvq8giqIIIiIiImr2JM6uABERERE5BoMdERERkYtgsCMiIiJyEQx2RERERC6CwY6IiIjIRTDYEREREbkIBjsiIiIiF8FgR0REROQiGOyIiIiIXASDHRE1muTkZAiCYHrJZDKEhYVh8uTJyMjIuOXz79y503Tu5ORkq2XuvvtuCIKANm3a3PL1AKBNmzZmn6nmq7i42CHXcLR58+ZBEATk5eXdtOygQYMwaNCghq8UETmEzNkVIKLbz5o1a9CxY0eUlZVh9+7dWLRoEXbt2oUTJ07Ay8vrls/v4+ODVatW4cknnzTbfvHiRezcuRO+vr63fI2a+vfvj3//+98W2z09PR16HSKim2GwI6JGFxsbi549ewIABg8eDL1ej4ULF2LLli2YMGECysrKkJeXh/Dw8Hqdf/z48fjkk09w9uxZREVFmbavXr0aoaGhiIuLQ1pamtkxZ8+eRfv27SEIgt3X8/PzQ9++fetVVyIiR2JXLBE5XVUounTpEgAgJycHERERGDhwIJKSkmzqMqxpyJAhCA8Px+rVq03bDAYDPv30U0yaNAkSieW3vqeeegoRERF47bXXcOTIkVv4NA3n888/R3x8PLy9veHt7Y2uXbti1apVpv2pqakYPXo0wsLC4O7ujvbt2+OZZ56p9e/vypUreOCBB+Dr6wulUonHH38cV69evWk9Kioq8NZbb6Fj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gMCAzMxM+Pj51LldERERE1NBEUURRURFCQkIgkdTdJsdgZ0VmZmat6zESEREROcOVK1cQFhZWZxkGOyuqFrG+cuWKwxb8tpVWq8X27duRkJBg83qYRNQ08X4mch3OvJ/VajXCw8NN+aQuDHZWVHW/+vr6OiXYeXp6wtfXlz8IiJo53s9ErqMp3M+2PB7GwRNERERELoLBjoiIiMhFMNgRERERuQgGOyIiIiIXwWBHRERE5CIY7IiIiIhcBIMdERERkYtgsCMiIiJyEQx2RERERC6CwY6IiIjIRTDYERE1AL1Bj0M5h3Cs4hgO5RyC3qB3dpWI6DbAtWKJiBxsx6UdWHxwMXJKcwAAX/30FYI8gzCr9yzcG3Gvk2tHRK6MLXZERA6049IOJO5MNIW6KrmluUjcmYgdl3Y4qWZEdDtgsCMichC9QY/FBxdDhGixr2rbkoNL2C1LRA2GXbFERDehM+hQqClEgaYA18uvG79qrqOg3PxrelG6RUtdTSJEZJdmY87/5qBnUE8Eewcj2Mv4cpe5N+InIiJXxWBHRLcVg2hAUUVRdUCrI6hV7VdXqB1ah+8vfI/vL3xvts3f3R8hXiGmsBfiHQKVlwohXiEI8Q6Br5svBEFwaD2IyPUw2BFRsyWKIoq1xRZBrObXG/9coCmAQTTYfS0BApQKJfwUfsaXux9aKFpUf1X4Ia8sD8uPLL/puQaHD4bOoENWSRYyizNRqivFtfJruFZ+DSfzT1o9xlPmaWzd8w62CIDBXsFo6dESUonU7s9FRK6FwY6ImgRRFFGmK6u99cxKeCsoL4BO1NXrej5yH7Nw5qe4Iaj
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# Create subplots\n",
"fig, ax = plt.subplots()\n",
"\n",
"# Loop through each measurement type\n",
"model = \"P>M>F\"\n",
"data = cable_data\n",
"imgclass = \"cable\"\n",
"\n",
"# Plot both bottle and cable data\n",
"ax.plot([1,3,5], data[\"CAML\"].get(\"2 ways only detect if faulty or not\", []), marker='o', label=f'CAML', linestyle='-')\n",
"ax.plot([1,3,5], data[\"P>M>F\"].get(\"2 ways only detect if faulty or not\", []), marker='o', label=f'P>M>F', linestyle='-')\n",
"ax.plot([1,3,5], data[\"ResNet50\"].get(\"2 ways only detect if faulty or not\", []), marker='o', label=f'ResNet50', linestyle='-')\n",
"\n",
"\n",
"ax.set_title(f'{model} - {imgclass}')\n",
"ax.set_xlabel(\"Shots per class\")\n",
"ax.set_ylabel(\"Accuracy\")\n",
"ax.legend()\n",
"ax.grid(True)\n",
"\n",
"ax.set(xlim=(0.75, 5.25), xticks=[1,3,5])\n",
"\n",
"# Adjust layout\n",
"plt.tight_layout()\n",
"plt.savefig(f\"comparison-2way-{imgclass}.png\")"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAnUAAAHWCAYAAAARl3+JAAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjAsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvlHJYcgAAAAlwSFlzAAAPYQAAD2EBqD+naQAAenpJREFUeJzt3Xd8zPcfB/DX9y6XXHZkD1lIQsQMImaNRGjRTSnaohRVpYNWa/y0Shfa0qJWVY3qriKt2qNW7JEQEpEd2fvu+/vj5JKTHUm+yeX1fDzuIfdd9758uXv5fj9DEEVRBBERERE1ajKpCyAiIiKih8dQR0RERKQHGOqIiIiI9ABDHREREZEeYKgjIiIi0gMMdURERER6gKGOiIiISA8w1BERERHpAYY6IiIiIj3AUEdEVbZhwwYIgoBTp05Ve99bt25BEAR88skntVZP0TE3bNhQa8eUStHv9tatW1KXUi4PDw889thjlW6nT+eFqDFhqCMiIiLSAwx1RERERHqAoY6IHsoLL7wAMzMzREREYMiQITAzM4OrqytmzZqFvLy8Utur1Wp88MEHcHNzg1KpRJcuXfDPP//obBMREYEXX3wRXl5eMDExgYuLC4YOHYoLFy5UWk9V992/fz8EQcAPP/yAd999F87OzrCwsMD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JAABbW9taOzZDHRERUQOnUqm0gc7GxkbqcughGRsbAwASEhLQrFmzWjsuO0oQERE
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# Create subplots\n",
"fig, ax = plt.subplots()\n",
"\n",
"# Loop through each measurement type\n",
"model = \"P>M>F\"\n",
"data = cable_data\n",
"imgclass = \"cable\"\n",
"\n",
"# Plot both bottle and cable data\n",
"ax.plot([5, 10, 15, 30], data[\"P>M>F\"].get(\"inbalanced - more good shots\", []), marker='o', label=f'P>M>F', linestyle='-')\n",
"ax.plot([5, 10, 15, 30], data[\"ResNet50\"].get(\"inbalanced - more good shots\", []), marker='o', label=f'ResNet50', linestyle='-')\n",
"\n",
"\n",
"ax.set_title(f'Inbalanced - {imgclass}')\n",
"ax.set_xlabel(\"Shots per class\")\n",
"ax.set_ylabel(\"Accuracy\")\n",
"ax.legend()\n",
"ax.grid(True)\n",
"\n",
"ax.set(xlim=(4.75, 30.25), xticks=[5,10,15,30])\n",
"\n",
"# Adjust layout\n",
"plt.tight_layout()\n",
"plt.savefig(f\"inbalanced-{imgclass}.png\")"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAnUAAAHWCAYAAAARl3+JAAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjAsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvlHJYcgAAAAlwSFlzAAAPYQAAD2EBqD+naQAAkFtJREFUeJzs3XdYFFcXwOHf7LL0JjZQEbtiF1QsGGNv2GvsvcSuKZ/pmhg1McYWe+8txhY1aqzYe8PeQMSugCJ15/tjI5GACggM4HmfZ57A7J07Z1iyHO/MPVdRVVVFCCGEEEJkaDqtAxBCCCGEEO9OkjohhBBCiExAkjohhBBCiExAkjohhBBCiExAkjohhBBCiExAkjohhBBCiExAkjohhBBCiExAkjohhBBCiExAkjohhBBCiExAkjohMqgFCxagKArHjh1L8rE3b95EURTGjx+fYvG87HPBggUp1qdWXv5sb968+cZ2a9eu5aOPPqJQoUJYWVmRL18+OnTowJUrV956jjVr1qAoCitXroz3WpkyZVAUhb/++iveawULFsTDwyPR15KRKYrCgAED3tpu9+7dKIrC7t27Uz8oIdIxSeqEECKZxo0bR1hYGF9++SVbt27lhx9+4OTJk3h4eHD+/Pk3Hvvhhx+iKAq7du2Ks//x48ecPXsWGxubeK/dvn2b69evU6NGjRS/FiFExmemdQBCCJFRbdy4kRw5csTZV7NmTfLly8evv/7KnDlzXntstmzZKFmyZLzRpT179mBmZkaPHj3iJXUvv5ekTgiREBmpEyIT6dq1K7a2tly9epWGDRtia2uLq6srw4cPJyIiIl57o9HI6NGjyZs3L5aWlpQvX56///47TpurV6/SrVs3ChcujLW1Nblz56Zx48acPXv2rfEk9tiXt8+WL1/Ol19+Sa5cubC3t6d27dpcunQpXr9bt26lVq1aODg4YG1tjbu7O2PGjInT5tixYzRp0gQnJycsLS0pV64cq1atitfXoUOHqFq1KpaWluTKlYsRI0YQFRX11msD4iV0ALly5SJPnjwEBAS89fgaNWpw6dIlgoKCYvft3r2bChUq0LBhQ44fP05oaGic1/R6PdWqVQNg5MiReHl54eTkhL29PR4eHsydOxdVVWOP6dGjB05OToSFhcU7f82aNSlRokSirjWxAgMD6d27N66urpibm5MrVy5atWrFvXv3AAgPD2f48OGULVsWBwcHnJycqFy5MuvXr39tnzNnzqRIkSJYWFhQvHhxVqxYkahYEvs7IERmIUmdEJlMVFQUTZo0oVatWqxfv57u3bvz66+/Mm7cuHhtp06dytatW5k4cSJLlixBp9PRoEEDDh48GNvmzp07ZM2albFjx7J161Z+++03zMzM8PLySjDhelVSj/3iiy+4desWc+bMYdasWVy5coXGjRsTExMT22bu3Lk0bNgQo9HIjBkz2LhxI4MGDeL27duxbXbt2kXVqlV5+vQpM2bMYP369ZQtW5a2bdvGeebPz8+PWrVq8fTpUxYsWMCMGTM4efIk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SZOiKJibm8d57+7evfva2a9///13gu9PwYIFXzsqmJTfASEyE0nqhHiP6fV66tSpw7BhwzAajYwbN46QkBBGjhwZ28bHx4cFCxZQrFgxSpcuzfHjx/n555/fepvtXY9NiK2tLb/88gs9e/akdu3a9OrVi5w5c3L16lVOnz7N1KlTAVMJjAYNGlCvXj26du1K7ty5efz4MRcuXODEiROsXr0agK+++ooNGzZQs2ZNvvnmG6ytrfntt994/vx5ouIZNGgQc+fOpXv37pQqVYpDhw7FvmZhYUG5cuXe2sfLUiTr1q1Dp9PFPk/3UvXq1Zk4cSIQ93m6Ro0aMWHCBNq3b0/v3r159OgR48e
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# Create subplots\n",
"fig, ax = plt.subplots()\n",
"\n",
"# Loop through each measurement type\n",
"model = \"P>M>F\"\n",
"data = cable_data\n",
"imgclass = \"cable\"\n",
"\n",
"# Plot both bottle and cable data\n",
"ax.plot([5, 10, 15, 30], data[\"P>M>F\"].get(\"inbalance 2 way\", []), marker='o', label=f'P>M>F', linestyle='-')\n",
"ax.plot([5, 10, 15, 30], data[\"ResNet50\"].get(\"inbalance 2 way\", []), marker='o', label=f'ResNet50', linestyle='-')\n",
"\n",
"\n",
"ax.set_title(f'Inbalanced 2-Way - {imgclass}')\n",
"ax.set_xlabel(\"Shots per class\")\n",
"ax.set_ylabel(\"Accuracy\")\n",
"ax.legend()\n",
"ax.grid(True)\n",
"\n",
"ax.set(xlim=(4.75, 30.25), xticks=[5,10,15,30])\n",
"\n",
"# Adjust layout\n",
"plt.tight_layout()\n",
"plt.savefig(f\"inbalanced-2way-{imgclass}.png\")"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAnYAAAHWCAYAAAD6oMSKAAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjAsIGh0dH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GzZsUHx9fRUrKyulcuXKyoIFCzKdM7tZsff2DxkyRKlQoYKi0+kUd3d3pXXr1sqsWbMK7PMLIfKPSlFKweKJQgiRR0uXLmXkyJGcOnUKX19fS4cjhBCPJYmdEEJkIzAwkCtXrvDuu+/Spk2bR05UEEKIokQSOyGEyEblypWJjIykXbt2/PDDD9m2EBFCiKJGEjshhBBCiBJCZsUKIYQQQpQQktgJIYQQQpQQktgJIYQQQpQQpW7lCZPJxI0bN3B0dHxiB3khhBBCCEtTFIX4+HjKly+PWv34e3KlLrG7ceMG3t7elg5DCCGEECJXwsLCMpZdfJRSl9g5OjoC5i+Ok5NToZ5br9ezfft2unTpgk6nK9RzCyEKnlzjQpRclry+4+Li8Pb2zshhHqfUJXb3yq9OTk4WSezs7OxwcnKSH/pClEByjQtRchWF6zsnj5DJ5AkhhBBCiBLC4ondsmXLqFKlCjY2NjRp0oS9e/c+dnxqaiqTJk3Cx8cHa2trqlWrxsqVKwspWiGEEEKIosuipdi1a9cyatQoli1bRps2bfjmm2/o3r07ISEhVKpUKdv39O/fn5s3b7JixQqqV69OVFQUBoOhkCMXQgghhCh6LJrYLViwgKFDhzJs2DAAFi1axLZt21i+fDlz5szJMn7
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# Create subplots\n",
"fig, ax = plt.subplots()\n",
"\n",
"# Loop through each measurement type\n",
"data = cable_data\n",
"imgclass = \"cable\"\n",
"\n",
"# Plot both bottle and cable data\n",
"#only faulty class detect\n",
"#1,3,5 shots normal\n",
"ax.plot([1,3,5], data[\"CAML\"].get(\"only faulty class detect\", []), marker='o', label=f'CAML', linestyle='-')\n",
"ax.plot([1,3,5], data[\"P>M>F\"].get(\"only faulty class detect\", []), marker='o', label=f'P>M>F', linestyle='-')\n",
"ax.plot([1,3,5], data[\"ResNet50\"].get(\"only faulty class detect\", []), marker='o', label=f'ResNet50', linestyle='-')\n",
"\n",
"\n",
"ax.set_title(f'8-Way - {imgclass}')\n",
"ax.set_xlabel(\"Shots per class\")\n",
"ax.set_ylabel(\"Accuracy\")\n",
"ax.legend()\n",
"ax.grid(True)\n",
"\n",
"ax.set(xlim=(0.75, 5.25), xticks=[1,3,5])\n",
"\n",
"# Adjust layout\n",
"plt.tight_layout()\n",
"plt.savefig(f\"faultclasses-{imgclass}.png\")"
]
}
],
"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.13.1"
}
},
"nbformat": 4,
"nbformat_minor": 4
}