A method for detecting bubble defects of cement pole production slurry

CN122906003APending Publication Date: 2026-10-13HENAN XUDI ELECTRIC POWER TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611106513.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-24
Publication Date
2026-10-13

AI Technical Summary

Technical Problem

[0003]工业现场采集的图像往往背景复杂,导致数据集内包含大量高度相似的冗余样本

Benefits of technology

[0007]本发明通过利用历史周期损失值的离散系数并结合当期损失值生成综合主导度得分,能够评估样本在训练过程中的重要程度,发掘对模型优化具有关键作用的高价值样本。利用特征图谱相似性识别冗余非主导样本,并根据反向调节的抑制概率对所述样本的梯度向量进行随机置零处理,不仅降低了冗余信息对梯度更新的干扰与计算资源的消耗,还缓解了模型的过拟合风险。将主导样本的梯度向量分解为平行与正交分量并分别进行重赋权,深入剖析了样本间的梯度关联规律,实现了对模型优化方向的精细化控制。根据平均梯度夹角散度持续更新历史周期参数,建立起梯度一致性与观察窗口的联动机制,保障了整个训练过程的稳定,提升了水泥电杆气泡缺陷检测模型的准确率、收敛速度与稳定性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122906003A_ABST
    Figure CN122906003A_ABST
Patent Text Reader

Abstract

The application provides a cement pole production slurry bubble defect detection method, a training batch is constructed by collecting a slurry image and sent into a detection model, a current loss and a gradient are calculated, a comprehensive dominant degree score is constructed in combination with a historical N period loss dispersion coefficient, N is updated along with a gradient direction divergence, dominant and non-dominant samples are distinguished according to the score, non-dominant redundant samples are screened and an inhibition probability is adjusted, redundant sample gradients are randomly set to zero, average gradients of the two types of samples are respectively calculated, dominant sample gradients are split into parallel and orthogonal components and are differentially weighted; the period N is updated according to the gradient angle divergence, an overall gradient update model is fused, and slurry image bubble defects are identified after training.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of testing, and in particular relates to a method for detecting air bubble defects in cement pole production slurry. Background Technology

[0002] Cement poles, as indispensable basic support facilities in power transmission and communication networks, have structural strength and service life that directly affect the safe and stable operation of related systems. In actual production, due to manufacturing conditions such as slurry mixing and centrifugal molding, air bubble defects are easily generated on the surface and inside of cement poles. Traditional defect detection methods rely on manual visual inspection, which is not only time-consuming, labor-intensive, and inefficient, but also highly susceptible to the fatigue and subjective experience of quality inspectors, leading to frequent missed and false detections. This method can no longer meet the needs of modern large-scale intelligent industrial production. Deep learning image detection technology is now widely used in industrial surface defect detection scenarios, building intelligent detection models and opening up new technical paths for identifying air bubble defects in cement poles.

[0003] Images collected from industrial sites often have complex backgrounds, resulting in a large number of highly similar redundant samples within the dataset. During conventional model training, the gradients generated by these numerous, simple, redundant samples tend to dominate the parameter update direction of the entire model, leading to overfitting to common features and neglecting the learning of complex, indistinguishable bubble defects. Furthermore, traditional gradient optimization algorithms typically employ a static, indiscriminate strategy when processing different samples, failing to consider the historical training state and real-time instability of the samples, and unable to adjust based on the actual contribution of the samples to the model's generalization ability. This rigid update mechanism easily causes the model to get stuck in local optima in the later stages of training and often leads to conflicts and cancellations between different gradient vectors, limiting the detection model's ability to extract and represent complex defect features. Therefore, how to assess the importance of samples from a global perspective, reasonably suppress the interference of redundant samples, and optimize the overall gradient update direction has become a crucial problem that urgently needs to be solved to improve the accuracy and stability of bubble defect detection on cement poles. Summary of the Invention

[0004] To improve the generalization performance and defect identification accuracy of the cement pole bubble defect detection model, this disclosure provides a method for detecting bubble defects in cement pole production slurry.

[0005] In a first aspect, this disclosure provides a method for detecting air bubble defects in the slurry used in cement pole production, comprising the following steps: Acquire cement pole grout images to construct training batches, input the training batches into the detection model to calculate the current loss value and gradient vector, extract the historical N period loss values ​​of the samples to calculate the dispersion coefficient as an instability index, combine the current loss value and the instability index to obtain the comprehensive dominance score, N is initially taken as the actual number of periods, and subsequently adjusted according to the gradient direction divergence of the previous period; The samples are divided into a dominant sample set and a non-dominant sample set according to the overall dominance score. The similarity of the feature map of the non-dominant samples is calculated to identify redundant non-dominant samples. The base suppression probability is adjusted in reverse according to the score of the redundant non-dominant samples to generate the suppression probability. The gradient vector of the redundant non-dominant samples is randomly set to zero according to the suppression probability to obtain the processed non-dominant sample set. The average gradient vectors of the dominant sample set and the processed non-dominant sample set are calculated. The gradient vectors of each sample in the dominant sample set are decomposed into projected components and orthogonal components that are parallel to the average gradient of the non-dominant sample set. These components are reweighted with different gain coefficients. The divergence is calculated based on the angle between the two average gradient vectors. The calculated result is multiplied by a preset scaling factor, rounded, and the lower bound is set to 1 before updating N. The processed gradient vectors are integrated to update the detection model parameters. The trained model is used to detect images and output bubble defect information.

