Imbalanced sample image regression network training method with noise and application

By discretizing regression values ​​and constructing feature space, the training complexity problem caused by noise and imbalanced samples is solved, efficient end-to-end training and robustness improvement are achieved, and the smoothness and accuracy of the prediction are ensured.

CN120808057APending Publication Date: 2025-10-17HEFEI LASSETER ROBOT TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202510894299.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-30
Publication Date
2025-10-17

Smart Images

  • Figure CN120808057A_ABST
    Figure CN120808057A_ABST
Patent Text Reader

Abstract

The invention discloses a noise-carrying unbalanced sample image regression network training method and application, and relates to the technical field of image processing. The problems of low training efficiency, high noise sensitivity and distribution imbalance caused by dependence on manual intervention weight adjustment and a complex preprocessing process in the prior art are solved. According to the method, an ordered candidate feature space is constructed through discretization annotation values, and the geometrical relationship of adjacent vectors is stabilized through cosine constraints; constructing a regression network to output a prediction feature vector, and dynamically dividing positive and negative candidate sets based on a relaxation factor; a geometric constraint collaborative optimization mechanism is adopted, and end-to-end training is carried out in combination with zoom-in loss and zoom-out loss; and normalizing the similarity, weighting and fusing the discrete candidate values, and outputting a continuous regression result. According to the method, labeling noise interference is shielded by loosening a safe area, sample distribution deflection is automatically corrected by using global gradient balance, and the robustness and prediction continuity of a model in a complex industrial scene are remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the technical field of image processing, and particularly relates to a method for training an image regression network under the condition that sample labels are noisy and unbalanced. BACKGROUND

[0002] The method for training an unbalanced sample regression network with noise and application is a supervised learning optimization technique. The training of a supervised deep learning image regression network relies on balance and requires correct sample labels as a supervision signal. Otherwise, the training effect is poor and an excellent regression prediction cannot be obtained. In some tasks, the correctness of sample labels cannot be guaranteed. For example, in the pig backfat value measurement task, the labels provided by artificial measurement are affected by the posture of the pig and the difference in experience between different measurement personnel, resulting in unavoidable noise in the measurement values and the inability to achieve the accuracy of the measurement caliper. The balance of samples cannot be guaranteed either. Most pig backfat values in pig farms are usually concentrated in a small interval (e.g., 17mm-23mm), and the number of pigs with small or large backfat values is generally small.

[0003] In the prior art, when dealing with noisy or unbalanced data through supervised learning, the training process usually relies on preset sample screening or weighting strategies. Sample data and labels are input into a multi-stage training framework, and noise is separated or distribution is balanced through iterative optimization. Or the training system itself first performs data preprocessing to enable the model to fit the effective data distribution and output a prediction result close to the true value according to the input features. However, the process of constructing a robust model generally uses sample processing procedures under strong hypothesis conditions to approximate the objective function. The ultimate goal is to let the network map the mathematical relationship between features and potential true labels, and determine whether the predicted value conforms to the actual distribution trend of the data. However, in the prior art, due to the need for low noise ratio or manual intervention for balancing operations, or the introduction of complex processes such as multi-stage cross-validation, the training strategy calculation complexity is high, which also reduces the end-to-end optimization efficiency of the model and the real scene generalization ability. SUMMARY

[0004] The present application aims to at least solve one of the technical problems existing in the prior art. To this end, the present application proposes a method for training an unbalanced sample regression network with noise and application, which solves the technical problem that the training strategy calculation complexity is high and the end-to-end optimization efficiency and real scene generalization ability are reduced due to the need for low noise assumption or manual balancing operation and complex preprocessing process in the prior art.

[0005] To achieve the above-mentioned purpose, the present application adopts the following technical solutions:

[0006] The first aspect of the present application provides a method for training an unbalanced sample image regression network with noise, comprising:

[0007] S1, collecting image sample data to be regressed and corresponding label values, generating M discrete candidate values V m according to the range of the label values and the preset expected accuracy;

[0008] S2, randomly generating candidate feature vectors based on the discrete candidate values, and constraining the included angles between the candidate feature vectors by cosine similarity loss;

