Automatic packaging method for stringing fruits
By combining high-precision dynamic weighing, multi-spectral imaging and X-ray detection technology, an automatic packaging method for fruit skewers is constructed, which realizes full-dimensional high-precision detection of the inside and surface of the fruit, solves the problem of incomplete quality detection in the existing technology, improves the sorting accuracy and packaging efficiency, and ensures the accuracy and quality stability of fruit sorting.
Patent Information
- Application Number
- CN202510542667.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-28
- Publication Date
- 2025-07-08
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the existing automatic packaging technology of fruit skewers, the quality inspection is not comprehensive and the sorting accuracy is low, and the internal defects of the fruit are not detected, resulting in high sorting error rate, confusing packaging specifications and defective products entering the market.
A high-precision dynamic weighing sensor, multi-spectral industrial camera and X-ray transmission imager are used to collect instantaneous weight data, surface image data and internal defect data of fruits, build weight grading models, surface detection models and internal detection models, combine composite quality characteristics for comprehensive quality scoring and packaging execution logic, and use three-dimensional kanban display defect correlation data for real-time monitoring.
It realizes full-dimensional high-precision detection of fruit sorting, improves the accuracy and packaging efficiency of sorting, ensures that fruit sorting is omitted, reduces losses and ensures quality stability.
Smart Images

