Felix Kleinsteuber преди 2 години
родител
ревизия
88e5ee155e

Файловите разлики са ограничени, защото са твърде много
+ 0 - 0
approach3_local_features.ipynb


+ 21 - 15
approach4_autoencoder.ipynb

@@ -2,15 +2,21 @@
  "cells": [
   {
    "cell_type": "code",
-   "execution_count": 30,
+   "execution_count": 1,
    "metadata": {},
    "outputs": [
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "/home/kleinsteuber/anaconda3/envs/pytorch-gpu/lib/python3.10/site-packages/tqdm/auto.py:22: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
+      "  from .autonotebook import tqdm as notebook_tqdm\n"
+     ]
+    },
     {
      "name": "stdout",
      "output_type": "stream",
      "text": [
-      "The autoreload extension is already loaded. To reload it, use:\n",
-      "  %reload_ext autoreload\n",
       "Found 2 sessions\n",
       "Session 'Beaver_01' at folder: /home/kleinsteuber/vscode/ResizedSessions256_NoBackup/VIELAAS_Spring_Session01-VIELAAS_Beaver_01\n",
       "Loaded scans.\n"
@@ -46,7 +52,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 21,
+   "execution_count": 2,
    "metadata": {},
    "outputs": [
     {
@@ -68,7 +74,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 28,
+   "execution_count": 3,
    "metadata": {},
    "outputs": [
     {
@@ -127,7 +133,7 @@
        ")"
       ]
      },
-     "execution_count": 28,
+     "execution_count": 3,
      "metadata": {},
      "output_type": "execute_result"
     }
@@ -218,7 +224,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 3,
+   "execution_count": 4,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -228,7 +234,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 4,
+   "execution_count": 5,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -237,7 +243,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 5,
+   "execution_count": 6,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -248,7 +254,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 6,
+   "execution_count": 7,
    "metadata": {},
    "outputs": [
     {
@@ -265,7 +271,7 @@
        "dtype: float64"
       ]
      },
-     "execution_count": 6,
+     "execution_count": 7,
      "metadata": {},
      "output_type": "execute_result"
     }
@@ -276,7 +282,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 7,
+   "execution_count": 8,
    "metadata": {},
    "outputs": [
     {
@@ -293,7 +299,7 @@
        "dtype: float64"
       ]
      },
-     "execution_count": 7,
+     "execution_count": 8,
      "metadata": {},
      "output_type": "execute_result"
     }
@@ -304,7 +310,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 17,
+   "execution_count": 9,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -326,7 +332,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 19,
+   "execution_count": 10,
    "metadata": {},
    "outputs": [
     {

BIN
plots/approach3/roc_curves/Beaver_01_30_30_1024.pdf


BIN
plots/approach3/roc_curves/Beaver_01_30_30_1024.png


BIN
plots/approach3/roc_curves/Beaver_01_30_30_2048.pdf


BIN
plots/approach3/roc_curves/Beaver_01_30_30_2048.png


BIN
plots/approach4/roc_curves/Beaver_01_kde.pdf


+ 3 - 4
py/LocalFeatures.py

@@ -4,6 +4,7 @@
 import cv2 as cv
 import numpy as np
 from tqdm import tqdm
+from sklearn.cluster import KMeans
 
 from py.Session import SessionImage
 
@@ -65,10 +66,8 @@ def generate_dictionary_from_descriptors(dscs, dictionary_size: int):
     assert len(dscs.shape) == 2 and dscs.shape[1] == 128
     assert dictionary_size > 0 and dictionary_size <= dscs.shape[0]
 
-    BOW = cv.BOWKMeansTrainer(dictionary_size)
-    for dsc in dscs:
-        BOW.add(dsc)
-    dictionary = BOW.cluster()
+    kmeans = KMeans(dictionary_size, verbose=1).fit(dscs)
+    dictionary = kmeans.cluster_centers_
     assert dictionary.shape == (dictionary_size, 128)
     return dictionary
 

+ 22 - 12
results.ipynb

@@ -13,17 +13,19 @@
    "source": [
     "## Beaver_01\n",
     "\n",
-    "| Approach | Configuration | Best AUC | TNR @TPR $\\geq$ 0.9 | TNR @TPR $\\geq$ 0.99 |\n",
-    "| --- | --- | ---: | ---: | ---: |\n",
-    "| 1a - Basic Frame Differencing | abs var | 0.7415 | 0.4865 | 0.2432 |\n",
-    "| | $\\sigma=2$, sq var | 0.8986 | 0.7162 | 0.5270 |\n",
-    "| | $\\sigma=4$, sq var | 0.9156 | 0.7973 | 0.5676 |\n",
-    "| 1b - Histogram Comparison | p-mean | 0.6707 | | |\n",
-    "| 2 - Background Estimation | no lapse, sq var | 0.7897 | 0.6622 | 0.2703 |\n",
-    "| | $\\sigma=2$, no lapse, sq var | 0.8735 | 0.7973 | 0.4865 |\n",
-    "| | $\\sigma=4$, no lapse, sq var | 0.8776 | 0.7838 | 0.4459 |\n",
-    "| 3 - BOW | $k=2048, kp=30$ | 0.7741 | 0.4976 | 0.0564 |\n",
-    "| 4 - Autoencoder | Deep +Noise +Sparse KDE | 0.9209 | 0.8514 | 0.1216 |"
+    "| Approach | Configuration | Best AUC | TNR @TPR $\\geq$ 0.9 | TNR @TPR $\\geq$ 0.95 | TNR @TPR $\\geq$ 0.99 |\n",
+    "| --- | --- | ---: | ---: | ---: | --: |\n",
+    "| 1a - Basic Frame Differencing | abs var | 0.7415 | 0.4865 | | 0.2432 |\n",
+    "| | $\\sigma=2$, sq var | 0.8986 | 0.7162 | | 0.5270 |\n",
+    "| | $\\sigma=4$, sq var | 0.9156 | 0.7973 | | 0.5676 |\n",
+    "| 1b - Histogram Comparison | p-mean | 0.6707 | | | |\n",
+    "| 2 - Background Estimation | no lapse, sq var | 0.7897 | 0.6622 | | 0.2703 |\n",
+    "| | $\\sigma=2$, no lapse, sq var | 0.8735 | 0.7973 | | 0.4865 |\n",
+    "| | $\\sigma=4$, no lapse, sq var | 0.8776 | 0.7838 | | 0.4459 |\n",
+    "| 3 - BOW | $k=2048, kp=30$ | 0.7741 | 0.4976 | 0.3382 | 0.0564 |\n",
+    "| | $k=1024, kp=30$, +motion | 0.7056 | 0.2432 | 0.2222 | 0.0821 |\n",
+    "| | $k=2048, kp=30$, +motion | 0.7390 | 0.3172 | 0.3092 | 0.0612 |\n",
+    "| 4 - Autoencoder | Deep +Noise +Sparse KDE | 0.9209 | 0.8514 | 0.6892 | 0.1216 |"
    ]
   },
   {
@@ -47,7 +49,15 @@
   {
    "cell_type": "markdown",
    "metadata": {},
-   "source": []
+   "source": [
+    "gaia5: python train_bow.py ResizedSessions_NoBackup beaver_01 --clusters 4096 --include_motion && python eval_bow.py ResizedSessions_NoBackup beaver_01 --clusters 4096 --include_motion\n",
+    "\n",
+    "gaia4: python train_bow.py ResizedSessions_NoBackup beaver_01 --clusters 4096 && python eval_bow.py ResizedSessions_NoBackup beaver_01 --clusters 4096\n",
+    "\n",
+    "gaia3: python train_bow.py ResizedSessions_NoBackup beaver_01 --clusters 2048 --step_size 40 && python eval_bow.py ResizedSessions_NoBackup beaver_01 --clusters 2048 --step_size 40\n",
+    "\n",
+    "herkules: python train_bow.py ResizedSessions_NoBackup beaver_01 --clusters 2048 --step_size 40 --include_motion && python eval_bow.py ResizedSessions_NoBackup beaver_01 --clusters 2048 --step_size 40 --include_motion"
+   ]
   },
   {
    "cell_type": "code",

Някои файлове не бяха показани, защото твърде много файлове са промени