Multi-threshold image segmentation system, method, and media for supply chain product inspection
By using the fireworks algorithm to preprocess and segment images of supply chain products, the problem of high algorithm complexity and long segmentation time in multi-threshold image segmentation methods is solved. This enables effective identification of slightly damaged parts of supply chain products, improving segmentation efficiency and real-time performance.
Patent Information
- Application Number
- CN202310088563.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-09
- Publication Date
- 2025-11-11
- Estimated Expiration
- 2043-02-09
AI Technical Summary
Existing multi-threshold image segmentation methods exhibit non-linear growth in algorithm complexity and segmentation time, making it difficult to meet the requirements of efficiency and real-time performance in image application analysis. Furthermore, the human eye struggles to detect minor damage to products in the supply chain.
The image preprocessing is performed using a fireworks algorithm. Explosion sparks are generated by an explosion operator, Gaussian mutation is performed on randomly selected fireworks, and a new fireworks population is generated using an exponential perturbation mapping rule and a random selection strategy. Finally, the image is segmented using the optimal threshold.
It improves the efficiency of multi-threshold image segmentation, reduces segmentation time, and can effectively identify minor damage to products in the supply chain, meeting the requirements of high efficiency and real-time performance.
Smart Images

Figure CN116385473B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of supply chain product inspection technology, specifically to a multi-threshold image segmentation system, method, and medium for supply chain product inspection. Background Technology
[0002] Thresholding segmentation is a commonly used classic image segmentation method, which can be divided into single-threshold segmentation and multi-threshold segmentation based on the number of thresholds. However, in reality, images often contain complex information and require the extraction of multiple targets. In such cases, a single threshold cannot meet the segmentation accuracy requirements, and a set of thresholds, i.e., multiple thresholds, is needed to divide the image into multiple non-overlapping parts.
[0003] Multi-threshold image segmentation effectively addresses the problem of insufficient image segmentation accuracy in real-world applications. However, the algorithm complexity increases non-linearly with the number of thresholds, leading to a significant increase in segmentation time, making it difficult to meet the efficiency and real-time requirements of image analysis applications. Therefore, improving the efficiency and reducing the segmentation time of multi-threshold segmentation has become a major challenge, making research on fast multi-threshold image segmentation methods of great practical significance. Summary of the Invention
[0004] The purpose of this invention is to provide a multi-threshold image segmentation system, method, and medium for product inspection in the supply chain, in order to solve the problem that the human eye cannot easily identify minor damage to products in the equipment supply chain in the prior art.
[0005] To achieve the above objectives, embodiments of the present invention provide a multi-threshold image segmentation method for supply chain product inspection, the method specifically including:
[0006] Obtain product images from the supply chain;
[0007] The product images of the supply chain are preprocessed to obtain preprocessed images;
[0008] Based on the preprocessed image, an explosion spark is generated according to the explosion operator;
[0009] Randomly select several fireworks and perform Gaussian mutation operation to generate mutated sparks;
[0010] According to the exponential perturbation mapping rule, the explosion sparks and the mutated sparks that exceed the boundary range are mapped back to the feasible range, and a new fireworks population is generated according to the random selection strategy.
[0011] Determine whether the new fireworks population has reached the termination condition. If so, use the optimal threshold to segment the preprocessed image to obtain a segmented image.
[0012] Based on the segmented image detection supply chain products.
[0013] Based on the above technical solution, the present invention can be further improved as follows:
[0014] Further, the preprocessing of the supply chain product images to obtain preprocessed images includes:
[0015] The fireworks population is initialized and basic parameters are set, including setting the fireworks population size, maximum number of iterations, explosion radius control constant, spark number control constant, mutation probability factor, and individual boundary range.
[0016] Further, the step of generating explosion sparks based on the preprocessed image according to the explosion operator includes:
[0017] Calculate the fitness of the fireworks group, and calculate the blast radius and the number of sparks produced for each firework based on the fitness.
[0018] An explosion operation is performed on the aforementioned fireworks group to generate multiple explosive sparks.
[0019] Furthermore, the step of generating explosion sparks based on the preprocessed image according to the explosion operator also includes:
[0020] Calculate the j-th firework produced by the explosion of the i-th firework using Formula 1;
[0021]
[0022] Where, x ij D Let j be the j-th firework produced by the explosion of the i-th firework, where j∈[1,S]. i A i Let be the explosion radius of the i-th firework;
[0023] The explosion radius of the i-th firework is calculated using Formula 2;
[0024]
[0025] Among them, f i Let f be the fitness value of the i-th firework, Θ be the basic blast radius, and f be the blast radius. min Let ε be the minimum fitness value of the t-th generation fireworks, and let ε be a very small constant to avoid the numerator and denominator being zero.
[0026] Furthermore, the step of generating explosion sparks based on the preprocessed image according to the explosion operator also includes:
[0027] The number of sparks generated by the i-th firework explosion is calculated using Formula 3.
[0028]
[0029] Where Φ is the number of basic sparks, f max Let ε be the maximum fitness value of the t-th generation fireworks, and let ε be a very small constant to avoid the numerator and denominator being zero.
[0030] Furthermore, the random selection of several fireworks for Gaussian mutation operation to generate mutated sparks includes:
[0031] Calculate the Gaussian variation spark using Formula 4;
[0032] gaussian(h)=x h dnorm(1,1) formula 4;
[0033] Where gaussian(h) is the Gaussian mutation spark, x h Let d be a randomly selected firework, d be a 1×D dimensional {0,1} random matrix, and norm(1) be a random number that follows a Gaussian distribution with a mean of 1 and a variance of 1.
[0034] Furthermore, the step of randomly selecting several fireworks to perform a Gaussian mutation operation to generate mutated sparks also includes:
[0035] The k-th dimension of particle i is calculated using Formula 5;
[0036] X ik =X ik +β(k)*(X gk -X ik ) Formula 5;
[0037] Among them, X ik Let X represent the k-th dimension of particle i. gk Let represent the k-th dimension of the currently globally optimal particle, and β(k) be the exponential perturbation factor of the particle in the k-th dimension.
[0038] Further, the step of mapping the explosion sparks and the mutated sparks that exceed the boundary range back to the feasible range according to the exponential perturbation mapping rule, and generating a new fireworks population according to a random selection strategy, includes:
[0039] The k-th dimension of xijD exceeds the boundary using Equation 6;
[0040] x ij k =x l +mod(|x ij k |x u -x l ) Formula 6;
[0041] Where, x u and x l These represent the upper and lower bounds of the solution in dimension k, respectively.
[0042] A multi-threshold image segmentation system for product inspection in the supply chain includes:
[0043] Memory; and
[0044] A processor connected to the memory, the processor being configured to:
[0045] Obtain product images from the supply chain;
[0046] The product images of the supply chain are preprocessed to obtain preprocessed images;
[0047] Based on the preprocessed image, an explosion spark is generated according to the explosion operator;
[0048] Randomly select several fireworks and perform Gaussian mutation operation to generate mutated sparks;
[0049] According to the exponential perturbation mapping rule, the explosion sparks and the mutated sparks that exceed the boundary range are mapped back to the feasible range, and a new fireworks population is generated according to the random selection strategy.
[0050] Determine whether the new fireworks population has reached the termination condition. If so, use the optimal threshold to segment the preprocessed image to obtain a segmented image.
[0051] Based on the segmented image detection supply chain products.
[0052] A non-transitory computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method.
[0053] The embodiments of the present invention have the following advantages:
[0054] This invention discloses a multi-threshold image segmentation method for supply chain product detection. The method involves: acquiring supply chain product images; preprocessing the supply chain product images to obtain preprocessed images; generating explosion sparks based on the preprocessed images using an explosion operator; randomly selecting several fireworks and performing Gaussian mutation operations to generate mutated sparks; mapping the explosion sparks and mutated sparks exceeding the boundary range back to the feasible range according to an exponential perturbation mapping rule; generating a new fireworks population based on a random selection strategy; determining whether the new fireworks population has reached the termination condition; if so, segmenting the preprocessed images using the optimal threshold to obtain segmented images; and detecting supply chain products based on the segmented images. This method solves the problem in existing technologies where the human eye cannot easily identify slightly damaged parts of products in the equipment supply chain. Attached Figure Description
[0055] To more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are merely exemplary, and those skilled in the art can derive other embodiments based on the provided drawings without creative effort.
[0056] The structures, proportions, sizes, etc. illustrated in this specification are only for the purpose of assisting those skilled in the art in understanding and reading the content disclosed herein, and are not intended to limit the conditions under which the present invention can be implemented. Therefore, they have no substantial technical significance. Any modifications to the structure, changes in the proportions, or adjustments to the size, without affecting the effects and objectives that the present invention can produce, should still fall within the scope of the technical content disclosed in the present invention.
[0057] Figure 1 This is a flowchart of the multi-threshold image segmentation method for supply chain product inspection according to the present invention;
[0058] Figure 2 This is a flowchart of the multi-threshold image segmentation system for supply chain product inspection according to the present invention;
[0059] Figure 3 This is a schematic diagram illustrating the difference in mutation paths between the improved mutation operator and the Gaussian mutation operator of this invention. Detailed Implementation
[0060] The following specific embodiments illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0061] Example
[0062] Figure 1 This is a flowchart illustrating an embodiment of the multi-threshold image segmentation method for supply chain product inspection according to the present invention. Figure 1 As shown, the multi-threshold image segmentation method for supply chain product inspection provided by this embodiment of the invention includes the following steps:
[0063] S101, Obtain supply chain product images, and preprocess the supply chain product images to obtain preprocessed images;
[0064] Specifically, the fireworks population is initialized and basic parameters are set, including setting the fireworks population size, maximum number of iterations, explosion radius control constant, spark number control constant, mutation probability factor, and individual boundary range.
[0065] S102, Generates explosion sparks based on the explosion operator according to the preprocessed image;
[0066] Specifically, the fitness of the fireworks group is calculated, and the explosion radius and the number of sparks produced by each firework are calculated based on the fitness.
[0067] An explosion operation is performed on the aforementioned fireworks group to generate multiple explosive sparks.
[0068] The fireworks algorithm is a novel swarm intelligence algorithm that mimics the spark production process of fireworks during an explosion. Different fireworks have different explosion radii and produce different numbers of sparks, corresponding to superior and inferior solutions when solving the problem. Gaussian mutation is applied to several better solutions to increase the diversity of the population. Assume the initial fireworks population in the t-th iteration is X(t) = [x1...]. D x2 D ,…,x i D ,…,x N D Let D represent the dimension of the search space and N represent the number of fireworks. Then the formula for generating fireworks in the t-th generation is:
[0069] x ij D =x i D +A i dunifrnd(-1,1) formula 1;
[0070] Where, x ij D Let j be the j-th firework produced by the explosion of the i-th firework, where j∈[1,S]. i A i Let be the explosion radius of the i-th firework;
[0071] The explosion radius of the i-th firework is calculated using Formula 2;
[0072]
[0073] Among them, f i Let f be the fitness value of the i-th firework, Θ be the basic blast radius, and f be the blast radius. min Let ε be the minimum fitness value of the t-th generation fireworks, and let ε be a very small constant to avoid the numerator and denominator being zero.
[0074] The number of sparks generated by the i-th firework explosion is calculated using Formula 3.
[0075]
[0076] Where Φ is the number of basic sparks, f max Let ε be the maximum fitness value of the t-th generation fireworks, and let ε be a very small constant to avoid the numerator and denominator being zero.
[0077] To limit the number of sparks generated, the following formula is usually used to limit S. i Organize:
[0078]
[0079] Where, on the left side of the equation, S i Let a and b be the final number of explosion sparks, where a and b are constants, and a <b<1。
[0080] Brilliant fireworks often create a joyful and beautiful atmosphere. High-quality fireworks typically rise higher and produce more sparks, while lower-quality fireworks rise lower and produce fewer sparks. Each spark generated by a firework explosion has its own three-dimensional coordinates, and the visual effect varies depending on the spark's location. While an individual firework may have a relatively weak brightness, the overall effect of the explosion is always dazzling. Inspired by the varying explosion radii and number of sparks produced during fireworks explosions, Tan and Zhu, scholars at Peking University, proposed a novel swarm intelligence optimization algorithm called the Fireworks Algorithm in 2010.
[0081] The fireworks algorithm primarily relies on parallel fireworks explosions and Gaussian mutation for iterative optimization. The initial fireworks correspond to a set of solutions in the optimization space. The quality of a fireworks is determined by calculating its fitness. Unlike the information interaction method of biological swarm intelligence algorithms, the fireworks algorithm achieves information interaction through fitness values. The differences in information transmission and search capabilities between fireworks of varying fitness levels are mainly reflected in the different explosion operators (including explosion intensity, i.e., the number of sparks generated; explosion amplitude, i.e., the explosion radius; and displacement operations). High-fitness individuals disperse within a smaller area, generating more sparks to fully utilize their local search capabilities, while low-fitness individuals disperse within a larger area, generating fewer sparks to increase their search neighborhood radius and the probability of finding better individuals. To increase population diversity, one or more fireworks are randomly selected for Gaussian mutation, allowing the resulting sparks to potentially move away from their original positions, supplementing the search mechanism of the explosion operators. During iteration, sparks exceeding the feasible region are adjusted back to the feasible region through mapping operations such as modular arithmetic and random operations. Each iteration retains the best individual to fully utilize its excellent positional information, while the remaining N-1 individuals are generated from the rest of the fireworks and sparkler populations according to distance selection rules. The fireworks population generated through explosion, mutation, mapping, and selection operations continues for the next iteration until predetermined conditions are met.
[0082] S103, randomly select several fireworks and perform Gaussian mutation operation to generate mutated sparks;
[0083] Specifically, to further improve the diversity of the spark population, l sparks are randomly selected from X(t) for Gaussian heterogeneity testing, using the following formula:
[0084] gaussian(h)=x h dnorm(1,1) formula 4;
[0085] Where gaussian(h) is the Gaussian mutation spark, x h Let d be a randomly selected firework, d be a 1×D dimensional {0,1} random matrix, and norm(1) be a random number that follows a Gaussian distribution with a mean of 1 and a variance of 1.
[0086] According to the elite retention strategy, the optimal solution in generation t is directly retained to the next generation. The remaining N-1 solutions are selected according to the selection rule based on fitness distance, with the probability formula as follows:
[0087]
[0088] Where H is the candidate set, and D i For x in the candidate set i The sum of distances to other individuals in the candidate set, p i For individual x i The probability of being selected.
[0089] The k-th dimension of particle i is calculated using Formula 5;
[0090] X ik =X ik +β(k)*(X gk -X ik ) Formula 5;
[0091] Among them, X ik Let X represent the k-th dimension of particle i. gk Let represent the k-th dimension of the currently globally optimal particle, and β(k) be the exponential perturbation factor of the particle in the k-th dimension.
[0092] S104, according to the exponential perturbation mapping rule, the explosion sparks and the mutated sparks that exceed the boundary range are mapped back to the feasible range, and a new fireworks population is generated according to the random selection strategy.
[0093] Specifically, x is calculated using Formula 6. ij D The k-th dimension exceeds the boundary;
[0094] x ij k =x l +mod(|x ij k |x u -x l ) Formula 6;
[0095] Where, x u and x l These represent the upper and lower bounds of the solution in dimension k, respectively.
[0096] S105, determine whether the new fireworks population has reached the termination condition. If so, use the optimal threshold to segment the preprocessed image to obtain the segmented image.
[0097] If the new fireworks population does not meet the termination condition, proceed to step S102 to continue the iteration.
[0098] S106, a product based on the segmentation image detection supply chain.
[0099] The Fireworks Algorithm is a novel swarm intelligence optimization algorithm. Its group search method and inter-individual information interaction methods have many unique and novel features. The characteristics of its search mechanism can be summarized as follows:
[0100] (1) Parallel bursting. In each iteration, after the explosion operator is assigned according to the fitness interaction information, each firework individual performs the explosion operation in its own neighborhood. The generation of explosion sparks causes the population size to grow explosively, which reflects the parallel bursting characteristics of the firework algorithm.
[0101] (2) Transient nature. The transient nature of the fireworks algorithm is mainly reflected in two aspects: First, most of the sparks generated by the explosion and mutation of the fireworks population will not be selected as the next generation of fireworks, but only briefly contribute their search value, reflecting the transient existence of sparks; Second, the process of fireworks explosion generating sparks is unidirectional. Once the explosion spark is generated, it becomes an independent individual. Even if the spark position is worse, it will not return to its original position, reflecting the instantaneous memory of the spark for the upper layer fireworks.
[0102] (3) Diversity. The diversity of the fireworks algorithm is also reflected in two aspects. First, the explosion intensity and explosion range of each firework are guided by its fitness value, and the dimension of the displacement operation is also randomly generated, reflecting the diversity of the explosion operator. Second, in addition to the explosion operation, the fireworks algorithm also incorporates the Gaussian mutation operation, further increasing the diversity of the population.
[0103] (4) Locality. Each firework performs an explosion within its neighborhood, and the coverage area of the explosion sparks has a certain locality.
[0104] (5) Simplicity. The fireworks algorithm has fewer parameters, the interaction mechanism between groups is also simpler, and it is easy and convenient to operate.
[0105] (6) Fairness. Each spark has the opportunity to be selected as the next generation of fireworks. Individual fireworks of the new generation may come from different fireworks, or may come partly or entirely from the same contemporary fireworks.
[0106] (7) Flexibility. The unique information exchange method of the Fireworks Algorithm makes the group relatively independent, and there is no direct interaction between individuals. Therefore, increasing or decreasing the number of individuals has little impact on the overall optimization ability of the population, reflecting the flexibility of adjustable population size.
[0107] (8) Applicability. The search rules of the FWA group have a wide range of applicability and can demonstrate good optimization ability even for some problems that are not explicitly expressed.
[0108] The greater the total entropy of each part, the more information is contained, and the better the segmentation effect. Suppose there is a digital image I(x,y) with a total of M pixels and L gray levels, where f1(x,y) represents the gray value of point (x,y), and M... i Let i represent the number of pixels with gray level i (i = 0, 1, ..., L-1). Then, the percentage of pixels with gray level i in the image is:
[0109]
[0110] If a threshold t is selected to segment the image into two regions, Z1 and Z2, then the pixel proportions of regions Z1 and Z2 are as follows:
[0111]
[0112] The Kapur entropy of the image is calculated as follows:
[0113]
[0114] If we select the threshold set T = {t1, t2, ..., t...} k |0<t1<t2<…<t k The image is divided into k+1 regions Z1, Z2, ..., Z ≤ L-1. k+1 The problem then becomes multi-threshold segmentation. The total image entropy for multi-threshold Kapur entropy is derived from the principle of single-threshold Kapur entropy as follows:
[0115]
[0116] The objective is to find the set of threshold values T that maximizes the range of values, i.e.:
[0117]
[0118] As can be seen from the above, FWA has good optimization performance, and its unique burst capability further improves the algorithm's solution speed. However, it can also be observed that FWA always performs better on problems where the optimal value is obtained at the origin. As the distance between the optimal point and the origin increases, its solution performance deteriorates. A deeper analysis of FWA's search mechanism reveals that the main reasons for this result are as follows:
[0119] (1) After mapping particles that exceed the limit, they are likely to fall near the origin, thereby increasing the probability of finding the optimal solution, which is not the original intention of the algorithm design.
[0120] (2) FWA adopts a Gaussian mutation strategy, which increases the probability that the mutation spark will fall near the origin. This also means that after the processing of the two strategies of mapping and mutation, the particles far away from the origin will become sparse, which increases the number of invalid searches for problems where the optimal solution is not near the origin, and reduces the optimization efficiency of the algorithm.
[0121] Furthermore, while FWA particles exchange information through fitness values, a method effective for determining the number of explosion sparks and the explosion radius, the lack of direct information exchange between particles increases the probability of the algorithm getting stuck in local loops. Further analysis revealed that the new population selection strategy based on the sum of particle fitness values requires significant computation, increasing the algorithm's runtime.
[0122] Based on the above analysis, this chapter improves the mutation operator, mapping strategy, and selection strategy of FWA for the multi-threshold image segmentation problem. It proposes an exponential perturbation factor β(k) = e^(k-1) on the k-th dimension of the particle. -r(D-k), where D is the particle dimension, r∈[0,1] is a random number, and the specific improvement method is introduced below.
[0123] Mutation operators are an important step in the FWA optimization process. Good mutation sparks can increase population diversity and improve the algorithm's optimization efficiency. However, Gaussian mutation has certain limitations. This paper introduces an exponential perturbation factor to improve the mutation operator as follows:
[0124] X ik =X ik +β(k)*(X gk -X ik )
[0125] Where X ik Let X represent the k-th dimension of particle i. gk Let represent the k-th dimension of the currently globally optimal particle, and β(k) be the exponential perturbation factor of the particle in the k-th dimension.
[0126] The path differences between the two mutation strategies are as follows: Figure 3 As shown, the improved mutation process utilizes information from the global optimal solution, causing particles to mutate in the most favorable direction. This approach is inspired by the social behavior in the particle swarm optimization algorithm and aims to improve the algorithm's search efficiency.
[0127] The mapping rule of FWA pulls out-of-bounds particles back into the feasible region, but particles are more likely to fall near the origin, which undoubtedly increases the number of invalid searches when solving multi-threshold segmentation problems. Therefore, to increase the randomness of the mapped particles, this paper proposes a mapping rule that introduces an exponential perturbation factor, as follows:
[0128] X ik =X ik +β(k)*(X uk -X lk )
[0129] Where X u X l These are the upper and lower bounds of the particle, respectively.
[0130] The distance-based selection strategy in basic FWA is not suitable for image segmentation problems due to its high computational cost. This paper adopts an elite-roulette strategy to generate a new generation of fireworks population, in which the globally optimal particle of the population is directly retained to the next generation, and the remaining N-1 particles are generated by the roulette rule.
[0131] The search process of EPFWA mainly consists of four stages. In the fireworks explosion stage, the fireworks population instantly generates a large number of sparks through the explosion operation. The position of each effective spark is a solution within the feasible region. This process is equivalent to individual fireworks performing a deep local search within their respective neighborhoods. The retained fireworks or sparks are all near the local optimum, and the global optimum is also likely to be generated at these points. In the improved mutation stage, individual fireworks utilize favorable information in the population space (including fireworks and sparks) to move closer to the current best individual, avoiding the blindness of the original mechanism. This is equivalent to increasing the search neighborhood of the best individual and is also beneficial to the global evolution direction of the population. After the search in the first two stages, a large number of particles gather near the optimum. The improved mapping operation in this paper helps to increase population diversity. EPFWA uses an elite-roulette wheel selection strategy to obtain the next generation of fireworks population, which saves a lot of running time compared to the distance-based selection strategy in FWA. Therefore, the exponential perturbation fireworks algorithm EPFWA proposed in this chapter theoretically has good local and global optimization capabilities.
[0132] Based on the flowchart above, pseudocode for a multi-threshold image segmentation algorithm based on EPFWA was designed, as shown in Table 1.
[0133]
[0134]
[0135] Table 1
[0136] This multi-threshold image segmentation method for supply chain product detection involves: acquiring supply chain product images; preprocessing the supply chain product images to obtain preprocessed images; generating explosion sparks based on the preprocessed images using an explosion operator; randomly selecting several fireworks and performing Gaussian mutation operations to generate mutated sparks; mapping the explosion sparks and mutated sparks that exceed the boundary range back to the feasible range according to an exponential perturbation mapping rule; generating a new fireworks population according to a random selection strategy; determining whether the new fireworks population has reached the termination condition; if so, segmenting the preprocessed images using the optimal threshold to obtain segmented images; and detecting supply chain products based on the segmented images.
[0137] Figure 2 This is a flowchart illustrating an embodiment of the multi-threshold image segmentation system for supply chain product inspection of the present invention; as follows: Figure 2 As shown in the figure, an embodiment of the present invention provides a multi-threshold image segmentation system for supply chain product inspection, comprising the following steps:
[0138] Memory 10; and
[0139] A processor 20 connected to the memory 10 is configured to:
[0140] Obtain product images from the supply chain;
[0141] The product images of the supply chain are preprocessed to obtain preprocessed images;
[0142] Based on the preprocessed image, an explosion spark is generated according to the explosion operator;
[0143] Randomly select several fireworks and perform Gaussian mutation operation to generate mutated sparks;
[0144] According to the exponential perturbation mapping rule, the explosion sparks and the mutated sparks that exceed the boundary range are mapped back to the feasible range, and a new fireworks population is generated according to the random selection strategy.
[0145] Determine whether the new fireworks population has reached the termination condition. If so, use the optimal threshold to segment the preprocessed image to obtain a segmented image.
[0146] Based on the segmented image detection supply chain products.
[0147] This embodiment provides a non-transitory computer-readable medium storing computer instructions that cause a computer to execute the methods provided in the above-described method embodiments. These instructions include, for example: acquiring a supply chain product image; preprocessing the supply chain product image to obtain a preprocessed image; generating explosion sparks based on the preprocessed image using an explosion operator; randomly selecting several fireworks and performing a Gaussian mutation operation to generate mutated sparks; mapping the explosion sparks and mutated sparks exceeding the boundary range back to the feasible range according to an exponential perturbation mapping rule, and generating a new fireworks population according to a random selection strategy; determining whether the new fireworks population has reached a termination condition; if so, segmenting the preprocessed image using an optimal threshold to obtain a segmented image; and detecting supply chain products based on the segmented image.
[0148] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned medium includes various media that can store program code, such as ROM, RAM, magnetic disk, or optical disk.
[0149] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0150] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable medium, such as ROM / RAM, magnetic disk, optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods of various embodiments or some parts of embodiments.
[0151] Although the present invention has been described in detail above with general descriptions and specific embodiments, modifications or improvements can be made to it, which will be obvious to those skilled in the art. Therefore, all such modifications or improvements made without departing from the spirit of the present invention fall within the scope of protection claimed by the present invention.
Claims
1. A multi-threshold image segmentation method for product inspection in the supply chain, characterized in that, The method specifically includes: Acquire supply chain product images, and preprocess the supply chain product images to obtain preprocessed images; Based on the preprocessed image, an explosion spark is generated according to the explosion operator; Randomly select several fireworks and perform a Gaussian mutation operation to generate mutated sparks, including: Calculate the Gaussian variation spark using Formula 4; gaussian(h)=x h dnorm(1, 1) Formula 4; Where gaussian(h) is the Gaussian mutation spark, x h For the randomly selected fireworks, d is a 1×D dimensional {0,1} random matrix, and norm(1) is a Gaussian random number with mean 1 and variance 1. The k-th dimension of particle i is calculated using Formula 5; X ik =X ik +β(k)*(X gk -X ik ) Formula 5; Among them, X ik Let X represent the k-th dimension of particle i. gk Let represent the k-th dimension of the currently globally optimal particle, and β(k) be the exponential perturbation factor of the particle in the k-th dimension; According to the exponential perturbation mapping rule, the explosion sparks and the mutated sparks that exceed the boundary range are mapped back to the feasible range. A new fireworks population is generated according to a random selection strategy, including: The k-th dimension of xijD exceeds the boundary using Equation 6; x ij k =x l +mod(|x ij k |x u -x l ) Formula 6; Where, x u and x l Let represent the upper and lower bounds of the solution in dimension k, respectively; Determine whether the new fireworks population has reached the termination condition. If so, use the optimal threshold to segment the preprocessed image to obtain a segmented image. Based on the segmented image detection supply chain products.
2. The multi-threshold image segmentation method for supply chain product inspection according to claim 1, characterized in that, The preprocessing of the supply chain product images to obtain preprocessed images includes: The fireworks population is initialized and basic parameters are set, including setting the fireworks population size, maximum number of iterations, explosion radius control constant, spark number control constant, mutation probability factor, and individual boundary range.
3. The multi-threshold image segmentation method for supply chain product inspection according to claim 1, characterized in that, The step of generating explosion sparks based on the preprocessed image according to the explosion operator includes: Calculate the fitness of the fireworks group, and calculate the blast radius and the number of sparks produced for each firework based on the fitness. An explosion operation is performed on the aforementioned fireworks group to generate multiple explosive sparks.
4. The multi-threshold image segmentation method for supply chain product inspection according to claim 3, characterized in that, The step of generating explosion sparks based on the preprocessed image according to the explosion operator further includes: Calculate the j-th firework produced by the explosion of the i-th firework using Formula 1; x ij D = x i D +A i dunifrnd(-1,1) Formula 1; in, Let j be the j-th firework produced by the explosion of the i-th firework, where j∈[1,S]. i A i Let be the explosion radius of the i-th firework; The explosion radius of the i-th firework is calculated using Formula 2; Among them, f i Let f be the fitness value of the i-th firework, Θ be the basic blast radius, and f be the blast radius. min Let ε be the minimum fitness value of the t-th generation fireworks, and let ε be a very small constant to avoid the numerator and denominator being zero.
5. The multi-threshold image segmentation method for supply chain product inspection according to claim 4, characterized in that, The step of generating explosion sparks based on the preprocessed image according to the explosion operator further includes: The number of sparks generated by the i-th firework explosion is calculated using Formula 3. Where Φ is the number of basic sparks, f max Let ε be the maximum fitness value of the t-th generation fireworks, and let ε be a very small constant to avoid the numerator and denominator being zero.
6. A multi-threshold image segmentation system for supply chain product inspection, characterized in that, include: Memory; as well as A processor connected to the memory, the processor being configured to: Obtain product images from the supply chain; The product images of the supply chain are preprocessed to obtain preprocessed images; Based on the preprocessed image, an explosion spark is generated according to the explosion operator; Randomly select several fireworks and perform Gaussian mutation operation to generate mutated sparks; Calculate the Gaussian variation spark using Formula 4; gaussian(h)=x h dnorm(1, 1) Formula 4; Where gaussian(h) is the Gaussian mutation spark, x h For the randomly selected fireworks, d is a 1×D dimensional {0,1} random matrix, and norm(1) is a Gaussian random number with mean 1 and variance 1. The k-th dimension of particle i is calculated using Formula 5; X ik =X ik +β(k)*(X gk -X ik ) Formula 5; Among them, X ik Let X represent the k-th dimension of particle i. gk Let represent the k-th dimension of the currently globally optimal particle, and β(k) be the exponential perturbation factor of the particle in the k-th dimension; According to the exponential perturbation mapping rule, the explosion sparks and the mutated sparks that exceed the boundary range are mapped back to the feasible range, and a new fireworks population is generated according to the random selection strategy. Calculated using Formula 6 The k-th dimension exceeds the boundary; x ij k =x l +mod(|x ij k |x u -x l ) Formula 6; Where, x u and x l Let represent the upper and lower bounds of the solution in dimension k, respectively; Determine whether the new fireworks population has reached the termination condition. If so, use the optimal threshold to segment the preprocessed image to obtain a segmented image. Based on the segmented image detection supply chain products.
7. A non-transitory computer-readable medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Method for image processing based on improved fireworks algorithm
CN106910201A
Image segmentation method and system
CN107507199A