Figure CN120270590A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of intelligent agricultural equipment and automated sorting and packaging technologies, and specifically relates to an automatic packaging method for fruit string packaging. Background Art
[0002] Automatic packaging of fruit string packaging is the application of technologies and equipment for automated stringing and packaging of fruit products. This technology uses automated machinery to arrange fruits in strings according to preset specifications and complete the packaging process. The equipment adopts a PLC control system and a mechanical transmission structure, enabling fully automated operations including conveying, sorting, bag making, and sealing. Its core advantage lies in avoiding damage to the fruit surface through soft material protection design, while using packaging materials to enhance the freshness preservation effect, which is particularly suitable for the grading and packaging needs of medium and small-scale orchards and fruit purchasers.
[0003] In order to solve the problems of incomplete quality inspection, low sorting accuracy, and lack of real-time decision support during the automatic packaging of fruit string packaging, the existing technology uses single-dimensional weight sorting and manual visual inspection sorting methods for processing. However, it still cannot detect internal defects and surface micro-defects of fruits, and the sorting threshold is static, resulting in misjudgment of critical samples, leading to high sorting error rates, chaotic packaging specifications, and defective products flowing into the market, causing product losses and damage to brand reputation. To solve the above problems, an automatic packaging method for fruit string packaging is proposed. Summary of the Invention
[0004] The purpose of the present invention is to provide an automatic packaging method for fruit string packaging to solve the problems raised in the above background art.
[0005] To solve the above technical problems, the technical solution adopted by the present invention is: an automatic packaging method for fruit string packaging, including the following steps:
[0006] S1. Collect and preprocess the instantaneous weight data, fruit surface image data, and internal defect data of each fruit unit during the fruit string packaging process;
[0007] S2. Extract composite quality features from the preprocessed instantaneous weight data, fruit surface image data, and internal defect data;
[0008] S3. Combine the composite quality features to construct a weight grading model, a surface detection model, and an internal detection model, and output weight grade labels, color grade labels, fruit surface defect marks, and internal defect marks;
[0009] S4. Perform weight disqualification elimination based on the instantaneous weight data and weight grade labels, combine the color grade, fruit surface defect marks, and internal defect marks to obtain a comprehensive quality score, construct an execution logic for automatic packaging of fruit string packaging, and count the surface defect rate and internal defect rate for early warning;
[0010] S5. Synchronously display the scatter plot related to weight defects and the heat map of internal density distribution using a 3D kanban.
[0011] A further improvement of the technical solution of the present invention lies in: in S1, the process of collecting and preprocessing the instantaneous weight data, fruit surface image data, and internal defect data of each fruit unit during the process of stringing fruits includes:
[0012] Deploy two sets of high-precision dynamic weighing sensors symmetrically at intervals of 50 cm along the conveying direction at the weighing station of the fruit stringing conveyor line. When the fruit unit passes through the weighing station, the high-precision dynamic weighing sensors output the original voltage signal at a sampling rate of 500 Hz, and multiply the difference between the original voltage signal and the no-load zero-point voltage by the sensitivity coefficient of the weighing sensor to obtain the instantaneous weight data of each fruit unit;
[0013] Deploy a multi-spectral industrial camera inside the closed light box, 30 cm vertically from the conveyor line, and equipped with a ring-shaped LED light source axially. After the photoelectric sensor detects that the fruit enters the shooting area, it sends a trigger pulse to the multi-spectral industrial camera to capture the RGB three-channel fruit surface image data;
[0014] Deploy an X-ray transmission imager below the conveyor line. After the X-ray penetrates the fruit, the detector generates a grayscale density map D(x, y) as the internal defect data of the fruit;
[0015] Among them, the range of the high-precision dynamic weighing sensor is set to 0 to 15 kg, the distance between the multi-spectral industrial camera and the weighing station is 1.2 m, its exposure time is 0.5 ms, the resolution of the RGB three-channel image is 2560×1920, the distance between the X-ray transmission imager and the weighing station is 2.5 m, the distance between its X-ray source and the detector is 40 cm, the energy parameter is set to 80 kV / 2 mA, the resolution of the grayscale density map is 0.2 mm / pixel, and the grayscale range is 0 - 4095;
[0016] Take a continuous 20-sampling-point window to calculate the weight mean and weight fluctuation range of the instantaneous weight data within the window. If there is an instantaneous weight data point whose difference from its mean exceeds ±3 g, it is determined as an interference signal and interpolated and replaced. The RGB three-channel fruit surface image data is converted to the HSV color space after equalization to enhance the contrast, the hue component matrix is extracted, and a 512×512 pixel area is intercepted with the fruit centroid as the center, and the fruit core area in the grayscale density map is located based on threshold segmentation.
[0017] A further improvement of the technical solution of the present invention lies in: in S2, the process of extracting the composite quality characteristics includes:
[0018] The composite quality characteristics include the weight mean, the weight fluctuation range, the 32-dimensional color distribution histogram vector, the texture contrast, and the density anomaly index;
[0019] Based on the 512×512 pixel hue component matrix, the hue values from 0 degrees to 360 degrees are equally divided into 32 intervals, each interval having a span of 11.25 degrees. The number of pixels in each interval is counted to generate a 32-dimensional color distribution histogram vector;
[0020] The preprocessed RGB three-channel fruit surface image is converted into a grayscale image, the gray-level co-occurrence matrix is obtained, and the joint probability of each pair of gray levels in the gray-level co-occurrence matrix is counted, and then the texture contrast is obtained;
[0021] The mean absolute deviation of the pixels in the fruit core area from the standard fruit core reference density is counted as the density anomaly index.
[0022] A further improvement of the technical solution of the present invention lies in: in S3, when constructing a weight grading model and outputting a weight grade label, the process includes:
[0023] Based on a data set covering the full range of 30g - 1000g samples including the weight mean W avg and the weight fluctuation range ΔW, a two-dimensional vector X n =[W avg ,ΔW] T is constructed for each fruit unit, where n is the sample serial number;
[0024] A weight grading model is established through Gaussian mixture model clustering. It is assumed that the fruit weight distribution is linearly superimposed by two Gaussian distributions, and each distribution corresponds to a weight grade. The weight grades include medium-sized fruits and large fruits. The mixing coefficients, mean vectors, and covariance matrices in the fruit weight distribution are iteratively optimized through the expectation-maximization algorithm. The posterior probability that the sample n belongs to the category k is analyzed, and the weight grade label to which it belongs is determined based on the maximum posterior probability of the sample n. The weight grade label includes 1 and 2, where 1 represents medium-sized fruits and 2 represents large fruits;
[0025] According to the clustering center, the weight grade division logic is defined. If 30≤W avg <200g and ΔW≤10g, it is determined as medium-sized fruits. If 200≤W avg <1000g and ΔW≤15g, it is determined as large fruits. If ΔW exceeds the corresponding thresholds for medium-sized fruits and large fruits, regardless of whether W avg is within its threshold range, rejection is triggered. A buffer zone is set in the 199g±1g interval. If 198≤W avg <202g and ΔW≤10g, it is determined as large fruits;
[0026] Initialize the medium fruit mean vector and the large fruit mean vector with the k-means algorithm, and initialize the covariance matrix as a diagonal matrix Iterate 100 times and verify that the weight grading error ≤ ±1g through 5000 sets of test set samples. The 5000 sets of test set samples include 2500 medium fruits and 2500 large fruits, including 1000 critical samples in the range of 198 - 202g.
[0027] A further improvement of the technical solution of the present invention lies in that: in S3, the process of constructing the surface detection model and outputting the fruit color grade and surface defect mark includes:
[0028] Integrate the 32-dimensional color distribution histogram and the texture contrast into a 33-dimensional input vector;
[0029] Establish a surface detection model using a one-dimensional convolutional neural network architecture. The one-dimensional convolutional neural network architecture includes an input layer, a first convolutional layer, a max pooling layer, a second convolutional layer, a flattening layer, a fully connected layer, and an output layer;
[0030] The input layer receives the 33-dimensional input vector and passes it to the first convolutional layer. The first shared convolutional layer uses 16 convolutional kernels of size 3, with a stride set to 1, extracts local features through the ReLU function activation, and outputs a 1×31 feature map with 16 channels. The max pooling layer sets the window size and stride to 2, compresses the feature dimension of the input vector to 1×15. The second shared convolutional layer uses 32 convolutional kernels of size 2, with a stride set to 1, extracts high-order features, and outputs a 1×14 feature map with 32 channels. The flattening layer unfolds the 1×14×32 feature map into a 448-dimensional vector. The 64 neurons inside the fully connected layer activate global features through the ReLU function. The 5 neurons inside the output layer output the color grade probability P through the Softmax function k , and a single neuron outputs the defect probability P through the Sigmoid function d , and maps it to the interval [0, 1];
[0031] Adopt the binary cross-entropy loss function, set the learning rate to 0.0001, combine the Adam optimizer to dynamically adjust the learning rate, iterate until the loss converges, and use 5000 sets of test sets for verification;
[0032] Take the maximum color probability grade L C = arg maxP k , where k = 1, 2, 3, 4, and 5. If max(P k ) ≥ 0.7, then determine that the corresponding color grade is k. If max(P k ) < 0.7, then determine it as color ambiguity;
[0033] Set the initial threshold of the defect probability to P. If P d ≥P, it is determined as a defect, and the surface defect label of the fruit is output as 1. If P d <P, it is determined as intact, and the surface defect label of the fruit is output as 0.
[0034] A further improvement of the technical solution of the present invention lies in: in S3, when constructing an internal detection model and outputting the internal defect label of the fruit, the process includes:
[0035] Taking the single-sample real-time processing as the time window and the density anomaly index as the input, set the internal defect labels of the corresponding fruit units to 0 and 1, where 0 indicates that the inside of the fruit is intact and 1 indicates that there are defects inside;
[0036] Adopt the radial basis kernel function of the support vector machine classification algorithm, use the kernel trick to construct a non-linear classification boundary, and jointly determine the classification hyperplane by the Lagrangian multiplier and bias term of the support vector. Search for the optimal hyperplane in the feature space, maximize the interval between the normal samples and the defect samples to construct a decision function, and the decision function converts the interval between the normal samples and the defect samples into a binary class label through the sign function, and use this binary class label as the internal defect label of the corresponding fruit unit;
[0037] Set the density anomaly index threshold, label the abnormal events according to the density anomaly index and its threshold, determine the optimal kernel function parameters and penalty factors through the grid search method, minimize the Hinge loss function, and based on the validation set data, fit the Lagrangian multiplier, bias term, optimal kernel function parameters and penalty factors to make the prediction result of the surface detection model consistent with the X-ray density detection standard.
[0038] A further improvement of the technical solution of the present invention lies in: in S4, the process of rejecting the unqualified weight includes:
[0039] Introduce the cumulative weight value W of the fruits in a single box box and the preset standard total weight W std = N·W target , where N is the standard number of a single box and W target is the target weight. If |W box -W std |> 5g, trigger the rejection of the whole box, and use the six-axis robotic arm to clamp the whole box and transfer it to the repair line within 500 ms, and record the box ID and the out-of-tolerance data at the same time;
[0040] The position of the fruits on the conveyor line is tracked by the photoelectric encoder, and the instantaneous weighing data, weight grade label and position coordinates are bound and stored, and the advance amount t of the rejection instruction is obtained delay , and its calculation process is as follows:
[0041]
[0042] Among them, L is the distance from the weighing station to the rejection station, and V is the conveyor line speed;
[0043] When the weight of the fruit is out of tolerance, compressed air with a pressure of 0.2 MPa is sprayed at a diffusion angle of 30°, so that the impact force does not exceed 0.5 N. If the out-of-tolerance fruit is adjacent to the qualified product, the air pressure is reduced to 0.15 MPa and the spraying time is shortened to 8 ms. The instantaneous weighing data is updated every 10 ms, so that the rejection response delay ≤ 8 ms.
[0044] A further improvement of the technical solution of the present invention lies in that: in S4, the process of obtaining the comprehensive quality score and constructing the automatic packaging execution logic for stringing fruits includes:
[0045] Based on the fruit color grade L C 、the fruit surface defect F s and the internal defect mark F i , color grade weights α, surface defect weights β, and internal defect weights γ are set for them respectively, and the comprehensive quality score L is obtained. The calculation process is as follows:
[0046]
[0047] L = α·I(L C ) + β·(1 - F s ) + γ·(1 - F i );
[0048] If it does not satisfy L≥0.9 and F s = 0 and F i = 0, it is determined that the fruit is unqualified and is rejected. The rejected product enters the defective product box through the diversion trough, and the rejection reason and timestamp are recorded. If L≥0.9 and F s = 0 and F i = 0, it is determined that the fruit is qualified. Among them, the qualified large fruits are packed in film-covered drag boxes, and the qualified medium fruits are packed in snap-on blister boxes;
[0049] When the fruit arrives at the packaging station, the packaging instruction is triggered by the position signal of the photoelectric encoder, and the packaging instruction lead time t p is obtained, and the temperature T of the film laminator and the vacuum pressure P of the blister box are adjusted according to W avg , and the calculation process is as follows: v T = 120 + 0.1·(W
[0050]
[0051] - 200); avg - 200);
[0052] P v= -80 - 0.2·(200 - W avg );
[0053] Wherein, L P is the distance from the packaging station to the weighing station, and V is the conveyor line speed.
[0054] A further improvement of the technical solution of the present invention lies in that: in the S4, the process of statistically analyzing the surface defect rate and the internal defect rate for early warning includes:
[0055] Taking a continuous M = 1000 fruit units as the statistical period, calculating the surface defect rate R s and the internal defect rate R i , after every M fruit detections are completed, reset the counter n = 1 and start counting again. The calculation process is as follows:
[0056]
[0057] When R s > 1%, reduce the initial threshold of the defect probability. When R i > 0.5%, adjust the energy parameters of the X-ray imager to 85 kV / 2.5 mA, trigger an audible and visual alarm, record the exceeding-standard R s , R i , the corresponding timestamp and the fruit ID, automatically start the equipment calibration process. The surface detection model takes pictures of the standard color plate and the defect template to update the reference color distribution histogram. The internal detection model recalculates the standard fruit core density and optimizes the support vector machine classification hyperplane based on the current defect distribution. After the calibration is completed, resume the detection process.
[0058] A further improvement of the technical solution of the present invention lies in that: in the S5, the process of using a 3D dashboard to synchronously display the weight defect correlation scatter plot and the internal density distribution heat map includes:
[0059] Based on the weight mean, the weight fluctuation range, the surface defect mark, the internal defect mark, and the fruit core area gray density map, with the weight mean as the horizontal axis and the comprehensive defect score N = 0.5F s + 0.5F i as the vertical axis, generate a dynamic weight defect correlation scatter plot. The color of each scatter point is encoded according to the P value. Green indicates no defect, yellow indicates the presence of either a surface defect or an internal defect, and red indicates both a surface defect and an internal defect. For each newly added fruit data, the weight defect correlation scatter plot adds the latest point and eliminates the old data beyond the 1000 historical windows. The transparency increases with time;
[0060] Normalize the density map of the fruit core area to the interval [0, 1]. Through HSV color space mapping, highlight the density anomaly area by overlaying a white border, generate a heat map of the internal density distribution, and scale the heat map of the internal density distribution proportionally according to the actual size of the fruit type to fit the surface geometry of the three-dimensional model and display the abnormal internal density distribution.
[0061] Push data in real time based on the WebSocket protocol, bind the fruit position, composite quality characteristics to the three-dimensional fruit model, support popping up a floating window by clicking on the three-dimensional fruit model to display quality parameters. When the viewing angle changes, synchronously update the scatter plot related to weight defects and the heat map of the internal density distribution through the projection matrix, adopt the level of detail technology to dynamically adjust the rendering resolution, and perform real-time heat rendering using OpenGL Shader.
[0062] Due to the adoption of the above technical solutions, the technical progress achieved by the present invention compared with the prior art is:
[0063] 1. The present invention provides an automatic packaging method for fruit in series. By integrating dynamic weighing, multispectral imaging and X-ray detection technologies, it realizes all-dimensional and high-precision detection of weight, surface and internal defects, breaks through the blind area of traditional single-dimensional detection, significantly improves the comprehensiveness and accuracy of quality determination, and ensures no omission in fruit sorting.
[0064] 2. The present invention provides an automatic packaging method for fruit in series. Based on composite quality characteristics, an intelligent sorting model is constructed, combined with a dynamic threshold and a comprehensive scoring mechanism, to achieve precise execution of film covering and blister packaging, solve the problems of traditional sorting relying on manual labor, low efficiency and mixed specifications, and greatly improve packaging efficiency and product consistency.
[0065] 3. The present invention provides an automatic packaging method for fruit in series. Utilize a three-dimensional dashboard to map real-time data related to weight defects and internal density heat maps, support second-level early warning and self-calibration of production line anomalies, provide a visual decision-making basis for process optimization, reduce losses and ensure quality stability, and realize intelligent full-process monitoring. Description of the Drawings
[0066] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required in the embodiments. Obviously, the drawings in the following description are only some embodiments recorded in the present invention. For those of ordinary skill in the art, other drawings can also be obtained based on these drawings.
[0067] Figure 1 It is a flowchart of the present invention. Detailed Embodiments
[0068] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0069] An embodiment is as Figure 1 shown. The present invention provides an automatic packaging method for fruit string packaging, including the following steps:
[0070] S1. Collect and preprocess the instantaneous weight data, fruit surface image data, and internal defect data of each fruit unit during the fruit string packaging process. Deploy two sets of high-precision dynamic weighing sensors symmetrically at intervals of 50 cm along the conveying direction at the weighing position of the fruit string packaging conveyor line. When the fruit unit passes through the weighing position, the high-precision dynamic weighing sensors output the original voltage signal at a sampling rate of 500 Hz. Multiply the difference between the original voltage signal and the no-load zero-point voltage by the sensitivity coefficient of the weighing sensor to obtain the instantaneous weight data of each fruit unit. Deploy a multi-spectral industrial camera inside the enclosed light box, 30 cm vertically from the conveyor line, and equipped with a ring-shaped LED light source axially. After the photoelectric sensor detects that the fruit enters the shooting area, it sends a trigger pulse to the multi-spectral industrial camera to capture the RGB three-channel fruit surface image data. Deploy an X-ray transmission imager below the conveyor line. After the X-ray penetrates the fruit, the detector generates a grayscale density map D(x,y) as the fruit internal defect data. Among them, the range of the high-precision dynamic weighing sensor is set to 0 to 15 kg, the distance between the multi-spectral industrial camera and the weighing position is 1.2 m, its exposure time is 0.5 ms, the RGB three-channel image resolution is 2560×1920, the distance between the X-ray transmission imager and the weighing position is 2.5 m, the distance between its ray source and the detector is 40 cm, the energy parameters are set to 80 kV / 2 mA, the resolution of the grayscale density map is 0.2 mm / pixel, the grayscale range is 0 - 4095, take a continuous 20-sampling-point window to calculate the weight mean and weight fluctuation range of the instantaneous weight data within the window. If there is an instantaneous weight data point whose difference from its mean exceeds ±3 g, it is determined as an interference signal and interpolated and replaced. The RGB three-channel fruit surface image data is converted to the HSV color space after equalization to enhance the contrast, the hue component matrix is extracted, and a 512×512 pixel area is intercepted with the fruit centroid as the center. Based on threshold segmentation, locate the fruit core area in the grayscale density map;
[0071] S2. Extract composite quality features from the pre-processed instantaneous weight data, fruit surface image data and internal defect data. The composite quality features include weight mean, weight fluctuation range, 32-dimensional color distribution histogram vector, texture contrast and density anomaly index. Based on a 512×512 pixel hue component matrix, the hue value from 0 to 360 degrees is equally divided into 32 intervals, each interval spanning 11.25 degrees. The number of pixels in each interval is counted to generate a 32-dimensional color distribution histogram vector. The pre-processed RGB three-channel fruit surface image is converted into a grayscale image to obtain a grayscale co-occurrence matrix. The joint probability of each pair of grayscale levels in the grayscale co-occurrence matrix is counted to obtain the texture contrast. The mean absolute deviation of pixels in the core area from the standard core reference density is counted as the density anomaly index.
[0072] S3, combined with composite quality features, build weight grading model, surface detection model and internal detection model, output weight grade label, color grade label, fruit surface defect and internal defect label, based on weight mean W avg The data set of samples covering the full range of 30g-1000g and weight fluctuation range ΔW is used to construct a two-dimensional vector X for each fruit unit. n =[W avg ,ΔW] T , where n is the sample number. A weight classification model is established by clustering the Gaussian mixture model. It is assumed that the fruit weight distribution is a linear superposition of two Gaussian distributions, each of which corresponds to a weight grade, and the weight grades include medium and large fruits. The mixing coefficient, mean vector and covariance matrix in the fruit weight distribution are iteratively optimized by the expectation maximization algorithm. The posterior probability that sample n belongs to category k is analyzed, and the weight grade label to which sample n belongs is determined by the maximum posterior probability of sample n. The weight grade label Includes 1 and 2, where 1 represents medium fruit and 2 represents large fruit. The weight classification logic is defined based on the cluster center. If 30≤W avg <200g and ΔW≤10g, it is considered as medium fruit. 200 ≤ W avg If the fruit weight is less than 1000g and ΔW≤15g, it is considered as large fruit. If ΔW exceeds the corresponding threshold of medium fruit and large fruit, regardless of W avg Whether it is within the threshold range, it will trigger the rejection, and set a buffer zone in the range of 199g±1g. If 198≤W avg <202g and ΔW≤10g, it is judged as a large fruit, and the k-means algorithm is used to initialize the mean vector of the medium fruit and the mean vector of the large fruit, and the covariance matrix is initialized to a diagonal matrix Iterate to 100 times and verify that the weight grading error ≤ ±1g through 5000 sets of test set samples. The 5000 sets of test set samples include 2500 sets of medium fruits and 2500 sets of large fruits, among which there are 1000 sets of critical samples in the range of 198 - 202g. Integrate the 32 - dimensional color distribution histogram and texture contrast into a 33 - dimensional input vector, and establish a surface detection model using a one - dimensional convolutional neural network architecture. The one - dimensional convolutional neural network architecture includes an input layer, a first convolutional layer, a max - pooling layer, a second convolutional layer, a flattening layer, a fully - connected layer, and an output layer. The input layer receives the 33 - dimensional input vector and passes it to the first convolutional layer. The first shared convolutional layer uses 16 convolutional kernels of size 3, with a stride set to 1, extracts local features through ReLU function activation, and outputs a 1×31 feature map with 16 channels. The max - pooling layer sets the window size and stride to 2, compresses the feature dimension of the input vector to 1×15. The second shared convolutional layer uses 32 convolutional kernels of size 2, with a stride set to 1, extracts high - order features, and outputs a 1×14 feature map with 32 channels. The flattening layer unfolds the 1×14×32 feature map into a 448 - dimensional vector. The 64 neurons inside the fully - connected layer activate global features through the ReLU function. The 5 neurons inside the output layer output the color grade probability P through the Softmax function k , and a single neuron outputs the defect probability P through the Sigmoid function d , and maps it to the interval [0, 1]. Adopt the binary cross - entropy loss function, set the learning rate to 0.0001, combine the Adam optimizer to dynamically adjust the learning rate, iterate until the loss converges, and use 5000 sets of test sets for verification. Take the maximum color probability level L C = arg maxP k , where k = 1, 2, 3, 4, and 5. If max(P k ) ≥ 0.7, then determine that the corresponding color grade is k. If max(P k ) < 0.7, then determine it as color ambiguity. Set the initial threshold of the defect probability to P. If P d ≥ P, then determine it as a defect, output the fruit surface defect label as 1. If P dIf <P, it is determined to be intact, and the surface flaw mark of the fruit is labeled as 0. Taking the single-sample real-time processing as the time window and the density anomaly index as the input, the internal flaw marks of the corresponding fruit unit are set to 0 and 1, where 0 indicates that the inside of the fruit is intact and 1 indicates that there is a flaw inside. The radial basis kernel function of the support vector machine classification algorithm is used, and the kernel trick is utilized to construct a non-linear classification boundary. The classification hyperplane is jointly determined by the Lagrange multipliers and bias terms of the support vectors. The optimal hyperplane is searched for in the feature space, and the margin between normal samples and defective samples is maximized to construct a decision function. The decision function converts the margin between normal samples and defective samples into binary class labels through the sign function, and these binary class labels are used as the internal flaw marks of the corresponding fruit unit. A density anomaly index threshold is set, and abnormal events are labeled based on the density anomaly index and its threshold. The optimal kernel function parameters and penalty factor are determined through the grid search method, and the Hinge loss function is minimized. Based on the validation set data, the Lagrange multipliers, bias terms, optimal kernel function parameters, and penalty factor are fitted to make the prediction results of the surface detection model consistent with the X-ray density detection standard;
[0073] S4. Perform weight non-conformance rejection based on instantaneous weight data and weight grade labels. Combine the color grade, surface flaws of the fruit, and internal flaw marks to obtain a comprehensive quality score, construct the automatic packaging execution logic for fruit stringing, and count the surface flaw rate and internal flaw rate for early warning. Introduce the cumulative weight value W of the fruit in a single box box and the preset standard total weight W std = N·W target , where N is the standard number per box and W target is the target weight. If |W box -W std |> 5g, then trigger the rejection of the entire box. Use a six-axis robotic arm to grip the entire box and transfer it to the repair line within 500 ms. At the same time, record the box ID and out-of-tolerance data. The position of the fruit on the conveyor line is tracked by an optical encoder, and the instantaneous weighing data, weight grade labels, and position coordinates are bound and stored. Obtain the advance amount t delay of the rejection instruction, and its calculation process is as follows:
[0074]
[0075] where L is the distance from the weighing station to the rejection station and V is the conveyor line speed. When the fruit weight is out of tolerance, compressed air at a pressure of 0.2 MPa is sprayed at a diffusion angle of 30°, so that the impact force does not exceed 0.5 N. If the fruit with out-of-tolerance weight is adjacent to the qualified product, the air pressure is reduced to 0.15 MPa and the spraying time is shortened to 8 ms. The instantaneous weighing data is updated every 10 ms to make the rejection response delay ≤ 8 ms. Based on the fruit color grade L C , surface flaw F s of the fruit, and internal flaw mark Fi Set the color grade weight α, surface defect weight β, and internal defect weight γ for them respectively, and obtain the comprehensive quality score L. The calculation process is as follows:
[0076]
[0077] L = α·I(L C ) + β·(1 - F s ) + γ·(1 - F i );
[0078] If it does not meet L ≥ 0.9 and F s = 0 and F i = 0, then it is determined that the fruit is unqualified and is removed. The removed products enter the defective product box through the diversion groove, and the removal reason and time stamp are recorded. If L ≥ 0.9 and F s = 0 and F i = 0, then it is determined that the fruit is qualified. Among them, the qualified large fruits are packed in film-covered drag boxes, and the qualified medium fruits are packed in snap-on blister boxes. When the fruits reach the packaging station, the packaging instruction is triggered by the position signal of the photoelectric encoder, and the packaging instruction lead time t p is obtained, and according to W avg , the temperature T of the film laminator and the vacuum pressure P of the blister box are adjusted v . The calculation process is as follows:
[0079]
[0080] T = 120 + 0.1·(W avg - 200);
[0081] P v = -80 - 0.2·(200 - W avg );
[0082] Among them, L P is the distance from the packaging station to the weighing station, V is the conveyor line speed. Taking a continuous M = 1000 fruit units as the statistical period, calculate the surface defect rate R s and the internal defect rate R i . After every M fruit detections are completed, reset the counter n = 1 and start counting again. The calculation process is as follows:
[0083]
[0084] When R s > 1%, reduce the initial threshold of the defect probability. When R i > 0.5%, adjust the energy parameters of the X-ray imager to 85 kV / 2.5 mA, trigger the audible and visual alarm, and record the exceeded R s , R i, corresponding to the timestamp and fruit type ID, automatically start the device calibration process. The surface detection model takes pictures of the standard color plate and the defect sample plate to update the reference color distribution histogram. The internal detection model recalculates the standard fruit core density and optimizes the support vector machine classification hyperplane based on the current defect distribution. After calibration, resume the detection process;
[0085] S5. Use a 3D dashboard to synchronously display the scatter plot related to weight defects and the heat map of internal density distribution. Based on the weight mean, weight fluctuation range, surface defect marks, internal defect marks, and the gray density map of the fruit core area, with the weight mean as the horizontal axis and the comprehensive defect score N = 0.5F s + 0.5F i as the vertical axis, generate a dynamic scatter plot related to weight defects. The color of each scatter point is encoded according to the P value. Green indicates no defects, yellow indicates the presence of either surface defects or internal defects, and red indicates both surface defects and internal defects. For each newly added fruit type data, the scatter plot related to weight defects appends the latest point and eliminates the old data beyond the 1000 - point historical window. The transparency increases with time. Normalize the density map of the fruit core area to the [0, 1] interval, map it through the HSV color space, and highlight the density abnormal area with a white border to generate the heat map of internal density distribution. The heat map of internal density distribution is scaled proportionally according to the actual size of the fruit type and fits the surface geometry of the 3D model to display the abnormal internal density distribution. Push data in real - time based on the WebSocket protocol, bind the fruit position, composite quality characteristics to the 3D fruit model, support clicking on the 3D fruit model to pop up a floating window to display quality parameters. When the viewing angle changes, synchronously update the scatter plot related to weight defects and the heat map of internal density distribution through the projection matrix, use the level - of - detail technology to dynamically adjust the rendering resolution, and perform real - time heat rendering using OpenGL Shader.
[0086] As mentioned above, it is only the specific implementation manner of this application, but the protection scope of this application is not limited thereto. Any person skilled in the art within the technical scope disclosed by this application can easily think of changes or substitutions, which should all be covered within the protection scope of this application. Therefore, the protection scope of this application should be subject to the protection scope of the claims.
Claims
1. An automatic packaging method for stringing fruits, characterized in that, It includes the following steps: S1. Collect and preprocess the instantaneous weight data, fruit surface image data, and internal defect data of each fruit unit during the fruit stringing process; S2. Extract composite quality features from the preprocessed instantaneous weight data, fruit surface image data, and internal defect data; S3. Combine the composite quality features to construct a weight grading model, a surface detection model, and an internal detection model, and output weight grade labels, color grade labels, fruit surface defects, and internal defect marks; S4. Perform weight non-conformance rejection based on the instantaneous weight data and weight grade labels, combine the color grade, fruit surface defects, and internal defect marks to obtain a comprehensive quality score, construct an automatic packaging execution logic for fruit stringing, and statistically calculate the surface defect rate and internal defect rate for early warning; S5. Use a 3D dashboard to synchronously display the weight defect correlation scatter plot and the internal density distribution heat map.
2. The automatic packaging method for stringing fruits according to claim 1, characterized in that: In the above S1, the process of collecting and preprocessing the instantaneous weight data, fruit surface image data, and internal defect data of each fruit unit during the fruit stringing process includes: Deploy two sets of high-precision dynamic weighing sensors symmetrically at intervals of 50 cm along the conveying direction at the weighing station of the fruit stringing conveyor line. When the fruit unit passes through the weighing station, the high-precision dynamic weighing sensors output the original voltage signal at a sampling rate of 500 Hz, and multiply the difference between the original voltage signal and the no-load zero voltage by the sensitivity coefficient of the weighing sensor to obtain the instantaneous weight data of each fruit unit; Deploy a multi-spectral industrial camera inside the closed light box, 30 cm vertically from the conveyor line, and equipped with a ring-shaped LED light source axially. After the photoelectric sensor detects that the fruit enters the shooting area, it sends a trigger pulse to the multi-spectral industrial camera to capture the RGB three-channel fruit surface image data; Deploy an X-ray transmission imager below the conveyor line. After the X-ray penetrates the fruit, the detector generates a grayscale density map D(x,y) as the internal defect data of the fruit; Take a continuous 20-sampling-point window to calculate the weight mean and weight fluctuation range of the instantaneous weight data within the window. If there is an instantaneous weight data point whose difference from its mean exceeds ±3 g, it is determined as an interference signal and interpolated and replaced. The RGB three-channel fruit surface image data is converted to the HSV color space after equalization to enhance the contrast, extract the hue component matrix, and intercept a 512×512 pixel area centered on the fruit centroid, and locate the fruit core area in the grayscale density map based on threshold segmentation.
3. The automatic packaging method for stringing fruits according to claim 2, characterized in that: In the above S2, the process of extracting composite quality features includes: The composite quality features include weight mean, weight fluctuation range, 32-dimensional color distribution histogram vector, texture contrast, and density anomaly index; Based on the 512×512 pixel hue component matrix, divide the hue values from 0 degrees to 360 degrees into 32 intervals, each interval spanning 11.25 degrees, count the number of pixels in each interval, and generate a 32-dimensional color distribution histogram vector; Convert the preprocessed RGB three-channel fruit surface image to a grayscale image, obtain the gray-level co-occurrence matrix, count the joint probability of each pair of gray levels in the gray-level co-occurrence matrix, and then obtain the texture contrast; The average absolute deviation of the pixels within the pit region from the standard pit reference density is used as the density anomaly index.
4. A method for automatically packaging fruit in series according to claim 3, characterized in that: In the step S3, the process of constructing a weight grading model and outputting weight grade labels includes: Based on a data set covering the full range of samples from 30 g to 1000 g, including the weight mean W avg and the weight fluctuation range ΔW, a two-dimensional vector X n = [W avg , ΔW] T is constructed for each fruit unit, where n is the sample serial number; A weight classification model is established through Gaussian mixture model clustering. It is assumed that the fruit weight distribution is a linear superposition of two Gaussian distributions, and each distribution corresponds to a weight grade. The weight grades include medium-sized fruits and large fruits. The mixing coefficients, mean vectors, and covariance matrices in the fruit weight distribution are iteratively optimized through the expectation-maximization algorithm. The posterior probability that the sample n belongs to the category k is analyzed, and the weight grade label to which it belongs is determined based on the maximum posterior probability of the sample n. The weight grade label includes 1 and 2, where 1 represents medium-sized fruits and 2 represents large fruits; Define the weight grade division logic according to the cluster center. If 30 ≤ W avg < 200 g and ΔW ≤ 10 g, it is determined as a medium-sized fruit. If 200 ≤ W avg < 1000 g and ΔW ≤ 15 g, it is determined as a large-sized fruit. If ΔW exceeds the corresponding thresholds for medium-sized and large-sized fruits, regardless of whether W avg is within its threshold range, rejection is triggered. A buffer zone is set in the range of 199 g ± 1 g. If 198 ≤ W avg < 202 g and ΔW ≤ 10 g, it is determined as a large-sized fruit; Initialize the medium fruit mean vector and the large fruit mean vector with the k-means algorithm, and initialize the covariance matrix as a diagonal matrix Iterate 100 times and verify that the weight classification error ≤ ±1g through 5000 sets of test set samples. The 5000 sets of test set samples include 2500 medium fruits and 2500 large fruits, including 1000 critical samples in the range of 198 - 202g.
5. A method for automatically packaging fruit in series according to claim 4, characterized in that: In the step S3, the process of constructing a surface detection model and outputting fruit color grades and surface defect marks includes: Integrate the 32-dimensional color distribution histogram and texture contrast into a 33-dimensional input vector; Use a one-dimensional convolutional neural network architecture to establish a surface detection model. The one-dimensional convolutional neural network architecture includes an input layer, a first convolutional layer, a max pooling layer, a second convolutional layer, a flattening layer, a fully connected layer, and an output layer; The input layer receives a 33-dimensional input vector and passes it to the first convolutional layer. The first shared convolutional layer uses 16 convolutional kernels of size 3, with a stride set to 1. It extracts local features through activation by the ReLU function and outputs a 1×31 feature map with 16 channels. The max pooling layer has a window size and stride of 2, compressing the feature dimension of the input vector to 1×15. The second shared convolutional layer uses 32 convolutional kernels of size 2, with a stride set to 1, extracts high-order features, and outputs a 1×14 feature map with 32 channels. The flattening layer unfolds the 1×14×32 feature map into a 448-dimensional vector. 64 neurons inside the fully connected layer activate global features through the ReLU function, and 5 neurons inside the output layer output the color level probability P through the Softmax function k , and a single neuron outputs the defect probability P through the Sigmoid function d , and maps it to the interval [0, 1]; Adopt a binary cross-entropy loss function, set the learning rate to 0.0001, dynamically adjust the learning rate in combination with the Adam optimizer, iterate until the loss converges, and use 5000 sets of test sets for verification; Obtain the maximum color probability level L C = arg max P k , where k = 1, 2, 3, 4, and 5. If max(P k ) ≥ 0.7, then determine that the corresponding color level is k. If max(P k ) < 0.7, then determine it as color ambiguity; Set the initial threshold of the defect probability as P. If P d ≥P, it is determined as a defect, and the surface defect of the fruit is marked as 1. If P d <P, it is determined as intact, and the surface defect of the fruit is marked as 0.
6. A method for automatically packaging fruit in series according to claim 5, characterized in that: In the step S3, the process of constructing an internal detection model and outputting internal defect marks of fruits includes: Taking a single-sample real-time processing as the time window and the density anomaly index as the input, set the internal defect marks of the corresponding fruit units to 0 and 1. Among them, 0 indicates that the inside of the fruit is intact, and 1 indicates that there are defects inside; Adopt the radial basis kernel function of the support vector machine classification algorithm, use the kernel trick to construct a non-linear classification boundary, jointly determine the classification hyperplane by the Lagrange multipliers and bias terms of the support vectors, find the optimal hyperplane in the feature space, maximize the interval between normal samples and defective samples to construct a decision function, and the decision function converts the interval between normal samples and defective samples into binary class labels through the sign function, and use this binary class label as the internal defect mark of the corresponding fruit unit; Set the density anomaly index threshold, label abnormal events according to the density anomaly index and its threshold, determine the optimal kernel function parameters and penalty factors through the grid search method, minimize the Hinge loss function, and based on the validation set data, fit the Lagrange multipliers, bias terms, optimal kernel function parameters and penalty factors to make the prediction results of the surface detection model consistent with the X-ray density detection standard.
7. A method for automatically packaging fruit in series according to claim 6, characterized in that: In the step S4, the process of removing fruits with unqualified weight includes: Introduce the cumulative weight value W of fruits in a single box box With the preset standard total weight W std = N·W target , where N is the standard quantity per box and W target is the target weight. If |W box - W std | > 5g, then the entire box is triggered to be rejected, and the entire box is clamped by a six-axis robotic arm and transferred to the repair line within 500 ms. At the same time, the box ID and out-of-tolerance data are recorded; The position of fruits on the conveyor line is tracked by an optoelectronic encoder, and the instantaneous weighing data, weight grade labels are bound and stored with the position coordinates to obtain the lead t of the rejection instruction delay , and its calculation process is as follows: Among them, L is the distance from the weighing station to the removal station, and V is the conveyor line speed; When the weight of the fruit is out of tolerance, use compressed air with a pressure of 0.2 MPa to spray at a diffusion angle of 30°, so that the impact force does not exceed 0.5 N. If the fruit with out-of-tolerance weight is adjacent to the qualified product, reduce the air pressure to 0.15 MPa and shorten the spraying time to 8 ms, update the instantaneous weighing data every 10 ms, so that the removal response delay ≤ 8 ms.
8. A method for automatically packaging fruit in series according to claim 7, characterized in that: In the step S4, the process of obtaining the comprehensive quality score and constructing the automatic packaging execution logic for fruit string loading includes: Based on the fruit color grade L C , the fruit surface defect F s and the internal defect mark F i , respectively set the color grade weight α, the surface defect weight β and the internal defect weight γ for them, and obtain the comprehensive quality score L. The calculation process is as follows: L = α·I(L C ) + β·(1 - F s ) + γ·(1 - F i ); If L≥0.9 and F s = 0 and F i = 0, it is determined that the fruit is unqualified and is removed. The removed products enter the defective product box through the diversion trough, and the reasons for removal and the time stamp are recorded. If L≥0.9 and F s = 0 and F i = 0, it is determined that the fruit is qualified. Among them, the qualified large fruits are packed in film-covered drag boxes, and the qualified medium fruits are packed in snap-on blister boxes; When the fruits arrive at the packaging station, the packaging instruction is triggered by the position signal of the photoelectric encoder, and the advance quantity t of the packaging instruction is obtained. p , and according to W avg Adjust the temperature T of the film laminating machine and the vacuum pressure P of the plastic suction box. v , and the calculation process is as follows: T = 120 + 0.1·(W avg - 200); P v = -80 - 0.2·(200 - W avg ); Among them, L P is the distance from the packaging station to the weighing station, and V is the conveyor line speed.
9. A method for automatically packaging fruit in series according to claim 8, characterized in that: In the step S4, the process of counting the surface defect rate and internal defect rate for early warning includes: Taking consecutive M = 1000 fruit units as the statistical period, calculate the surface defect rate R s and the internal defect rate R i , after every M fruit detections are completed, reset the counter n = 1 and start the statistics again. The calculation process is as follows: When R s > 1%, the initial threshold for reducing the defect probability is decreased. When R i > 0.5%, the energy parameters of the X-ray imager are adjusted to 85 kV / 2.5 mA, an audible and visual alarm is triggered, and the excessive R s and R i , the corresponding timestamp, and the fruit type ID are recorded, the equipment calibration process is automatically started, the surface detection model takes pictures of the standard color plate and the defect sample to update the reference color distribution histogram, the internal detection model recalculates the standard fruit pit density, and the support vector machine classification hyperplane is optimized based on the current defect distribution. After calibration is completed, the detection process is resumed.
10. A method for automatically packaging fruit in series according to claim 9, characterized in that: In the step S5, the process of synchronously displaying the weight defect correlation scatter plot and the internal density distribution heat map using a three-dimensional dashboard includes: Based on the weight mean, weight fluctuation range, surface defect marks, internal defect marks, and the gray density map of the pit region, with the weight mean as the horizontal axis and the comprehensive defect score N = 0.5F s + 0.5F i as the vertical axis, a dynamic weight-defect correlation scatter plot is generated. The color of each scatter point is encoded according to the P value. Green indicates no defect, yellow indicates the presence of either a surface defect or an internal defect, and red indicates both a surface defect and an internal defect. For each newly added fruit data, the weight-defect correlation scatter plot appends the latest point and eliminates the old data beyond the 1000 historical windows, and the transparency increases with time; Normalize the density map of the fruit core area to the interval [0, 1]. Through HSV color space mapping, highlight the density abnormal area by superimposing a white border, generate a heat map of the internal density distribution, and scale the heat map of the internal density distribution proportionally according to the actual size of the fruit type to fit the surface geometric structure of the three-dimensional model and display the abnormal internal density distribution; Push data in real time based on the WebSocket protocol, bind the fruit position and composite quality characteristics to the three-dimensional fruit model, support clicking on the three-dimensional fruit model to pop up a floating window to display quality parameters. When the viewing angle changes, synchronously update the scatter plot associated with weight defects and the heat map of the internal density distribution through the projection matrix, dynamically adjust the rendering resolution using the level of detail technology, and perform real-time heat rendering using OpenGL Shader.
Citation Information
Cited By
Multi-stage screening and quality detection method for peaches
CN121354095A