[0009] S3, constructing a regression network to be trained with the image sample data as input and the predicted feature vector p as output; wherein the predicted feature vector p is a high-dimensional embedding vector extracted by the regression network to be trained from the image sample data;

[0010] S4, screening out a positive candidate feature vector C q based on the label value y in the candidate feature vectors, and screening out a negative candidate feature vector set C u based on a preset relaxation factor s;

[0011] Wherein, the relaxation factor s is used to define the tolerance range of noise and control the boundary division of the positive candidate feature vector and the negative candidate feature vector set during training; the negative candidate feature vector set C u is all candidate feature vectors with a distance exceeding the relaxation factor s from the positive candidate feature vector C q , {C u |u∈[1,q-s]∪[q+s,M]}.

[0012] S5, based on the predicted feature vector p, the positive candidate feature vector C q and the negative candidate feature vector set C u , jointly training the regression network to be trained after calculating the pull loss and the push loss by geometric constraint collaborative optimization.

[0013] Wherein, the pull loss is used to force the predicted feature vector p to approach the positive candidate feature vector C q ; and the push loss is used to force the predicted feature vector p to move away from the negative candidate feature vector set C u .

[0014] Preferably, the M discrete candidate values V m are generated according to the range of the label values and the preset expected accuracy, comprising:

[0015] extracting the maximum label value L max and the minimum label value L min from the label values;

[0016] The number of discrete candidate values M is calculated by the formula ; wherein, W is a preset expected accuracy, is rounded up to the nearest integer.

[0017] The discrete candidate values V m are calculated by the formula V min = L m +m×W, wherein m = 1, 2, 3, …, M.

[0018] Preferably, the cosine similarity loss is used to constrain the angle between the candidate feature vectors, including:

[0019] The candidate feature vectors are arranged in ascending order of the discrete candidate values.

[0020] The cosine similarity between two candidate feature vectors is calculated by the formula D a,b = norm(C)@norm(C T ); wherein, the D a,b represents the cosine similarity between the a-th candidate feature vector and the b-th candidate feature vector, norm(*) represents the L2 norm calculation, @ represents the matrix multiplication calculation, and c is the set of candidate feature vectors, a, b = 1, 2, 3, …, M.

[0021] The first loss is calculated by the formula

[0022] The candidate feature vectors are updated by the formula to fix the angle between adjacent vectors at a preset value T.

[0023] Preferably, the first loss is used to force the spatial geometric relationship of all candidate feature vectors to be consistent with the numerical order of the corresponding discrete candidate values.

[0024] Preferably, the index q of the positive candidate feature vector C q in the candidate feature vector based on the labeled value y satisfies:

[0025] Preferably, the index u of the negative candidate feature vector set C u satisfies: u ∈ [1, q-s] ∪ [q+s, M].

[0026] Preferably, the formula of the pull loss is: loss2 = log(1+exp(-cosd(p, C q ))), wherein the pull loss is used to minimize the predicted feature vector p and the positive candidate feature vector C q ​​cosd(p,C q ) represents the cosine similarity between the predicted feature vector p and the positive candidate feature vector C q .

[0027] Preferably, the calculation formula of the push-away loss is: Wherein, the push-away loss is used to force the predicted feature vector p to be away from the negative candidate feature vector set C u .

[0028] Preferably, the joint training of the to-be-trained regression network comprises:

[0029] Let the angle between the predicted feature vector p and the negative candidate feature vector set C u be greater than the angle between the predicted feature vector p and the positive candidate feature vector;

[0030] The pull-in loss loss2 is calculated by the calculation formula of the pull-in loss;

[0031] The push-away loss loss3 is calculated by the calculation formula of the push-away loss;

[0032] The to-be-trained regression network is trained by the calculation formula , wherein the param(R) is the learnable parameter of the to-be-trained regression network.

[0033] The second aspect of the present application provides a regression network application for unbalanced sample images with noise, comprising:

[0034] Obtaining the number of image samples to be regressed;

