Frontiers in Computing and Intelligent Systems ISSN: 2832-6024 | Vol. 13, No. 2, 2025 7 Optimization of BP Neural Network Image Restoration based on Improved Cuckoo Algorithm Jianhong Li *, Yan Liang and Hui Zheng Sichuan Vocational and Technical College, Suining Sichuan, 629000, China * Corresponding author: Jianhong Li (Email: 516331055@qq.com) Abstract: To address the limitations of BP neural networks, such as their sensitivity to initial weights and thresholds and their tendency to get stuck in local optima, this paper uses the cuckoo algorithm to search for the initial weights and thresholds of BP neural networks, thereby eliminating their dependence on initial weights and thresholds. Improvements were made to the step size and discovery probability of the cuckoo algorithm. The improved cuckoo algorithm was used to search for the initial weights and thresholds of the BP neural network, and the optimized network was applied to restore the Lena image . Experimental results show that for the Lena image, the ICS-BP neural network achieves a peak signal-to-noise ratio (PSNR) that is 4.83% and 3.53% higher than the BP neural network and PSO-BP neural network, respectively, and a structural similarity (SSIM) that is 1.62% and 0.67% higher than the BP neural network and PSO-BP neural network, respectively, indicating that the optimized BP neural network achieves better image restoration performance. Additionally, the ICS-BP converged after 35 iterations, which is faster than the BP neural network (137 iterations) and the PSO-BP neural network (81 iterations), thereby improving efficiency. Keywords: Image Restoration; Intelligent Optimization Algorithm; BP Neural Network. 1. Introduction Humans primarily obtain important information through vision. In the environment in which we live, we encounter many unexpected situations and uncontrollable factors that can degrade image quality during generation[1], storage, and transmission, significantly impacting our use of images. In many fields, such as aerospace, industry, manufacturing, and science, there are high requirements for image quality. Therefore, research into image restoration methods holds significant value. The greatest challenge in image restoration lies in the incorrect understanding of prior knowledge regarding the degradation process. In real-world image processing, much of the prior knowledge is unknown[2], and obtaining such knowledge is extremely difficult, with some cases even impossible to achieve. As a result, traditional methods are no longer sufficient to meet current needs. Backpropagation (BP) neural networks offer numerous advantages over traditional methods, such as autonomous learning capabilities[3], adaptability, parallel processing, and robust performance. Applying BP neural networks to image restoration problems holds significant potential and promise for future development. In 2006[4] Wang Hui et al. from Shanghai Jiao Tong University proposed a neural network- based image restoration algorithm. This algorithm obtains an input set by sampling the inner edges and flat regions of an image using a sliding window, and then restores the image using a BP neural network, achieving certain results. In 2019, Xue HZ et al. proposed an image restoration method based on a BP neural network[5], primarily establishing an image restoration model based on a BP neural network. Experimental results indicate that, compared to traditional methods, the image restoration performance has improved to some extent. However, this method also has certain limitations. The BP neural network is highly sensitive to initial weights and threshold values[6], and these initial values are randomly generated. This can lead to excessive iterations during training, making convergence difficult or even impossible. Additionally, each training result is inconsistent, leading to increased errors and potentially getting stuck in a local optimum. Therefore, an intelligent optimization algorithm is used to optimize the initial weights and threshold values of the BP neural network.[7] The optimized weights and threshold values are then assigned to the BP neural network for training, and the trained network is finally used for image restoration. This method can address many issues that traditional methods struggle with or cannot resolve, while also addressing problems such as slow convergence[8], susceptibility to local optima, and high error rates in BP neural networks. It provides new directions and perspectives for image restoration methods, facilitating their widespread application across various fields. 2. Cuckoo Algorithm 2.1. Original Cuckoo Algorithm Table 1. Cuckoo algorithm rules 1.All cuckoos in the population lay only one egg at a time and place it randomly in a nest; 2.In order to maintain the population and prevent degeneration, the optimal cuckoo individuals will remain unchanged; 3.The population size is fixed, and the probability of the host bird discovering the cuckoo's egg is  0,1aP  . In nature, there is a bird called the cuckoo, which seems to lack maternal instincts. It does not build its own nest nor raise its own offspring. Instead, it secretly places its eggs in the nests of other birds, relying on them to raise its young. Xin- she-Yang and Suash-Deb et al. proposed the Cuckoo Search algorithm (CS) in 2009[9]. This algorithm is a search algorithm based on cuckoo egg hatching rates, featuring few 8 parameter settings, fast optimization, and high accuracy. It is primarily used to solve optimization problems. In order to make the cuckoo algorithm applicable to solving optimization problems, Xin-she-Yang and Suash-Deb simplified and abstracted the cuckoo's nest-building and egg- incubation behavior and established the rules in table 1. The position update formula for the cuckoo algorithm is as follows:  1t t i ix x L     (1) Professor Yang Xinshe et al. took the growth factor as:  0 t i bestx x    (2) t ix denotes the position of the i-th bird's nest at iteration t, 1t ix  denotes the position of the i-th bird's nest at iteration t+1,  denotes point-to-point multiplication,  denotes the step size control quantity 0 0.01  , bestx denotes the current optimal position, and  L  denotes the random search path of the Lévy flight. 2.2. Improving the Cuckoo Algorithm Improvements in detection probability In the cuckoo algorithm 0 0.01  , limiting the range of variation of the step size factor with a constant reduces the accuracy of the algorithm's solution. Our requirement is to enhance the algorithm's search capability in the early stages of the search by using large step sizes, and to improve search accuracy in the later stages by using small step sizes. Therefore, we add a cosine function to dynamically decrease the curve in the range [0,1], resulting in the following improvement: 0 max max 0.001 cos t t t           (3) Replacing the original with the improved version yields the step formula for Levy flight:    1 max max 0.001 cost t t i i i best t x x t x x Levy t              (4) Improvements in detection probability The discovery probability of the original cuckoo algorithm is 0.25Pa  ,In actual situations, the discovery probability is not fixed. To better reflect reality, a dynamic discovery probability should be used. In the early stages of algorithm search, increasing the discovery probability helps to increase the diversity of solutions. In the later stages of algorithm search, diversity is no longer the main goal, so accuracy should be improved. Therefore, reducing the discovery probability in the later stages will improve the accuracy of the algorithm search. max max exp cost begin t t Pa Pa t t              (5) 3. Optimization of BP Neural Network Image Restoration Based on Improved Cuckoo Algorithm 3.1. Improved Cuckoo Algorithm Optimization of BP Neural Networks BP neural networks are sensitive to initial weights and thresholds, prone to getting stuck in local minima, and the initial weights and thresholds of BP neural networks are random, which can cause inconsistent results in each training session and increase errors. Due to the characteristics of the Levy flight, the improved cuckoo algorithm is combined with a BP neural network to optimize the weights and thresholds of the BP neural network, enabling it to break free from dependence on initial weights and thresholds, reduce errors, and improve convergence speed. Each nest location represents the dimension of the objective function to be optimized. The mean squared error of the BP neural network is treated as the fitness function, and the global optimal solution is found using the improved cuckoo algorithm. The final optimal solution is then assigned to the BP neural network. The improved cuckoo algorithm optimization neural network flowchart is shown in Figure 1 below. The improved cuckoo algorithm for optimizing the image restoration steps of the BP neural network (ICS-BP) is as follows. Step 1: Set the original image as the desired output, add Gaussian blur to the original image as input, and set the network parameters. Step 2: The position vector of the bird's nest is regarded as the network weight and threshold, and the mean square error of the network is regarded as the fitness function. After initializing the network parameters, the improved cuckoo algorithm performs optimization. When the error is less than the present value or the maximum number of iterations is reached, the algorithm ends, the position vector of the optimal bird's nest is saved, and the optimal weight and threshold are obtained. Step 3: Train the BP neural network. When the error requirement is met or the maximum number of iterations is reached, the network training ends, and the network's weights, thresholds, and other parameters are saved. Step 4: Test the network, input the blurred image, and denormalize the output image data to obtain the restored image. 3.2. ICS-BP Neural Network Image Restoration Experiment Results and Analysis The experimental environment is Matlab 2014b. A 9×9 Gaussian blur with a variance of 1 is applied to the image. Since a BP neural network with a 9:20:1 structure is used, the dimension D is 221, i.e., there are 221 weights and thresholds in total. The improved cuckoo algorithm has a nest number m=25 and a maximum iteration count of 200. We compared the results of Wiener filter restoration, BP neural network restoration, PSO-BP neural network restoration, and ICS-BP neural network restoration. The Lena image was selected as the training image, and the trained models were used for blurred image restoration. The results are shown in Figure 2 below. 9 The mean square error of BP output as a fitness function BP neural network section Determine the network structure Initialize network weight thresholds Obtain the optimized weight threshold Training BP networks computational error Update the weight threshold after training Meet the requirements? No Yes end ICS Algorithm Section ICS encoding of initial values Location update Calculate fitness Select, replace, remove Meet the requirements? Yes No Figure 1. Flow chart of ICS-BP neural network (a)Original image (b)blurred image (c) Wiener restoration (d)BP recovery (e)PSO-BP restoration (f) ICS-BP Recovery Figure 2. Lena image restoration renderings 10 As can be seen from Figure 2, the images restored by the BP neural network, PSO-BP, and ICS-BP do not exhibit white pixels, with the ICS-BP neural network producing the best restoration results. To more intuitively compare the quality of the restored images, peak signal-to-noise ratio (PSNR) and structural similarity (SSIM) are used to evaluate the restored images, with higher PSNR and SSIM values indicating better restoration quality. Table 2. PSNR and SSIM of LENA restoration Restoration method PSNR (dB) SSIM Rule-based filtering 25.2706 0.8461 BP neural network 35.7024 0.9660 PSO-BP 36.1503 0.9752 ICS-BP 37.4259 0.9817 As shown in Table 2, the peak signal-to-noise ratio (PSNR) of the ICS-BP neural network image restoration improved by 4.83% and 3.53% compared to the BP neural network and PSO-BP neural network image restoration, respectively, while the structural similarity (SSIM) improved by 1.62% and 0.67%, respectively. This indicates that ICS-BP image restoration is the most effective, with the restored images being closer to the original images. 1 5 10 15 20 25 30 35 40 Number of iterations 10-4 10-3 10-2 10-1 100 101 Best Validation Performance is 0.00096419 at epoch 35 Train Validation Test Best mean square error Figure 3. ICS-BP training convergence diagram As can be seen from Figure 3 above, the ICS-BP neural network converges after 35 iterations, compared to 137 iterations for the BP neural network and 81 iterations for the PSO-BP neural network. The ICS-BP neural network has faster convergence characteristics, improving efficiency. 4. Conclusion This article introduces the cuckoo algorithm and uses an improved cuckoo algorithm to optimize the initial weights and thresholds of a backpropagation (BP) neural network, addressing issues such as sensitivity to initial weights and thresholds, slow convergence speed, and susceptibility to local optima. First, the Cuckoo Algorithm is improved by using a cosine function to modify the step size and an exponential function to improve the discovery probability. The improved step size enhances convergence speed, while the improved discovery probability enhances convergence accuracy. The improved Cuckoo Algorithm is then applied to optimize the weights and thresholds of the BP neural network and is utilized in image restoration. Experimental results show that the peak signal-to-noise ratio (PSNR) and structural similarity (SSIM) of ICS-BP image restoration are both higher than those of the BP neural network and PSO-BP neural network, indicating that ICS-BP achieves better restoration results, with restored images closer to the original images and faster convergence. References [1] Huo Y K, Wei G, Zhang Y D, et al. An adaptive threshold for the Canny operator of edge detection[C] proceedings of the 2010 International Conference on Image. Analysis and Signal Processing Piscataway: IEEE, 2010:371-374. [2] Liu C J, Ding W F, et al. Prediction of highspeed grinding temperature of titanium matrix composites using BP neural network basedon PSO algorithm[J]. International Journal of Advanced Manufacturing Technology, 2017, 89(5-8): 2277- 2285. [3] Liu B, Wang L, Jin Y, et al. Designing Neural Networks Using Hybrid Particle Swarm Optimization[C]. International Symposium on Neural Net works. Springer Berlin Heidelberg, 2005: 391-397. [4] Nawi N M, Khan A, Rehman M Z. A New Levenberg Marquardt based Back Propagation Algorithm Trained with Cuckoo Search[J]. Procedia Technology, 2013, 11(1): (18-23). [5] Huang Y Q, Zhang J, Li X, et al. Thermal error modeling by integrating GA and BP algorithms for the highspeed spindle[J]. The International Journal of dvanced Manufacturing Technology, 2014, 71(9-12): 1669-1675. 11 [6] Xue HZ, Cui HW. Research on image restoration algorithms baseed on BP neural network[J]. Joural Of Communication And Image Represention, 2019, 59(204-209). [7] P Barthelemy, J Bertolotti. A Lvy flight for light.Nature, 2008, 453(7194): 495-498. [8] M F Shlesing. Mathematical physics:Search research Nature, 2006, 443(7109): 281-282. [9] X S Yang, S Deb. Engineering optimisation by cuckoo search [J]. International Journal of Mathematical Modelling and Numerical Optimisation, 2010, 1(4): 330-343.