Image edge detection method based on memristor array ant colony algorithm
By using ant colony optimization algorithm based on memristor array in image edge detection, the shortcomings of traditional algorithms in complex backgrounds and high noise image processing are solved, and the edge detection with low energy consumption, high efficiency and high precision is achieved. In particular, Outstanding performance in detecting edges of small objects.
Patent Information
- Application Number
- CN202411808652.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-10
- Publication Date
- 2025-01-07
- Estimated Expiration
- Not applicable · inactive patent
Smart Images

Figure CN119273707A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of image edge detection, and specifically proposes a method for performing image edge detection on an image by using an ant colony optimization algorithm based on a memristor array. Background Art
[0002] Image edge detection is one of the basic tasks in the field of computer vision. It plays an important role in many aspects such as image segmentation, object recognition and morphological analysis. Traditional edge detection algorithms such as Sobel operator and Canny operator rely on the gradient change of the image. Although they perform well in simple scenes, their effects are easily limited when processing images with complex backgrounds and high noise. In addition, with the rapid development of computer vision technology, edge detection methods based on deep neural networks such as Holistically-Nested Edge Detection (HED) have also gradually been applied. However, neural network methods have high computational complexity, high energy consumption, and high requirements on hardware resources, which is not conducive to energy-sensitive application scenarios.
[0003] This paper proposes an ant colony optimization algorithm based on a memristor array, which performs better in image edge detection than the traditional Sobel operator and the edge detection method based on a neural network. The use of memristors enables the algorithm to achieve efficient parallel computing and storage fusion at the hardware level, improving computing density and speed.
[0004] Ant Colony Optimization (ACO) is a bionic optimization algorithm inspired by the foraging behavior of ants in nature. When ants are looking for food, they release pheromones on the path, and other ants tend to choose the path with higher pheromone concentration when choosing a path. This behavior pattern is mathematically expressed and used to solve complex combinatorial optimization problems, such as the traveling salesman problem (TSP). In the ant colony algorithm, the concentration of pheromones reflects the quality of the path, and after multiple iterations, the system converges to the optimal solution.
[0005] Ant colony algorithm is widely used in image processing, especially in image edge detection, due to its robustness and flexibility. Image edge detection is one of the basic tasks of computer vision. Ant colony algorithm can effectively detect the change of pixel intensity in the image and find the boundary of the image. The advantage of ACO is that it can process multiple possible paths in parallel and select the optimal edge based on local information.
[0006] In recent years, with the progress of memristor technology, researchers have tried to map the calculation process of the ant colony algorithm to the memristor circuit, thereby using the parallel computing characteristics of the memristor to accelerate the execution of the ant colony algorithm. The pheromone concentration update mechanism in the ant colony algorithm can be realized through the conductance change of the memristor. This mapping enables the memristor to simulate the search and optimization process in the ant colony algorithm.
[0007] The structure of the memristor array is a natural fit for the parallel path search of the ant colony algorithm. By arranging multiple memristors in the array, the system is able to simultaneously calculate pheromone changes on multiple paths, thereby speeding up the image edge detection process. In addition, the non-volatile nature of the memristor allows it to store the history of pheromones, which makes it very suitable for step-by-step optimization tasks in image processing. Summary of the invention
[0008] This paper proposes an ant colony optimization algorithm based on a memristor array, which performs better in image edge detection than the traditional Sobel operator and the edge detection method based on a neural network. Compared with the traditional edge detection method based on a processor or a neural network, the ant colony algorithm implemented by the memristor array has lower energy consumption, higher computational efficiency, and can detect more detailed image edges.
[0009] In order to achieve the above object, the technical solution of the present invention is as follows:
[0010] An image edge detection method based on an ant colony algorithm of a memristor array comprises the following steps:
[0011] S101: Construct a nonlinear voltage-controlled memristor model with relaxation term to simulate the updating process of pheromone concentration in ant colony algorithm;
[0012] S102: construct an improved ant colony optimization algorithm, with pixel intensity contrast as a heuristic factor. The ant colony determines the probability of selecting each path based on the pheromone concentration and the heuristic factor on the path;
[0013] S103: Initialize the size of the memristor array according to the height and width of the image to be processed, and locate the action path of the ant to the specific memristor to be operated through the column selection circuit and the row selection circuit of the memristor array; start iteration, and the conductivity of the memristor is updated as the pheromone concentration;
[0014] S104: When the set number of iterations is reached, a conductivity matrix based on the memristor array is obtained, a threshold is set according to the mean value of the conductivity matrix, and pixel points corresponding to memristors above the threshold are marked as image edges, thereby generating a binary edge detection result.
[0015] The memristor model is specifically constructed as follows:
[0016] Memristor resistance Calculated by the following formula:
[0017] ;
[0018] in, is the maximum resistance of the memristor, is the minimum resistance of the memristor, is the internal state variable;
[0019] Memristor conductivity With current The relationship is described by the following formula:
[0020] ;
[0021] in, Indicates conductivity Over time The rate of change, is the drift constant, is the relaxation term;
[0022] The improved ant colony optimization algorithm improves the ant colony optimization algorithm, and the specific construction process is as follows:
[0023] S301: Ant initial position selection, each ant starts from a random position in the image, initial pheromone concentration is a constant;
[0024] S302: Pixel intensity contrast as a heuristic factor , given by the following formula:
[0025]
[0026] in, represents the maximum pixel intensity value in the image, Represents the intensity value of the adjacent pixels above the current pixel. Represents the intensity value of the adjacent pixels below the current pixel. Indicates the intensity value of the adjacent pixel to the left of the current pixel. Indicates the intensity value of the adjacent pixel to the right of the current pixel;
[0027] S303: Iteration starts. The ant starts from each pixel point and can only move in four directions: up, down, left, and right. The probability of selecting each path is determined based on the pheromone concentration and heuristic factor on the path, and finally a path is selected for movement.
[0028] S304: Determine whether the currently selected path is better by comparing the contrast of each pixel point on the path currently selected by the ant with the existing pheromone concentration, and update the pheromone concentration on the path passed by the ant;
[0029] S305: The iteration ends and the ant finds the optimal edge in the image.
[0030] The step S103 is specifically as follows:
[0031] S401: According to the height of the image and width , initialize the size of the memristor array, specifically:
[0032] ;
[0033] in, is the number of pixels of each ant's moving path;
[0034] S402: Locate a specific memristor that needs to be operated through a row and column selection circuit; specifically, in the memristor array, each memristor corresponds to a pixel point of the image, and the movement of the ant between the pixels is mapped to the conductivity update between adjacent memristors;
[0035] S403: Initialize the internal parameters of each memristor; each ant starts from a random pixel point of the image, and when the ant passes through a certain memristor node, the conductivity of the memristor is updated, and the conductivity matrix corresponding to the memristor array is initialized based on the result of the ant's path selection;
[0036] S404: Iteration starts, multiple paths are updated simultaneously, making the conductivity of the memristor change.
[0037] The step S104 is specifically as follows:
[0038] S501: Iteratively update the conductivity matrix until the set number of iterations is reached and the path converges to the optimal edge;
[0039] S502: Setting the threshold of edge detection according to the mean value of the conductivity matrix finally obtained: , when a certain position Memristor conductivity Greater than the average value of the entire conductivity matrix When , the position is marked as an edge point, that is, , otherwise it is marked as a non-edge point, that is, ;
[0040] S503: The conductivity Pixels greater than the threshold are marked as image edges, a binary edge detection result is generated, and the detected image is output.
[0041] The present invention realizes hardware acceleration of the ant colony optimization algorithm through a memristor array and successfully applies it to image edge detection. Experiments show that by adjusting the ant colony path length and the number of iterations, more delicate edge detection results can be obtained, especially when processing the edges of small objects.
[0042] The advantage of this method is that compared with the existing technology, this solution has higher computing density, lower energy consumption, and better detection accuracy. At the same time, the ant colony algorithm based on memristor array can generate more refined edges than traditional edge detection methods (such as Sobel operator and neural network-based edge detection). BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the technical solution of the present invention, the present invention is further described below in conjunction with the accompanying drawings and specific implementation methods.
[0044] Figure 1 It is a flow chart of a method for image edge detection based on an ant colony algorithm of a memristor array of the present invention;
[0045] Figure 2 is a schematic diagram of a nonlinear voltage-controlled memristor model of the present invention;
[0046] Figure 3 is a schematic diagram of the ant colony optimization algorithm of the present invention;
[0047] Figure 4 is a control flow chart of the memristor array of the present invention;
[0048] Figure 5 is a flow chart of conductivity matrix generation and image edge detection of the present invention;
[0049] Figure 6 is an example diagram of the image edge detection result of the present invention;
[0050] Figure 7 This is a diagram of a memristor array for implementing an ant colony algorithm according to the present invention. DETAILED DESCRIPTION
[0051] In order to more clearly illustrate the technical solution of the present invention, the present invention is further described below in conjunction with the accompanying drawings and specific examples. The specific implementation of the present invention is not limited to the following examples, and appropriate changes and modifications can be made according to actual needs without affecting the essence and scope of the present invention.
[0052] Figure 1 : is a flow chart of a method for image edge detection based on an ant colony algorithm of a memristor array of the present invention. As shown in the figure, the method comprises the following steps:
[0053] S101: Design a nonlinear voltage-controlled memristor model with relaxation term, which can simulate the updating process of pheromone concentration in ant colony algorithm, so that the ant colony algorithm and memristor circuit can be mapped one to one;
[0054] Specifically, Figure 2 is a schematic diagram of the nonlinear voltage-controlled memristor model of the present invention, wherein the memristor value By internal variables As shown in the figure, the process is as follows:
[0055] The resistance of a memristor Changes in internal state variables Control, memristor Calculated by the following formula:
[0056]
[0057] in, is the maximum resistance of the memristor, is the minimum resistance of the memristor, and the internal state variable Determine the resistance value of the memristor;
[0058] Internal state variables Over time The rate of change is controlled by the following formula:
[0059]
[0060] in, Indicates internal variables Over time The rate of change, is the drift constant, which represents the characteristic parameter of the memristor. represents the voltage across the memristor, is the relaxation term, which is used to describe the natural decay of the memristor state;
[0061] Memristor conductivity With current The relationship is described by the following formula:
[0062]
[0063] in, Indicates conductivity Over time The rate of change of the memristor is finally output.
[0064] S102: Design an improved ant colony optimization algorithm to guide ants to choose the optimal path through the calculation and iterative update of the heuristic factor, thereby improving the accuracy of edge detection;
[0065] Figure 3 Schematic diagram of the ant colony optimization algorithm of the present invention. As shown in the figure, the process includes the following steps:
[0066] S301: Ant initial position selection, each ant starts from a random position in the image, initial pheromone concentration is a constant;
[0067] S302: Pixel intensity contrast as a heuristic factor , given by the following formula:
[0068]
[0069] in, represents the maximum pixel intensity value in the image, Represents the intensity value of the adjacent pixels above the current pixel. Represents the intensity value of the adjacent pixels below the current pixel. Indicates the intensity value of the adjacent pixel to the left of the current pixel. Indicates the intensity value of the adjacent pixel to the right of the current pixel;
[0070] S303: Iteration starts. The ant starts from each pixel point and can only move in four directions: up, down, left, and right. The probability of selecting each path is determined based on the pheromone concentration and heuristic factor on the path, and finally a path is selected for movement.
[0071] S304: Determine whether the currently selected path is better by comparing the contrast of each pixel on the path currently selected by the ant and the existing pheromone concentration. The greater the contrast between the pixels, the more likely it is that the path is an edge. At the same time, the higher the pheromone concentration accumulated on the path, the more ants have chosen the path before, indicating that the path is more likely to be a valid edge. If there is no better path, reselect the path. If it is better, update the pheromone concentration on the path passed by the ants;
[0072] S305: The iteration ends, the ants find the optimal edge in the image, and the algorithm converges.
[0073] S103: Use high-density memristor arrays to achieve parallel computing of the ant colony algorithm. Use the programmability and low energy consumption characteristics of memristors to achieve parallel path selection and pheromone updates, greatly improving computing efficiency.
[0074] Figure 4 This is a control flow chart of the memristor array of the present invention. As shown in the figure, the process includes the following parts:
[0075] S401: According to the height of the image and width , initialize the size of the memristor array, specifically:
[0076]
[0077] in, is the number of pixels of each ant's moving path;
[0078] S402: Locate the specific memristor that needs to be operated through the row and column selection circuit; specifically, in the memristor array, each memristor corresponds to a pixel of the image, and the movement of the ant between the pixels is mapped to the conductivity update between adjacent memristors. Since the ant can only move in four directions, up, down, left, and right, and each movement involves two adjacent pixels, it is necessary to select and update the corresponding adjacent memristor pairs in the memristor array. This selection process is mainly achieved through the row selection circuit on the left side of the array and the column selection circuit on the top, such as Figure 7 As shown, there are two control circuits in the memristor array: the column selection circuit at the top and the row selection circuit on the left. The switch controls the current input, Switches control the connection of adjacent columns or rows. The switch controls the output of the current. By controlling the switches in these two circuits, specific memristors can be selectively connected to form a current path and locate the specific memristor that needs to be operated. By controlling the switch to connect each memristor element, the conductance is updated. The current pulse of the update path is set as:
[0079]
[0080] By controlling the circuit, the parallel update of the four directions (up, down, left, and right) of the memristor array can be achieved, thereby accelerating the calculation process of the ant colony algorithm.
[0081] S403: Start iteration to make the conductivity of the memristor Changes, the specific changes follow the formula:
[0082]
[0083] The rate of change of conductivity consists of two parts, one of which is related to the current passing through The other part is in direct proportion to the conductivity itself, indicating that the current increases the conductivity; the other part is in negative proportion to the conductivity itself, indicating that the conductivity will decay spontaneously. This actually reflects the accumulation and volatilization process of pheromones in the ant colony algorithm, where the current is equivalent to the pheromones left by ants, and the relaxation term corresponds to the natural volatilization of pheromones.
[0084] S404: Determine whether the conductivity of the memristor reaches the expected threshold. If not, continue to apply current. , and change the conductivity of the memristor. If it is reached, the iteration ends;
[0085] S405: Utilize the parallel computing capability of the memristor array to achieve simultaneous updates of multiple paths and speed up the computing speed.
[0086] S104: A conductivity matrix is obtained by calculating the memristor array, and after multiple iterations, a threshold is set according to the mean value of the conductivity matrix, and pixels above the threshold are marked as image edges, thereby generating a binary edge detection result.
[0087] Figure 5 : is a flow chart of conductivity matrix generation and image edge detection of the present invention. As shown in the figure, this step includes the following operations:
[0088] S501: Each ant starts from a random pixel point of the image and selects a path according to the pheromone concentration of the neighboring nodes of the current node and the comprehensive value of the heuristic factor. When the ant passes through a node, the conductivity of the node is updated according to the ant's access frequency or pheromone concentration. When all ants complete the path selection, the conductivity matrix of the memristor is initialized based on the results of the ant's path selection;
[0089] S502: iteratively updating the conductivity matrix, the path converges to the optimal edge;
[0090] S503: Setting the threshold of edge detection according to the mean value of the conductivity matrix: , when a certain position Memristor conductivity Greater than the average value of the entire conductivity matrix When , the position is marked as an edge point, that is, , otherwise it is marked as a non-edge point, that is, ;
[0091] S504: Determine the conductivity of each pixel Is it greater than the threshold? , the conductivity Pixels greater than the mean are marked as image edges, a binary edge detection result is generated, and the detection image is output.
[0092] Figure 6 This is an example diagram of the image edge detection result of the present invention. As shown in the figure, the figure is used to illustrate the effect of the ant colony optimization algorithm after implementing image edge detection in the memristor array. Figure 6(a) and (b) in the figure show the detection effect for two different test images (one is a building image and the other is an elephant group image). It can be seen from the results that when the number of iterations and the path length are small, the detected edges are rough, and even cause similar edges to merge together. As the number of iterations and the path length increase, the detected edges gradually become finer and clearer. This shows that the choice of parameters has an important influence on the precision of edge detection. By using this method, it is possible to detect edges that are finer than traditional methods (such as the Sobel operator), especially in high-complexity and high-contrast image scenes. The above describes the specific implementation methods of the present invention, but it is only for illustrative purposes, and the relevant interface diagrams are all schematic diagrams. Without departing from the principles and essence of the present invention, various modifications can be made to these implementation methods in practical applications. Therefore, the scope of protection of the present invention is limited by the attached claims.
Claims
1. An image edge detection method based on a memristor array ant colony algorithm, characterized in that: The following steps are involved: S101: Construct a nonlinear voltage-controlled memristor model with relaxation term to simulate the updating process of pheromone concentration in ant colony algorithm; S102: construct an improved ant colony optimization algorithm, with pixel intensity contrast as a heuristic factor. The ant colony determines the probability of selecting each path based on the pheromone concentration and the heuristic factor on the path; S103: Initialize the size of the memristor array according to the height and width of the image to be processed, and locate the action path of the ant to the specific memristor to be operated through the column selection circuit and the row selection circuit of the memristor array; start iteration, and the conductivity of the memristor is updated as the pheromone concentration; S104: When the set number of iterations is reached, a conductivity matrix based on the memristor array is obtained, a threshold is set according to the mean value of the conductivity matrix, and pixel points corresponding to memristors above the threshold are marked as image edges, thereby generating a binary edge detection result.
2. The image edge detection method based on memristor array ant colony algorithm according to claim 1 is characterized in that: The memristor model is specifically constructed as follows: Memristor resistance Calculated by the following formula: ; in, is the maximum resistance of the memristor, is the minimum resistance of the memristor, is the internal state variable; Memristor conductivity With current The relationship is described by the following formula: ; in, Indicates conductivity Over time The rate of change, is the drift constant, is the relaxation term.
3. The image edge detection method based on memristor array ant colony algorithm according to claim 2 is characterized in that: The improved ant colony optimization algorithm improves the ant colony optimization algorithm, and the specific construction process is as follows: S301: Ant initial position selection, each ant starts from a random position in the image, initial pheromone concentration is a constant; S302: Pixel intensity contrast as a heuristic factor , given by the following formula: ; in, represents the maximum pixel intensity value in the image, Represents the intensity value of the adjacent pixels above the current pixel. Represents the intensity value of the adjacent pixels below the current pixel. Indicates the intensity value of the adjacent pixel to the left of the current pixel. Indicates the intensity value of the adjacent pixel to the right of the current pixel; S303: Iteration starts. The ant starts from each pixel point and can only move in four directions: up, down, left, and right. The probability of selecting each path is determined based on the pheromone concentration and heuristic factor on the path, and finally a path is selected for movement. S304: Determine whether the currently selected path is better by comparing the contrast of each pixel point on the path currently selected by the ant with the existing pheromone concentration, and update the pheromone concentration on the path passed by the ant; S305: The iteration ends and the ant finds the optimal edge in the image.
4. The image edge detection method based on memristor array ant colony algorithm according to claim 3 is characterized in that: The step S103 is specifically as follows: S401: According to the height of the image and width , initialize the size of the memristor array, specifically: ; in, is the number of pixels of each ant's moving path; S402: Locate a specific memristor that needs to be operated through a row and column selection circuit; specifically, in the memristor array, each memristor corresponds to a pixel point of the image, and the movement of the ant between the pixels is mapped to the conductivity update between adjacent memristors; S403: Initialize the internal parameters of each memristor; each ant starts from a random pixel point of the image, and when the ant passes through a certain memristor node, the conductivity of the memristor is updated, and the conductivity matrix corresponding to the memristor array is initialized based on the result of the ant's path selection; S404: Iteration starts, multiple paths are updated simultaneously, making the conductivity of the memristor change.
5. The image edge detection method based on memristor array ant colony algorithm according to claim 4 is characterized in that: The step S104 is specifically as follows: S501: Iteratively update the conductivity matrix until the set number of iterations is reached and the path converges to the optimal edge; S502: Setting the threshold of edge detection according to the mean value of the conductivity matrix finally obtained: , when a certain position Memristor conductivity Greater than the average value of the entire conductivity matrix When , the position is marked as an edge point, that is, , otherwise it is marked as a non-edge point, that is, ; S503: The conductivity Pixels greater than the threshold are marked as image edges, a binary edge detection result is generated, and the detected image is output.
6. The image edge detection method based on memristor array ant colony algorithm according to claim 5, characterized in that: The internal state variable Controlled by voltage, it is implemented by the following formula: ; in, Represents internal state variables Over time The rate of change, represents the voltage across the memristor.
Citation Information
Patent Citations
Image edge detection optimization method
CN116188507A
Initialization method of image edge detection model
CN117934525A