[0035] Inputting the image sample data into the trained regression network to obtain a predicted feature vector, wherein the trained regression network is a model obtained based on the network training method of the first aspect;

[0036] Normalizing the cosine similarity between the predicted feature vector and all candidate feature vectors to obtain a weight proportion, and weighting and fusing the weight proportion and the discrete candidate value to output a final regression prediction result.

[0037] Preferably, the weighting and fusing of the weight proportion and the discrete candidate value comprises:

[0038] The cosine similarity between the predicted feature vector p and all candidate feature vectors is calculated by the calculation formula D m = cosd(p,C m ).

[0039] The weight proportion is calculated by the calculation formula E m = softmax(D m), normalizing the cosine similarity, and calculating a ratio of similarity of the input image sample data and the corresponding label value to each candidate feature vector;

[0040] by the calculation formula The final regression prediction result is calculated by weighting and fusing the weight proportion and the discrete candidate value.

[0041] Based on the above technical solutions, in the noise-containing unbalanced sample image regression network training method and application provided in the application, the continuous regression value is discretized into an ordered candidate value and an ordered feature space is constructed, a safety zone mechanism is constructed in combination with a relaxation factor, the label noise is allowed to fluctuate within a controllable range, the strong hypothesis limitation of the sample distribution by a traditional noise processing scheme is effectively eliminated, the gradient contribution of each type of sample is automatically balanced by a global negative sample pushing mechanism, the domain difference risk caused by a generative adversarial network and the cumbersome process of manual weight adjustment are avoided, continuous interpolation decoding is realized based on the similarity weighted fusion of the ordered feature manifold, the smooth output of the prediction value is ensured without step jumps, a closed-loop training process from discrete feature mapping to continuous regression output is formed, the robustness and generalization ability of the model in a noise and unbalanced coexisting scene are significantly improved while ensuring mathematical continuity and achieving efficient end-to-end training.

[0042] Compared with the prior art, the application has the following beneficial effects:

[0043] 1. In the application, the continuous regression value is discretized into an ordered candidate value and an ordered feature space is constructed, a safety zone mechanism is constructed in combination with a relaxation factor, the label noise is allowed to fluctuate within a controllable range, the coupling interference of noise and sample imbalance in an image regression task is effectively overcome, the dependence of a traditional noise processing scheme on a strong hypothesis of sample distribution is significantly reduced. In the training process, the noise tolerance and the adaptive adjustment of the sample distribution are simultaneously realized, the noise sample proportion does not need to be preset or the sample weight does not need to be manually intervened, the complexity and the artificial cost of the training strategy are greatly reduced, and the robustness and the generalization ability of the regression network under non-ideal labeling conditions are significantly improved. Specifically, the safety zone mechanism defined by the relaxation factor s allows the error of the label value within ±s candidate value units to not produce an error gradient, effectively shielding the negative influence of the noise; meanwhile, the gradient contribution of each type of sample in the training is automatically balanced by a global negative sample pushing mechanism, the cumbersome process of manually adjusting the sample weight and the domain difference risk possibly caused by a generative adversarial network are avoided, and efficient end-to-end training is realized.

[0044] 2. This application decouples the continuity of the regression value from the topological constraints of the feature space by constructing an ordered mathematical relationship between discrete candidate features based on a preset angle T, thereby ensuring the smoothness and accuracy of the prediction output. This design enables the model to learn a feature manifold with a clear geometric structure and a distance that is directly related to the difference in the labeled value. In the application stage, the predicted feature vector p is weighted and the discrete candidate values ​​are fused based on the cosine similarity between the predicted feature vector p and all candidate feature vectors, thereby achieving smooth interpolation decoding from the discrete feature space to the continuous regression value, ensuring that the prediction result has no step jump and maintaining the continuity of the regression task. Its end-to-end single network training architecture effectively avoids the high computational complexity and information loss introduced by the existing technology that relies on multi-stage cross-validation recognition noise or complex preprocessing processes. While simplifying the system implementation and improving training efficiency, it significantly maintains the computing performance advantages required for industrial-grade applications and the deployment efficiency in real scenarios. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0046] Figure 1 A schematic diagram of the image regression network training system architecture provided in an embodiment of the present application;