[0006] Secondly, this disclosure also provides a system for detecting air bubble defects in cement pole production slurry, comprising the following modules: The extraction module is used to acquire cement pole slurry images to construct training batches. The training batches are input into the detection model to calculate the current loss value and gradient vector. The loss values ​​of N historical periods of the samples are extracted to calculate the dispersion coefficient as an instability index. The current loss value and the instability index are combined to obtain the comprehensive dominance score. N is initially taken as the actual number of periods, and is subsequently adjusted according to the gradient direction divergence of the previous period. The calculation module is used to divide the samples into a dominant sample set and a non-dominant sample set according to the comprehensive dominance score, calculate the similarity of the feature map of the non-dominant samples, identify redundant non-dominant samples, adjust the basic suppression probability in reverse according to the score of the redundant non-dominant samples to generate the suppression probability, and randomly set the gradient vector of the redundant non-dominant samples to zero according to the suppression probability to obtain the processed non-dominant sample set. The detection module is used to calculate the average gradient vectors of the dominant sample set and the processed non-dominant sample set. It decomposes the gradient vectors of each sample in the dominant sample set into projected components and orthogonal components parallel to the non-dominant average gradients, and reweights them with different gain coefficients. It calculates the divergence based on the angle between the two average gradient vectors, multiplies the calculation result by a preset scaling factor, rounds it, limits the lower bound to 1, and then updates N. It integrates the processed gradient vectors to update the detection model parameters and uses the trained model to detect images and output bubble defect information.

[0007] This invention utilizes the discrete coefficients of historical periodic loss values ​​and combines them with the current periodic loss value to generate a comprehensive dominance score. This allows for the assessment of the importance of samples during training and the identification of high-value samples that play a crucial role in model optimization. Redundant non-dominant samples are identified using feature map similarity, and their gradient vectors are randomly zeroed based on the suppression probability of back-adjustment. This not only reduces the interference of redundant information on gradient updates and the consumption of computational resources but also mitigates the risk of model overfitting. The gradient vectors of dominant samples are decomposed into parallel and orthogonal components and reweighted accordingly, providing a deep analysis of the gradient correlation patterns between samples and enabling fine-grained control over the direction of model optimization. Historical periodic parameters are continuously updated based on the average gradient angle divergence, establishing a linkage mechanism between gradient consistency and the observation window. This ensures the stability of the entire training process and improves the accuracy, convergence speed, and stability of the cement pole bubble defect detection model. Attached Figure Description

[0008] Figure 1 A flowchart of a method for detecting air bubble defects in cement pole production slurry; Figure 2 This is a diagram illustrating the fluctuations and instability of historical loss values. Figure 3 This is a schematic diagram of sample partitioning based on score ranking. Detailed Implementation

[0009] The terms "first," "second," and "third," etc., used in this application specification, claims, and the aforementioned drawings are used to distinguish different objects, not to limit a specific order.

[0010] In the embodiments of this application, the terms "exemplary" or "for example" are used to indicate that something is an example, illustration, or description. Any embodiment or design that is described as "exemplary" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design. Specifically, the use of the terms "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.

[0011] Reference Figure 1 This invention provides a method for detecting air bubble defects in cement pole production slurry, comprising the following steps: S1. Obtain cement pole grout images to construct training batches. Input the training batches into the detection model to calculate the current loss value and gradient vector. Extract the historical N period loss values ​​of the samples to calculate the dispersion coefficient as an instability index. Combine the current loss value and the instability index to obtain the comprehensive dominance score. N is initially taken as the actual number of periods, and subsequently adjusted according to the gradient direction divergence of the previous period.

[0012] High-resolution images of the cement pole grout surface are acquired, read, and uniformly scaled to a set resolution. The CLAHE algorithm is used for contrast-limited histogram equalization to enhance bubble features. A training batch containing a fixed number of samples is constructed. The training batch data is input into a detection model based on the CSPDarknet network architecture. After forward propagation, the model outputs predicted bounding boxes and confidence scores. The cross-entropy loss between the predicted confidence score and the class label is calculated, as well as the positional regression loss (such as CIoU loss or L1 loss) between the predicted and ground truth bounding boxes. The weighted sum of these two losses is used as the current loss value. In one embodiment, the detection model includes a sequentially connected input layer, a feature extraction backbone network composed of multiple convolutional layers, a feature fusion layer, and an output layer. The input to the model is the preprocessed cement pole bubble image sample; after forward propagation calculation, its output is the predicted value for the image sample, specifically the predicted bounding box and confidence score.

