From 7a9cd94851954d99721bae7ea9e91eb2b8c8f6a3 Mon Sep 17 00:00:00 2001
From: Tiago Freitas Pereira <tiagofrepereira@gmail.com>
Date: Tue, 4 May 2021 17:52:33 +0200
Subject: [PATCH] UPdated some defaults

---
 notebooks/50-shades-of-face.ipynb | 62 +++++++++++++++++++------------
 1 file changed, 39 insertions(+), 23 deletions(-)

diff --git a/notebooks/50-shades-of-face.ipynb b/notebooks/50-shades-of-face.ipynb
index dc80e92d..0e987722 100644
--- a/notebooks/50-shades-of-face.ipynb
+++ b/notebooks/50-shades-of-face.ipynb
@@ -12,7 +12,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 6,
+   "execution_count": 1,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -29,6 +29,18 @@
     "import os\n",
     "import scipy.spatial\n",
     "import bob.measure\n",
+    "dask_client = None\n",
+    "\n",
+    "###\n",
+    "image_size = 112\n",
+    "\n",
+    "# eyes position in the vertical axis\n",
+    "# final position will be image_size/height_denominators\n",
+    "height_denominators = [4.5,4,3.5,3,2.8]\n",
+    "\n",
+    "# Eyes distance to be explored\n",
+    "eyes_distances = [30, 35, 40, 42,45,48]\n",
+    "\n",
     "\n",
     "\n",
     "output_path = \"./50-shades\"\n",
@@ -51,14 +63,24 @@
     "\n"
    ]
   },
+  {
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "## Setting up the grid\n",
+    "\n",
+    "If you want to run this on the cluster, don't forget to `SETSHELL grid` before running the cell below.\n"
+   ]
+  },
   {
    "cell_type": "code",
-   "execution_count": 7,
+   "execution_count": 2,
    "metadata": {},
    "outputs": [],
    "source": [
     "# Starting dask client\n",
     "\n",
+    "\n",
     "from dask.distributed import Client\n",
     "from bob.pipelines.distributed.sge import SGEMultipleQueuesCluster\n",
     "\n",
@@ -78,13 +100,13 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 8,
+   "execution_count": 3,
    "metadata": {},
    "outputs": [
     {
      "data": {
       "application/vnd.jupyter.widget-view+json": {
-       "model_id": "bf5cb5839aaf46e8808e0c3ebc3abb88",
+       "model_id": "365e408f16e04de7ba0f709639b4ee8d",
        "version_major": 2,
        "version_minor": 0
       },
@@ -101,12 +123,6 @@
     "\n",
     "annotation_type = \"eyes-center\"\n",
     "fixed_positions = None\n",
-    "height_denominators = [4.5,4,3.5,3]\n",
-    "eyes_distances = [30, 35, 40, 42,45,48]\n",
-    "\n",
-    "#height_denominators = [3,4]\n",
-    "#eyes_distances = [42,43]\n",
-    "\n",
     "\n",
     "\n",
     "def get_cropers(final_size = 112,\n",
@@ -179,7 +195,8 @@
     "\n",
     "subplot_shape = (int((len(eyes_distances)*len(height_denominators))/len(height_denominators)),len(height_denominators))\n",
     "\n",
-    "transformers = get_cropers(height_denominators=height_denominators,\n",
+    "transformers = get_cropers(final_size=image_size,\n",
+    "                           height_denominators=height_denominators,\n",
     "                           eyes_distances=eyes_distances)\n",
     "\n",
     "plot_faces(transformers, database, subplot_shape)\n"
@@ -191,12 +208,12 @@
    "source": [
     "## Run vanilla biometrics\n",
     "\n",
-    "Here we are running Vanilla Biometrics several times and collecting the `1-FNMR@FMR=0.01` and plotting."
+    "Here we are running Vanilla Biometrics several times and collecting the `1-FNMR@FMR=0.001` and plotting."
    ]
   },
   {
    "cell_type": "code",
-   "execution_count": 9,
+   "execution_count": 4,
    "metadata": {},
    "outputs": [
     {
@@ -226,13 +243,19 @@
       "There's no data to train background model.For the rest of the execution it will be assumed that the pipeline is stateless.\n",
       "There's no data to train background model.For the rest of the execution it will be assumed that the pipeline is stateless.\n",
       "There's no data to train background model.For the rest of the execution it will be assumed that the pipeline is stateless.\n",
+      "There's no data to train background model.For the rest of the execution it will be assumed that the pipeline is stateless.\n",
+      "There's no data to train background model.For the rest of the execution it will be assumed that the pipeline is stateless.\n",
+      "There's no data to train background model.For the rest of the execution it will be assumed that the pipeline is stateless.\n",
+      "There's no data to train background model.For the rest of the execution it will be assumed that the pipeline is stateless.\n",
+      "There's no data to train background model.For the rest of the execution it will be assumed that the pipeline is stateless.\n",
+      "There's no data to train background model.For the rest of the execution it will be assumed that the pipeline is stateless.\n",
       "There's no data to train background model.For the rest of the execution it will be assumed that the pipeline is stateless.\n"
      ]
     },
     {
      "data": {
       "application/vnd.jupyter.widget-view+json": {
-       "model_id": "fe0dca81b68641348a28c2e165519e92",
+       "model_id": "6556949a548c4f1da86073f0a9351109",
        "version_major": 2,
        "version_minor": 0
       },
@@ -290,9 +313,9 @@
     "    \n",
     "    scores_dev = os.path.join(output_path, \"scores-dev\")\n",
     "    \n",
-    "    # Picking FNMR@FAR=0.01\n",
+    "    # Picking FNMR@FAR=0.001\n",
     "    neg, pos = bob.bio.base.score.load.split_four_column(scores_dev)\n",
-    "    far_thres = bob.measure.far_threshold(neg, pos, 0.01)\n",
+    "    far_thres = bob.measure.far_threshold(neg, pos, 0.001)\n",
     "    fpr,fnr = bob.measure.fprfnr(neg, pos, far_thres)\n",
     "    fnmr_1 = round(1-fnr,2)\n",
     "    fnmrs.append(fnmr_1)\n",
@@ -310,13 +333,6 @@
     "# Shutting down client\n",
     "dask_client.shutdown()"
    ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "metadata": {},
-   "outputs": [],
-   "source": []
   }
  ],
  "metadata": {
-- 
GitLab