[0047] Figure 2 A schematic diagram of the overall process of the image regression network training method provided in an embodiment of the present application;

[0048] Figure 3 A schematic diagram of the positive and negative candidate feature vector screening process provided in an embodiment of the present application;

[0049] Figure 4 Schematic diagram of the joint training loss calculation process provided in the embodiment of the present application;

[0050] Figure 5 A schematic diagram of the overall process of the image regression network application provided in the embodiment of this application. DETAILED DESCRIPTION

[0051] To make the purposes, technical solutions, and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are some but not all of the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative work fall within the protection scope of the present application.

[0052] The training method and application of the image regression network with noisy and unbalanced samples provided by the embodiments of the present application can be applied to Figure 1 The training system 100 shown in FIG. 1, the training system 100 includes a data acquisition device 10, an edge server 20, a storage 30, an edge computing gateway 40, and a feedback device 50. Figure 1 The training system 100 shown in FIG. 1, the training system 100 includes a data acquisition device 10, an edge server 20, a storage 30, an edge computing gateway 40, and a feedback device 50.

[0053] The data acquisition device 10 is deployed at an image sample collection site and is configured to acquire image sample data to be processed and corresponding label values in real time, and transmit the image sample data packet and the corresponding label values to the edge server 20 through a data transmission channel.

[0054] The edge server 20 is configured to execute the core training logic of the regression network, generate discrete candidate values according to the label value range and the preset expected accuracy after receiving the image sample data and the label values transmitted by the data acquisition device 10, and construct an ordered feature space; filter a set of positive candidate feature vectors and negative candidate feature vectors based on a relaxation factor, calculate a pull-in loss and a push-away loss through a geometric constraint collaborative optimization mechanism, and drive end-to-end update of regression network parameters; meanwhile, the generated candidate feature vectors are stored in the storage 30, and the trained regression network model and the prediction data packet are forwarded to the edge computing gateway 40.

[0055] The storage 30 is configured to store the discrete candidate values, the set of candidate feature vectors, and the intermediate state data of the regression network generated by the edge server 20, provide real-time calling support for the ordered feature space in the training process, and respond to the data access request of the edge server 20 through a high-speed data bus.

[0056] The edge computing gateway 40 receives the regression network model and the prediction result transmitted by the edge server 20, performs data encapsulation and communication protocol conversion, and then distributes the processed data packet to the feedback device 50 through a low-latency network; meanwhile, the edge computing gateway 40 monitors the communication state between devices to ensure the continuity of the training process.

[0057] The feedback device 50 receives the regression prediction result and the model state data transmitted by the edge computing gateway 40, displays the training process through a graphical interface, and provides a visual analysis report of the prediction result to an operator.

[0058] To solve the technical problems of high computational complexity of training strategy, low efficiency of end-to-end optimization, and weak generalization ability in real scenarios caused by relying on low noise assumption, manual intervention sample balance operation, and introduction of multi-stage complex preprocessing process in the prior art, an unbalanced sample image regression network training method with noise is provided in the embodiments of the present application, comprising:

[0059] S1, collecting image sample data to be regressed and corresponding label values, generating M discrete candidate values V according to the range of the label values and the preset expected accuracy m ; wherein the preset expected accuracy W is set in advance according to experience;

[0060] S2, randomly generating candidate feature vectors based on the discrete candidate values, and constraining the included angles between the candidate feature vectors by cosine similarity loss;

[0061] S3, constructing a regression network to be trained with the image sample data as input and the predicted feature vector p as output; wherein the predicted feature vector p is a high-dimensional embedding vector extracted by the regression network to be trained from the image sample data;

[0062] S4, filtering out the positive candidate feature vector C q based on the label value y in the candidate feature vector, and filtering out the negative candidate feature vector set C u based on the preset relaxation factor s;