[0013] Backpropagation is performed by calling an automatic differentiation engine with a single-sample gradient acquisition mechanism, such as a registered gradient hook function or a batched single-sample gradient operator, to calculate and extract the single-sample gradient vectors corresponding to each network parameter layer. A double-ended queue data structure is used to store the historical loss value of each sample. An array of loss values ​​for the current sample over the past N training epochs is extracted, the standard deviation is calculated, and the mean function is used to calculate the average. The standard deviation is divided by the average to obtain the coefficient of variation, which serves as the instability index. Weights for the current loss value and the instability index are set. The current loss value is multiplied by the loss value weight, and the instability index is multiplied by the instability index weight to obtain the overall dominance score. In the initial training phase, N is assigned the number of actual training epochs performed. In subsequent training, the value of N is adjusted by reading the gradient directional divergence value from the previous epoch.

[0014] In one embodiment, the step of extracting the historical N-period loss values ​​of the sample and calculating the coefficient of variation as an instability indicator includes: Calculate the standard deviation and mean of the historical loss values ​​over N periods; The standard deviation is divided by the mean to obtain the quotient, which is used as the sample instability index.

[0015] The proposed solution involves a defect detection neural network model. The model's structure includes a sequentially connected input layer, a feature extraction backbone network composed of multiple convolutional layers, a feature fusion layer, and an output layer. The input to the model is a sample image of air bubbles on a cement pole, and the output is a predicted value for that sample. During training, a circular queue or historical data buffer is constructed for each training sample to record and store the forward propagation loss value of that sample in the most recent N training epochs. For example, when N is initially 5, for the i-th sample, five historical loss values ​​are recorded from epoch t-4 to epoch t. These loss values ​​are assumed to be... , , , , , refer to Figure 2 The curve represents the trajectory of the loss value change in a single iteration across five training cycles. The horizontal axis marks the iteration number, and the vertical axis records the corresponding loss function value. The curve fluctuations correspond to the historical loss oscillations of the samples, which can help calculate the coefficient of variation and support the complete calculation process of the instability index. The arithmetic mean of these five historical loss values ​​is calculated; the average value in the example above... .

[0016] Based on this average, the sample standard deviation of these N loss values ​​is calculated. According to the calculation formula, the standard deviation of this data is approximately 0.0927. After calculating the average and standard deviation, the coefficient of variation is calculated by dividing the obtained standard deviation by the average. Combining the aforementioned values, the coefficient of variation is 0.2505. This quotient is set as the instability index for the current sample, typically ranging from 0 to 1, but can be greater than 1 in extreme divergence cases. This index reduces the scaling effect caused by different absolute magnitudes of loss and can represent the degree of fluctuation in the model's fit to a specific sample. A higher instability index indicates that the loss oscillates significantly during the training process, usually corresponding to hard-to-classify samples or boundary samples with labeled noise.

[0017] In one embodiment, the step of combining the current loss value with the instability index to obtain a comprehensive dominance score includes: Calculate using the following formula: ; Where S is the overall dominance score of the corresponding training sample, L is the current loss value, e is the natural constant, and I is the instability index.

[0018] After obtaining the current loss value and instability index for each training sample, the tensor operation module configured internally by the system performs numerical calculations according to the exponentially weighted fusion formula. It reads the combined weighted specific loss value of the cross-entropy between the output predicted value and the true label of the sample in the defect detection neural network model for the current period, as well as the bounding box IoU regression loss, and records this loss value as the current loss value. The system calls the pre-calculated instability index I for this sample and uses the natural exponential function from the system's mathematical library to calculate the natural constant e, which is approximately equal to 2.71828 raised to the power of I. Since the instability index I is typically a non-negative floating-point number, this exponential term will always be greater than or equal to 1, thus amplifying the current period's loss value non-linearly. For example, suppose a specific sample of a cement pole's bubble image has a forward calculated loss value in the current period. And if the instability index I calculated in the previous steps is 0.3, then calculate... The current period loss value Compared with the exponential scaling factor calculated above Multiplying these results yields the overall dominance score, S. Using the same values, S ≈ 0.6074. The score represents the difficulty of fitting the sample in the current network state and the oscillations in its training history. A higher score indicates that the sample is not only difficult to fit in the current network state but also... The large size of I, and its historical volatility, means it often plays a dominant role in updating the model's gradient. All multiplication and exponential operations can be performed in parallel using underlying tensor operators, ensuring computation on thousands of samples within each training batch. This combined mechanism reduces the limitation of relying on a single current loss to determine sample importance, preventing the model from overlooking truly difficult-to-optimize samples when facing occasional low losses, and making subsequent gradient calculations more targeted and stable in weight allocation.

