Method and system for identifying and sorting potato skins
Through the automatic image acquisition and multi-objective algorithm optimization identification process, the cumbersome and inaccurate problems of the existing potato grading screening methods are solved, and the rapid and accurate identification and grading of potato peel defects is achieved, which improves production efficiency and food safety.
Patent Information
- Application Number
- CN202411650417.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-19
- Publication Date
- 2025-03-11
AI Technical Summary
The existing potato grading screening methods have problems such as artificial visual dependence, low flux and accuracy, and mechanical grading may lead to secondary damage, resulting in cumbersome, time-consuming, and subjective and instability.
采用自动化的图像采集、处理和识别流程,通过多目标算法优化,结合Elman网络和帕雷托解,实现马铃薯薯皮缺陷的识别和分级。
It realizes the rapid and accurate classification and sorting of potatoes, improves production efficiency, reduces artificial differences and secondary damage, and improves food safety and product quality.
Smart Images

Figure CN119600591A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of data processing, and in particular to a method and system for identifying and sorting potato peels. Background Art
[0002] The quality of potatoes is affected by many factors, among which the surface quality of potato peel is one of the important indicators. The roughness of potato peel is an important appearance quality trait of potato tubers and an important criterion and basis for variety-specific testing and commercial classification and grading.
[0003] At present, potato grading and screening mainly focus on simple manual grading and mechanical grading of tuber shape, size and defects. Manual grading relies on qualitative classification by visual senses, with low throughput and accuracy. Although mechanical grading can avoid manual differences, it will cause secondary damage to varying degrees and reduce the commercial quality of potatoes. This method is not only time-consuming and labor-intensive, but also has problems of subjectivity and instability. Summary of the invention
[0004] The technical problem to be solved by the present invention is to provide a potato peel identification and sorting method and system, which can quickly and accurately classify potatoes through automated image acquisition, processing and identification processes, avoiding the tedious and time-consuming traditional manual sorting and improving overall production efficiency.
[0005] In order to solve the above technical problems, the technical solution of the present invention is as follows:
[0006] In a first aspect, a method for identifying and sorting potato peels comprises:
[0007] Acquiring image information of potatoes through an image acquisition device;
[0008] Initialize the parameters of the multi-objective algorithm, and calculate the objective function values of the classification accuracy and the time spent on potato peel recognition through the objective function according to the parameters of the multi-objective algorithm;
[0009] According to the objective function value, the initial position is evaluated to obtain an initial evaluation result;
[0010] According to the initial evaluation results, optimization is performed to obtain the optimized results;
[0011] Update the population position according to the optimization results, recalculate the objective function value, and update the external repository to obtain the Pareto solution in the external document;
[0012] According to the Pareto solution, potato peel defects are identified and classified to obtain identification and classification results;
[0013] According to the identification and grading results, the potato peels are sorted.
[0014] Furthermore, the parameters of the multi-objective algorithm are initialized, and the objective function values of the classification accuracy and the time spent on potato peel recognition are calculated through the objective function according to the parameters of the multi-objective algorithm, including:
[0015] Initialize the parameters of the multi-objective algorithm, including population size, number of grids in each dimension, number of iterations, maximum value of variables, minimum value of variables, and initial position of the population;
[0016] According to the parameters of the multi-objective algorithm, Calculate the objective function value of classification accuracy, where f1(y) is the classification accuracy, TP is the number of potato peels correctly identified as defective, TN is the number of potato peels correctly identified as non-defective, FP is the number of potato peels that are actually non-defective but are mistakenly identified as defective, FN is the number of potato peels that are actually defective but are mistakenly identified as non-defective, and C FP is the economic loss caused by identifying a non-defective sample as defective, C FN The economic loss caused by each error in identifying a defective sample as non-defective. α and β are weight coefficients ranging from 0 to 1; α×C FP is the economic cost of a false positive error, β×C FN is the economic cost incurred in false positive errors;
[0017] According to the parameters of the multi-objective algorithm, through f2(y)=T max -t+γ×La is the objective function value of the time spent on potato peel recognition, where f2(y) is the time spent on recognition, T max is the maximum allowed time, indicating the highest acceptable time threshold; t is the time required for actual operation, La includes the time required for data preprocessing and reasoning, network transmission and data acquisition; γ is a weight coefficient, ranging from 0 to 1.
[0018] Further, the initial position is evaluated according to the objective function value to obtain an initial evaluation result, including:
[0019] Encode the initial weights of the Elman network into several binary strings, where each individual binary string represents a set of network parameters as a candidate for the initial position;
[0020] By transmitting the initial weight code, each node in the network is activated to realize the conversion of input signal into network output;
[0021] Compare the objective function value with the output of the network to obtain a comparison result;
[0022] According to the comparison result, the initial position is evaluated to obtain an initial evaluation result.
[0023] Further, based on the initial evaluation results, optimization is performed to obtain optimization results, including:
[0024] Calculate the mean square error of the objective function value of each individual in the current population to select individuals with excellent performance;
[0025] Individuals with excellent performance will be selected for crossover and mutation operations to generate new weight configurations;
[0026] Apply the newly generated weight configuration to the Elman network, calculate the network output, and compare it with the objective function value to evaluate the performance of the new individual;
[0027] The population is updated according to the evaluation results of the new individuals, the individuals with poor performance are replaced, and the currently found optimal weight configuration and its corresponding network output and objective function value are recorded to obtain the optimization result.
[0028] Further, the population position is updated according to the optimization results, the objective function value is recalculated, and the external repository is updated to obtain the Pareto solution in the external document, including:
[0029] Update the population position according to the optimization results, and recalculate the objective function values of classification accuracy and potato peel recognition time for each individual in the updated population;
[0030] According to the objective function value, the updated population is non-dominated and sorted, and the individuals are layered according to their dominance relationship. In each non-dominated layer, the crowding degree of the individuals is calculated to obtain the crowding degree of the non-dominated individuals.
[0031] The crowding of non-dominated individuals in the population is compared with the crowding of individuals in the external repository to obtain the Pareto solution in the external document.
[0032] Furthermore, according to the objective function value, the updated population is non-dominated and sorted, and the individuals are layered according to their dominance relationship. In each non-dominated layer, the crowding degree of the individuals is calculated to obtain the crowding degree of the non-dominated individuals, including:
[0033] According to the objective function value, create an empty frontier list and an empty domination count list, and compare individuals: for each pair of individuals i and j, if individual i dominates individual j, increase the domination count of individual j by 1 and add individual i to the domination set of individual j; if individual j dominates individual i, increase the domination count of individual i by 1 and add individual j to the domination set of individual i;
[0034] In each non-dominated layer, by Calculate the crowding of individuals to obtain the crowding of non-dominated individuals, where C(i) is the crowding of individual i, fm (i+1) and f m (i-1) are the target values of the neighboring individuals of individual i on target m, f max (m) and f min (m) is the maximum and minimum target value of target m in the current layer, M is the total number of targets, and m is the index.
[0035] Furthermore, according to the Pareto solution, potato peel defects are identified and graded to obtain identification and grading results, including:
[0036] Identification of potato peel defects to identify the type and severity of potato defects;
[0037] According to the Pareto solution, the identified defect types and severity are graded to obtain identification and classification results.
[0038] In a second aspect, a potato peel identification and sorting system comprises:
[0039] The acquisition module is used to acquire the image information of potatoes through an image acquisition device; initialize the parameters of the multi-objective algorithm, and calculate the objective function values of the classification accuracy and the time spent on potato peel recognition through the objective function according to the parameters of the multi-objective algorithm; and evaluate the initial position according to the objective function value to obtain an initial evaluation result;
[0040] The processing module is used for performing optimization according to the initial evaluation result to obtain the optimization result; updating the population position according to the optimization result, recalculating the objective function value, and updating the external repository to obtain the Pareto solution in the external document; identifying and grading the potato peel defects according to the Pareto solution to obtain the identification and grading result; and sorting the potato peel according to the identification and grading result.
[0041] According to a third aspect, a computing device includes:
[0042] one or more processors;
[0043] The storage device is used to store one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the method described.
[0044] In a fourth aspect, a computer-readable storage medium stores a program, and when the program is executed by a processor, the method described is implemented.
[0045] The above solution of the present invention includes at least the following beneficial effects:
[0046] Through the automated image acquisition and recognition process, this method can quickly identify and grade potato peel defects for a large number of potatoes, thereby significantly improving sorting efficiency; the multi-objective algorithm is used to optimize the recognition process, which not only considers the classification accuracy, but also takes into account the time spent on recognition, which helps to maximize recognition accuracy while ensuring recognition speed; by accurately identifying and grading potato peel defects, potatoes with serious defects can be removed in time, and by providing detailed identification and grading results, production processes can be adjusted based on these data, resource allocation can be optimized, or more targeted market strategies can be formulated; by accurately identifying and removing defective potatoes, it helps to improve food safety levels and protect consumer rights. At the same time, providing high-quality, defect-free potato products can enhance consumer purchasing confidence and satisfaction. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 The present invention is a schematic flow chart of a method for identifying and sorting potato peels provided by an embodiment of the present invention.
[0048] Figure 2 The figure is a schematic diagram of a potato peel identification and sorting system provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0049] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in a form and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0050] like Figure 1 As shown, an embodiment of the present invention provides a method for identifying and sorting potato peels, the method comprising the following steps:
[0051] Step 11, acquiring image information of potatoes through an image acquisition device;
[0052] Step 12, initializing the parameters of the multi-objective algorithm, and calculating the objective function values of the classification accuracy and the time spent on potato peel recognition through the objective function according to the parameters of the multi-objective algorithm;
[0053] Step 13, evaluating the initial position according to the objective function value to obtain an initial evaluation result;
[0054] Step 14, performing optimization according to the initial evaluation result to obtain an optimization result;
[0055] Step 15, updating the population position according to the optimization result, recalculating the objective function value, and updating the external repository to obtain the Pareto solution in the external document;
[0056] Step 16, identifying and grading potato peel defects according to the Pareto solution to obtain identification and grading results;
[0057] Step 17, sorting the potato peels according to the identification and grading results.
[0058] In the embodiment of the present invention, high-quality, high-resolution potato images are obtained to provide an accurate data basis for subsequent processing; by initializing the algorithm parameters, the focus of the optimization process can be adjusted according to actual needs, and the benchmark point is set for the entire optimization process according to the objective function value. By optimizing the algorithm, the classification accuracy can be improved and the recognition time can be reduced, thereby improving the overall performance. Updating the population position and the external storage repository helps to find a solution closer to the global optimum, that is, the Pareto solution. Using the Pareto solution for identification and grading can more efficiently and accurately judge the quality of potatoes. Through accurate sorting, the quality of potatoes sold on the market can be ensured and consumer satisfaction can be improved.
[0059] In a preferred embodiment of the present invention, the above step 11 may include:
[0060] An image is acquired by an image acquisition device, and the image is preprocessed to obtain a preprocessed image.
[0061] In the embodiment of the present invention, through preprocessing, noise and interference information in the image can be removed, the contrast and clarity of the image can be enhanced, and the overall quality of the image can be improved. Grayscale processing converts a color image into a grayscale image, reducing the amount of data and complexity of subsequent processing. At the same time, denoising and enhancement processing also make subsequent feature extraction and recognition more accurate and efficient. High-quality preprocessed images can more accurately reflect the actual characteristics of potatoes, thereby improving the accuracy of subsequent defect recognition. By optimizing image quality through preprocessing, possible misjudgments and repeated operations in subsequent processing can be reduced, thereby saving time and computing resources.
[0062] In a preferred embodiment of the present invention, the above step 12 may include:
[0063] Step 121, initializing the parameters of the multi-objective algorithm, including the population size, the number of grids in each dimension, the number of iterations, the maximum value of the variable, the minimum value of the variable, and the initial position of the population;
[0064] Step 122, according to the parameters of the multi-objective algorithm, by Calculate the objective function value of classification accuracy, where f1(y) is the classification accuracy, TP is the number of potato peels correctly identified as defective, TN is the number of potato peels correctly identified as non-defective, FP is the number of potato peels that are actually non-defective but are mistakenly identified as defective, FN is the number of potato peels that are actually defective but are mistakenly identified as non-defective, and C FP is the economic loss caused by identifying a non-defective sample as defective, C FN The economic loss caused by each error in identifying a defective sample as non-defective. α and β are weight coefficients ranging from 0 to 1; α×C FP is the economic cost of a false positive error, β×C FN is the economic cost incurred in false positive errors;
[0065] Step 123, according to the parameters of the multi-objective algorithm, by f2(y)=T max -t+γ×La is the objective function value of the time spent on potato peel recognition, where f2(y) is the time spent on recognition, T max is the maximum allowed time, indicating the highest acceptable time threshold; t is the time required for actual operation, La includes the time required for data preprocessing and reasoning, network transmission and data acquisition; γ is a weight coefficient, ranging from 0 to 1.
[0066] In the embodiment of the present invention, setting a suitable population size helps to find more potential excellent solutions in the search space while maintaining the operational efficiency of the algorithm. The refined number of grids can improve the accuracy of the search and help find a more accurate optimal solution. Clarifying the value range of the variable helps to limit the search space and improve the search efficiency of the algorithm. A good initial position setting can accelerate the convergence process of the algorithm and improve the optimization efficiency. Through TP, TN, FP and FN, the performance of potato peel defect recognition can be comprehensively and accurately evaluated, and economic loss parameters can be introduced, such as the loss of identifying a non-defective as a defective and the loss of identifying a defective as a non-defective, so that the objective function is closer to the actual application scenario, and the optimization result is more practical. By adjusting the weight coefficient, the classification accuracy and the economic losses caused by different types of errors can be balanced according to actual needs, and more flexible and refined optimization can be achieved. Taking recognition time as one of the optimization goals helps to improve the real-time and response speed of the recognition system while ensuring classification accuracy. By setting the maximum allowed time and considering the actual time consumption of model operation and data transmission, resource allocation can be optimized to avoid unnecessary waste of time. By adjusting the weight coefficient γ, the best balance between classification accuracy and recognition time can be found to meet the performance and efficiency requirements of different application scenarios.
[0067] In a specific embodiment of the present invention, the number of individuals used in the algorithm is determined, the number of grids in each dimension needs to be set, and the number of iterations that the algorithm will execute is set. Upper and lower bounds are set for each variable in the search space to determine the initial position of the population. Classification results are collected, including TP, TN, FP, and FN. Based on the collected classification results, the objective function value of the classification accuracy is calculated by a formula, and an economic loss factor is introduced. The time objective function value is calculated by comparing the actual running time and the maximum allowed time.
[0068] In a preferred embodiment of the present invention, the above step 13 may include:
[0069] Step 131, encoding the initial weights of the Elman network into a number of binary strings, wherein each individual binary string represents a set of network parameters as a candidate for the initial position;
[0070] Step 132, activating each node in the network by transmitting the initial weight code to realize the conversion of the input signal into the output of the network;
[0071] Step 133, comparing the objective function value with the output of the network to obtain a comparison result;
[0072] Step 134 , evaluating the initial position according to the comparison result to obtain an initial evaluation result.
[0073] In the embodiment of the present invention, by encoding the network weights into binary strings, it is possible to effectively search in discrete space. In the evolutionary algorithm, the use of binary coding can simplify crossover and mutation operations, thereby improving the algorithm's operational efficiency. The binary coding method allows fine-tuning of the weights. By changing certain bits in the binary string, fine adjustment of the network weights can be achieved, thereby more flexibly exploring different network configurations. By comparing the objective function value with the network output, a standardized evaluation process can be established to make the performance comparison of different initial weight combinations more objective and fair; by comparing the results and the initial evaluation, the efficiency and stability of network training can be improved.
[0074] In a specific embodiment of the present invention, all weights to be optimized in the Elman network are determined, including the number of weights from the input layer to the hidden layer, from the hidden layer to the output layer, and from the hidden layer context node to the hidden layer. For each weight, a binary string of a certain length is used for encoding, wherein the length of the binary string depends on the required weight accuracy and range. For example, if a weight range is [-1,1] and 16 different levels are desired, a 4-bit binary string (from 0000 to 1111) can be used to represent it. The binary strings of all weights are connected to form a longer binary string representing an individual (i.e., a set of network parameters). Each binary string is converted into its corresponding real value, and the decoded weight is set as the initial weight of the Elman network. Given an input signal, the signal is forward propagated through the network, including calculating the activation values of the hidden layer and the output layer, and updating the state of the hidden layer context node. According to the nature of the problem, one or more objective functions are defined, and for each objective function, the value of its current network output is calculated. The actual output of the network is compared with the target output by calculating the mean square error between the two, and the quality of the initial position is evaluated based on the objective function value and the output comparison result.
[0075] In a preferred embodiment of the present invention, the above step 14 may include:
[0076] Step 141, calculating the mean square error of the objective function value of each individual in the current population to select individuals with excellent performance;
[0077] Step 142, individuals with excellent performance are selected for crossover and mutation operations to generate new weight configurations;
[0078] Step 143, applying the newly generated weight configuration to the Elman network, calculating the network output, and comparing it with the objective function value to evaluate the performance of the new individual;
[0079] Step 144, update the population according to the evaluation results of the new individuals, replace individuals with poor performance, and record the currently found optimal weight configuration and its corresponding network output and objective function value to obtain the optimization result.
[0080] In an embodiment of the present invention, by calculating the mean square error of the objective function value of each individual, the performance of each individual can be accurately quantified and evaluated, which helps to accurately identify individuals with excellent performance; by selecting individuals with excellent performance for crossover operations, it helps to pass on excellent genes to the next generation, and the mutation operation can introduce new gene mutations, increase the diversity of the population, and help the algorithm jump out of the local optimum. The newly generated weight configuration is applied to the Elman network, and the effect of the new configuration can be verified in real time. By comparing with the objective function value, the bad weight configuration can be discovered and corrected in time, thereby continuously improving the performance of the network. By continuously updating the population and replacing individuals with poor performance, the vitality and diversity of the population can be maintained, and the algorithm can be prevented from converging prematurely or falling into the local optimum. Recording the currently found optimal weight configuration and its corresponding network output and objective function value helps to track the optimization progress and effect of the algorithm at any time.
[0081] In a specific embodiment of the present invention, a population is composed of multiple individuals, each of which represents a set of weight configurations of the Elman network. The objective function is a criterion for evaluating network performance, usually based on the error between the network output and the expected output. For each individual in the population, its weight configuration is applied to the Elman network, and the output of the network is calculated by forward propagation. Then, the mean square error between the network output and the objective function value is calculated. According to the calculated mean square error, individuals with excellent performance are selected. Two of the selected individuals with excellent performance are randomly selected as parents and crossover operations are performed. The crossover operation is to generate new offspring individuals by exchanging some genes of the parent individuals. New genetic variations are introduced by randomly changing some gene values in the individuals, and the new weight configuration generated by the crossover and mutation operations is applied to the Elman network. The network output of the new individual is compared with the objective function value to evaluate the performance of the new individual. According to the evaluation results of the new individual, the individuals with poor performance in the population are selectively replaced. In the process of updating the population, the optimal weight configuration currently found is recorded. At the same time, the network output and objective function value corresponding to the optimal configuration are recorded. By continuously iterating the above steps, the population will gradually evolve a better weight configuration. Finally, when the maximum number of iterations is reached, the iteration stops, and the currently recorded optimal weight configuration and its corresponding network output and objective function value are output as the optimization result.
[0082] In a preferred embodiment of the present invention, the above step 15 may include:
[0083] Step 151, updating the population position according to the optimization result, and recalculating the objective function values of the classification accuracy and the time spent on potato peel recognition for each individual in the updated population;
[0084] Step 152, performing non-dominated sorting on the updated population according to the objective function value, stratifying the individuals according to their dominance relationship, and calculating the crowding degree of the individuals in each non-dominated layer to obtain the crowding degree of the non-dominated individuals;
[0085] Step 153, compare the crowding degree of the non-dominated individuals in the population with the crowding degree of the individuals in the external repository to obtain the Pareto solution in the external document.
[0086] In an embodiment of the present invention, by updating the population position according to the optimization result, the algorithm can dynamically adjust the search direction and more accurately approach the global optimal solution. Updating the population position helps to reduce the search in invalid or inefficient areas, thereby improving the search efficiency of the algorithm. Recalculating the objective function values of the classification accuracy and the time spent on potato peel recognition can provide real-time performance feedback for the algorithm and ensure the effectiveness of the optimization process. Considering the classification accuracy and recognition time at the same time, the algorithm can balance and optimize between multiple objectives. Non-dominated sorting can ensure that individuals in the population are balanced on multiple objectives and avoid over-optimization of a single objective. Calculating the crowding of individuals helps to identify similar individuals in the same non-dominated layer, guiding the algorithm to search more in sparse areas to increase the possibility of finding a better solution. By comparing with individuals in an external repository, the algorithm can identify the optimal trade-off solution in the current multi-objective optimization problem, that is, the Pareto solution. The Pareto solution provides decision makers with a basis for selection and compromise between multiple objectives, which helps to make more reasonable and effective decisions.
[0087] In a specific embodiment of the present invention, according to the obtained optimization results, the optimal weight configuration is obtained, and the individuals in the population are updated. For each individual in the updated population, its objective function value needs to be recalculated, and the objective function includes the classification accuracy and the time spent on potato peel recognition. The classification accuracy can be obtained by applying the individual weight configuration to the classification; the potato peel recognition time can be obtained by recording the time required to process a single sample or a batch of samples. For each individual, check whether it is no worse than any other individual in all objective functions. If so, it is regarded as a non-dominated individual. Then, these non-dominated individuals are placed in the first layer, removed from the population, and the above process is repeated until all individuals are stratified. In each non-dominated layer, the crowding of the individual is calculated. The crowding of the non-dominated individuals in the population is compared with the crowding of the individuals in the external storage. If a non-dominated individual in the population is better than an individual in the external storage in terms of crowding (that is, its crowding value is smaller), it can be considered to replace the individual in the external storage. According to the comparison result, the individual in the external storage is updated. After multiple iterations and updates, the external repository will contain a set of Pareto solutions that achieve the best balance between multiple objective functions (such as classification accuracy and recognition time). Ultimately, one or more solutions can be selected from the external repository as the final solution to the problem.
[0088] In a preferred embodiment of the present invention, the above step 152 may include:
[0089] Step 1521, based on the objective function value, create an empty frontier face list and an empty domination count list, and compare individuals: for each pair of individuals i and j, if individual i dominates individual j, then increase the domination count of individual j by 1, and add individual i to the domination set of individual j; if individual j dominates individual i, then increase the domination count of individual i by 1, and add individual j to the domination set of individual i;
[0090] Step 1522, at each non-dominated layer, by Calculate the crowding of individuals to obtain the crowding of non-dominated individuals, where C(i) is the crowding of individual i, f m (i+1) and f m (i-1) are the target values of the neighboring individuals of individual i on target m, f max (m) and f min (m) is the maximum and minimum target value of target m in the current layer, M is the total number of targets, and m is the index.
[0091] In the embodiment of the present invention, the relationship between the advantages and disadvantages of individuals can be clearly determined through non-dominated sorting, which is particularly important for multi-objective optimization problems, because there are often conflicts and trade-offs between multiple objectives. Non-dominated sorting divides individuals into different frontier layers, and individuals in each layer do not dominate each other on multiple objectives, which helps the algorithm to gradually approach the global optimal solution set during the optimization process. Through the update of dominance count and dominance set, the algorithm can efficiently identify individuals in the same non-dominated layer, thereby reducing unnecessary comparisons and calculations. Crowding calculation helps to evaluate the distribution of individuals in the same non-dominated layer, thereby avoiding the population from being too concentrated or sparse, and maintaining the diversity of the population. By calculating the crowding of individuals, the algorithm can identify which areas are already too crowded and which areas still have potential optimization space, thereby guiding the search process to a more promising direction. As an important indicator in the selection operation, crowding helps to find a better trade-off point between multiple objectives, thereby improving the quality and practicality of the final solution.
[0092] In a specific embodiment of the present invention, an empty frontier surface list and a domination count list are created, and an empty domination set is created for each individual, wherein the domination relationship is expressed as follows: Assuming there are two individuals A and B, if: A is better than B in all objectives (i.e., the objective function value is smaller), and A is better than B in at least one objective (i.e., the value is smaller in a certain objective), then A dominates B. Traverse each pair of individuals i and j (i≠j) in the population, and for each pair of individuals, compare their objective function values. If individual i is better than or equal to individual j in all objectives, and is strictly better than j in at least one objective, then i is considered to dominate j; if i dominates j, increase j's domination count by 1, and add i to j's domination set; if j dominates i, increase i's domination count by 1, and add j to i's domination set; if i and j do not dominate each other, no operation is performed. Traverse all individuals in the population, find individuals with a domination count of 0, which belong to the first-level frontier (that is, they are not dominated by any other individuals), add these individuals to the first element of the frontier list, and remove these individuals from the current population; for each individual in the current frontier, traverse each dominated individual in its domination set, reduce the domination count of the dominated individual by 1, and if the domination count of the dominated individual becomes 0, add it to the next frontier; repeat this process until all frontiers are constructed or there are no individuals left in the population.
[0093] In another specific embodiment of the present invention, in each non-dominated layer (frontier surface), the crowding degree of the individual is calculated to evaluate the density of the individuals around it. For each individual in the frontier surface, its crowding degree is initialized to 0. For each objective function, the maximum and minimum values of the objective function value in the current frontier surface are found, and each individual i in the current frontier surface is traversed. For each objective function, the difference between the target values of the adjacent individuals of individual i on the target is calculated and divided by the range of the target in the current frontier surface. The local density on all targets is added to obtain the total crowding degree of individual i.
[0094] In a preferred embodiment of the present invention, the above step 16 may include:
[0095] Identification of potato peel defects to identify the type and severity of potato defects;
[0096] According to the Pareto solution, the identified defect types and severity are graded to obtain identification and classification results.
[0097] In an embodiment of the present invention, by identifying and grading the defect types and severity of potatoes, producers can promptly discover and remove potatoes with serious defects, thereby improving the overall product quality. Identifying and grading potato defects can avoid mixing defective potatoes with non-defective potatoes, thereby reducing waste during storage, transportation and sales. By identifying and grading potato defects, we can understand possible problems in the production process, such as planting technology, pest and disease control, etc. The market has increasingly higher requirements for potato quality. By identifying and grading potato defects, the needs of different consumers for potato quality can be met. The grading results based on the Pareto solution provide producers with a clear decision-making basis, and they can quickly determine which potatoes are suitable for sale and which need to be eliminated or reduced in price. By identifying and grading potato defects, the sustainable development of the potato industry can be promoted.
[0098] In a specific embodiment of the present invention, an image data set containing multiple defect types is established based on potato images, and the defect type and its severity in each image are annotated. The identified defect types and severity are used for Pareto analysis to determine the key factors affecting potato quality, that is, those defect types that occur frequently and have a great impact on potato quality; based on the results of the Pareto analysis, a potato grading standard is formulated, and potatoes can be divided into several grades: "high quality" (no critical defects), "good" (with minor non-critical defects), "general" (with moderate non-critical defects) and "poor quality" (with critical defects). Potatoes are graded according to the formulated grading standards and the defect information identified by the model.
[0099] like Figure 2As shown, an embodiment of the present invention further provides a potato peel identification and sorting system 20, comprising:
[0100] The acquisition module 21 is used to acquire the image information of potatoes through an image acquisition device; initialize the parameters of the multi-objective algorithm, and calculate the objective function values of the classification accuracy and the time spent on potato peel recognition through the objective function according to the parameters of the multi-objective algorithm; and evaluate the initial position according to the objective function value to obtain an initial evaluation result;
[0101] The processing module 22 is used to optimize according to the initial evaluation result to obtain the optimization result; update the population position according to the optimization result, recalculate the objective function value, and update the external repository to obtain the Pareto solution in the external document; identify and classify the potato peel defects according to the Pareto solution to obtain the identification and classification results; sort the potato peels according to the identification and classification results.
[0102] It should be noted that the system is a system corresponding to the above method, and all implementation methods in the above method embodiment are applicable to this embodiment and can achieve the same technical effect.
[0103] The embodiment of the present invention further provides a computing device, comprising: a processor, a memory storing a computer program, wherein when the computer program is executed by the processor, the method described above is executed. All implementations in the above method embodiment are applicable to this embodiment and can achieve the same technical effect.
[0104] The embodiment of the present invention also provides a computer-readable storage medium storing instructions, which, when executed on a computer, enable the computer to execute the method described above. All implementations in the above method embodiment are applicable to this embodiment and can achieve the same technical effect.
[0105] The above is a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for identifying and sorting potato peels, characterized in that: The method comprises: Acquiring image information of potatoes through an image acquisition device; Initialize the parameters of the multi-objective algorithm, and calculate the objective function values of the classification accuracy and the time spent on potato peel recognition through the objective function according to the parameters of the multi-objective algorithm; According to the objective function value, the initial position is evaluated to obtain an initial evaluation result; According to the initial evaluation results, optimization is performed to obtain the optimized results; Update the population position according to the optimization results, recalculate the objective function value, and update the external repository to obtain the Pareto solution in the external document; According to the Pareto solution, potato peel defects are identified and classified to obtain identification and classification results; According to the identification and grading results, the potato peels are sorted.
2. The potato peel identification and sorting method according to claim 1, characterized in that: Initialize the parameters of the multi-objective algorithm. According to the parameters of the multi-objective algorithm, calculate the objective function values of the classification accuracy and the time spent on potato peel recognition through the objective function, including: Initialize the parameters of the multi-objective algorithm, including population size, number of grids in each dimension, number of iterations, maximum value of variables, minimum value of variables, and initial position of the population; According to the parameters of the multi-objective algorithm, Calculate the objective function value of classification accuracy, where f1(y) is the classification accuracy, TP is the number of potato peels correctly identified as defective, TN is the number of potato peels correctly identified as non-defective, FP is the number of potato peels that are actually non-defective but are mistakenly identified as defective, FN is the number of potato peels that are actually defective but are mistakenly identified as non-defective, and C FP is the economic loss caused by identifying a non-defective sample as defective, C FN The economic loss caused by each error in identifying a defective sample as non-defective. α and β are weight coefficients ranging from 0 to 1; α×C FP is the economic cost of a false positive error, β×C FN is the economic cost incurred in false positive errors; According to the parameters of the multi-objective algorithm, through f2(y)=T max -t+γ×La is the objective function value of the time spent on potato peel recognition, where f2(y) is the time spent on recognition, T max is the maximum allowed time, indicating the highest acceptable time threshold; t is the time required for actual operation, La includes the time required for data preprocessing and reasoning, network transmission and data acquisition; γ is a weight coefficient, ranging from 0 to 1.
3. The potato peel identification and sorting method according to claim 2, characterized in that: According to the objective function value, the initial position is evaluated to obtain the initial evaluation results, including: Encode the initial weights of the Elman network into several binary strings, where each individual binary string represents a set of network parameters as a candidate for the initial position; By transmitting the initial weight code, each node in the network is activated to realize the conversion of input signal into network output; Compare the objective function value with the output of the network to obtain a comparison result; According to the comparison result, the initial position is evaluated to obtain an initial evaluation result.
4. The potato peel identification and sorting method according to claim 3, characterized in that: Based on the initial evaluation results, optimization is performed to obtain the optimized results, including: Calculate the mean square error of the objective function value of each individual in the current population to select individuals with excellent performance; Individuals with excellent performance will be selected for crossover and mutation operations to generate new weight configurations; Apply the newly generated weight configuration to the Elman network, calculate the network output, and compare it with the objective function value to evaluate the performance of the new individual; The population is updated according to the evaluation results of the new individuals, the individuals with poor performance are replaced, and the currently found optimal weight configuration and its corresponding network output and objective function value are recorded to obtain the optimization result.
5. The potato peel identification and sorting method according to claim 4, characterized in that: Update the population position according to the optimization results, recalculate the objective function value, and update the external repository to obtain the Pareto solution in the external document, including: Update the population position according to the optimization results, and recalculate the objective function values of classification accuracy and potato peel recognition time for each individual in the updated population; According to the objective function value, the updated population is non-dominated and sorted, and the individuals are layered according to their dominance relationship. In each non-dominated layer, the crowding degree of the individuals is calculated to obtain the crowding degree of the non-dominated individuals. The crowding of non-dominated individuals in the population is compared with the crowding of individuals in the external repository to obtain the Pareto solution in the external document.
6. The potato peel identification and sorting method according to claim 5, characterized in that: According to the objective function value, the updated population is non-dominated and sorted, and the individuals are layered according to their dominance relationship. In each non-dominated layer, the crowding degree of the individuals is calculated to obtain the crowding degree of the non-dominated individuals, including: According to the objective function value, create an empty frontier list and an empty domination count list, and compare individuals: for each pair of individuals i and j, if individual i dominates individual j, increase the domination count of individual j by 1 and add individual i to the domination set of individual j; if individual j dominates individual i, increase the domination count of individual i by 1 and add individual j to the domination set of individual i; In each non-dominated layer, Calculate the crowding of individuals to obtain the crowding of non-dominated individuals, where C(i) is the crowding of individual i, f m (i+1) and f m (i-1) are the target values of the neighboring individuals of individual i on target m, f max (m) and f min (m) is the maximum and minimum target value of target m in the current layer, M is the total number of targets, and m is the index.
7. The potato peel identification and sorting method according to claim 6, characterized in that: According to the Pareto solution, potato peel defects are identified and graded to obtain identification and classification results, including: Identification of potato peel defects to identify the type and severity of potato defects; According to the Pareto solution, the identified defect types and severity are graded to obtain identification and classification results.
8. A potato peel identification and sorting system, characterized in that: include: The acquisition module is used to acquire the image information of potatoes through an image acquisition device; initialize the parameters of the multi-objective algorithm, and calculate the objective function values of the classification accuracy and the time spent on potato peel recognition through the objective function according to the parameters of the multi-objective algorithm; According to the objective function value, the initial position is evaluated to obtain an initial evaluation result; A processing module, used for performing optimization according to the initial evaluation result to obtain an optimization result; Update the population position according to the optimization results, recalculate the objective function value, and update the external repository to obtain the Pareto solution in the external document; According to the Pareto solution, potato peel defects are identified and graded to obtain identification and grading results; according to the identification and grading results, potato peels are sorted.
9. A computing device, characterized in that include: one or more processors; A storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement the method as claimed in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a program, which, when executed by a processor, implements the method according to any one of claims 1 to 7.