[0063] Wherein, the relaxation factor s is used to define the tolerance range of noise and control the boundary division of the positive candidate feature vector and the negative candidate feature vector set during training; the negative candidate feature vector set C u is all the candidate feature vectors with a distance exceeding the relaxation factor s from the positive candidate feature vector C q , {C u |u∈[1,q-s]∪[q+s,M]}.

[0064] S5, based on the predicted feature vector p, the positive candidate feature vector C q and the negative candidate feature vector set C u , jointly training the regression network to be trained after calculating the pull loss and the push loss by geometric constraint collaborative optimization.

[0065] Wherein, the pull loss is used to force the predicted feature vector p to approach the positive candidate feature vector C q ; and the push loss is used to force the predicted feature vector p to move away from the negative candidate feature vector set C u .

[0066] Based on this, the embodiments of the present application break through the double challenges of weak model robustness and poor generalization ability caused by the coupling of noise interference and sample imbalance in image regression tasks: by constructing a collaborative training mechanism of "discrete sequential feature space-relaxed safety zone-global gradient balance", the continuous regression value is discretized into candidate features with clear geometric constraints, the noise tolerance boundary is dynamically defined by the relaxation factor, and the adaptive adjustment of label error and distribution skew is realized; At the same time, the dual gradient constraint mechanism of pull loss and push loss is innovatively introduced, which synchronously optimizes the feature space anchoring and negative sample repulsion during the training process, effectively avoids the information loss and calculation redundancy caused by traditional multi-stage preprocessing, and significantly improves the prediction accuracy and anti-interference ability of the model in industrial complex scenes.

[0067] As shown in Figure 2 , the image regression network training method with imbalanced sample images with noise provided by the embodiments of the present application comprises:

[0068] S1, collect image sample data to be regressed and corresponding label values, generate M discrete candidate values V according to the range of label values and the preset expected accuracy W m ; wherein the preset expected accuracy W is set in advance according to experience;

[0069] In some implementation modes, the global image dataset of the regression task to be collected is extracted, and the label values of all image sample data are counted and the global maximum value L max and the minimum value L min are counted; according to the preset expected accuracy, the label value range is equally spaced and cut, and the generated discrete candidate value sequence is used as the numerical basis for constructing an ordered feature space.

[0070] It should be noted that,

[0071] The number M of discrete candidate values is calculated as follows: Wherein, W is the preset expected accuracy, is the calculation result of , and the upper integer is taken;

[0072] The discrete candidate value V m is calculated as follows: V m = L min +m×W; wherein m=1,2,3,…,M.

[0073] S2, randomly generate candidate feature vectors based on discrete candidate values, and constrain the included angle between candidate feature vectors by cosine similarity loss;

[0074] In some implementations, an N-dimensional initial eigenvector is randomly generated for each discrete candidate value and arranged in ascending order according to the numerical values ​​of the discrete candidate values; a pairwise cosine similarity matrix of all candidate eigenvectors is calculated, where the cosine similarity is achieved by multiplying the candidate eigenvector matrix after L2 norm normalization; a first loss function is calculated based on the cosine similarity, which is generated by counting the mean of the absolute deviations between the measured similarity of each pair of candidate eigenvectors and their target similarity, where the target similarity is determined by the product of the cosine value of the eigenvector index spacing and a preset target angle T; the candidate eigenvectors are iteratively updated by minimizing the first loss function, forcing the spatial angle of adjacent candidate eigenvectors to stably converge to the preset value T.

[0075] It should be noted that

[0076] Calculation method of cosine similarity: D a,b =norm(C)@norm(C T ); where D a,b represents the cosine similarity between the a-th candidate feature vector and the b-th candidate feature vector; norm(*) represents L2norm calculation, @ represents matrix multiplication calculation, C is the set of candidate feature vectors; a, b = 1, 2, 3, ..., M;

[0077] The calculation method of the first loss is:

[0078] Update the calculation method of candidate feature vectors:

[0079] S3. Construct a regression network to be trained whose input is the image sample data and whose output is the predicted feature vector p; wherein the predicted feature vector p is a high-dimensional embedding vector extracted by the regression network to be trained from the image sample data;