[0019] S2, based on the overall dominance score, divide the samples into a dominant sample set and a non-dominant sample set. Calculate the similarity of the feature maps of the non-dominant samples to identify redundant non-dominant samples. Adjust the base suppression probability inversely based on the scores of the redundant non-dominant samples to generate a suppression probability. Randomly set the gradient vector of the redundant non-dominant samples to zero according to the suppression probability to obtain the processed non-dominant sample set. The overall dominance scores of all samples in the current batch are sorted in descending order. A quantile threshold is set, and samples with scores greater than or equal to the threshold are assigned to the dominant sample set, while samples with scores less than the threshold are assigned to the non-dominant sample set. A multi-channel two-dimensional feature map is extracted from the feature pyramid network layer of the detection model for each non-dominant sample to be tested. The structural similarity index between this feature map and the feature maps of each other sample in the non-dominant sample set is calculated. A similarity threshold and a proportion threshold are set, and it is determined whether each structural similarity index value is greater than the similarity threshold. The total number of similar samples with values ​​greater than the threshold is counted, and this total number of similar samples is divided by the total number of other non-dominant samples to obtain the proportion. When this proportion is greater than the set proportion threshold, the corresponding sample to be tested is marked as a redundant non-dominant sample. A fixed base suppression probability is preset. The comprehensive dominance score of redundant non-dominant samples is mapped to a range of 0 to 1 using the minimax normalization method. The suppression increment is calculated by multiplying the difference between the value 1 and the normalized score by an adjustment coefficient. The base suppression probability is added to the suppression increment, and the sum is compared with the value 1, taking the minimum value. Alternatively, the sum of the base suppression probability and the adjustment coefficient is pre-defined to be less than or equal to 1. This calculates the suppression probability for that sample, ensuring that samples with higher scores have a lower probability of being suppressed. The `bernoulli` function is called to generate a Bernoulli distribution mask matrix with the same dimension as the gradient vector of the redundant non-dominant samples and following a parameter of (1 - suppression probability). This mask matrix is ​​multiplied element-wise with the original gradient vector, randomly zeroing some gradient parameters. Non-dominant samples not marked as redundant retain their gradient vectors unchanged. The processed redundant non-dominant samples are merged with the unmodified non-dominant samples to form a processed non-dominant sample set.

[0020] In one embodiment, dividing the samples into a dominant sample set and a non-dominant sample set based on the overall dominance score includes: The samples in the training batch are sorted in descending order according to the overall dominance score; The dominant sample set is formed by selecting the samples corresponding to the top 20% of the overall dominance scores. The non-dominant sample set consists of samples that rank in the bottom 80% of the overall dominance scores.

[0021] After the forward propagation computation of each training batch is completed and the comprehensive dominance score is extracted, a sorting algorithm is used to perform structured segmentation of all samples within that batch. The comprehensive dominance score sequence corresponding to, for example, 64 samples in the current training batch is collected, and sorting operators such as quicksort or heapsort are used to sort these 64 samples in descending order of score. During the sorting process, the original indices corresponding to each sample are recorded and adjusted simultaneously to ensure that subsequent features or gradient vectors are traceable and segmented. After descending sorting, samples with the highest scores, high fitting difficulty, and oscillating characteristics are pushed to the front of the queue, while stable samples with low fitting difficulty and small loss fluctuations are pushed to the back of the queue.

[0022] The slice extraction operation is performed using the batch size and a set truncation ratio. Specifically, the threshold index of 12.8 is calculated using floating-point multiplication, and the system defaults to rounding down to the integer limit of 12. The top 12 samples with sorted indices from 0 to 11 in the extraction queue, representing the top 20% of the overall scores, are allocated their corresponding pointers in storage space or GPU memory to a new tensor set, which is designated as the dominant sample set. Simultaneously, the remaining 52 samples with indices from 12 to 63, representing the bottom 80% of the samples, are extracted to form the non-dominant sample set. The dominant sample set contains a few key samples with complex defects such as blurred boundaries and overlapping bubbles; the gradient information of these samples will be extracted with emphasis. The non-dominant sample set contains easily identifiable background or simple bubble samples for subsequent similarity detection and probabilistic gradient suppression. This percentage-based truncation method allows each training batch to adjust its internal sample set structure, maintaining the weight of key feature gradients while improving the operational efficiency of the filtering mechanism. Figure 3 The graph arranges all samples in descending order of overall dominance score. The vertical lines divide the sample sets into two categories. Dark bars represent high-scoring dominant samples, while light bars represent low-scoring non-dominant samples. The bar height corresponds to the score of a single sample, which can distinguish the boundary between the two categories and the differences in score distribution.

[0023] In one embodiment, calculating the similarity of non-dominant sample feature maps and identifying redundant non-dominant samples includes: Obtain the feature map of each non-dominant sample to be tested, and calculate the structural similarity index between the feature map and the feature map of each other sample in the non-dominant sample set. Determine whether the structural similarity index values ​​obtained for the sample to be inspected are greater than a preset fixed threshold of 0.85, and count the total number of similar samples corresponding to values ​​greater than 0.85; The proportion is obtained by dividing the total number of similar samples by the total number of remaining samples in the non-dominant sample set excluding the sample to be tested. When the proportion is greater than 60%, the corresponding sample to be tested is marked as a redundant non-dominant sample.

