A heterogeneous knowledge distillation method for real-time identification and particle size analysis of dense small particles
Patent Information
- Application Number
- CN202611196607.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-07
- Publication Date
- 2026-10-20
AI Technical Summary
[0007]本发明旨在解决现有技术中密集小颗粒图像内部不同区域的检测难度差异未被充分利用、轻量化学生模型在密集粘连区域容易产生漏检或重复检测、目标检测结果与区域颗粒数量及粒径分布之间缺乏一致性约束,以及固定候选框抑制参数、置信度阈值和粒径校正参数难以适配不同区域复杂度的问题
第一,通过在完整图像坐标空间建立逻辑网格区域索引,在不物理裁切图像且不增加模型前向次数的情况下,获得局部密集度参数、纹理边界复杂度参数和综合复杂度标量,使同一幅密集小颗粒图像内部的区域难度差异能够被量化并参与后续训练和推理。
Smart Images

Figure FT_1 
Figure FT_2 
Figure FT_3
Abstract
Description
Technical Field
[0001] This invention relates to the fields of industrial machine vision, deep learning model compression, and online particle size detection technology. More specifically, it relates to a method for real-time identification and particle size analysis of dense small particles based on logical grid region complexity representation, heterogeneous dual-teacher knowledge distillation, adaptive label allocation, and lightweight edge reasoning. Background Technology
[0002] In the production, conveying, and grading of green pellets, ore particles, tablets, grain pellets, and other near-spherical industrial particles, particle quantity, average particle size, and the proportion of particles in different size ranges are important parameters for evaluating process status and product quality. Traditional manual sampling inspection methods suffer from low detection frequency, strong subjectivity, and difficulty in reflecting changes in continuous production processes. Therefore, using fixed RGB industrial cameras to capture particle images on conveyor belts or trays and performing continuous detection through machine vision methods has become an important approach for online monitoring of industrial particles.
[0003] However, industrial particle images typically exhibit characteristics such as a large number of targets, small target size, significant contact or occlusion between targets, and complex local reflections and texture variations. The detection difficulty within the same image is also uneven: some areas show relatively dispersed particles with clear outlines, while others exhibit high aggregation, boundary adhesion, and local texture interference. Applying identical training and supervision strength and post-processing parameters to the entire image can easily lead to problems such as repeated learning of simple regions, insufficient supervision of complex regions, missed detections in dense areas, duplicate detections, and biased particle size estimation.
[0004] Existing deep object detection models can improve detection accuracy by increasing network size or adding feature fusion layers, but this also increases the number of parameters and computational cost, making them unsuitable for real-time operation on industrial edge devices. Conventional knowledge distillation methods typically guide student model training with a single teacher model or uniform distillation weights across the entire image, rarely distinguishing the local density and texture boundary complexity of different regions within the image. Furthermore, relying solely on instance-level knowledge provided by the object detection teacher makes it difficult to directly constrain the number and size distribution of particles in a region, thus limiting their ability to suppress missed detections, duplicate detections, and particle size statistical errors in dense targets.
[0005] Furthermore, the allocation of positive and negative samples in dense, small-particle scenes is easily affected by competition from neighboring targets. Assigning labels solely based on a fixed cross-union threshold or a fixed number of positive samples may cause adjacent particles to share the same candidate location, or result in insufficient effective positive samples for tiny particles. Fixed candidate box suppression thresholds, confidence thresholds, and particle size correction parameters are also difficult to adapt simultaneously to local regions of varying complexity.
[0006] Therefore, it is necessary to provide a method that can fully utilize high-precision teacher models during the offline training phase, adjust the knowledge transfer intensity according to the differences in local region complexity, maintain a single lightweight network forward propagation during the edge inference phase, and complete particle detection, counting, and particle size statistics. Summary of the Invention
[0007] The present invention aims to address the following problems in the prior art: the difference in detection difficulty between different regions within dense small particle images is not fully utilized; lightweight student models are prone to missed detections or duplicate detections in densely adhered regions; there is a lack of consistency constraints between target detection results and the number and size distribution of particles in the region; and fixed candidate box suppression parameters, confidence thresholds and particle size correction parameters are difficult to adapt to the complexity of different regions.
[0008] To address the aforementioned technical problems, this invention provides a heterogeneous knowledge distillation method for real-time identification and particle size analysis of dense small particles, comprising an offline training stage and an edge real-time inference stage executed sequentially; the offline training stage is used to obtain a lightweight student model with fixed weights, a real-time complexity mapping function, and a preset parameter set; the edge real-time inference stage completes the detection, counting, and particle size analysis of dense small particle targets based on the lightweight student model, the real-time complexity mapping function, and the preset parameter set.
[0009] The offline training phase includes steps S101 to S106.
[0010] Step S101: Obtain the training image of industrial particles and calculate the regional complexity matrix and the comprehensive complexity scalar corresponding to each logical grid region.
[0011] The industrial particle training image is a three-channel image with particle target bounding boxes. Without altering the pixel arrangement of the complete image or cropping it into independent sub-images, R logical grid regions are established in the coordinate space of the complete image according to a preset number of rows and columns. Each logical grid region records its coordinate range and region index. The complete industrial particle training image is still input as a single tensor into subsequent models. For the... For each logical grid region, local density parameters are calculated based on the number of particle target bounding boxes, the area ratio of particle target bounding boxes, and the proximity of particle target centers within that logical grid region. The texture boundary complexity parameter is calculated based on the gradient intensity, edge pixel ratio, edge continuity, and texture entropy within the logical grid region. .
[0012] in, ; This represents the total number of logical grid regions. For the first Original values of local density for each logical grid region; , and These are the normalization term for the number of particle target bounding boxes, the term for the area ratio of particle target bounding boxes, and the term for the proximity of particle target centers; , and These are the corresponding combination coefficients. For the first The original value of the texture boundary complexity of each logical grid region; , , and These are normalized gradient intensity, edge pixel ratio, edge continuity, and texture entropy, respectively. , , and These are the corresponding combination coefficients. Each combination coefficient is a non-negative parameter, and their sum is 1.
[0013] Will and Normalized to Obtain local density parameters and texture boundary complexity parameters The first Local density parameters of a logical grid region and texture boundary complexity parameters Compositional region complexity vector ; All The region complexity vectors of each logical grid region are arranged in region index order to obtain the region complexity matrix. : based on and Calculate the first The scalar of the overall complexity of each logical grid region : in, The combined weights corresponding to the local density parameters. The combined weights corresponding to the texture boundary complexity parameters. and All parameters are non-negative and adjustable. Step S101 outputs the region complexity matrix. and the comprehensive complexity scalar of each logical grid region The weights for regional differential knowledge distillation are determined in step S103, and the matching relationship of candidate samples is determined in step S105.
[0014] Step S102: Call the detection teacher model and statistical teacher model with fixed parameters to output three types of heterogeneous teacher knowledge.
[0015] The complete industrial particle training image with logical grid region index obtained in step S101 is input into the detection teacher model and the statistical teacher model, respectively. The detection teacher model and the statistical teacher model are pre-trained before executing step S102. The detection teacher model is trained based on particle target bounding boxes and particle boundary supervision labels. The particle boundary supervision labels are obtained by weakly supervised boundary generation processing from the industrial particle training image and its corresponding particle target bounding boxes. The weakly supervised boundary generation processing includes image edge extraction, particle target bounding box region constraint, adhesion particle boundary separation, and boundary correction. The statistical teacher model generates particle quantity labels and particle size distribution labels corresponding to each logical grid region based on the logical grid region index and particle target bounding boxes established in step S101, and is trained based on the particle quantity labels and particle size distribution labels. After training, the network parameters of both models remain fixed and are used to output teacher knowledge.
[0016] The teacher detection model uses a YOLOv8-L type convolutional object detection network, which includes a teacher feature extraction network, a multi-scale feature fusion network, and object detection and boundary detection branches connected to the multi-scale feature fusion network in sequence.
[0017] The teacher feature extraction network takes a complete industrial particle training image as input and extracts features sequentially through a convolutional layer, a C2f network unit, and an SPPF network unit, outputting multiple teacher feature maps with different downsampling scales. The multi-scale feature fusion network takes all teacher feature maps as input and outputs teacher semantic feature maps at multiple scales through channel adjustment, top-down upsampling fusion, and bottom-down downsampling fusion. ,in A scale index for teacher semantic features; The object detection branch uses the semantic feature maps of all teachers. As input, the classification path and regression path of the detection head are decoupled through anchorless bounding boxes; the outputs are teacher candidate detection boxes, teacher particle target presence probability, and teacher localization quality for the complete industrial particle training image. The classification path outputs the teacher particle target presence probability corresponding to each teacher candidate detection box, the regression path outputs the teacher candidate detection box position parameters and teacher localization quality, and the target detection branch outputs the results to characterize the target detection capability of the detection teacher model and serve as the basis for judging the completion of the pre-training of the detection teacher model; the output results do not participate in the heterogeneous knowledge distillation in step S105. The boundary detection branch takes the teacher semantic feature map with the highest spatial resolution among multiple teacher semantic feature maps as input, and sequentially passes it through a channel adjustment convolutional layer, a convolutional processing layer, an upsampling layer, and an output convolutional layer to output a teacher boundary probability map for training images of complete industrial particles. .
[0018] The statistical teacher model is a statistical network trained independently of the detection teacher model, including a statistical feature extraction network, a statistical feature fusion network, a regional statistical feature aggregation unit, a particle number prediction branch, and a particle size distribution prediction branch.
[0019] The statistical feature extraction network takes a complete industrial particle training image as input, performs multi-scale feature extraction through a ResNet50 network, and outputs statistical feature maps at multiple scales. The statistical feature fusion network takes statistical feature maps of all scales as input, and outputs a fused statistical feature map through channel alignment and cross-scale feature fusion. ; The regional statistical feature aggregation unit integrates statistical feature maps. Using the logical grid region index established in step S101 as input, for the first... Region pooling is performed on the feature locations corresponding to the nth logical grid region to obtain the nth... Teacher region statistical feature vector of each logical grid region ; The particle number prediction branch uses the teacher region statistical feature vector. For input, output the first... Predicted number of teacher particles in each logical grid region ; The particle size distribution prediction branch uses the teacher region statistical feature vector. For input, output the first... Teacher particle size distribution vector for each logical grid region .
[0020] The three types of heterogeneous teacher knowledge mentioned in step S102 include teacher semantic feature maps at multiple scales for the complete image. The semantic knowledge constituted, and the teacher boundary probability graph oriented towards the complete image. The boundary detection knowledge constituted and the predicted value of the number of teacher particles in each logical grid region. Teacher particle size distribution vector The particle statistical knowledge constitutes the knowledge. Step S102 outputs the three types of heterogeneous teacher knowledge for step S105 to calculate the regional distillation loss.
[0021] Step S103: Determine the distillation weights for basic knowledge and regionally differentiated knowledge.
[0022] Pre-set the basic knowledge distillation weights corresponding to semantic knowledge, boundary detection knowledge, and particle statistics knowledge, respectively. , and ,and All logical grid regions use the same basic knowledge distillation weights.
[0023] Based on the comprehensive complexity scalar of each logical grid region obtained in step S101 The differential knowledge distillation weights for the r-th logical grid region are determined using the Softmax normalization method. To perform heterogeneous knowledge transfer in regions for training images of industrial particles: in, Temperature parameters are used to control the smoothness of the distribution of differential knowledge distillation weights; For summation index; Comprehensive complexity scalar The larger the value, the greater the weight of differentiated knowledge distillation. The larger it is.
[0024] Step S103 Output basic knowledge distillation weights , and and regionally differentiated knowledge distillation weights This provides the first weighting within the region and the second weighting between regions for step S105.
[0025] Step S104: Input the complete industrial particle training image into the lightweight student model, and output the predicted detection box and the three types of student knowledge corresponding to the three types of heterogeneous teacher knowledge, namely student semantic knowledge, student boundary detection knowledge and student particle statistical knowledge.
[0026] The lightweight student model includes a lightweight feature extraction network, a multi-scale feature fusion network, an object detection branch, a boundary detection branch, a statistical prediction branch, and a feature adaptation layer.
[0027] The lightweight feature extraction network takes a complete industrial particle training image as input and passes through an initial convolutional layer, a shallow feature stage of ShuffleNetV2, and a deep feature stage of RepVGG in sequence, outputting multiple student feature maps with different downsampling scales. The multi-scale feature fusion network takes all student feature maps as input and outputs original student semantic feature maps at multiple scales through channel adjustment, upsampling or downsampling, and feature fusion. ,in A scale index for student semantic features; The feature adaptation layer uses the original student semantic feature map at the corresponding scale. As input, the output is a adapted student semantic feature map with the same number of channels and spatial size as the teacher's semantic feature map. After all adaptations are completed, the student semantic feature maps constitute the student semantic knowledge and correspond to the semantic knowledge in step S102 on a scale-by-scale basis.
[0028] The object detection branch uses all original student semantic feature maps. As input, the detection head is decoupled without anchor frames, and the output includes candidate detection boxes, particle target confidence, and positioning quality, which are used in step S105 to complete positive and negative sample allocation and detection loss calculation.
[0029] The boundary detection branch takes the original student semantic feature map with the highest spatial resolution among multiple original student semantic feature maps as input, and sequentially passes it through a channel adjustment convolutional layer, a convolutional processing layer, an upsampling layer, and an output convolutional layer to output a student boundary probability map for training images of complete industrial particles. The student boundary probability diagram The student's boundary detection knowledge is constructed and corresponds to the boundary detection knowledge in step S102.
[0030] The statistical prediction branch uses all original student semantic feature maps. Using the logical grid region index established in step S101 as input, for the first... Region pooling and feature fusion are performed on the feature locations corresponding to the first logical grid region to obtain the second logical grid region. Student region statistical shared characteristics in each logical grid region ; The student area statistical sharing characteristics Input the student particle number prediction path and the student particle size distribution prediction path respectively, and output the first... Predicted number of student particles in each logical grid region and student particle size distribution vector The predicted number of particles for students. and student particle size distribution vector Together they constitute the student's particle statistics knowledge, and correspond to the particle statistics knowledge in step S102 region by region.
[0031] Step S105: Based on the region complexity matrix, the detection loss is calculated using a joint decision mechanism of intersection-union ratio and granular density; the region-level distillation loss is calculated based on the differences between the three types of heterogeneous teacher knowledge and the three types of student knowledge corresponding to each item; the region-level distillation loss is weighted and summarized according to the differentiated knowledge distillation weights corresponding to each logical grid region to obtain the global distillation loss, and combined with the detection loss to construct a multi-dimensional joint loss function. The first in the training data Each particle target is labeled as . The output of step S104 will be the first The candidate detection boxes are denoted as The particle target bounding box is the range of real particle locations pre-labeled in the training data, and the candidate detection box is the rectangular prediction region output by the lightweight student model before positive and negative sample allocation and candidate box suppression.
[0032] Calculate candidate detection boxes With particle target annotation box The intersection-union ratio between them, combined with the particle target annotation box. Local density parameters of the logical grid region where the center is located Obtain candidate sample matching scores : in, Candidate detection boxes With particle target annotation box The crossover ratio between them This is a non-negative density correction factor. Based on the local density parameter... Determine the first Number of positive samples corresponding to each particle target bounding box : in, The number of basic positive samples; This is the density adjustment coefficient; and These are the lower and upper limits for the number of positive samples, respectively; round This indicates rounding to the nearest integer. This indicates that the calculation results will be limited to the upper and lower limits.
[0033] Calculate the first Normalized nearest neighbor distance between each particle target bounding box and its nearest neighbor particle target bounding box and will Adhesion determination threshold Compare: in, For the first The Euclidean distance between the center of each particle target and the center of its nearest neighbor; For the first The pixel size of each particle target; To prevent positive numbers with a denominator of zero.
[0034] when Not less than At that time, the first Each particle target is determined to be a relatively independent particle target; when Less than When this occurs, it is identified as an adherent particle target, and the hard attribution radius of the candidate sample is reduced and the positive sample determination threshold is increased according to a preset scaling relationship. The hard attribution radius, positive sample determination threshold, and... The specific value is determined by the validation set, and an implementable value is given in the specific implementation.
[0035] According to the The hard-attribution range of candidate samples corresponding to each particle target bounding box and the positive sample determination threshold are used to filter candidate samples that meet the conditions from the candidate samples corresponding to the particle target bounding box, and the candidate samples are scored according to their matching. Sort from highest to lowest; when the number of candidate samples that meet the conditions is greater than the previously determined number of positive samples. When, select the previous sorted items. One candidate sample is used as the positive sample to be assigned to the particle target annotation box; when the number of candidate samples that meet the condition is no greater than When the conditions are met, all candidate samples that meet the conditions will be used as positive samples to be assigned.
[0036] When the same candidate sample belongs to multiple positive samples to be assigned in the bounding boxes of particle targets, the matching score is based on the candidate sample. The normalized center distance between the center of the candidate detection box and the center of the corresponding particle target annotation box is used to determine the competition score of the candidate sample relative to each particle target annotation box. When the difference between the highest and second-highest competitive scores exceeds a preset competitive difference threshold. When the candidate sample is not greater than the preset competition difference threshold, the candidate sample is assigned only to the particle target bounding box corresponding to the highest competition score. At that time, the Softmax function is used to generate soft-assigned weights based on each competition score. The soft assignment weight is used to characterize the relative affiliation of the candidate sample to different competing particle target bounding boxes, and is used to weight the loss contribution of the candidate sample relative to the corresponding particle target bounding box. Candidate samples that have completed hard or soft assignment are defined as positive samples, and candidate samples that have not been assigned to any particle target bounding box are defined as negative samples.
[0037] Calculate the detection loss based on positive and negative samples. : in, There is a loss for the particulate target; The bounding box regression loss is the boundary box regression loss between the candidate detection box and the corresponding particle target annotation box. To locate the quality loss; and These are the corresponding loss coefficients.
[0038] The teacher semantic feature map output in step S102 Teacher Boundary Probability Diagram And the adapted student semantic feature map output in step S104 Student boundary probability diagram All outputs are geared towards the complete image. For calculating the... The distillation loss of the first logical grid region will be the first... The location range of each logical grid region in the complete image coordinate space is respectively mapped to the... The coordinate spaces of the feature maps corresponding to each semantic feature scale and the coordinate spaces of the boundary probability maps are used to extract the corresponding regions from the above complete image output, thus obtaining the semantic feature maps of the regions. Student semantic feature map after region adaptation Regional Teacher Boundary Probability Diagram Boundary probability diagram of students in the region .
[0039] The predicted value of the number of particles in the teacher Teacher particle size distribution vector Student particle number prediction value and student particle size distribution vector The regional-level results directly output by the statistical branches of the statistical teacher model and the lightweight student model are the same as those of the first generation. Each logical grid region corresponds to a symbol, therefore its symbol output includes a region index. .
[0040] For the Each logical grid region, and the region semantic knowledge distillation loss. Knowledge distillation loss for regional boundary detection Regional particle statistics knowledge of distillation loss They are respectively: in, A set of feature scale indices for participating in semantic knowledge distillation; For the first Scale weights for each semantic feature scale; Indicates mean square error; This represents the binary cross-entropy loss; express loss; Indicates smoothness loss; express Divergence; , and This represents the corresponding loss coefficient.
[0041] Based on the basic knowledge distillation weights obtained in step S103, the first... The three types of region knowledge distillation losses for each logical grid region are weighted for the first time to obtain the region-level distillation loss. Then, the distillation losses of all regions are weighted a second time according to the regionally differentiated knowledge distillation weights to obtain the global distillation loss. : Detect loss With global distillation loss Combining these elements yields a multi-dimensional joint loss function. : in, This represents the global distillation loss coefficient.
[0042] Step S105 outputs the multi-dimensional joint loss function. This allows step S106 to perform backpropagation.
[0043] Step S106 trains, compresses, and fixes a lightweight student model based on a multi-dimensional joint loss function, while establishing a real-time complexity mapping function and a preset parameter set.
[0044] During training, the detection teacher model and the statistical teacher model only perform forward propagation and the network parameters remain fixed; the gradient of the multi-dimensional joint loss function is used to update the lightweight student model, feature adaptation layer, object detection branch, boundary detection branch and statistical prediction branch.
[0045] After each training epoch, calculate the relative decrease of the multi-dimensional joint loss function in that epoch compared to the previous training epoch; when continuous The relative decrease in each training epoch was less than the preset convergence threshold. When, or when the training rounds reach the preset maximum number of training rounds. At that time, it is determined that the lightweight student model meets the preset convergence condition. , and All of these are parameters set before training and confirmed through the validation set, and one specific value of each is given in the specific implementation.
[0046] For a lightweight student model that meets the preset convergence conditions, structured channel pruning, RepVGG structure reparameterization, and integer bit width quantization are performed. The structured channel pruning deletes low-importance channels based on channel importance and performs retraining. The RepVGG structure reparameterization effectively merges the multi-branch convolutional structure in the training phase into a single-branch convolutional structure. The integer bit width quantization converts the model weights and activation values into integer bit width representations, resulting in a lightweight student model with fixed weights for edge deployment.
[0047] Furthermore, a real-time complexity mapping function is established based on the industrial particle training set. Specifically, the offline local density parameters and texture boundary complexity parameters of each logical grid region calculated in step S101 are used as supervision targets, and online observable feature vectors are constructed using the image observable features of the corresponding regions that can be obtained without manual annotation. And train online local density mapping functions respectively. and online texture boundary complexity mapping function For real-time acquired industrial particle images, according to the first... The online observable feature vectors corresponding to each logical grid region are used to calculate the online local density parameter and the online texture boundary complexity parameter using the online local density mapping function and the online texture boundary complexity mapping function, respectively: in, and These are the online local density parameter and the online texture boundary complexity parameter, respectively. For the first Online observable feature vectors corresponding to each logical grid region; and These are the online local density mapping function and the online texture boundary complexity mapping function, respectively. This indicates that the mapping results will be restricted to a uniform numerical range.
[0048] The online comprehensive complexity scalar is calculated based on the online local density parameter and the online texture boundary complexity parameter. Multiple complexity intervals corresponding to the numerical range of the online comprehensive complexity are determined using a validation set. Candidate box suppression parameters, confidence thresholds, and grain size correction parameters are configured for each complexity interval to form a preset parameter set. The specific values of the complexity interval boundaries and corresponding parameters are given in the specific implementation.
[0049] Step S106 outputs a lightweight student model with fixed weights, a real-time complexity mapping function, and a preset parameter set for use in the edge real-time inference stage.
[0050] The edge real-time inference stage includes steps S201 to S205; Step S201: Real-time acquisition of dense small-particle images and calculation of online region complexity matrix, and calculation of online comprehensive complexity scalar.
[0051] A fixed RGB industrial camera is used to acquire dense, small-particle images of an industrial scene in real time, and a logical grid region index is established using the same logical grid method as in step S101; the complete image remains a single, unified tensor. For the r-th logical grid region, observable features of the image are extracted and input into the real-time complexity mapping function established in step S106 to obtain online local density parameters. and online texture boundary complexity parameters Then calculate the online synthesis complexity scalar. : The first Online local density parameters of a logical grid region and online texture boundary complexity parameters Composition of online region complexity vector ; The online region complexity vectors of each logical grid region are arranged in region index order to obtain the online region complexity matrix. : Step S201 outputs the online region complexity matrix and all online synthesis complexity scalars, which are used by step S203 to determine the post-processing parameters for the corresponding region.
[0052] Step S202 inputs the preprocessed dense small particle image into the trained lightweight student model, and outputs the predicted detection box of the dense small particle target in the image and the corresponding confidence score through a single network forward propagation. The preprocessing involves image resizing and pixel normalization, consistent with the offline training phase. Step S203 adaptively determines the candidate box suppression parameters, confidence threshold and particle size correction parameters of the corresponding region from the preset parameter set based on the online synthesis complexity scalar of each logical grid region, so as to adapt to the particle detection and size correction requirements of logical grid regions with different complexities. The preset parameter set includes at least parameter combinations corresponding to low complexity, medium complexity, and high complexity ranges, respectively, when the online synthesis complexity scalar... When the parameters are located between adjacent complexity intervals, interpolation is performed on the parameters corresponding to the adjacent complexity intervals. Step S203 outputs the candidate box suppression parameters, confidence threshold, and particle size correction parameters corresponding to each logical grid region, which are then used by step S204 to process the predicted detection boxes and calculate the physical particle size.
[0053] Step S204 involves filtering and deduplicating candidate detection boxes, determining the total number of particles, converting the particle pixel diameter to the particle physical diameter, and performing multi-interval particle diameter statistics.
[0054] First, the confidence level of each candidate detection box is compared with the confidence level threshold corresponding to the logical grid region where its center is located. Candidate detection boxes that are lower than the confidence level threshold are deleted.
[0055] For any two retained candidate detection boxes, calculate their Cross-Union Ratio (CUI), Normalized Center Distance (NCD), and Pixel Size Similarity. If the CUI is not less than the candidate box suppression threshold for the corresponding logical grid region, the NCD is less than the preset duplicate box center distance threshold, and the Pixel Size Similarity is not less than the preset size similarity threshold, then the two boxes are considered duplicates of the same particle target, and the candidate detection box with the higher particle target confidence is retained. Otherwise, the two boxes are retained as different particle targets. Specific values for each threshold are given in the detailed implementation. The number of retained predicted detection boxes after deduplication is determined as the total number of particles.
[0056] For the The reserved predicted detection boxes have widths and heights of 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ... and Then the pixel size and particle physical size Determine them according to the following formulas respectively: in, Index of the predicted detection boxes to be retained; and The first The pixel width and pixel height of each retained predicted detection box; For the first The pixel size of each particle target; and For the first The x and y coordinates of the center of each preserved predicted detection box in the complete image coordinate space; The position scale coefficient is obtained based on the camera calibration parameters; For the first The center of the target particle is located at the [number]th [unit]. Particle size correction parameters corresponding to each logical grid region; For the first The physical particle size of each particle target is determined. The physical particle sizes of all particle targets are statistically analyzed according to a preset particle size range to obtain multi-range particle size distribution results.
[0057] Step S205 synchronously outputs the detection results of dense small particle targets, the total number of particles, and the particle size distribution results in multiple intervals, so as to realize the real-time identification and particle size analysis of dense small particle targets.
[0058] The dense small particle target detection results include the predicted detection box position and target confidence, while the multi-interval particle size distribution results include the number or proportion of particles corresponding to each preset particle size interval. Compared with the prior art, the present invention has at least the following beneficial effects: First, by establishing a logical grid region index in the complete image coordinate space, local density parameters, texture boundary complexity parameters, and comprehensive complexity scalars are obtained without physically cropping the image or increasing the number of forward passes of the model. This allows the differences in regional difficulty within the same dense small-particle image to be quantified and used in subsequent training and inference.
[0059] Second, by providing semantic knowledge, boundary detection knowledge, and particle statistical knowledge through a detection teacher model with fixed parameters and an independently trained statistical teacher model, the lightweight student model is simultaneously constrained by instance-level visual knowledge and region-level quantity and particle size distribution knowledge, which helps to reduce missed detections, duplicate detections, and particle size statistical bias of densely clustered particle targets.
[0060] Third, a two-level weighting mechanism is constructed by using basic knowledge distillation weights and regionally differentiated knowledge distillation weights. First, regional-level distillation loss is formed in each logical grid region. Then, the contribution of each logical grid region to the global distillation loss is adjusted according to the comprehensive complexity scalar, so that regions with higher comprehensive complexity can obtain more sufficient knowledge transfer.
[0061] Fourth, the matching relationship of candidate samples is determined by combining the intersection-union ratio and particle density. The number of positive samples or the threshold for positive sample determination is determined based on the region complexity matrix. In the case of multi-target competition, the distance between the center of the candidate detection box and the center of the particle target annotation box is combined to determine the allocation object or the allocation weight, which helps to improve the problem of positive and negative sample mismatch for dense small particle targets. The detection teacher model and the statistical teacher model are only used for offline training. In the edge real-time inference stage, only the lightweight student model with fixed weights, the real-time complexity mapping function and the lightweight post-processing process are retained, thereby reducing the number of model parameters and computational overhead of edge inference.
[0062] Fifth, by mapping the observable texture features of online images to the same numerical range as the offline comprehensive complexity scalar, and adaptively determining the candidate box suppression parameters, confidence thresholds, and particle size correction parameters based on the online comprehensive complexity scalar, and combining the camera calibration parameters to complete the physical particle size conversion and multi-interval particle size statistics, appropriate detection and size correction strategies can be adopted for different complexity regions in the same image. Attached Figure Description
[0063] Figure 1 This is a schematic diagram of the overall process of the real-time identification and particle size analysis method for dense small particles of the present invention.
[0064] Figure 2 This diagram illustrates the connection between the detection teacher model, the statistical teacher model, and the lightweight student model of this invention.
[0065] Figure 3 This is a schematic diagram of the joint label allocation process based on crossover ratio and particle density of the present invention. Detailed Implementation
[0066] The present invention will be further described below with reference to specific embodiments. This embodiment strictly follows the order of steps S101 to S106 and steps S201 to S205 in the invention description, and specifically describes the logical grid region complexity calculation, detection teacher model and statistical teacher model pre-training, lightweight student model forward propagation, region heterogeneous knowledge distillation, joint label allocation of intersection-union ratio and granular density, model compression, real-time complexity mapping, and edge real-time inference process. The following scenario settings, network configurations, and parameter values are used to illustrate a preferred method for repeated implementation and do not constitute a limitation on the scope of protection of the present invention.
[0067] Example 1: Real-time identification and particle size analysis of dense small particles under fixed top-view RGB industrial camera conditions This embodiment uses raw mineral pellets on a conveyor belt as the detection object, and employs a fixed top-down RGB industrial camera to continuously acquire images of industrial particles. The relative position of the camera to the detection plane of the conveyor belt remains fixed during the offline training and real-time edge inference phases. Camera calibration is performed using a planar calibration board of known dimensions to obtain the conversion relationship between pixel size and physical size at different positions in the complete image coordinate space. The acquired industrial particle images include situations such as dispersed particles, locally dense particles, particles in contact with each other, local occlusion, and boundary adhesion.
[0068] Industrial particle training images used for model training and validation are labeled with particle targets, with each particle target corresponding to a particle target bounding box. When adjacent particles are in contact or adhered, they are still labeled as individual particle instances. The labeled data is divided into training, validation, and test sets in an 8:1:1 ratio. The training set is used for training the detection teacher model, statistical teacher model, lightweight student model, and real-time complexity mapping function. The validation set is used to determine various weights, label assignment parameters, convergence conditions, and preset parameter sets. The test set is used only for independent experimental validation after training. Before inputting the image into the model, the entire image is uniformly adjusted to 640 pixels × 640 pixels and pixel normalized. The size adjustment does not change the subsequent logical grid processing method, which only uses it as a coordinate index.
[0069] The "grid partitioning" referred to in this paper refers to logical grid region partitioning, that is, establishing logical grid region indices and corresponding position coordinates only in the coordinate space of the complete image, without physically cropping the complete image into multiple independent sub-images. The detection teacher model, statistical teacher model, and lightweight student model all perform forward propagation with the complete image as a whole tensor.
[0070] Step S101: Obtain the training image of industrial particles and calculate the regional complexity matrix and the comprehensive complexity scalar corresponding to each logical grid region.
[0071] In this embodiment, a 4x4 grid is established in the coordinate space of the complete industrial particle training image. Each logical grid region is a non-overlapping regular logical grid region, and region indices are assigned to each logical grid region in order from left to right and from top to bottom. Each logical grid region records its top-left corner coordinates, bottom-right corner coordinates, and region index in the complete image.
[0072] For the Each logical grid region is used to count particles whose center falls within that region. The particle target bounding box count is a normalized term. The ratio of the number of bounding boxes for particle targets in the region to the number of reference particle targets in a single logical grid region of the training set is used for calculation, and the result is limited to... ; Area percentage of particle target annotation box The ratio of the sum of the areas of the particle target bounding boxes within the region to the pixel area of the logical grid region is used for calculation, and is limited to... .
[0073] Particle target center proximity term The distance is determined based on the center distance between each particle target and its nearest neighbor within the logical grid region. For the first... Each particle target has a pixel size using Calculation, where and Let the pixel width and pixel height of the bounding box of the particle target be denoted as ; calculate the Euclidean distance between the center of the particle target and the center of its nearest neighboring particle target. , As the proximity value of the particle target, and the first The average proximity values of all particle targets within each logical grid region are obtained. When the number of particle targets in the region is no greater than 1, let This embodiment takes .
[0074] The first is obtained according to the calculation formula of the original value of local density in the invention content. Original value of local density of each logical grid region : In this embodiment, we take , , All three are non-negative parameters and satisfy the following conditions: .
[0075] For the texture boundary complexity parameter, the first The original image pixels corresponding to each logical grid region are converted into grayscale images. The Sobel operator is used to calculate the gradient magnitude, and the gradient intensity is obtained by normalization using the statistical range of the training set. Canny edge detection is used to obtain a binary edge map, and the proportion of edge pixels to the total number of pixels in the logical grid area is used as the edge pixel percentage. Edge continuity is determined based on the ratio between the length of continuous edge pixels and the total length of all edge pixels in the binary edge map. The texture entropy is calculated and normalized based on the grayscale histogram of the logical grid region. The above. , , and All are limited to .
[0076] The original value of texture boundary complexity is calculated according to the formula in the invention. The original value of texture boundary complexity for each logical grid region : In this embodiment, we take , , , All four are non-negative parameters and satisfy the following conditions: .
[0077] Based on the corresponding logical grid regions in the training set and The statistical range is subjected to minimum-maximum normalization to obtain the local density parameter. and texture boundary complexity parameters And limit both to The first A logical grid area and Compositional region complexity vector ,all The region complexity vectors of each logical grid region are arranged in region index order to obtain the region complexity matrix. : Calculate the first according to the combination method in the invention content. The scalar of the overall complexity of each logical grid region : This embodiment takes , The region complexity matrix obtained in step S101 and the comprehensive complexity scalar The weights for regional differential knowledge distillation are respectively used in step S103 to determine the weights, and in step S105 to determine the matching relationship of candidate samples.
[0078] Step S102: Call the detection teacher model and statistical teacher model with fixed parameters to output three types of heterogeneous teacher knowledge.
[0079] The detection teacher model and the statistical teacher model are pre-trained before the lightweight student model. The training input for the detection teacher model is a complete industrial particle training image, and the supervision information includes particle target bounding boxes and particle boundary supervision labels obtained according to the weakly supervised boundary generation method described below. The training input for the statistical teacher model is also a complete industrial particle training image, and the supervision information includes particle number labels and particle size distribution labels, generated by the logical grid region index established in step S101 and the particle target bounding boxes. After the two teacher models have completed pre-training, all network parameters are fixed, and only forward propagation is performed in steps S102 to S106.
[0080] The teacher detection model employs the YOLOv8-L type convolutional object detection network defined in the invention, comprising a teacher feature extraction network, a multi-scale feature fusion network, and object detection and boundary detection branches connected to the multi-scale feature fusion network, respectively. The teacher feature extraction network takes a complete industrial particle training image as input and extracts multi-scale teacher feature maps sequentially through convolutional layers, C2f network units, and SPPF network units. In this embodiment, downsampling factors of 8, 16, and 32 are selected for subsequent multi-scale feature fusion. The multi-scale feature fusion network takes all teacher feature maps as input and obtains teacher semantic feature maps at multiple scales through channel adjustment, top-down upsampling fusion, and bottom-down downsampling fusion. Under a 640 pixel × 640 pixel input condition, the three semantic scale spatial dimensions involved in distillation in this embodiment are 80 × 80, 40 × 40, and 20 × 20, respectively, and the corresponding scale indices are denoted as follows: .
[0081] The object detection branch uses all teacher semantic feature maps { The input is}, which outputs the probability of teacher particle target presence through the classification path of the unanchored detection head, and outputs the position parameters of teacher candidate detection boxes and teacher localization quality through the regression path. The output of the target detection branch is used to supervise target detection during the pre-training process of the teacher model, and is not directly calculated as the object of the three-class region knowledge distillation loss in step S105.
[0082] The boundary detection branch takes the teacher semantic feature map with the highest spatial resolution as input, and sequentially passes it through a channel-adjusted convolutional layer, a convolutional processing layer, an upsampling layer, and an output convolutional layer to obtain a teacher boundary probability map for training images with complete industrial particles. In this embodiment, when the industrial particle training image has particle target bounding boxes but lacks pixel-level manual annotation of particle boundaries, a weakly supervised boundary generation method is used to obtain the particle boundary supervision labels. Specifically, the industrial particle training image is grayscaled and smoothed, and Canny edge detection is used to obtain initial boundary results. The boundary processing area corresponding to each particle target is defined according to the particle target bounding boxes, and the boundaries of mutually contacting or adhered particle targets are separated using distance transformation and watershed methods. Morphological closing operations and boundary thinning are performed on the separated boundary results, and regions with boundary position errors, missing boundaries, or broken boundaries are manually corrected to obtain particle boundary supervision labels corresponding to the industrial particle training image. The particle boundary supervision labels serve as supervision information in the pre-training stage of the boundary detection branch and are used to calculate the boundary supervision loss between the teacher boundary probability map and the corresponding particle boundary supervision labels.
[0083] The teacher detection model is jointly pre-trained using particle target presence loss, bounding box regression loss, localization quality loss, and boundary supervision loss. In this embodiment, the AdamW optimizer is used, with a batch size of 16 and a maximum training epoch of 200. The model parameters corresponding to the point where the detection performance on the validation set no longer improves are used as fixed parameters.
[0084] The statistical teacher model is a statistical network trained independently of the detection teacher model, including a statistical feature extraction network, a statistical feature fusion network, a regional statistical feature aggregation unit, a particle number prediction branch, and a particle size distribution prediction branch. The statistical feature extraction network takes a complete industrial particle training image as input; in this embodiment, ResNet50 is used to extract statistical feature maps at multiple scales. The statistical feature fusion network performs channel alignment and cross-scale fusion on the statistical feature maps at all scales to obtain a fused statistical feature map. Regional statistical feature aggregation units are based on Using the logical grid region index established in step S101 as input, the first... The location range of each logical grid region in the complete image is mapped to... Corresponding to the location, region-adaptive average pooling is performed to obtain the teacher's region statistical feature vector. This embodiment will Set it to a 256-dimensional vector.
[0085] Particle number prediction branch As input, the output is the first layer. Predicted number of teacher particles in each logical grid region Particle size distribution prediction branch As input, the teacher particle size distribution vector is output through a fully connected layer and a Softmax layer. In this embodiment, the statistical range of pixel size in the training set is divided into 5 preset pixel size intervals. It contains 5 components, each representing the percentage of particles in the corresponding pixel size range.
[0086] The region particle number label of the statistical teacher model falls into the center of the statistical particle target annotation box. The number of particles in each logical grid region is obtained; the region particle size distribution label is calculated based on the pixel width and pixel height of the particle target annotation box. The particle size distribution is then obtained by statistical analysis and normalization according to the aforementioned five pixel particle size intervals. The particle number prediction branch is trained using SmoothL1 loss, and the particle size distribution prediction branch is trained using KL divergence loss. In this embodiment, the AdamW optimizer is used, with a batch size of 16 and a maximum training epoch of 200, to use the model parameters corresponding to the stable particle number error and particle size distribution error in the validation set region as fixed parameters. The above five preset particle size intervals are used for offline statistical knowledge learning, and are divided into equal-width intervals according to the statistical range of pixel particle size in the training set; they are independent of the physical particle size intervals divided according to the camera calibration results in step S204.
[0087] Teacher semantic feature maps at multiple scales { Semantic knowledge is constituted by the teacher's boundary probability graph. The boundary detection knowledge is composed of the predicted number of teacher particles in each logical grid region. Teacher particle size distribution vector Together, they constitute particle statistical knowledge. Step S102 outputs the three types of heterogeneous teacher knowledge for step S105 to calculate regional distillation losses.
[0088] Step S103: Determine the distillation weights for basic knowledge and regionally differentiated knowledge.
[0089] Pre-set the basic knowledge distillation weights corresponding to semantic knowledge, boundary detection knowledge, and particle statistics knowledge. , and All logical grid regions use the same basic knowledge distillation weights. This embodiment takes... , , ,satisfy .
[0090] Based on the comprehensive complexity scalar of each logical grid region obtained in step S101 The first is determined according to the Softmax normalization method in the invention content. Regional Differentiation Knowledge Distillation Weights for Each Logical Grid Region : in, Temperature parameters are used to control the smoothness of the distribution of regionally differentiated knowledge distillation weights. This embodiment uses... Therefore, the overall complexity scalar The larger the logical grid region, the greater its regional differential knowledge distillation weight. Larger, and the entire logical grid area The sum is 1.
[0091] Step S103 Output basic knowledge distillation weights , and and regionally differentiated knowledge distillation weights This provides the first weighting within the region and the second weighting between regions for step S105.
[0092] Step S104: Input the complete industrial particle training image into the lightweight student model, and output the predicted detection box and the three types of student knowledge corresponding to the three types of heterogeneous teacher knowledge item by item.
[0093] The lightweight student model comprises a lightweight feature extraction network, a multi-scale feature fusion network, an object detection branch, a boundary detection branch, a statistical prediction branch, and a feature adaptation layer. The lightweight feature extraction network takes a complete industrial particle training image as input and sequentially passes it through an initial convolutional layer, a shallow feature stage using ShuffleNetV2, and a deep feature stage using RepVGG, outputting student feature maps at multiple downsampling scales. This embodiment uses three scales corresponding to the detection teacher model for subsequent feature fusion.
[0094] The multi-scale feature fusion network takes all student feature maps as input and outputs original student semantic feature maps at multiple scales through channel adjustment, top-down upsampling fusion, and bottom-down downsampling fusion. For the first Each semantic feature scale will be used to transform the original student semantic feature map. Input the corresponding feature adaptation layer This embodiment uses 1×1 convolution to adjust the number of channels. When the spatial dimensions of the teacher and students are inconsistent, bilinear interpolation is used to adjust the spatial dimensions, resulting in the adapted student semantic feature map. Student semantic feature map after full adaptation This constitutes the student's semantic knowledge and is combined with the teacher's semantic feature map output in step S102. Corresponding to each scale.
[0095] The object detection branch uses all the original student semantic feature maps As input, the candidate detection bounding boxes, particle target confidence, and localization quality are output by the anchorless decoupled detection head, and then used in step S105 for positive and negative sample allocation and detection loss calculation. The boundary detection branch takes the original student semantic feature map with the highest spatial resolution as input, and uses the channel-adjusted convolution, convolution processing, upsampling, and output convolution structure corresponding to the boundary detection branch of the detection teacher model to obtain the student boundary probability map for the complete industrial particle training image. The This constitutes the knowledge of student boundary detection.
[0096] The statistical prediction branch uses all original student semantic feature maps. And the logical grid region index established in step S101 is used as input. The first... The location range of each logical grid region is mapped to the original student semantic feature map at each scale. Adaptive average pooling is performed on the corresponding location. Then, the regional features at multiple scales are concatenated and fused to obtain the statistically shared features of the student region. This embodiment will Set as a 256-dimensional vector. The student particle number prediction path and the student particle size distribution prediction path are respectively... For input, output the first... Predicted number of student particles in each logical grid region and student particle size distribution vector The aforementioned and Together, they constitute students' knowledge of particle statistics, and are respectively related to the steps in S102. and Corresponding to each region.
[0097] Step S105: Perform joint label assignment based on cross-union ratio and particle density, calculate detection loss and regional distillation loss, and construct a multi-dimensional joint loss function.
[0098] The first in the training data Each particle target is labeled as . The output of step S104 will be the first The candidate detection boxes are denoted as Calculate candidate detection boxes With particle target annotation box Crossover ratio between And combined with particle target annotation boxes The center is located at Local density parameters of a logical grid region The candidate sample matching score is obtained according to the calculation formula in the invention. : in, The non-negative density correction factor is taken in this embodiment. .
[0099] Based on local density parameters Determine the first Number of positive samples corresponding to each particle target bounding box : This embodiment takes the number of basic positive samples. Density adjustment coefficient Lower limit of positive sample size Upper limit of positive sample size .
[0100] Calculate the first Normalized nearest neighbor distance between each particle target bounding box and its nearest neighbor particle target bounding box : This embodiment uses a preset adhesion determination threshold. .when At that time, the first Each particle target is determined to be a relatively independent particle target; when When this occurs, it is classified as an adherent particle target. In this embodiment, the hard-attribution radius of the basic candidate samples for relatively independent particle targets is set to... The threshold for determining the basic positive sample is set to For relatively independent particulate targets, adopt , For targets with adhered particles, the following method is adopted: , .
[0101] For the Each particle target bounding box, located at the hard attribution radius from the center of the candidate detection box. Internal and candidate sample matching score Not less than the positive sample judgment threshold The candidate samples were screened and then sorted according to... Sort from highest to lowest; when the number of candidate samples that meet the condition is greater than When, select the previous sorted items. The candidate sample is the first The number of positive samples to be assigned to each particle target bounding box; when the number of candidate samples meeting the condition is no greater than When the conditions are met, all candidate samples that meet the conditions will be used as positive samples to be assigned.
[0102] When the same candidate sample belongs to multiple positive samples to be assigned in the bounding boxes of particle targets, the candidate sample matching score is used. The competition score is determined by the normalized center distance between the center of the candidate detection box and the center of the corresponding particle target annotation box. This embodiment uses the following formula to calculate the normalized center distance: The competition score is calculated using the following formula: in, and These represent candidate detection boxes. and particle target annotation box The center coordinates, The center distance penalty coefficient is taken in this embodiment. .
[0103] The competition scores corresponding to the same candidate sample are sorted from largest to smallest. When the difference between the highest and second-highest competition scores exceeds a preset competition difference threshold... When the candidate sample is not greater than the particle target bounding box corresponding to the highest competition score, the candidate sample is assigned only to the bounding box of the particle target. At that time, the soft-assigned weights are generated using the Softmax function based on each competition score. : in, In order to be with the first A set of granular target bounding box indices that form a competitive relationship among candidate samples. The summation index in the set. This is a soft-assignment temperature parameter. In this embodiment, we take... , The soft-assignment weight This is used to weight the loss contribution of the candidate sample relative to different particle target bounding boxes. Candidate samples that have completed hard or soft assignment are defined as positive samples, and candidate samples that have not been assigned to any particle target bounding box are defined as negative samples.
[0104] Calculate the detection loss based on positive and negative samples. : in, There is a loss due to particulate targets. The bounding box regression loss is the boundary box regression loss between the candidate detection box and the corresponding particle target annotation box. To locate the quality loss, , and These are the corresponding loss coefficients. This embodiment will... , and The initial values of all three parameters were set to 1.00, and the three loss coefficients were evaluated on the validation set based on the detection recall, the number of repeated detections, and the counting error.
[0105] The teacher semantic feature map output in step S102 Teacher Boundary Probability Diagram And the adapted student semantic feature map output in step S104 Student boundary probability diagram All outputs are for the complete image. To calculate the... The distillation loss of the first logical grid region will be the first... The location range of each logical grid region in the complete image coordinate space is respectively mapped to the first... The coordinate spaces of the feature maps corresponding to each semantic feature scale and the coordinate spaces of the boundary probability maps are used to extract the corresponding regions from the above complete image output, thus obtaining the semantic feature maps of the regions for teachers. Student semantic feature map after region adaptation Regional Teacher Boundary Probability Diagram Boundary probability diagram of students in the region Teacher particle count prediction Teacher particle size distribution vector Student particle number prediction value and student particle size distribution vector This is the regional-level result directly output by the statistical branch.
[0106] For the Each logical grid region, and the region semantic knowledge distillation loss. Calculated according to the method described in the invention: This embodiment takes the following semantic scales for the three involved distillation: , and And the sum of the weights of the three scales is 1.
[0107] Knowledge distillation loss for regional boundary detection for: This embodiment takes .
[0108] Regional particle statistics knowledge distillation loss for: This embodiment takes , . and All are 5-dimensional particle size distribution vectors, and the sum of each component is 1.
[0109] Based on the basic knowledge distillation weights obtained in step S103, the distillation losses of the three types of regional knowledge in the same logical grid region are weighted for the first time to obtain the regional-level distillation loss. : Then, distill the weights according to regional differences. The regional distillation loss of all logical grid regions is weighted a second time to obtain the global distillation loss. : Detect loss With global distillation loss Combining these elements yields a multi-dimensional joint loss function. : This embodiment takes , The result obtained in step S105 This is used for backpropagation in step S106.
[0110] Step S106: Train, compress, and fix the lightweight student model based on the multi-dimensional joint loss function, and at the same time establish a real-time complexity mapping function and a preset parameter set.
[0111] During training, the detection teacher model and the statistical teacher model only perform forward propagation and the network parameters remain fixed; a multi-dimensional joint loss function is used. The gradient is used only to update the lightweight feature extraction network, multi-scale feature fusion network, feature adaptation layer, object detection branch, boundary detection branch and statistical prediction branch in the lightweight student model.
[0112] This embodiment uses the AdamW optimizer, with an initial learning rate of [value missing]. Batch size is 16.
[0113] After each training epoch, calculate the relative decrease of the multi-dimensional joint loss function in that epoch compared to the previous training epoch. When consecutive... The relative decrease in each training epoch was less than the preset convergence threshold. When, or when the training rounds reach the preset maximum number of training rounds. At that time, the lightweight student model is determined to meet the preset convergence condition. This embodiment takes... , , .
[0114] For lightweight student models that meet the preset convergence criteria, structured channel pruning, RepVGG structure reparameterization, and integer bit-width quantization are performed. In this embodiment, the importance of channels is determined by combining the convolutional channel weight magnitude and validation set sensitivity, and channels with lower importance are deleted first, reducing the total number of convolutional channels participating in edge deployment by 20%.
[0115] After pruning, the retraining is set to 20 training epochs. After the retraining is completed, the multi-branch convolutional structures of the RepVGG network units during the training phase are equivalently merged into single-branch convolutional structures.
[0116] Finally, the model weights and activation values are quantized and calibrated using an INT8 integer bit width to obtain a lightweight student model with fixed weights for edge deployment.
[0117] The feature adaptation layer and statistical prediction branch are used for knowledge transfer and region-level distillation loss calculation during the offline training phase. In the edge deployment mode, where only the particle target detection results, total number of particles, and multi-interval particle size distribution results need to be output, step S202 only calls the forward path in the lightweight student model used to generate the predicted detection box and particle target confidence; the distillation gradient generated by the statistical prediction branch during the offline training phase has already been applied to the shared lightweight feature extraction network and multi-scale feature fusion network, and therefore is not used as the direct basis for particle counting and physical particle size calculation in step S204.
[0118] Furthermore, a real-time complexity mapping function is established based on the industrial particle training set. For each industrial particle training image in the training set, according to the logical grid region index in step S101, starting from the... Image observable features that can be directly calculated without particle-based target bounding boxes are extracted from the original pixels of a logical grid region. This embodiment selects four terms—normalized gradient intensity, normalized edge response intensity, edge pixel ratio, and normalized texture entropy—to form the online observable feature vector. .
[0119] The local density parameters calculated in step S101 and texture boundary complexity parameters As online local density mapping functions respectively and online texture boundary complexity mapping function The monitoring objective is linear regression. This embodiment uses linear regression as the monitoring target. and The specific implementation uses the mean square error between the mapping result and the corresponding supervised target as the fitting objective. It determines the mapping coefficients and biases using the training set, and uses the parameters corresponding to the lowest mean square error in the validation set as fixed parameters. The fixed real-time complexity mapping function outputs the online local density parameters according to the formula in the invention. and online texture boundary complexity parameters : Calculate the online synthesis complexity scalar using the same combined weights as in step S101: This embodiment uses a validation set to... The complexity is divided into three intervals: low complexity [0, 0.33), medium complexity [0.33, 0.67), and high complexity [0.67, 1]. For each of these three complexity intervals, the candidate box suppression cross-union ratio thresholds are set to 0.45, 0.55, and 0.65, respectively, and the confidence thresholds are set to 0.35, 0.30, and 0.25, respectively. The particle size correction parameter... These are set to 1.00, 1.03, and 1.06 respectively, forming a preset parameter set. When When the values are between representative values of adjacent complexity intervals, linear interpolation can be performed on the corresponding parameters of adjacent intervals to reduce parameter abrupt changes near the region boundary.
[0120] Step S106 outputs a lightweight student model with fixed weights, a real-time complexity mapping function with fixed parameters, and a preset parameter set, which are then used by steps S201 to S205 to perform edge real-time inference.
[0121] Step S201: Real-time acquisition of dense small-particle images and calculation of online region complexity matrix and online comprehensive complexity scalar.
[0122] A fixed RGB industrial camera, with the same installation location and calibration status as in the offline training phase, is used to acquire dense, small-grain images in real time. A logical grid region index is then established using the same 4x4 logical grid method as in step S101; the complete image remains a single, unified tensor. For the first... For each logical grid region, online observable feature vectors are extracted using the same method as when establishing the real-time complexity mapping function in step S106. Input online local density mapping functions with fixed parameters respectively. and online texture boundary complexity mapping function Online local density parameters are obtained. and online texture boundary complexity parameters .
[0123] The calculation method described in the invention yields the first... The online synthesis complexity scalar of a logical grid region : The first A logical grid area and Composition of online region complexity vector ; All The online region complexity vectors are arranged in region index order to obtain the online region complexity matrix. : Step S201: Output the online region complexity matrix and all online synthesis complexity scalars This provides the post-processing parameters for step S203 to determine the corresponding logical grid region.
[0124] Step S202: Input the preprocessed dense small particle image into the trained lightweight student model, and output the predicted detection box and corresponding confidence score through a single network forward propagation.
[0125] The real-time acquired complete dense small-particle image is resized to 640 pixels × 640 pixels and pixel normalized in the same way as in the offline training phase. The preprocessed complete image is then used as a whole tensor and input into the lightweight student model with fixed weights obtained in step S106. The lightweight student model outputs the predicted detection boxes and particle confidence scores corresponding to all dense small-particle targets in the image through a single network forward propagation. All predicted detection boxes are represented using complete image coordinates and are associated with the corresponding logical grid region index obtained in step S201 based on the center coordinates of the predicted detection boxes.
[0126] Step S203: Determine the candidate box suppression parameters, confidence thresholds, and particle size correction parameters corresponding to each logical grid region from the preset parameter set based on the online synthesis complexity scalar.
[0127] According to the The online synthesis complexity scalar for each logical grid region Query the preset parameter set formed in step S106. When When the complexity is in the low-complexity range, a candidate box suppression cross-union threshold of 0.45, a confidence threshold of 0.35, and a particle size correction parameter are used. ;when When the complexity is in the medium range, the candidate box suppression cross-union ratio threshold is 0.55, the confidence threshold is 0.30, and the particle size correction parameter is used. ;when When the complexity is in the high-complexity range, a candidate box suppression cross-union ratio threshold of 0.65, a confidence threshold of 0.25, and a particle size correction parameter are used. The parameters output in step S203 are used in step S204 to perform filtering, deduplication, and particle size correction on the predicted detection boxes.
[0128] Step S204: Filter and remove duplicate candidate detection boxes, determine the total number of particles, convert the particle pixel diameter to the particle physical diameter, and perform multi-interval particle diameter statistics.
[0129] First, based on the confidence threshold corresponding to the logical grid region where the center of the predicted detection box is located, the predicted detection boxes output in step S202 are filtered, and predicted detection boxes with particle target confidence lower than the corresponding confidence threshold are deleted.
[0130] For any two retained predicted detection boxes after filtering, their intersection-over-union (IoU), normalized center distance, and pixel size similarity are calculated. In this embodiment, the normalized center distance is obtained by dividing the Euclidean distance between the centers of the two predicted detection boxes by the average pixel size of the two boxes, and the pixel size similarity is obtained by dividing the smaller pixel size by the larger pixel size. When the IoU is not less than the candidate box suppression IoU threshold of the corresponding logical grid region, the normalized center distance is less than 0.30, and the pixel size similarity is not less than 0.85, the two boxes are determined to be duplicate boxes of the same particle target, and only the predicted detection box with the higher confidence of the particle target is retained; otherwise, the two boxes are retained as different particle targets. The number of predicted detection boxes retained after deduplication is determined as the total number of particles.
[0131] For the The retained predicted detection boxes have pixel width and pixel height of respectively. and Calculate the particle pixel size according to the formula in the invention. : Determine the first based on camera calibration parameters. Center of each prediction detection box Location scale factor And combined with the center of the predicted detection box at the th Grain size correction parameters for each logical grid region Calculate the physical particle size using the following formula. : Based on the particle size statistics requirements in the production of green pellets, this embodiment divides the physical particle size into five intervals: less than 8 mm, 8-10 mm, 10-12 mm, 12-16 mm, and not less than 16 mm. The number and proportion of particles in each interval are counted, and the average physical particle size of all particles is calculated.
[0132] Step S205: Simultaneously output the detection results of dense small particle targets, the total number of particles, and the particle size distribution results in multiple intervals.
[0133] The final predicted detection box, particle target confidence level, and particle physical size obtained in step S204 are associated with the original industrial particle image, and the total number of particles, the number of particles corresponding to each preset particle size interval, the proportion of each particle size interval, and the average physical particle size are output simultaneously. The output results can be used as data input for particle size monitoring in the pelletizing process, early warning of abnormal particle size ratio, and back-end process control platform.
[0134] Through the above implementation method, a lightweight student model with fixed weights, a real-time complexity mapping function, and a preset parameter set are obtained in the offline training stage. In the edge real-time inference stage, only one forward propagation of the lightweight student model is required on the complete industrial particle image acquired in real time. The detection box selection, particle counting, physical particle size conversion, and multi-interval particle size statistics are completed by combining the real-time complexity features corresponding to each logical grid region, thereby completing the real-time identification and particle size analysis of dense small particle targets.
[0135] The embodiments described above are only used to illustrate the technical solutions of the present invention, and are not intended to limit the scope of protection of the present invention. Those skilled in the art can make corresponding adjustments or substitutions to the number of logical grids, network channel configuration, training parameters, decision thresholds, and post-processing parameters based on the actual industrial particle types, imaging conditions, and edge device computing capabilities without departing from the technical concept of the present invention. All equivalent changes or substitutions made should be included within the scope of protection of the present invention.
Claims
1. A heterogeneous knowledge distillation method for real-time identification and particle size analysis of dense small particles, characterized in that, It includes an offline training phase and an edge real-time inference phase executed sequentially; the offline training phase is used to obtain a lightweight student model with fixed weights, a real-time complexity mapping function, and a preset parameter set; the edge real-time inference phase completes the detection, counting, and particle size analysis of dense small-particle targets based on the lightweight student model, the real-time complexity mapping function, and the preset parameter set. The offline training phase includes steps S101 to S106; Step S101: Obtain the training image of industrial particles and calculate the region complexity matrix and the comprehensive complexity scalar corresponding to each logical grid region; Step S102: Call the detection teacher model and statistical teacher model with fixed parameters to output three types of heterogeneous teacher knowledge; Step S103: Determine the distillation weights for basic knowledge and regionally differentiated knowledge; Step S104: Input the complete industrial particle training image into the lightweight student model, and output the predicted detection box and the three types of student knowledge corresponding to the three types of heterogeneous teacher knowledge, namely, student semantic knowledge, student boundary detection knowledge and student particle statistical knowledge. Step S105: Based on the region complexity matrix, the detection loss is calculated using a joint decision mechanism of intersection-union ratio and granular density; the region-level distillation loss is calculated based on the differences between the three types of heterogeneous teacher knowledge and the three types of student knowledge corresponding to each item; the region-level distillation loss is weighted and summarized according to the differentiated knowledge distillation weights corresponding to each logical grid region to obtain the global distillation loss, and combined with the detection loss to construct a multi-dimensional joint loss function. Step S106 trains, compresses, and fixes a lightweight student model based on a multi-dimensional joint loss function, while establishing a real-time complexity mapping function and a preset parameter set. The edge real-time inference stage includes steps S201 to S205; Step S201: Real-time acquisition of dense small-particle images and calculation of online region complexity matrix, and calculation of online comprehensive complexity scalar; Step S202 inputs the preprocessed dense small particle image into the trained lightweight student model, and outputs the predicted detection box of the dense small particle target in the image and the corresponding confidence score through a single network forward propagation. Step S203 adaptively determines the candidate box suppression parameters, confidence threshold and particle size correction parameters of the corresponding region from the preset parameter set based on the online synthesis complexity scalar of each logical grid region, so as to adapt to the particle detection and size correction requirements of logical grid regions with different complexities. Step S204: Filter and remove duplicate candidate detection boxes, determine the total number of particles, convert the particle pixel size to the particle physical size, and perform multi-interval particle size statistics. Step S205 synchronously outputs the detection results of dense small particle targets, the total number of particles, and the particle size distribution results in multiple intervals, so as to realize the real-time identification and particle size analysis of dense small particle targets.
2. The heterogeneous knowledge distillation method for real-time identification and particle size analysis of dense small particles according to claim 1, characterized in that, The specific steps of S101 are as follows: the industrial particle training image is a three-channel image with particle target bounding boxes; without changing the pixel arrangement of the complete image or cropping the image into independent sub-images, R logical grid regions are established in the coordinate space of the complete image according to a preset number of rows and columns; each logical grid region records its coordinate range and region index, and the complete industrial particle training image is still input into the subsequent model as a whole tensor; for the first... For each logical grid region, local density parameters are calculated based on the number of particle target bounding boxes, the area ratio of particle target bounding boxes, and the proximity of particle target centers within that logical grid region. The texture boundary complexity parameter is calculated based on the gradient intensity, edge pixel ratio, edge continuity, and texture entropy within the logical grid region. ; in, ; This represents the total number of logical grid regions. For the first Original values of local density for each logical grid region; , and These are the normalization term for the number of particle target bounding boxes, the term for the area ratio of particle target bounding boxes, and the term for the proximity of particle target centers; , and These are the corresponding combination coefficients; For the first The original value of the texture boundary complexity of each logical grid region; , , and These are normalized gradient intensity, edge pixel ratio, edge continuity, and texture entropy, respectively. , , and These are the corresponding combination coefficients; each combination coefficient is a non-negative parameter, and their sum is 1. Will and Normalized to Obtain local density parameters and texture boundary complexity parameters The first Local density parameters of a logical grid region and texture boundary complexity parameters Compositional region complexity vector ; All The region complexity vectors of each logical grid region are arranged in region index order to obtain the region complexity matrix. : based on and Calculate the first The scalar of the overall complexity of each logical grid region : in, The combined weights corresponding to the local density parameters. The combined weights corresponding to the texture boundary complexity parameters. and All are non-negative adjustable parameters.
3. The heterogeneous knowledge distillation method for real-time identification and particle size analysis of dense small particles according to claim 1, characterized in that, The specific steps of S102 are as follows: The complete industrial particle training image with logical grid region index obtained in step S101 is input into the detection teacher model and the statistical teacher model respectively. The detection teacher model and the statistical teacher model are pre-trained before executing step S102. The detection teacher model is trained based on particle target bounding boxes and particle boundary supervision labels. The particle boundary supervision labels are obtained by weakly supervised boundary generation processing from the industrial particle training image and its corresponding particle target bounding boxes. The weakly supervised boundary generation processing includes image edge extraction, particle target bounding box region constraint, adhesion particle boundary separation, and boundary correction. The statistical teacher model generates particle number labels and particle size distribution labels corresponding to each logical grid region according to the logical grid region index and particle target bounding boxes established in step S101, and is trained based on the particle number labels and particle size distribution labels. After training, the network parameters of both are kept fixed and used to output teacher knowledge. The detection teacher model adopts a YOLOv8-L type convolutional object detection network, including a teacher feature extraction network, a multi-scale feature fusion network, and object detection branches and boundary detection branches connected to the multi-scale feature fusion network respectively. The teacher feature extraction network takes a complete industrial particle training image as input and extracts features sequentially through a convolutional layer, a C2f network unit, and an SPPF network unit, outputting multiple teacher feature maps with different downsampling scales. The multi-scale feature fusion network takes all teacher feature maps as input and outputs teacher semantic feature maps at multiple scales through channel adjustment, top-down upsampling fusion, and bottom-down downsampling fusion. ,in A scale index for teacher semantic features; The object detection branch uses the semantic feature maps of all teachers. As input, the classification and regression paths of the detection head are decoupled through an anchorless frame; The system outputs teacher candidate detection boxes, teacher particle target existence probabilities, and teacher localization quality for training images of complete industrial particles. The classification path outputs the teacher particle target existence probabilities corresponding to each teacher candidate detection box, the regression path outputs the teacher candidate detection box position parameters and teacher localization quality, and the target detection branch outputs results to characterize the target detection capability of the detection teacher model and as a basis for judging the completion of the pre-training of the detection teacher model. The output results do not participate in the heterogeneous knowledge distillation in step S105. The boundary detection branch takes the teacher semantic feature map with the highest spatial resolution among multiple teacher semantic feature maps as input, and sequentially passes it through a channel adjustment convolutional layer, a convolutional processing layer, an upsampling layer, and an output convolutional layer to output a teacher boundary probability map for training images of complete industrial particles. ; The statistical teacher model is a statistical network trained independently of the detection teacher model, including a statistical feature extraction network, a statistical feature fusion network, a regional statistical feature aggregation unit, a particle number prediction branch, and a particle size distribution prediction branch. The statistical feature extraction network takes a complete industrial particle training image as input, performs multi-scale feature extraction through a ResNet50 network, and outputs statistical feature maps at multiple scales. The statistical feature fusion network takes statistical feature maps of all scales as input, and outputs a fused statistical feature map through channel alignment and cross-scale feature fusion. ; The regional statistical feature aggregation unit integrates statistical feature maps. Using the logical grid region index established in step S101 as input, for the first... Region pooling is performed on the feature locations corresponding to the nth logical grid region to obtain the nth... Teacher region statistical feature vector of each logical grid region ; The particle number prediction branch uses the teacher region statistical feature vector. For input, output the first... Predicted number of teacher particles in each logical grid region ; The particle size distribution prediction branch uses the teacher region statistical feature vector. For input, output the first... Teacher particle size distribution vector for each logical grid region ; The three types of heterogeneous teacher knowledge mentioned in step S102 include teacher semantic feature maps at multiple scales for the complete image. The semantic knowledge constituted, and the teacher boundary probability graph oriented towards the complete image. The boundary detection knowledge constituted and the predicted value of the number of teacher particles in each logical grid region. Teacher particle size distribution vector The statistical knowledge of the constituent particles.
4. The heterogeneous knowledge distillation method for real-time identification and particle size analysis of dense small particles according to claim 1, characterized in that, Specifically, step S103 involves: pre-setting the basic knowledge distillation weights corresponding to semantic knowledge, boundary detection knowledge, and particle statistical knowledge, respectively. , and ,and All logical grid regions use the same basic knowledge distillation weights. Based on the comprehensive complexity scalar of each logical grid region obtained in step S101 The differential knowledge distillation weights for the r-th logical grid region are determined using the Softmax normalization method. To perform heterogeneous knowledge transfer in regions for training images of industrial particles: in, Temperature parameters are used to control the smoothness of the distribution of differential knowledge distillation weights; For summation index; ;Comprehensive complexity scalar The larger the value, the greater the weight of differentiated knowledge distillation. The larger it is.
5. The heterogeneous knowledge distillation method for real-time identification and particle size analysis of dense small particles according to claim 1, characterized in that, The step S104 specifically involves the following: the lightweight student model includes a lightweight feature extraction network, a multi-scale feature fusion network, an object detection branch, a boundary detection branch, a statistical prediction branch, and a feature adaptation layer; The lightweight feature extraction network takes a complete industrial particle training image as input and passes through an initial convolutional layer, a shallow feature stage of ShuffleNetV2, and a deep feature stage of RepVGG in sequence, outputting multiple student feature maps with different downsampling scales. The multi-scale feature fusion network takes all student feature maps as input and outputs original student semantic feature maps at multiple scales through channel adjustment, upsampling or downsampling, and feature fusion. ,in A scale index for student semantic features; The feature adaptation layer uses the original student semantic feature map at the corresponding scale. As input, the output is a adapted student semantic feature map with the same number of channels and spatial size as the teacher's semantic feature map. After all adaptations are completed, the student semantic feature map constitutes the student semantic knowledge, and corresponds to the semantic knowledge in step S102 on a scale-by-scale basis. The object detection branch uses all original student semantic feature maps. As input, the detection head is decoupled without anchor frames, and the output is candidate detection boxes, particle target confidence, and positioning quality; The boundary detection branch takes the original student semantic feature map with the highest spatial resolution among multiple original student semantic feature maps as input, and sequentially passes it through a channel adjustment convolutional layer, a convolutional processing layer, an upsampling layer, and an output convolutional layer to output a student boundary probability map for training images of complete industrial particles. The student boundary probability diagram This constitutes knowledge of student boundary detection; The statistical prediction branch uses all original student semantic feature maps. Using the logical grid region index established in step S101 as input, for the first... Region pooling and feature fusion are performed on the feature locations corresponding to the first logical grid region to obtain the second logical grid region. Student region statistical shared characteristics in each logical grid region ; The student area statistical sharing characteristics Input the student particle number prediction path and the student particle size distribution prediction path respectively, and output the first... Predicted number of student particles in each logical grid region and student particle size distribution vector The student particle number prediction and student particle size distribution vector Together, they constitute students' knowledge of particulate statistics.
6. The heterogeneous knowledge distillation method for real-time identification and particle size analysis of dense small particles according to claim 1, characterized in that, The specific step S105 is as follows: The first [item] in the training data... Each particle target is labeled as . The output of step S104 is the first The candidate detection boxes are denoted as The particle target bounding box is the range of real particle locations pre-labeled in the training data, and the candidate detection box is the rectangular prediction region output by the lightweight student model before positive and negative sample allocation and candidate box suppression. Calculate candidate detection boxes With particle target annotation box The intersection-union ratio between them, combined with the particle target annotation box. Local density parameters of the logical grid region where the center is located Obtain candidate sample matching scores : in, Candidate detection boxes With particle target annotation box The crossover ratio between them This is a non-negative density correction factor; based on the local density parameter. Determine the first Number of positive samples corresponding to each particle target bounding box : in, The number of basic positive samples; This is the density adjustment coefficient; and These are the lower and upper limits for the number of positive samples, respectively; round This indicates rounding to the nearest integer. This indicates that the calculation results will be limited to the upper and lower limits; Calculate the first Normalized nearest neighbor distance between each particle target bounding box and its nearest neighbor particle target bounding box and will Adhesion determination threshold Compare: in, For the first The Euclidean distance between the center of each particle target and the center of its nearest neighbor; For the first The pixel size of each particle target; To prevent positive numbers with a denominator of zero; when Not less than At that time, the first Each particle target is determined to be a relatively independent particle target; when Less than When this happens, the candidate sample is identified as an adhering particle target, and the hard-attribution radius of the candidate sample is reduced and the positive sample determination threshold is increased according to the preset scaling relationship. According to the The hard-attribution range of candidate samples corresponding to each particle target bounding box and the positive sample determination threshold are used to filter candidate samples that meet the conditions from the candidate samples corresponding to the particle target bounding box, and the candidate samples are scored according to their matching. Sort from highest to lowest; when the number of candidate samples that meet the conditions is greater than the previously determined number of positive samples. When, select the previous sorted items. One candidate sample is used as the positive sample to be assigned to the particle target annotation box; when the number of candidate samples that meet the condition is no greater than When the conditions are met, all candidate samples that meet the conditions will be treated as positive samples to be assigned. When the same candidate sample belongs to multiple positive samples to be assigned in the bounding boxes of particle targets, the matching score is based on the candidate sample. The normalized center distance between the center of the candidate detection box and the center of the corresponding particle target annotation box is used to determine the competition score of the candidate sample relative to each particle target annotation box. When the difference between the highest and second-highest competitive scores exceeds a preset competitive difference threshold. When the candidate sample is not greater than the preset competition difference threshold, the candidate sample is assigned only to the particle target bounding box corresponding to the highest competition score. At that time, the Softmax function is used to generate soft-assigned weights based on each competition score. The soft assignment weight is used to characterize the relative degree of the candidate sample to different competing particle target bounding boxes, and is used to weight the loss contribution of the candidate sample relative to the corresponding particle target bounding box; the candidate sample that completes hard assignment or soft assignment is defined as a positive sample, and the candidate sample that is not assigned to any particle target bounding box is defined as a negative sample. Calculate the detection loss based on positive and negative samples. : in, There is a loss for the particulate target; The bounding box regression loss is the boundary box regression loss between the candidate detection box and the corresponding particle target annotation box. To locate the quality loss; and These are the corresponding loss coefficients; The teacher semantic feature map output in step S102 Teacher Boundary Probability Diagram And the adapted student semantic feature map output in step S104 Student boundary probability diagram All are outputs geared towards the complete image; for calculating the first... The distillation loss of the first logical grid region will be the first... The location range of each logical grid region in the complete image coordinate space is respectively mapped to the... The coordinate spaces of the feature maps corresponding to each semantic feature scale and the coordinate spaces of the boundary probability maps are used to extract the corresponding regions from the above complete image output, thus obtaining the semantic feature maps of the regions. Student semantic feature map after region adaptation Regional Teacher Boundary Probability Diagram Boundary probability diagram of students in the region ; The predicted value of the number of particles in the teacher Teacher particle size distribution vector Student particle number prediction value and student particle size distribution vector The regional-level results directly output by the statistical branches of the statistical teacher model and the lightweight student model are the same as those of the first generation. Each logical grid region corresponds to a symbol, therefore its symbol output includes a region index. ; For the Each logical grid region, and the region semantic knowledge distillation loss. Knowledge distillation loss for regional boundary detection Regional particle statistics knowledge of distillation loss They are respectively: in, A set of feature scale indices for participating in semantic knowledge distillation; For the first Scale weights for each semantic feature scale; Indicates mean square error; This represents the binary cross-entropy loss; express loss; Indicates smoothness loss; express Divergence; , and This corresponds to the loss coefficient; According to the basic knowledge distillation weight obtained in step S103, the first... The three types of region knowledge distillation losses for each logical grid region are weighted for the first time to obtain the region-level distillation loss. Then, the distillation losses of all regions are weighted a second time according to the regionally differentiated knowledge distillation weights to obtain the global distillation loss. : Detect loss With global distillation loss Combining these elements yields a multi-dimensional joint loss function. : in, This is the global distillation loss coefficient.
7. The heterogeneous knowledge distillation method for real-time identification and particle size analysis of dense small particles according to claim 1, characterized in that, Specifically, step S106 involves the following steps: During training, the detection teacher model and the statistical teacher model only perform forward propagation and the network parameters remain fixed; the gradient of the multi-dimensional joint loss function is used to update the lightweight student model, feature adaptation layer, object detection branch, boundary detection branch, and statistical prediction branch. After each training epoch, calculate the relative decrease of the multi-dimensional joint loss function in that epoch compared to the previous training epoch; when continuous The relative decrease in each training epoch was less than the preset convergence threshold. When, or when the training rounds reach the preset maximum number of training rounds. When the time is right, the lightweight student model is determined to meet the preset convergence condition; The lightweight student model that meets the preset convergence conditions is subjected to structured channel pruning, RepVGG structure reparameterization, and integer bit-width quantization. The structured channel pruning removes low-importance channels based on channel importance and performs retraining; the RepVGG structure reparameterization effectively merges the multi-branch convolutional structure in the training phase into a single-branch convolutional structure; and the integer bit-width quantization converts the model weights and activation values into integer bit-width representations to obtain a lightweight student model with fixed weights for edge deployment. Furthermore, a real-time complexity mapping function is established based on the industrial particle training set; specifically, the offline local density parameters and texture boundary complexity parameters of each logical grid region calculated in step S101 are used as supervision targets, and online observable feature vectors are constructed using the image observable features of the corresponding regions that can be obtained without manual annotation. And train online local density mapping functions respectively. and online texture boundary complexity mapping function For real-time acquired industrial particle images, according to the first... The online observable feature vectors corresponding to each logical grid region are used to calculate the online local density parameter and the online texture boundary complexity parameter using the online local density mapping function and the online texture boundary complexity mapping function, respectively: in, and These are the online local density parameter and the online texture boundary complexity parameter, respectively. For the first Online observable feature vectors corresponding to each logical grid region; and These are the online local density mapping function and the online texture boundary complexity mapping function, respectively. This indicates that the mapping results will be restricted to a uniform numerical range; The online comprehensive complexity scalar is calculated based on the online local density parameter and the online texture boundary complexity parameter; multiple complexity intervals corresponding to the numerical range of the online comprehensive complexity are determined through the validation set, and candidate box suppression parameters, confidence thresholds and particle size correction parameters are configured for each complexity interval to form a preset parameter set; the specific values of the complexity interval boundaries and corresponding parameters are given in the specific implementation.
8. The heterogeneous knowledge distillation method for real-time identification and particle size analysis of dense small particles according to claim 1, characterized in that, Step S201 specifically involves: using a fixed RGB industrial camera to acquire dense small-particle images of an industrial scene in real time, and establishing logical grid region indices according to the same logical grid method as in step S101; the complete image remains a single tensor; for the r-th logical grid region, extracting observable features of the image and inputting them into the real-time complexity mapping function established in step S106 to obtain online local density parameters. and online texture boundary complexity parameters Then calculate the online synthesis complexity scalar. : The first Online local density parameters of a logical grid region and online texture boundary complexity parameters Composition of online region complexity vector ; The online region complexity vectors of each logical grid region are arranged in region index order to obtain the online region complexity matrix. : 。 9. The heterogeneous knowledge distillation method for real-time identification and particle size analysis of dense small particles according to claim 1, characterized in that, In step S203: the preset parameter set includes at least parameter combinations corresponding to low complexity range, medium complexity range, and high complexity range, respectively, when the online synthesis complexity scalar... When the values are located between adjacent complexity intervals, interpolate the parameters corresponding to the adjacent complexity intervals.
10. The heterogeneous knowledge distillation method for real-time identification and particle size analysis of dense small particles according to claim 1, characterized in that, In step S204: First, the confidence level of the particle target of each candidate detection box is compared with the confidence level threshold corresponding to the logical grid region where its center is located, and candidate detection boxes that are lower than the confidence level threshold are deleted. For any two retained candidate detection boxes, calculate their cross-union ratio (CUI), normalized center distance (NCD), and pixel size similarity. If the CUI is not less than the candidate box suppression threshold of the corresponding logical grid region, the NCD is less than the preset duplicate box center distance threshold, and the pixel size similarity is not less than the preset size similarity threshold, then the two boxes are determined to be duplicate boxes of the same particle target, and the candidate detection box with the higher particle target confidence is retained. Otherwise, the two boxes are retained as different particle targets. For the The reserved predicted detection boxes have widths and heights of 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ... and Then the pixel size and particle physical size Determine them according to the following formulas respectively: in, Index of the predicted detection boxes to be retained; and The first The pixel width and pixel height of each retained predicted detection box; For the first The pixel size of each particle target; and For the first The x and y coordinates of the center of each preserved predicted detection box in the complete image coordinate space; The position scale coefficient is obtained based on the camera calibration parameters; For the first The center of the target particle is located at the [number]th [unit]. Particle size correction parameters corresponding to each logical grid region; For the first The physical particle size of the target particle; The physical particle size of all particulate targets is statistically analyzed according to the preset particle size range to obtain the multi-range particle size distribution results; In step S205, the dense small particle target detection results include the predicted detection box position and target confidence, and the multi-interval particle size distribution results include the number of particles or the proportion of particles corresponding to each preset particle size interval.