[0080] In some implementations, a deep convolutional neural network, such as ResNet-34, is used as the basic skeleton, its original classification head is removed, and a fully connected layer is added as the output end. The dimension of the network output layer is set to the same N-dimensional space as the candidate feature vector, and the activation function uses linear activation; the input sample data is standardized and then input into the regression network to be trained; the network extracts the deep semantic features of the image step by step through a multi-layer convolution structure, compresses the spatial features into a compact vector representation through a global pooling layer, and maps the basic features to the N-dimensional space of the same dimension as the candidate feature vector through a fully connected layer to generate a predicted feature vector p.

[0081] For example, in the application of pig back fat thickness measurement, the specific processing flow of the regression network to be trained is as follows: first, the collected RGB image of the pig's back is standardized to eliminate the influence of illumination changes; then it is input into the ResNet-34 architecture, and multi-level visual features from edge texture to deep fat tissue are gradually extracted through five groups of residual convolution layers; after compression through the global average pooling layer, a 512-dimensional basic feature vector is obtained; finally, the feature is projected into a 128-dimensional candidate feature space through a fully connected layer to generate a predicted feature vector p.

[0082] S4. Filter out the positive candidate feature vector C from the candidate feature vectors based on the label value y q , based on the preset relaxation factor s, the negative candidate feature vector set C is screened out from the candidate feature vectors u ;

[0083] Among them, the relaxation factor s is used to define the tolerance range of noise and control the boundary division of the positive candidate feature vector and the negative candidate feature vector set during training; the negative candidate feature vector set C u For all positive candidate feature vectors C q Candidate feature vectors whose distance exceeds the relaxation factor s, {C u |u∈[1,qs]∪[q+s,M]};

[0084] In some implementations, see Figure 3 As shown, by calculating the label value y corresponding to the image sample data to be trained and all discrete candidate values ​​V m The absolute difference between the two, locate the index q corresponding to the minimum difference, and thus determine the positive candidate feature vector C q ; Based on the preset relaxation factor s, a noise tolerance safety zone is constructed. The range of the safety zone is (qs,q+s), ensuring that the fluctuation of the annotation value within this range will not trigger the wrong gradient; Screen the negative candidate feature vector set C u , contains all candidate feature vectors with indices in the range [1,qs] and [q+s,M], which will be forced to be excluded in subsequent training.

[0085] S5, based on the predicted feature vector p, the positive candidate feature vector C q and negative candidate feature vector set C u After calculating the pull-in loss and push-out loss through geometric constraint collaborative optimization, the regression network to be trained is jointly trained;

[0086] Among them, the pull-up loss is used to force the predicted feature vector p to approach the positive candidate feature vector C q ; Push loss is to force the predicted feature vector p to stay away from the negative candidate feature vector set C u .

[0087] In some implementations, refer to Figure 4 As shown, by maximizing the cosine similarity between the predicted feature vector p and the positive candidate feature vector C q , the pull-in loss is calculated to force the network to anchor the sample feature to the feature space position corresponding to the label value; by requiring the cosine similarity between the predicted feature vector p and each negative candidate feature vector to be less than the feature space repulsion threshold (|q-u| x cos(T)) mapped by the discrete candidate value distance, the network is forced to push the sample feature away from the feature region corresponding to the label value; the two loss functions are jointly backpropagated to drive the regression network parameter update.

[0088] It should be noted that the pull-in loss ensures accurate positioning in the feature space, and the push-away loss establishes a multi-level repulsion barrier to prevent feature drift; noise filtering and distribution balancing are simultaneously achieved in a single forward propagation, without the need for multi-stage preprocessing; adaptive gradient strength is established through the repulsion threshold mapped by the feature distance, avoiding manual weight adjustment; the global negative sample participates in optimization to form a natural sample balancing mechanism, eliminating the influence of distribution skew.