[0024] When performing redundant filtering on the non-dominant sample set, the system needs to access the deep network architecture of the defect detection neural network model to extract the multi-channel two-dimensional feature maps of the corresponding samples in the penultimate layer or a specified convolutional layer. Assuming there are 52 samples in the non-dominant sample set, for any sample A to be tested, the structural similarity index between the feature map and the remaining 51 samples is calculated sequentially. When calculating the structural similarity index, the statistics of the two feature maps in brightness, contrast, and structure are compared. For example, the structural similarity index between sample A and a certain sample might be calculated as 0.88. Through all 51 pairwise comparisons, a similarity score list containing 51 floating-point numbers is generated, representing the degree of feature overlap of sample A in the remaining non-dominant sample group of that batch.

[0025] After obtaining all similarity index values, these 51 floating-point numbers are fed one by one into the threshold judgment module, and Boolean logic judgment is performed with a fixed scalar of 0.85 as the boundary. The number of results greater than 0.85 is summarized and counted to obtain the total number of similar samples. Assuming that the structural similarity index value of the sample to be tested A with 32 of the remaining 51 samples exceeds 0.85, the total number of similar samples is 32. A proportion evaluation calculation is performed, dividing the total number of similar samples 32 by the total number of remaining samples 51, resulting in a proportion of approximately 62.7%. Since this calculation result is greater than the preset threshold condition of 60%, a redundancy flag is assigned to the sample to be tested A, marking it as a redundant non-dominant sample in memory space. This indicates that the representation features of sample A are already fully covered by the non-dominant set in the current batch, and the additional gradient information that the sample can provide is limited. Through this item-by-item statistics and threshold discrimination, similar samples that are close in the feature space are locked, thus locking the target object for the probabilistic stochastic gradient suppression mechanism.

[0026] In one embodiment, the step of adjusting the base suppression probability inversely based on the scores of redundant non-dominant samples to generate a suppression probability includes: The overall dominance score of the redundant non-dominant samples is mapped to a closed interval of 0 to 1 through minimax normalization to obtain the normalized score. The difference is obtained by subtracting the value 1 from the normalized score, and then multiplying the difference by a preset adjustment coefficient to calculate the suppression increment. The base suppression probability is added to the suppression increment to obtain the suppression probability of the corresponding redundant non-dominant sample.

[0027] To adjust the gradient suppression strength for samples marked as redundant non-dominant, a global base suppression probability of 0.2 is initialized and anchored to a fixed value of 0.2 through a parameter configuration file, ensuring that redundant samples maintain a 20% gradient zero suppression probability. The previously calculated comprehensive dominance score sequence for all redundant non-dominant samples in the current batch is extracted, and mapping is performed using the minimax normalization formula. For example, if the maximum score of these redundant samples is 0.8 and the minimum is 0.3, the normalized score for a specific redundant sample with a score S=0.4 is 0.2. This step, through scaling, ensures that all normalized scores fall within the closed numerical interval of 0 to 1, reducing the impact of probability jumps caused by drift between batches of absolute loss values. After normalization, algebraic operations for inverse probability mapping are initiated, giving relatively simple samples a higher suppression probability. For the sample with a normalized score of 0.2, the normalized score is subtracted from 1, resulting in 0.8.

[0028] Multiply the inverted difference by the maximum allowed probability fluctuation range of 0.6 to calculate the suppression increment of 0.48 for this specific sample. Execute the addition instruction to add the pre-anchored base suppression probability of 0.2 to the calculated suppression increment of 0.48, obtaining a value of 0.68. This value is assigned to this redundant non-dominant sample as its suppression probability. This indicates that in the subsequent backpropagation stage of the network, each parameter element in the gradient vector corresponding to the specific redundant sample has a 68% probability of being masked and zeroed out, no longer participating in the network parameter update of the current step. This smooth calculation strategy, combined with the relative difficulty of the samples themselves, not only discards redundant bubble samples with a maximum probability of 80%, but also retains some more difficult features through the suppression mechanism, reducing overfitting caused by feature repetition.

[0029] S3: Calculate the average gradient vectors of the dominant sample set and the processed non-dominant sample set. Decompose the gradient vectors of each sample in the dominant sample set into projection components and orthogonal components parallel to the non-dominant average gradients. Reweight them with different gain coefficients. Calculate the divergence based on the angle between the two average gradient vectors. Multiply the calculation result by a preset scaling factor, round it, and limit the lower bound to 1 before updating N. Integrate the processed gradient vectors to update the detection model parameters. Use the trained model to detect images and output bubble defect information.

