From 8a6a7062b240edbdb2bf9265ce1cdad5c587e577 Mon Sep 17 00:00:00 2001 From: Tiago Freitas Pereira <tiagofrepereira@gmail.com> Date: Tue, 4 May 2021 16:26:19 +0200 Subject: [PATCH] 50 shades --- notebooks/50-shades-of-face.ipynb | 62 ++++++++++++------------------- 1 file changed, 23 insertions(+), 39 deletions(-) diff --git a/notebooks/50-shades-of-face.ipynb b/notebooks/50-shades-of-face.ipynb index 0e987722..dc80e92d 100644 --- a/notebooks/50-shades-of-face.ipynb +++ b/notebooks/50-shades-of-face.ipynb @@ -12,7 +12,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 6, "metadata": {}, "outputs": [], "source": [ @@ -29,18 +29,6 @@ "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", @@ -63,24 +51,14 @@ "\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": 2, + "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "# Starting dask client\n", "\n", - "\n", "from dask.distributed import Client\n", "from bob.pipelines.distributed.sge import SGEMultipleQueuesCluster\n", "\n", @@ -100,13 +78,13 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "365e408f16e04de7ba0f709639b4ee8d", + "model_id": "bf5cb5839aaf46e8808e0c3ebc3abb88", "version_major": 2, "version_minor": 0 }, @@ -123,6 +101,12 @@ "\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", @@ -195,8 +179,7 @@ "\n", "subplot_shape = (int((len(eyes_distances)*len(height_denominators))/len(height_denominators)),len(height_denominators))\n", "\n", - "transformers = get_cropers(final_size=image_size,\n", - " height_denominators=height_denominators,\n", + "transformers = get_cropers(height_denominators=height_denominators,\n", " eyes_distances=eyes_distances)\n", "\n", "plot_faces(transformers, database, subplot_shape)\n" @@ -208,12 +191,12 @@ "source": [ "## Run vanilla biometrics\n", "\n", - "Here we are running Vanilla Biometrics several times and collecting the `1-FNMR@FMR=0.001` and plotting." + "Here we are running Vanilla Biometrics several times and collecting the `1-FNMR@FMR=0.01` and plotting." ] }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 9, "metadata": {}, "outputs": [ { @@ -243,19 +226,13 @@ "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": "6556949a548c4f1da86073f0a9351109", + "model_id": "fe0dca81b68641348a28c2e165519e92", "version_major": 2, "version_minor": 0 }, @@ -313,9 +290,9 @@ " \n", " scores_dev = os.path.join(output_path, \"scores-dev\")\n", " \n", - " # Picking FNMR@FAR=0.001\n", + " # Picking FNMR@FAR=0.01\n", " neg, pos = bob.bio.base.score.load.split_four_column(scores_dev)\n", - " far_thres = bob.measure.far_threshold(neg, pos, 0.001)\n", + " far_thres = bob.measure.far_threshold(neg, pos, 0.01)\n", " fpr,fnr = bob.measure.fprfnr(neg, pos, far_thres)\n", " fnmr_1 = round(1-fnr,2)\n", " fnmrs.append(fnmr_1)\n", @@ -333,6 +310,13 @@ "# Shutting down client\n", "dask_client.shutdown()" ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { -- GitLab