From 9f13d68c47fa4bdb5409b74458a888ab85227ea7 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Ruel Date: Fri, 23 Aug 2024 04:14:13 -0400 Subject: [PATCH] docs: update the jupiter notebooks --- notebooks/general_template_matching_example.ipynb | 11 ++++++----- notebooks/pose_extimation_example.ipynb | 13 +++++++------ 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/notebooks/general_template_matching_example.ipynb b/notebooks/general_template_matching_example.ipynb index 9166691..8dccca3 100644 --- a/notebooks/general_template_matching_example.ipynb +++ b/notebooks/general_template_matching_example.ipynb @@ -47,7 +47,7 @@ "source": [ "### Environment Set-up\n", "\n", - "* If running locally using jupyter, first install `openfdcm==0.9.0` in your environment using the installation instructions in the repository.\n", + "* If running locally using jupyter, first install `openfdcm==0.10.0` in your environment using the installation instructions in the repository.\n", "\n", "* If running from Google Colab, set using_colab=True below and run the cell." ] @@ -76,8 +76,8 @@ "# Install required libraries\n", "if using_colab:\n", " import sys\n", - " !{sys.executable} -m pip install openfdcm==0.9.0\n", - " !git clone --branch v0.8.3 --single-branch --depth 1 https://github.com/Innoptech/OpenFDCM\n", + " !{sys.executable} -m pip install openfdcm==0.10.0\n", + " !git clone --branch v0.10.0 --single-branch --depth 1 https://github.com/Innoptech/OpenFDCM\n", " %matplotlib inline" ] }, @@ -288,11 +288,13 @@ "# Perform template matching using OpenFDCM\n", "max_tmpl_lines, max_scene_lines = 3, 10 # Combinatory search parameters, the greater deetctions the better but slower.\n", "depth = 30 # The [0, pi] discretization.\n", - "scene_padding = 1.0 # A ratio to pad the scene images used in the FDCM algorithm, use if best match may appear on image boundaries.\n", "coeff = 5.0 # A weighting factor to enhance the angular cost vs distance cost in FDCM algorithm.\n", + "scene_padding = 1.0 # A ratio to pad the scene images used in the FDCM algorithm, use if best match may appear on image boundaries.\n", + "distance_type = openfdcm.distance.L2 # or openfdcm.distance.L2_SQUARED or openfdcm.distance.L1\n", "#num_threads = 4\n", "\n", "threadpool = openfdcm.ThreadPool() # could pass num_threads here, but default is optimal\n", + "featuremap_params = openfdcm.Dt3CpuParameters(depth, coeff, scene_padding, distance_type)\n", "search_strategy = openfdcm.DefaultSearch(max_tmpl_lines, max_scene_lines)\n", "optimizer_strategy = openfdcm.BatchOptimize(5, threadpool)\n", "matcher = openfdcm.DefaultMatch()\n", @@ -300,7 +302,6 @@ "penalizer = openfdcm.ExponentialPenalty(tau=1.5)\n", "\n", "start_time = time.time()\n", - "featuremap_params = openfdcm.Dt3CpuParameters(depth=depth, dt3Coeff=coeff, padding=scene_padding)\n", "featuremap = openfdcm.build_cpu_featuremap(scene_lines, featuremap_params, threadpool)\n", "raw_matches = openfdcm.search(matcher, search_strategy, optimizer_strategy, featuremap, all_templates, scene_lines)\n", "penalized_matches = openfdcm.penalize(penalizer, raw_matches, openfdcm.get_template_lengths(all_templates))\n", diff --git a/notebooks/pose_extimation_example.ipynb b/notebooks/pose_extimation_example.ipynb index f5bc1ee..cbdb1d3 100644 --- a/notebooks/pose_extimation_example.ipynb +++ b/notebooks/pose_extimation_example.ipynb @@ -52,7 +52,7 @@ "\n", "### Environment Set-up\n", "\n", - "* If running locally using jupyter, first install `openfdcm==0.9.0` in your environment using the installation instructions in the repository.\n", + "* If running locally using jupyter, first install `openfdcm==0.10.0` in your environment using the installation instructions in the repository.\n", "\n", "* If running from Google Colab, set using_colab=True below and run the cell.\n", "\n" @@ -81,8 +81,8 @@ "# Install required libraries\n", "if using_colab:\n", " import sys\n", - " !{sys.executable} -m pip install openfdcm==0.9.0\n", - " !git clone --branch v0.9.0 --single-branch --depth 1 https://github.com/Innoptech/OpenFDCM\n", + " !{sys.executable} -m pip install openfdcm==0.10.0\n", + " !git clone --branch v0.10.0 --single-branch --depth 1 https://github.com/Innoptech/OpenFDCM\n", "\n" ] }, @@ -214,13 +214,14 @@ "\n", " # Perform template matching\n", " max_tmpl_lines, max_scene_lines = 4, 10 # Combinatory search parameters (the higer the better but exp slower).\n", - " depth = 30 # The [0, pi] discretization, the higher, the most precise but lin slower.\n", - " scene_padding = 1.0 # A ratio to pad the scene images used in the FDCM algorithm, use if best match may appear on image boundaries.\n", + " depth = 30 # The [0, pi] discretization.\n", " coeff = 5.0 # A weighting factor to enhance the angular cost vs distance cost in FDCM algorithm.\n", + " scene_padding = 1.0 # A ratio to pad the scene images used in the FDCM algorithm, use if best match may appear on image boundaries.\n", + " distance_type = openfdcm.distance.L2 # or openfdcm.distance.L2_SQUARED or openfdcm.distance.L1\n", " #num_threads = 4\n", "\n", " threadpool = openfdcm.ThreadPool() # could pass num_threads here, but default is optimal\n", - " featuremap_params = openfdcm.Dt3CpuParameters(depth, coeff, scene_padding)\n", + " featuremap_params = openfdcm.Dt3CpuParameters(depth, coeff, scene_padding, distance_type)\n", " search_strategy = openfdcm.DefaultSearch(max_tmpl_lines, max_scene_lines)\n", " optimizer_strategy = openfdcm.BatchOptimize(10, threadpool)\n", " matcher = openfdcm.DefaultMatch()\n",