[0030] The gradient vectors of all samples in both the dominant and processed non-dominant sample sets are summed along the batch dimension and divided by the number of samples in their respective sets. The `mean` function from the `torch` library is then used to obtain the dominant and non-dominant average gradient vectors. For each sample in the dominant sample set, the dot product of the sample's gradient vector and the non-dominant average gradient vector is calculated, divided by the square of the non-dominant average gradient vector's magnitude, and then multiplied by the non-dominant average gradient vector to obtain the projected component parallel to the non-dominant average gradient. This projected component is then subtracted from the original sample gradient vector to obtain the orthogonal component. An orthogonal gain coefficient less than 1 and a projection gain coefficient greater than 1 are preset. The orthogonal component is multiplied by the orthogonal gain coefficient, and the projected component is multiplied by the projection gain coefficient. The two weighted components are then added together to reweight the dominant sample gradient vector. The dot product of the dominant and non-dominant average gradient vectors is calculated, divided by the product of their magnitudes to obtain the cosine value, and the angle between the two average gradient vectors is obtained using the inverse cosine function (ACOS). This angle is used as the gradient direction divergence.

[0031] The gradient directional divergence is multiplied by a set constant scaling factor, and the `ceil` function from the `math` library is called to round the product up. The `max` function is then used to compare the rounded result with the integer 1, and the maximum value is taken as the new window length, covering the N value of the previous period. The gradient vector of the reweighted dominant sample is accumulated and averaged with the gradient vector of the processed non-dominant sample set to obtain the global update gradient. The `step` function of the AdamW optimizer is then called to update all weight parameters of the detection model using the global update gradient. In the actual detection stage, images of the cement poles to be tested are acquired using acquisition equipment and preprocessed. The preprocessed cement pole images are input into the detection model that has been trained and converged through the above process. Overlapping bounding boxes are filtered using the Non-Maximum Suppression (NMS) algorithm, and the detection results containing the location coordinates and size information of bubble defects are output.

[0032] In one embodiment, the step of decomposing the gradient vector of each sample in the dominant sample set into a projected component parallel to and an orthogonal component of the non-dominant average gradient includes: Calculate using the following formula: , ; Where g is the gradient vector calculated from the dominant sample. It is a non-dominant average gradient vector. The squared norm of the non-dominant average gradient vector. To prevent division by zero by a very small constant, · represents the dot product of two vectors. Represents the projected components. This represents orthogonal components.

[0033] After calculating the original gradients of all samples through backpropagation, the system needs to perform vector-level orthogonal decomposition in the Euclidean space of the parameters. This extracts the overall average gradient vector corresponding to the processed non-dominant sample set. It then calls the dot product operator at the lower level of the framework to calculate the gradient vector g of a specific sample in the dominant sample set and the average gradient vector. inner product scalar The L2 norm squared of the non-dominant average gradient is calculated by performing a sum of squares operation. To ensure numerical stability under extreme conditions such as minimal gradients in the early stages of a batch, a small, pre-defined tolerance constant is added to the denominator when calculating the division. If set as Dividing the calculated dot product scalar by the squared L2 norm with tolerance yields a projection coefficient representing the parallelism between the two. This scalar coefficient is then compared with the non-dominant average gradient vector. Multiply to construct the projected component vector. This projection component represents the degree to which the current challenging sample follows the optimization trend of the majority of simple samples.

[0034] After obtaining the projected components, perform a vector subtraction operation by subtracting the corresponding elements one by one. Subtract the calculated projected components from the original complete gradient vector g of the dominant sample. Find the orthogonal components. If in a two-dimensional parameter space, g equals vectors 3.0 and 4.0, and... If vectors 2.0 and 0.0 are equal and their squared L2 norm is 4.0, then their inner product is 6.0. Ignoring small constants... Afterwards, the projection coefficient is 1.5. The projected components are vectors 3.0 and 0.0 calculated from 1.5×2.0 and 1.5×0.0. By subtracting vectors 3.0 and 0.0 from vectors 3.0 and 4.0, the orthogonal components are obtained as vectors 0.0 and 4.0. This vector projection and removal operation divides a dominant gradient containing high-frequency detailed features in multidimensional space into a part that is in the same direction as the gradient and a part that is perpendicular to the gradient. This explicit orthogonal deconstruction method at the spatial level reduces the mutual cancellation effect of gradients caused by the addition of easy and difficult samples, and prepares a high-dimensional orthogonal input source for subsequent independent gain coefficient intervention and weighted splicing of the two types of feature gradients.

[0035] In one embodiment, the reweighting with different gain coefficients includes: Multiply the orthogonal components of each decomposed sample by the first gain constant to obtain the redefined orthogonal components; The projection components of the same sample are multiplied by the second gain constant to generate the redefined projection components. The redefined orthogonal component corresponding to the same sample is added to the redefined projection component to generate a replacement gradient vector, which is used to update the parameters of the detection model.