[0089] For example, in a pig back fat thickness measurement application, the specific implementation flow is as follows: when the input labeled value is a pig back image sample of 12.3 mm: the positive candidate feature vector is located as C 25 (corresponding to 12.5 mm, since |12.3-12.5|=0.2 is the smallest difference); based on the relaxation factor s=3, the negative candidate set is screened, the candidates within the safe zone [22, 28] are excluded, and the distal negative candidates such as C 15 (7.5 mm) and C 35 (17.5 mm) are selected; after the regression network outputs the predicted feature vector p: the pull-in loss is calculated to force the cosine similarity between p and C 25 to increase from 0.85 to 0.92; the push-away loss is calculated simultaneously to force the similarity between p and C 15 to decrease from 0.45 to 0.32 (lower than the threshold |25-15| x cos60°=10 x 0.5=5.0); the dual loss jointly backpropagates the gradient to update the network weights, and the noisy labeled sample avoids incorrect gradients due to the safety mechanism; the distal negative candidate feature vector set participates in gradient balancing to eliminate distribution skew.

[0090] As shown in Figure 5 , the present example also provides a noisy and unbalanced sample image regression network application, comprising:

[0091] Obtaining image sample data to be regressed;

[0092] Inputting the image sample data into the trained regression network to obtain a predicted feature vector, wherein the trained regression network is a model obtained based on a noisy and unbalanced sample image regression network training method;

[0093] The cosine similarity of the normalized prediction feature vector and all candidate feature vectors is weighted to obtain a weight proportion, and the weight proportion and the discrete candidate value are fused to output a final regression prediction result.

[0094] In some implementations, image sample data to be regressed is obtained; the image sample data is input into the trained regression network to obtain a prediction feature vector p; the cosine similarity of the prediction feature vector p and all candidate feature vectors C m is calculated to obtain an original similarity set D m ; the D m is subjected to softmax normalization processing to convert the similarity into a weight proportion E m , which ensures that the sum of all weights is 1 and highlights the most relevant discrete candidate value; the weight proportion E m is fused with the discrete candidate value V m to output a final regression prediction result y'.

[0095] It should be noted that the probability weight distribution is established by similarity normalization to overcome the step jump problem caused by discrete candidate values; the smooth interpolation between discrete candidate values is realized by using the geometric continuity of the ordered feature space to ensure the mathematical continuity of the prediction result; and the end-to-end fusion mechanism avoids the information loss introduced by traditional post-processing.

[0096] For example, in the application of measuring the back fat thickness of a pig, the implementation flow is as follows: the prediction feature vector p and the candidate vector set are calculated for similarity, where the similarities of C 23 (11.5mm), C 24 (12.0mm), and C 25 (12.5mm) are 0.68, 0.92, and 0.85, respectively; the weight proportions E 23 = 0.18, E 24 = 0.42, and E 25 = 0.40 are obtained by softmax normalization; and the final fat thickness value y' = 0.18 x 11.5 + 0.42 x 12.0 + 0.40 x 12.5 = 12.17mm is calculated by weighted fusion. The result has an error of only 0.03mm from the artificial measurement value 12.2mm, verifying the decoding accuracy.

[0097] The above examples are only used to illustrate the technical method of the present application and not to limit it. Although the present application has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical method of the present application can be modified or replaced equivalently without departing from the spirit and scope of the technical method of the present application.

Claims

1. A method for training a regression network for an image with unbalanced samples containing noise, characterized in that: include: Collect the image sample data to be regressed and the corresponding annotation values, and generate M discrete candidate values ​​according to the range of the annotation values ​​and the preset expected accuracy; Randomly generate candidate feature vectors based on the discrete candidate values, and constrain the angles between the candidate feature vectors by using cosine similarity loss; Construct a regression network to be trained whose input is the image sample data and whose output is the predicted feature vector p; wherein the predicted feature vector p is a high-dimensional embedding vector extracted by the regression network to be trained from the image sample data; Based on the label value y, the positive candidate feature vector C is selected from the candidate feature vectors. q , based on the preset relaxation factor s, the negative candidate feature vector set C is screened out from the candidate feature vectors u ; Wherein, the relaxation factor s is used to control the boundary division of the positive candidate feature vector and the negative candidate feature vector set during the training of the regression network to be trained; Based on the predicted feature vector p, the positive candidate feature vector C q and negative candidate feature vector set C u After calculating the pull-in loss and push-out loss through geometric constraint collaborative optimization, the regression network to be trained is jointly trained.

