The performance of many algorithms is highly dependent on the value of their parameters. There are categorical parameters (e.g., selecting between a simple thresholding method and Otsu’s method in the case of binarization) and numerical parameters (e.g., selecting a specific threshold value in the range of 0 to 255 in the case of binarization), and depending on the complexity of the algorithm in question, the number of possible combinations may be innumerable.
In practice, the search of any set of parameters whose number of possible combinations exceeds a 40-digit number for the image processing algorithm implemented by Halcon had to be performed manually. Moreover, users had to alter the parameters, run the algorithm again, and conduct a visual check of the output images to compare the quality of the different images.
Rule-based algorithms are usually associated with the following three issues.
We were able to improve the performance of the image processing algorithm by calling the Halcon program with Python, evaluating the algorithm based on the loss function, and optimizing its parameters using Optuna. The image processing program implemented by Halcon is called from Python to calculate the loss function from the output image. The parameters are then optimized using Optuna. As a result, we were able to efficiently search parameters whose number of possible combinations exceeds a 40-digit number and automatically find parameters that yield better output images than before.