[0036] After obtaining independent gradient vectors through a forward decomposition step, the system implements a scalar and vector multiplication adjustment mechanism using a pre-built asymmetric scaling factor in the configuration file. For the variable weight information carried in the dominant sample orthogonal components, the weight information is multiplied by a fixed first gain constant of 0.8, less than 1. For example, the orthogonal component vectors 0.0 and 4.0 obtained in the previous example are transformed and stored as redefined orthogonal component vectors 0.0 and 3.2 after being scaled by this 0.8 factor. This scaling and reweighting operation reduces the adverse effects of high-frequency noise and abnormal gradients caused by difficult-to-distinguish defect samples on the backbone weights of the defect detection neural network model, thus playing a regularizing role in smoothing the decision boundary. Simultaneously, for the projection components representing the direction of majority consensus and conducive to global convergence, a second gain constant of 1.5, greater than 1, is extracted and used to perform amplification multiplication. The aforementioned projection component vectors 3.0 and 0.0, after being multiplied by 1.5, are transformed into redefined projection component vectors 4.5 and 0.0.

[0037] This process consolidates and accelerates the model's learning pace in recognizing common, simple bubble features, giving the model stronger gradient guidance. After reshaping the shrinkage and expansion along the dual-track vector direction, a tensor merging operator of the same dimension is triggered. The scaled and denoised redefined orthogonal component vectors 0.0 and 3.2 are combined with the enhanced redefined projection component vectors 4.5 and 0.0, performing an element-wise summation operation to generate the reconstructed replacement gradient vector. In this example, the result is vectors 4.5 and 3.2. Compared to the original gradient vectors 3.0 and 4.0, the replacement gradient vector has its direction and magnitude tilted and corrected. The synthesized new gradient matrix is ​​then fed into the core pipeline of an optimizer, such as Adam or stochastic gradient descent, replacing the original unprocessed gradient signal. The optimizer then multiplies the reweighted replacement gradient vector according to the set learning rate, performing replacement on the specific parameters of the convolutional kernels at each layer of the current model. This mechanism utilizes the logic of dividing and conquering physical vectors and then recombining them to reconstruct the structure. While suppressing overfitting, it can extract structural information from difficult samples, thus improving the balance between convergence speed and stability of the cement pole bubble defect detection system.

[0038] This invention also proposes a system for detecting air bubble defects in cement pole production slurry, comprising the following modules: The extraction module is used to acquire cement pole slurry images to construct training batches. The training batches are input into the detection model to calculate the current loss value and gradient vector. The loss values ​​of N historical periods of the samples are extracted to calculate the dispersion coefficient as an instability index. The current loss value and the instability index are combined to obtain the comprehensive dominance score. N is initially taken as the actual number of periods, and is subsequently adjusted according to the gradient direction divergence of the previous period. The calculation module is used to divide the samples into a dominant sample set and a non-dominant sample set according to the comprehensive dominance score, calculate the similarity of the feature map of the non-dominant samples, identify redundant non-dominant samples, adjust the basic suppression probability in reverse according to the score of the redundant non-dominant samples to generate the suppression probability, and randomly set the gradient vector of the redundant non-dominant samples to zero according to the suppression probability to obtain the processed non-dominant sample set. The detection module is used to calculate the average gradient vectors of the dominant sample set and the processed non-dominant sample set. It decomposes the gradient vectors of each sample in the dominant sample set into projected components and orthogonal components parallel to the non-dominant average gradients, and reweights them with different gain coefficients. It calculates the divergence based on the angle between the two average gradient vectors, multiplies the calculation result by a preset scaling factor, rounds it, limits the lower bound to 1, and then updates N. It integrates the processed gradient vectors to update the detection model parameters and uses the trained model to detect images and output bubble defect information.

[0039] It is understood that the various numerical designations used in the embodiments of this application are merely for descriptive convenience and are not intended to limit the scope of the embodiments of this application. The order of the process numbers described above does not imply the order of execution; the execution order of each process should be determined by its function and internal logic.

Claims

1. A method for detecting air bubble defects in cement pole production slurry, characterized in that, Includes the following steps: Acquire cement pole grout images to construct training batches, input the training batches into the detection model to calculate the current loss value and gradient vector, extract the historical N period loss values ​​of the samples to calculate the dispersion coefficient as an instability index, combine the current loss value and the instability index to obtain the comprehensive dominance score, N is initially taken as the actual number of periods, and subsequently adjusted according to the gradient direction divergence of the previous period; The samples are divided into a dominant sample set and a non-dominant sample set according to the overall dominance score. The similarity of the feature map of the non-dominant samples is calculated to identify redundant non-dominant samples. The base suppression probability is adjusted in reverse according to the score of the redundant non-dominant samples to generate the suppression probability. The gradient vector of the redundant non-dominant samples is randomly set to zero according to the suppression probability to obtain the processed non-dominant sample set. The average gradient vectors of the dominant sample set and the processed non-dominant sample set are calculated. The gradient vectors of each sample in the dominant sample set are decomposed into projected components and orthogonal components that are parallel to the non-dominant average gradient. These components are reweighted with different gain coefficients. The divergence is calculated based on the angle between the two average gradient vectors. The calculated result is multiplied by a preset scaling factor, rounded, and bounded to a lower limit of 1 before updating N. The processed gradient vectors are integrated to update the detection model parameters. The trained model is used to detect bubble defect information in the image.