2. The method for training a regression network for an unbalanced sample image with noise according to claim 1, wherein: The generating of M discrete candidate values ​​according to the range of the marked value and the preset expected accuracy includes: Extract the maximum dimension value L among the dimension values max and the minimum dimension value L min ; By calculation Calculate the number of discrete candidate values ​​M; where W is the preset expected accuracy, For The calculation result of is rounded up; By calculating the formula V m =L min +m×W, calculate the discrete candidate value V m ; where m = 1, 2, 3,…, M.

3. The method for training a regression network for an unbalanced sample image with noise according to claim 1, wherein: The method of constraining the angle between candidate feature vectors by using cosine similarity loss includes: Arrange the candidate feature vectors in ascending order of discrete candidate values; By calculating the formula D a,b =norm(C)@norm(C T ), calculate the cosine similarity between two candidate feature vectors; wherein, the D a,b represents the cosine similarity between the a-th candidate feature vector and the b-th candidate feature vector, norm(*) represents L2norm calculation, @ represents matrix multiplication calculation, C is the set of candidate feature vectors, a, b = 1, 2, 3, ..., M; By calculation Calculate the first loss; By calculation Update the candidate feature vectors so that the angle between adjacent vectors is fixed at the preset value T.

4. The method for training a regression network for an unbalanced sample image with noise according to claim 1, wherein: The positive candidate feature vector C is selected from the candidate feature vectors based on the label value y. q The index q satisfies:

5. The method for training a regression network for an unbalanced sample image with noise according to claim 1, wherein: The negative candidate feature vector set C u The index u satisfies: u∈[1,qs]∪[q+s,M].

6. The method for training a regression network for an unbalanced sample image with noise according to claim 1, wherein: The calculation formula of the close loss is: loss2 = log(1+exp(-cosd(p,C q ))), wherein the close loss is used to minimize the relationship between the predicted feature vector p and the positive candidate feature vector C q The cosine deviation of the angle; the cosd(p,C q ) represents the predicted feature vector p and the positive candidate feature vector C q The cosine similarity of .

7. The method for training a regression network for an unbalanced sample image with noise according to claim 1, wherein: The calculation formula of the push-out loss is: The push-off loss is used to force the predicted feature vector p to stay away from the negative candidate feature vector set C u .

8. The method for training a regression network for an unbalanced sample image with noise according to claim 7, wherein: Jointly training the regression network to be trained, including: Let the predicted feature vector p and the negative candidate feature vector set C u The angle between is greater than the angle between the predicted feature vector p and the positive candidate feature vector; Calculate the approximation loss loss2 by using the approximation loss calculation formula; Calculate the push-out loss loss3 using the push-out loss calculation formula; By calculation The regression network to be trained is trained, wherein the param(R) is a learnable parameter of the regression network to be trained.

9. The method for training a regression network for an unbalanced sample image with noise according to claim 3, wherein: The first loss is used to enforce that the spatial geometric relationship of all candidate feature vectors is consistent with the numerical order of the corresponding discrete candidate values.

10. An application of a regression network for unbalanced sample images with noise, characterized in that: include: Obtain image sample data to be regressed; Inputting the image sample data into a trained regression network to obtain a prediction feature vector, wherein the trained regression network is a model obtained based on the method for training an image regression network for unbalanced samples with noise according to any one of claims 1 to 9; The cosine similarity between the normalized predicted feature vector and all candidate feature vectors is used to obtain the weight ratio, and the weight ratio and discrete candidate values ​​are weightedly fused to output the final regression prediction result.

Citation Information

Patent Citations

  • Text recognition model training method and device, text recognition method and device and electronic equipment

    CN114022887A

  • Image regression model training method, image regression analysis method, medium and terminal

    CN115240029A

  • Robust image classification method on label noisy data

    CN116468938A

  • Three-way decision active learning method based on elastic network

    CN120071056A

  • Graphic type identification method and apparatus, electronic device and readable storage medium

    WO2025043627A1