Variable Tuning

The Variable Tuning module provides a way to tune variable values automatically without having to change each variable independently. The module uses various techniques to change variable values and retest the pipeline for success or failure due to the value changes.

Its not uncommon to have several variables that need to be tuned to accommodate different environments. Manual tuning of these variable can be time consuming and require specific knowledge of how the variables affect the final results. An automated solution can provide quicker and more precise results as long as the variables that need to be changed are know and what variable indicates a success or failure situation.

Please note that while this module can be used to determine the best values for existing variables there is NO guarantee that a solution will be found. Typical use of this module is after at least one manual solution is found and the values need to be adapted for use on more test cases.



1. Variable To Tune - Specify which variables are used in the pipeline to configure modules. These values will be changed in order to test different values while recording if the final results are still successful. For example, you could use a low_size variable in the Blob Size module as a variable to eliminate small blobs. But as you may not be sure how small is too small, various values for this variable can be tested.

2. Min/Max Possible Values - These specify the range of possible values of the variables that would create reasonable results. Its important to keep the range as narrow as possible as the more possible values the slower some of the tuning processes will take. For example, removing small blobs might range from a min of 100 pixels to 5000 pixels.

3. Value Increment - While many values between the minimum and maximum possible values will create a successful solution, not every value needs to be tested since small value changes will not change the outcome. By specifying a large increment, one can test values between a wide range without testing each and every incremental change. For example, while we may want to check 100 to 5000 pixels for blob sizes, we only need to check every 100 pixels so that the sizes 100, 200, 300, etc. will be checked but not 101, 102, 103, etc.

4. Variable Containing Result - Specify the variable that will contain a value to be tested that will indicate success or failure of the analysis. In our example above, a Blob_Count variable could be specified as the result of the Blob Label module.

5. Comparison Method, Type, Value - These selections are the same as in the If Statement module in order to create a condition that can be used by the module to determine if the pipeline is successful or not. For example, we can compare the Blob_Count value to be equal to 4. As long as that condition holds true the pipeline configuration is assumed to be working.

Comparison Methods that are NOT included in the If_Statement module are:

Maximum/Minimum - Specify to find the maximum (largest) / minimum (smallest) number that the specified variable had during tuning.

Closest To/Furthest From - Specify to find the variable value that was closest to or furthest from the specified value. This allows you to specify an ideal value that may or may not be an exact match.

Note, because the previous 4 comparison methods are "best" result methods, they MUST be exhaustively evaluated or run for the maximum iterations in the case of Random technique. The Exhaustive First and Expand Current Techniques are disabled when these comparison methods are used.

6. Current Image or Folder - Specify where the images that are to be tested should come from. Current Image will only use the currently loaded image. Specifying a folder will load the images in that folder for testing.

7. Technique

  • Exhaustive Search - Performs an exhaustive search for correct solutions. All variables will be tested by starting with the minimum value to the maximum value using the increment to skip values. The method will select the solution with the most stable results and select the values in the middle of that solution. This should provide values that are most likely to generate the correct solution with the widest amount of image variance.

  • Exhaustive First Search - Performs an exhaustive search but terminates when the first successful solution is found ... if one exists.

  • Random Search - Will randomly assign values to the variables until a solution is found or the maximum number of possible solutions are tested (to avoid running forever if a solution is not found).

  • Search From Current - Assumes that a correct solution is close to the current configuration and will explore variables by increasing and decreasing current values in sequence until a solution is found.

  • Tune Current - Assumes that the current solution is a correct solution (i.e. the variables have been manually configured or have used one of the other methods to create one) and will search all current values to determine the low and high range and set the middle of such a range. This allows a current solution to be better explored to determine values that would provide the widest amount of image variance (as in exhaustive search).

8. Technique Variable - When set will disable all technique radio buttons. The value of the variable should be either the name of the technique:

"Exhaustive Search"
"Exhaustive First Search"
"Random Search"
"Search Current"
"Tune Current"

OR you can just use a number that indicates the same order:

where 2 would mean "Exhaustive First Search"

9. Max Iterations - The number specifies the maximum number of iterations the a search will attempt to find a viable solution. This ensures that regardless of the specified technique that the module eventually terminates.

10. Provide End_Tag to restrict tuning - Specify when needing to optimize the processing time taken by repeated execution of modules during the tuning process. When enabled only modules within the Variable_Tuning and End_Variable_Tuning modules in the pipeline will be used for variable tuning. This ensures that only those modules that actually affect the search result are executed as apposed to the entire pipeline.

11. Cache - Check Last Successful Configurations - Causes the module to check the last X combinations of variables that succeeding in passing the test. This assumes that some prior configuration changes will work for the current image and checks those first BEFORE beginning any of the search techniques. Thus if the image has only a couple of correct configurations that change once in a while, the module will first explore these before starting a particular search strategy. Using this option can speed up searching for successful configurations considerably regardless of what secondary search technique is used.

12. Tune Once button - Press to cause the pipeline to run for each combination of specified variables. This iteration will terminate once the solution is found and preserve those values that lead to that solution.

13. Tune Continuous - One enabled when the End_Tag is enabled. Once pressed will cause the module to continuously search for a solution for every new image introduced to the pipeline. Note, depending on the number of variables specified and the value range this will SEVERLY slow down the fps (frames per second) that the pipeline can process. It is recommended to be used on solutions that are not possible using other means and that do not have a realtime processing need.


The following example helps to illustrate the potential of this module. The task is to isolate the color cones in the image. We have 4 variables that are used in the RGB_Filter and Blob_Size modules. Using these 4 variables and the blob_count result we wish to find the 6 cones. The result of blob_count should therefore be 6.

 Download and run the example. If you un-press the Run button you will see the full RGB image with the 6 cones. Press RUN and then double click on the Variable Tuning module. Click on Tune (bottom left) and you will quickly see the image flicker and end up with the 6 Cones. The pipeline is set to use the Random technique which will not provide the optimum settings but will quickly converge onto a solution. Keep clicking on the Tune button to see other settings and potentially wrong ones.

 New Post 

Variable_Tuning Related Forum PostsLast postPostsViews