2. The method according to claim 1, characterized in that, The calculation of the coefficient of variation of the historical N-period loss values ​​of the extracted samples as an instability index includes: Calculate the standard deviation and mean of the historical loss values ​​over N periods; The standard deviation is divided by the mean to obtain the quotient, which is used as the sample instability index.

3. The method according to claim 1, characterized in that, The process of combining the current loss value with the instability index to obtain the comprehensive dominance score includes: Calculate using the following formula: ; Where S is the overall dominance score of the corresponding training sample, L is the current loss value, e is the natural constant, and I is the instability index.

4. The method according to claim 1, characterized in that, The process of dividing the samples into dominant and non-dominant sample sets based on the overall dominance score includes: The samples in the training batch are sorted in descending order according to the overall dominance score; The dominant sample set is formed by selecting the samples corresponding to the top 20% of the overall dominance scores. The non-dominant sample set consists of samples that rank in the bottom 80% of the overall dominance scores.

5. The method according to claim 1, characterized in that, The calculation of the similarity of feature maps of non-dominant samples and the identification of redundant non-dominant samples include: Obtain the feature map of each non-dominant sample to be tested, and calculate the structural similarity index between the feature map and the feature map of each other sample in the non-dominant sample set. Determine whether the structural similarity index values ​​obtained for the sample to be inspected are greater than a preset fixed threshold of 0.85, and count the total number of similar samples corresponding to values ​​greater than 0.85; The proportion is obtained by dividing the total number of similar samples by the total number of remaining samples in the non-dominant sample set excluding the sample to be tested. When the proportion is greater than 60%, the corresponding sample to be tested is marked as a redundant non-dominant sample.

6. The method according to claim 1, characterized in that, The step of adjusting the base suppression probability in reverse based on the scores of redundant non-dominant samples to generate the suppression probability includes: The overall dominance score of the redundant non-dominant samples is mapped to a closed interval of 0 to 1 through minimax normalization to obtain the normalized score. The difference is obtained by subtracting the value 1 from the normalized score, and then multiplying the difference by a preset adjustment coefficient to calculate the suppression increment. The base suppression probability is added to the suppression increment to obtain the suppression probability of the corresponding redundant non-dominant sample.

7. The method according to claim 1, characterized in that, The step of decomposing the gradient vector of each sample in the dominant sample set into a projected component parallel to the non-dominant average gradient and an orthogonal component includes: Calculate using the following formula: , ; Where g is the gradient vector calculated from the dominant sample. It is a non-dominant average gradient vector. The squared norm of the non-dominant average gradient vector. To prevent division by zero by a very small constant, · represents the dot product of two vectors. Represents the projected components. This represents orthogonal components.

8. The method according to claim 1, characterized in that, The reweighting with different gain coefficients includes: Multiply the orthogonal components of each decomposed sample by the first gain constant to obtain the redefined orthogonal components; The projection components of the same sample are multiplied by the second gain constant to generate the redefined projection components. The redefined orthogonal component corresponding to the same sample is added to the redefined projection component to generate a replacement gradient vector, which is used to update the parameters of the detection model.

9. A system for detecting air bubble defects in cement pole production slurry, characterized in that, Includes the following modules: The extraction module is used to acquire cement pole slurry images to construct training batches. The training batches are input into the detection model to calculate the current loss value and gradient vector. The loss values ​​of N historical periods of the samples are extracted to calculate the dispersion coefficient as an instability index. The current loss value and the instability index are combined to obtain the comprehensive dominance score. N is initially taken as the actual number of periods, and is subsequently adjusted according to the gradient direction divergence of the previous period. The calculation module is used to divide the samples into a dominant sample set and a non-dominant sample set according to the comprehensive dominance score, calculate the similarity of the feature map of the non-dominant samples, identify redundant non-dominant samples, adjust the basic suppression probability in reverse according to the score of the redundant non-dominant samples to generate the suppression probability, and randomly set the gradient vector of the redundant non-dominant samples to zero according to the suppression probability to obtain the processed non-dominant sample set. The detection module is used to calculate the average gradient vectors of the dominant sample set and the processed non-dominant sample set. It decomposes the gradient vectors of each sample in the dominant sample set into projected components and orthogonal components parallel to the non-dominant average gradients, and reweights them with different gain coefficients. It calculates the divergence based on the angle between the two average gradient vectors, multiplies the calculation result by a preset scaling factor, rounds it, limits the lower bound to 1, and then updates N. It integrates the processed gradient vectors to update the detection model parameters and uses the trained model to detect images and output bubble defect information.

10. The system according to claim 9, characterized in that, The calculation of the coefficient of variation of the historical N-period loss values ​​of the extracted samples as an instability index includes: Calculate the standard deviation and mean of the historical loss values ​​over N periods; The standard deviation is divided by the mean to obtain the quotient, which is used as the sample instability index.