Image processing model training method and device, electronic equipment and storage medium
By training the model using target and background image samples, the problems of poor generalization ability and high false detection rate of the network model are solved, and efficient and accurate image processing is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HANGZHOU HIKROBOT TECH CO LTD
- Filing Date
- 2022-09-08
- Publication Date
- 2026-06-02
AI Technical Summary
Existing technologies tend to overfit network models trained in a single scenario, leading to false detections when the scenario changes. They also exhibit poor generalization ability, low training efficiency for generated image samples, and a high false detection rate.
The model is trained using both labeled target image samples and unlabeled background image samples. By extracting image features and predicting labels, the model parameters are adjusted until convergence, thereby improving the model's generalization ability and training efficiency.
It effectively reduces the false detection rate of image processing models, improves the accuracy of models in image processing, and improves training efficiency without the need to generate additional image samples.
Smart Images

Figure CN115661564B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of deep learning model training technology, and in particular to training methods, apparatus, electronic devices and storage media for image processing models. Background Technology
[0002] Training a network model in a single scene is relatively simple, but the trained network model is prone to overfitting. As a result, when the scene changes, the network model may detect some interference objects that are different from the original background as targets, which leads to false detections and poor generalization ability of the network model.
[0003] To improve the generalization ability of the network model, it is necessary to train the model with a large number of image samples with rich backgrounds and targets. Related technologies use image sample generation methods to generate a large number of image samples with different backgrounds based on existing image samples.
[0004] However, in the above method, the model training efficiency is relatively low because an additional image generation step is required before model training. Furthermore, there are certain differences between the generated image samples and the real image samples. Therefore, the network model trained using the generated image samples has a high false detection rate and poor detection accuracy. Summary of the Invention
[0005] The purpose of this invention is to provide a training method, apparatus, electronic device, and storage medium for image processing models, so as to improve the efficiency of model training and reduce the false detection rate of image processing models. The specific technical solutions are as follows:
[0006] In a first aspect, embodiments of the present invention provide a method for training an image processing model, the method comprising:
[0007] Acquire image samples, wherein the image samples include target image samples with calibration labels and background image samples without calibration labels;
[0008] The image samples are input into the model to be trained, and the image features of the target image samples and the image features of the background image samples are extracted.
[0009] Based on the image features of the target image sample and the image features of the background image sample, the predicted label corresponding to the image sample is determined;
[0010] Based on the difference between the calibrated label and the predicted label, the model parameters of the model to be trained are adjusted until the model to be trained converges, thus obtaining the image processing model.
[0011] Optionally, the step of inputting the image samples into the model to be trained and extracting the image features of the target image samples and the image features of the background image samples includes:
[0012] If the image processing model is a model for mixed scenes, the target image sample and the background image sample are input into the first image feature extractor to extract the first image feature of the target image sample and the second image feature of the background image sample;
[0013] If the image processing model is a model for a specific scene, the target image sample is input into the second image feature extractor to extract the third image feature of the target image sample, and the background image sample is input into the third image feature extractor to extract the fourth image feature of the background image sample, wherein the target image sample is an image acquired against the background corresponding to the background image sample.
[0014] Optionally, the image processing model is a model for mixed scenes, and the step of adjusting the model parameters of the model to be trained based on the difference between the labeled label and the predicted label includes:
[0015] If the current input image is a background image sample without a label, the learning weights corresponding to the target position in the first image feature extractor are adjusted according to a preset method to reduce the learning weights. The target position is the position where the first image feature extractor extracts the second image features from the background image sample.
[0016] Based on the difference between the calibrated label and the predicted label and the preset loss function, the category loss and coordinate regression loss corresponding to the current input image are determined;
[0017] The backpropagation weights corresponding to the category loss are determined based on the adjusted learning weights and the category loss.
[0018] The model parameters of the model to be trained are adjusted according to the backpropagation weights corresponding to the category loss and the first preset backpropagation weights corresponding to the coordinate regression loss.
[0019] Optionally, the step of adjusting the learning weights corresponding to the target position in the first image feature extractor according to a preset method includes:
[0020] The learning weight α corresponding to the target location in the first image feature extractor is determined according to the following formula:
[0021]
[0022] Where n is the number of background image samples included in the image sample, batch is the total number of image samples, and β is a preset user parameter.
[0023] Optionally, the image processing model is a model for a specific scene, and the step of determining the predicted label corresponding to the image sample based on the image features of the target image sample and the image features of the background image sample includes:
[0024] The third image feature is fused with the fourth image feature to obtain the fused image feature;
[0025] Based on the fused image features, the predicted label corresponding to the image sample is determined.
[0026] Optionally, the image processing model is a model for a specific scene, and the step of adjusting the model parameters of the model to be trained based on the difference between the labeled label and the predicted label includes:
[0027] Based on the difference between the calibrated label and the predicted label, and a preset loss function, the category loss and coordinate regression loss corresponding to the target image sample are determined;
[0028] The model parameters of the model to be trained are adjusted based on the second preset backpropagation weights corresponding to the category loss and the third preset backpropagation weights corresponding to the coordinate regression loss.
[0029] Optionally, the method further includes:
[0030] Obtain the image to be processed;
[0031] The image to be processed is input into the image processing model to obtain the processing result output by the image processing model; or,
[0032] Obtain the background image corresponding to the image to be processed, input the image to be processed and the background image into the image processing model, and obtain the processing result output by the image processing model.
[0033] Secondly, embodiments of the present invention provide a training apparatus for an image processing model, the apparatus comprising:
[0034] An image sample acquisition module is used to acquire image samples, wherein the image samples include target image samples with calibration labels and background image samples without calibration labels;
[0035] An image feature extraction module is used to input the image samples into the model to be trained and extract the image features of the target image samples and the image features of the background image samples.
[0036] The prediction label determination module is used to determine the prediction label corresponding to the image sample based on the image features of the target image sample and the image features of the background image sample;
[0037] The model parameter adjustment module is used to adjust the model parameters of the model to be trained according to the difference between the calibration label and the predicted label until the model to be trained converges to obtain the image processing model.
[0038] Optionally, the image feature extraction module includes:
[0039] The first image feature extraction unit is used to input the target image sample and the background image sample into the first image feature extractor when the image processing model is a model for mixed scenes, and extract the first image feature of the target image sample and the second image feature of the background image sample;
[0040] The second image feature extraction unit is used to input the target image sample into the second image feature extractor to extract the third image feature of the target image sample when the image processing model is a model for a specific scene, and to input the background image sample into the third image feature extractor to extract the fourth image feature of the background image sample, wherein the target image sample is an image acquired under the background corresponding to the background image sample.
[0041] Optionally, the model parameter adjustment module includes:
[0042] The learning weight adjustment unit is used to adjust the learning weight corresponding to the target position in the first image feature extractor according to a preset method when the current input image is a background image sample without a label, in the case that the image processing model is a model for mixed scenes, so as to reduce the learning weight. The target position is the position where the first image feature extractor extracts the second image feature from the background image sample.
[0043] The first loss determination unit is used to determine the category loss and coordinate regression loss corresponding to the current input image based on the difference between the calibration label and the predicted label and a preset loss function;
[0044] The backpropagation weight determination unit is used to determine the backpropagation weights corresponding to the category loss based on the adjusted learning weights and the category loss.
[0045] The first model parameter adjustment unit is used to adjust the model parameters of the model to be trained according to the backpropagation weights corresponding to the category loss and the first preset backpropagation weights corresponding to the coordinate regression loss.
[0046] Optionally, the learning weight adjustment unit is specifically used for:
[0047] The learning weight α corresponding to the target location in the first image feature extractor is determined according to the following formula:
[0048]
[0049] Where n is the number of background image samples included in the image sample, batch is the total number of image samples, and β is a preset user parameter.
[0050] Optionally, the predicted label determination module includes:
[0051] The image feature fusion unit is used to fuse the third image feature with the fourth image feature when the image processing model is a model for a specific scene, so as to obtain the fused image feature;
[0052] The prediction label determination unit is used to determine the prediction label corresponding to the image sample based on the fused image features.
[0053] Optionally, the model parameter adjustment module includes:
[0054] The second loss determination unit is used to determine the category loss and coordinate regression loss corresponding to the target image sample based on the difference between the calibration label and the predicted label and a preset loss function, when the image processing model is a model for a specific scene.
[0055] The second model parameter adjustment unit is used to adjust the model parameters of the model to be trained based on the second preset backpropagation weights corresponding to the category loss and the third preset backpropagation weights corresponding to the coordinate regression loss.
[0056] Optionally, the device further includes:
[0057] The image acquisition module is used to acquire the image to be processed.
[0058] The processing result determination module is used to input the image to be processed into the image processing model to obtain the processing result output by the image processing model; or, it is used to obtain the background image corresponding to the image to be processed, input the image to be processed and the background image into the image processing model to obtain the processing result output by the image processing model.
[0059] Thirdly, embodiments of the present invention provide an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus;
[0060] Memory, used to store computer programs;
[0061] When the processor executes the program stored in the memory, it implements the training method steps of any of the image processing models described in the first aspect above.
[0062] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the training method steps of any of the image processing models described in the first aspect.
[0063] Beneficial effects of the embodiments of the present invention:
[0064] In the solution provided by this embodiment of the invention, an electronic device can acquire image samples, wherein the image samples include target image samples with labels and background image samples without labels; the image samples are input into a model to be trained, and image features of the target image samples and the background image samples are extracted; based on the image features of the target image samples and the background image samples, a predicted label corresponding to the image sample is determined; according to the difference between the labeled label and the predicted label, the model parameters of the model to be trained are adjusted until the model to be trained converges, thus obtaining an image processing model. Because the electronic device in this embodiment of the invention uses both labeled target image samples and unlabeled background image samples to train the model, the trained image processing model can effectively distinguish between the target and the background, greatly reducing the false detection rate of the image processing model and improving the accuracy of the image processing model when processing images. Furthermore, because existing image samples can be used for training without the need to generate additional image samples, the model training efficiency is also relatively high. Of course, implementing any product or method of this invention does not necessarily require achieving all of the above advantages simultaneously. Attached Figure Description
[0065] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other embodiments can be obtained based on these drawings.
[0066] Figure 1 A flowchart illustrating a training method for an image processing model provided in an embodiment of the present invention;
[0067] Figure 2 for Figure 1 A specific flowchart of step S104 in the illustrated embodiment;
[0068] Figure 3 for Figure 1 A specific flowchart of step S103 in the illustrated embodiment;
[0069] Figure 4 for Figure 1 Another specific flowchart of step S104 in the illustrated embodiment;
[0070] Figure 5 For based on Figure 1 A flowchart of an image processing method according to the embodiment shown;
[0071] Figure 6 For based on Figure 1 A specific flowchart of the training method for the image processing model in the illustrated embodiment;
[0072] Figure 7 A schematic diagram of the structure of a training device for an image processing model provided in an embodiment of the present invention;
[0073] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0074] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art based on this application are within the scope of protection of the present invention.
[0075] To improve the efficiency of model training and reduce the false detection rate of image processing models, embodiments of the present invention provide a training method, apparatus, electronic device, computer-readable storage medium, and computer program product for image processing models. The training method for an image processing model provided by an embodiment of the present invention will be described first below.
[0076] The image processing model training method provided in this embodiment of the invention can be applied to any electronic device that needs to train an image processing model, such as a server, processing device, etc., without specific limitations. For clarity, it will be referred to as an electronic device below.
[0077] like Figure 1 As shown, a training method for an image processing model includes:
[0078] S101, Obtain image samples.
[0079] The image samples include target image samples with calibration labels and background image samples without calibration labels.
[0080] S102, input the image sample into the model to be trained, and extract the image features of the target image sample and the image features of the background image sample.
[0081] S103, Based on the image features of the target image sample and the image features of the background image sample, determine the predicted label corresponding to the image sample.
[0082] S104, adjust the model parameters of the model to be trained according to the difference between the calibration label and the predicted label until the model to be trained converges to obtain the image processing model.
[0083] As can be seen, in the solution provided by the embodiments of the present invention, the electronic device can acquire image samples, wherein the image samples include target image samples with labels and background image samples without labels; the image samples are input into the model to be trained, and the image features of the target image samples and the background image samples are extracted; based on the image features of the target image samples and the background image samples, the predicted label corresponding to the image sample is determined; according to the difference between the labeled label and the predicted label, the model parameters of the model to be trained are adjusted until the model to be trained converges, thus obtaining the image processing model. Because the electronic device uses both labeled target image samples and unlabeled background image samples to train the model, the trained image processing model can effectively distinguish between the target and the background, greatly reducing the false detection rate of the image processing model and improving the accuracy of the image processing model in processing images. Furthermore, because existing image samples can be used for training without the need to generate additional image samples, the model training efficiency is also relatively high.
[0084] When a deep learning model for image processing needs to be trained, the electronic device can acquire target image samples with labels and background image samples without labels as image samples for training the model, i.e., perform step S101 above. In this way, since existing image samples can be used as image samples for training the model, there is no need to generate additional image samples, thus improving the efficiency of model training. The image processing model trained by the electronic device can be an image classification model, object detection model, semantic segmentation model, instance segmentation model, or panoptic segmentation model, etc., without specific limitations.
[0085] After acquiring image samples, the electronic device can use these image samples to train the training model, i.e., execute steps S102-S104 above, until the training model converges, thus obtaining the image processing model. In this way, because the image processing model is trained using target image samples and background image samples, it can effectively distinguish between the target and the background, greatly reducing the likelihood of detecting background interference as the target, i.e., lowering the false detection rate of the image processing model, thereby improving the accuracy of the image processing model when processing images.
[0086] Specifically, after acquiring image samples, the electronic device can input the image samples into the model to be trained and extract the image features of the image samples, i.e., perform the above step S102. Because the image samples can include target image samples with labels and background image samples without labels, the extracted image features can also correspondingly include the image features of the target image samples and the image features of the background image samples.
[0087] After acquiring the image features of the target image sample and the background image sample, the electronic device can determine the predicted label corresponding to the image sample based on the acquired image features, i.e., perform the above step S103. The predicted label can include different content depending on the type of image processing model. For example, when the image processing model is an image classification model, the predicted label can include the target type in the image sample; when the image processing model is an object detection model, the predicted label can include a bounding box identifying the target to be detected in the image sample; when the image processing model is a semantic segmentation model, the predicted label can include the target segmented from the image sample; when the image processing model is an instance segmentation model, the predicted label can include the target to be detected segmented from the image sample, as well as the annotation of the target; when the image processing model is a panoptic segmentation model, the predicted label can include the target segmented from the image sample, as well as the annotation of the target.
[0088] After determining the predicted label corresponding to the image sample, the electronic device can judge whether the result of the current training model in processing the image meets the preset requirements by measuring the difference between the labeled label and the predicted label. If the preset requirements are not met, the training model needs to continue. At this time, the electronic device can adjust the model parameters of the training model according to the difference between the labeled label and the predicted label until the training model converges, thus obtaining the image processing model, i.e., executing the above step S104.
[0089] In one implementation, the electronic device can determine whether the difference between the calibrated label and the predicted label is not greater than a preset threshold. If it is not greater, it indicates that the model to be trained has converged, and training can end, with the model to be trained becoming the image processing model. If it is greater, it indicates that the result of the current model to be trained processing the image cannot meet the preset requirements, and the model to be trained needs to continue training.
[0090] In the solution provided by the embodiments of the present invention, the electronic device can use target image samples and background image samples to train the model to be trained. In this way, on the one hand, the step of image generation can be omitted, improving the training efficiency of the model; on the other hand, the image processing model trained using target image samples and background image samples can distinguish between the target and the background well, greatly reducing the false detection rate of the image processing model and improving the accuracy of the image processing model when processing images.
[0091] As one embodiment of the present invention, the step of inputting the image samples into the model to be trained and extracting the image features of the target image samples and the image features of the background image samples may include:
[0092] If the image processing model is a model for mixed scenes, the target image sample and the background image sample are input into the first image feature extractor to extract the first image feature of the target image sample and the second image feature of the background image sample;
[0093] If the image processing model is a model for a specific scene, the target image sample is input into the second image feature extractor to extract the third image feature of the target image sample, and the background image sample is input into the third image feature extractor to extract the fourth image feature of the background image sample.
[0094] In addition to being image classification models, object detection models, semantic segmentation models, instance segmentation models, or panoptic segmentation models, the image processing models in this embodiment of the invention can also be further divided into models for mixed scenes and models for specific scenes. For example, when the image processing model is an object detection model, it can be further divided into object detection models for mixed scenes and object detection models for specific scenes.
[0095] In this context, "specific scenario" refers to using a labeled image and its corresponding background image as image sample pairs, inputting them into an object detection model through two inputs. The model then fuses the image features of the labeled image and the corresponding background image to train the model. This method requires the labeled image and background image to be from the same scene, but the richness requirement for the background image is relatively low. "Mixed scenario" refers to inputting a labeled image and a rich background image into an object detection model through a single input for training. This method requires a rich background image, but does not require the labeled image and background image to be from the same scene.
[0096] In other words, "mixed scene" and "scene-specific" actually refer to two methods for solving the background false detection problem. It doesn't mean that a target detection model used for mixed scenes can perform target detection on images in multiple scenes, while a target detection model used for scene-specific scenes can only perform target detection on images in that specific scene. In fact, a target detection model for scene-specific scenes can also perform target detection on images in any scene. It simply requires acquiring a background image without targets in the new scene as the background image, and then inputting this background image and the target image acquired in that new scene as an image pair into the target detection model. The choice between the mixed scene method and the scene-specific method can be made to solve the background false detection problem based on the actual application requirements.
[0097] In one implementation, when the image processing model is a model for mixed scenes, the image processing model can be understood as a general model. In the solution provided by the embodiments of the present invention, the electronic device can use a background image without a target to train the model, and the background image sample and the target image sample can share a feature extractor. Therefore, after the electronic device obtains the target image sample and the background image sample, it can input both the target image sample and the background image sample into the first image feature extractor, and extract the features of the target image sample as the first image feature and extract the features of the background image sample as the second image feature.
[0098] In another implementation, when the image processing model is designed for a specific scene, after acquiring a background image sample and a target image sample captured against the background image sample, the electronic device can input the target image sample and the background image sample into the feature extractor corresponding to the target image sample (i.e., the second image feature extractor) and the feature extractor corresponding to the background image sample (i.e., the third image feature extractor) through a two-branch input network. In other words, the target image sample and the background image sample are extracted using different feature extractors. The electronic device can extract features from the target image sample using the second image feature extractor as the third image feature, and extract features from the background image sample using the third image feature extractor as the fourth image feature.
[0099] In the solution provided by this invention, the electronic device can select either a general image feature extractor or a specific image feature extractor corresponding to the target image sample and the background image sample to extract features from the image sample, depending on the type of image processing model. This provides greater flexibility. Furthermore, when the image processing model is for mixed scenes, since the input image samples can be images from multiple scenes, the trained image processing model can be applied to image processing in different scenes. When the image processing model is for a specific scene, although the input image samples are images from a specific scene, different feature extractors are used to extract the image features of the target image sample and the background image sample respectively. Since the target image sample is acquired against the background corresponding to the background image sample, the trained image processing model can still be applied to image processing in different scenes. Simply input the image to be processed and its corresponding background image as image sample pairs into the image processing model during image processing.
[0100] As one embodiment of the present invention, such as Figure 2 As shown, when the image processing model is a model for mixed scenes, the step of adjusting the model parameters of the model to be trained based on the difference between the labeled label and the predicted label may include:
[0101] S201, if the current input image is a background image sample without a label, adjust the learning weights corresponding to the target position in the first image feature extractor according to a preset method to reduce the learning weights.
[0102] Since electronic devices use target image samples and background image samples as image samples, and when the image processing model is a model for mixed scenes, the target image samples and background image samples are input into a general feature extractor, namely the first image feature extractor, for feature extraction, there is a problem of imbalance between positive and negative samples of the foreground class and the background class.
[0103] Specifically, this is because the target image samples include both foreground and background samples, while the background image samples only include background samples. Furthermore, the target image samples and background image samples are input into a general feature extractor for feature extraction. This results in fewer foreground samples and more background samples, which means there is an imbalance between positive and negative samples in the foreground and background classes.
[0104] Therefore, when the electronic device determines that the current input image is a background image sample without a label, it can adjust the learning weight corresponding to the target position in the first image feature extractor in a preset manner. That is, it can adjust the learning weight corresponding to the position where the first image feature extractor extracts the second image feature from the background image sample, so as to reduce the learning weight of the model for the background class sample, thereby keeping the positive and negative samples of the foreground class and the background class balanced in the training of the model.
[0105] S202, based on the difference between the calibrated label and the predicted label and the preset loss function, determine the category loss and coordinate regression loss corresponding to the current input image;
[0106] When the loss is divided into category loss and coordinate regression loss, the electronic device can determine the category loss and coordinate regression loss corresponding to the current input image based on the difference between the calibration label and the predicted label and the preset loss function. The category loss represents the difference between the target categories included in the calibration label and the predicted label, and the coordinate regression loss represents the difference between the coordinates of the targets segmented from the image samples included in the calibration label and the predicted label.
[0107] When calculating the category loss corresponding to the current input image, the preset loss function can be the 0-1 loss function. When calculating the coordinate regression loss corresponding to the current input image, the preset loss function can be the squared loss function or the absolute value loss function, etc. These are all reasonable and are not specifically limited here.
[0108] S203, determine the backpropagation weights corresponding to the category loss based on the adjusted learning weights and the category loss;
[0109] Since the current input image is a background image sample without a label, there is no target box in the current input image. Therefore, when updating the backpropagation weights corresponding to the loss using the adjusted learning weights, it is not necessary to update the coordinate regression loss. Thus, after the electronic device determines the adjusted learning weights, class loss, and coordinate regression loss through the above steps S201 and S202, it can update the backpropagation weights corresponding to the class loss only based on the adjusted learning weights.
[0110] In one implementation, after determining the adjusted learning weights and the category loss, the electronic device can update the original backpropagation weights corresponding to the category loss based on the adjusted learning weights. For example, the adjusted learning weights can be multiplied by the original backpropagation weights corresponding to the category loss to obtain the updated backpropagation weights, and the updated backpropagation weights can be used to determine the backpropagation weights corresponding to the category loss.
[0111] S204, adjust the model parameters of the model to be trained according to the backpropagation weights corresponding to the category loss and the first preset backpropagation weights corresponding to the coordinate regression loss.
[0112] After determining the backpropagation weights corresponding to the category loss through step S203, i.e., updating the backpropagation weights corresponding to the category loss, the electronic device can adjust the model parameters of the model to be trained based on the updated backpropagation weights corresponding to the category loss and the original backpropagation weights corresponding to the coordinate regression loss, so as to reduce the false detection rate of the image processing model and improve the accuracy of the model to be trained when processing images. Steps S201-S204 are repeated to continuously adjust the model parameters of the model to be trained, and finally the model to be trained converges to obtain the image processing model.
[0113] In the solution provided by the embodiments of the present invention, when the image processing model of the electronic device is a model for mixed scenes, and the current input image is a background image sample without a label, the learning weight corresponding to the target position in the image feature extractor can be adjusted in a preset manner, and the adjusted weight is used to update the backpropagation weight corresponding to the category loss, so as to reduce the learning weight of the model for the background class sample, thereby solving the problem of imbalance between positive and negative samples of the foreground class and the background class when the model is trained using target image samples and background image samples.
[0114] As one embodiment of the present invention, the step of adjusting the learning weights corresponding to the target position in the first image feature extractor according to a preset method may include:
[0115] When adjusting the learning weight α corresponding to the target position in the first image feature extractor, the electronic device can use the following formula for adjustment:
[0116] f(x) = User parameters + Number of background image samples + Total number of image samples
[0117] In the above formula, "+" means that it needs to be taken into account, rather than being added together, and f(x) represents the formula used to calculate the learning weight α.
[0118] In one implementation, the electronic device can specifically determine the learning weight α corresponding to the target location in the first image feature extractor according to the following formula:
[0119]
[0120] Where n is the number of background image samples included in the image sample, batch is the total number of image samples, and β is a preset user parameter.
[0121] In one implementation, the preset user parameter β in the above formula can be set to a number less than 1, such as 0.999, according to actual needs. Those skilled in the art can adjust the preset user parameter β according to actual needs, and no specific limitation is made here.
[0122] In the solution provided by this embodiment of the invention, the electronic device can adjust the learning weights corresponding to the target positions in the first image feature extractor according to the above formula. The higher the proportion of background image samples in the image samples, the better. The larger the value of α, the more severe the imbalance between positive and negative samples in the foreground and background classes becomes. The smaller the value of the learning weight α calculated by the electronic device according to the above formula, the lower the learning weight for the background samples. This ensures that the positive and negative samples in the foreground and background classes remain balanced during model training, effectively solving the problem of imbalance between positive and negative samples in the foreground and background classes.
[0123] As one embodiment of the present invention, such as Figure 3 As shown, when the image processing model is a model for a specific scene, the step of determining the predicted label corresponding to the image sample based on the image features of the target image sample and the image features of the background image sample may include:
[0124] S301, the third image feature and the fourth image feature are fused to obtain the fused image feature;
[0125] Because when the image processing model is a model for a specific scenario, the electronic device uses a second image feature extractor and a third image feature extractor to extract features from the target image sample and the background image sample respectively. Therefore, before determining the prediction label corresponding to the image sample based on the image features, the electronic device can fuse the third image features and the fourth image features to obtain the fused image features.
[0126] For example, electronic devices can use network structures such as FPN (Feature Pyramid Networks), ResNet (Deep Residual Network), and SENet (Squeeze-and-Excitation Networks) to add elements from the third and fourth image features to obtain fused image features. Alternatively, they can use network structures such as DenseNet (Dense Convolutional Network) to concatenate the feature maps corresponding to the third and fourth image features. These are all reasonable approaches and are not specifically limited here.
[0127] S302, Based on the fused image features, determine the predicted label corresponding to the image sample.
[0128] After obtaining the fused image features, the electronic device can determine the predicted label corresponding to the image sample based on the fused image features. The predicted label corresponding to the image sample can include different contents depending on the type of image processing model. For example, the target type in the image sample, the bounding box of the target to be detected, or the target segmented from the image sample, etc. The contents included in the label can be set according to actual needs and the specific type of image processing model, and no specific limitation is made here.
[0129] In the solution provided by the embodiments of the present invention, when the image processing model of the electronic device is a model for a specific scene, the image features of the target image sample and the background image sample can be fused. Based on the fused image features, the predicted label corresponding to the image sample is determined, thereby reducing the false detection rate of the image processing model and improving the accuracy of the image processing model when processing images.
[0130] As one embodiment of the present invention, such as Figure 4 As shown, when the image processing model is a model for a specific scene, the step of adjusting the model parameters of the model to be trained based on the difference between the labeled label and the predicted label includes:
[0131] S401, Based on the difference between the calibrated label and the predicted label and the preset loss function, determine the category loss and coordinate regression loss corresponding to the target image sample;
[0132] Because when the image processing model is a model for a specific scenario, the electronic device processes the target image sample and the background image sample separately, and the background image sample does not contain the label, the electronic device can calculate only the loss corresponding to the target image sample when determining the loss of the image sample based on the difference between the label and the predicted label and the preset loss function.
[0133] When the loss is divided into category loss and coordinate regression loss, the electronic device can determine the category loss and coordinate regression loss corresponding to the target image sample based on the difference between the calibration label and the predicted label and the preset loss function. The category loss represents the difference between the target categories included in the calibration label and the predicted label, and the coordinate regression loss represents the difference between the coordinates of the targets segmented from the target image sample included in the calibration label and the predicted label.
[0134] When calculating the category loss corresponding to the target image sample, the preset loss function can be the 0-1 loss function. When calculating the coordinate regression loss corresponding to the target image sample, the preset loss function can be the squared loss function or the absolute value loss function, etc. These are all reasonable and are not specifically limited here.
[0135] S402, the model parameters of the model to be trained are adjusted based on the second preset backpropagation weights corresponding to the category loss and the third preset backpropagation weights corresponding to the coordinate regression loss.
[0136] Because when the image processing model is designed for a specific scenario, the electronic device inputs the target image sample and background image sample into different feature extractors. Furthermore, the background image sample and the target image acquired against the background are input into the model in pairs. Therefore, by pre-setting different learning weights for different feature extractors, the model can achieve balanced learning of positive and negative samples from the foreground and background classes. Thus, after obtaining the class loss and coordinate regression loss corresponding to the target image sample, the electronic device can directly adjust the model parameters of the model to be trained based on the second preset backpropagation weights corresponding to the class loss and the third preset backpropagation weights corresponding to the coordinate regression loss, without needing to update the backpropagation weights.
[0137] In the solution provided by the embodiments of the present invention, the electronic device can determine the category loss and coordinate regression loss corresponding to the target image sample based on the difference between the calibrated label and the predicted label and the preset loss function; the model parameters of the model to be trained are adjusted based on the second preset backpropagation weight corresponding to the category loss and the third preset backpropagation weight corresponding to the coordinate regression loss, thereby reducing the false detection rate of the image processing model, improving the accuracy of the model to be trained when processing images, and enabling the model to be trained to converge quickly.
[0138] As one embodiment of the present invention, such as Figure 5 As shown, the above method may further include:
[0139] S501, Obtain the image to be processed.
[0140] After the electronic device completes the model training process and obtains the image processing model, it can acquire the image to be processed and process the image according to the image processing model. For example, when the image processing model is an image classification model, the electronic device can classify the target in the image to be processed according to the image processing model. When the image processing model is a target detection model, the electronic device can detect a specific target in the image to be processed according to the image processing model. No specific limitation is made here.
[0141] S502, the image to be processed is input into the image processing model to obtain the processing result output by the image processing model.
[0142] S503, obtain the background image corresponding to the image to be processed, input the image to be processed and the background image into the image processing model, and obtain the processing result output by the image processing model.
[0143] Because image processing models can be used for mixed scenes or for specific scenes, when using an image processing model to process an image, the content of the input image processing model should be selected according to the specific type of the image processing model.
[0144] When the image processing model is designed for mixed scenes, the background image samples and target image samples share a feature extractor during the training process. Furthermore, the background image samples and target image samples can be input separately into the model to be trained. Therefore, for image processing models designed for mixed scenes, electronic devices can directly input the image to be processed into the image processing model and obtain the processing result output by the image processing model.
[0145] When the image processing model is designed for a specific scene, the background image samples and target image samples are trained using different feature extractors. Furthermore, the background image sample and the target image sample acquired against the background image sample are treated as a single image pair and input into the model for training. Therefore, for an image processing model designed for a specific scene, the electronic device can acquire the background image corresponding to the image to be processed, input the image to be processed and the background image as a single image pair into the image processing model, and obtain the processing result output by the image processing model.
[0146] In the embodiments of this invention, after the electronic device completes the training of the model to be trained and obtains the image processing model, it can acquire the image to be processed and process the image according to the image processing model. Furthermore, because the image processing model is for mixed scenes, the input image samples are images from multiple scenes, so the trained image processing model can be applied to image processing in different scenes. When the image processing model is for feature scenes, although image samples from a specific scene are used for training, different feature extractors are used to extract image features from the target image sample and the background image sample respectively. The target image sample is an image captured against the background image sample. Therefore, after training, the image processing model can still be applied to image processing in multiple scenes. It only requires capturing a background image of a new scene without a target as the background image, and inputting this background image and the target image captured against the background image as an image pair into the image processing model. That is, even when the image processing model is for feature scenes, it can still be applied to image processing in different scenes.
[0147] The following is based on Figure 6 The training method of the image processing model provided in the embodiments of the present invention will be described by way of example.
[0148] The electronic device can execute steps S601 and S602 to collect target image samples and background image samples, then execute step S603 to use the target image samples and background image samples as the image sample set for training the model, and then execute step S604 to determine whether the model to be trained is a model for mixed scenes.
[0149] If the model is used for mixed scenes, proceed to step S605 to extract image features from the image samples using a general feature extractor. Then proceed to step S606 to determine if the image sample for which image features are being extracted is a background image sample. If it is, proceed to step S607 to reduce the background learning weights, and then proceed to step S608 to adjust the parameters according to the preset loss function. If not, proceed directly to step S608 to adjust the parameters according to the preset loss function. Proceed to step S612 to determine if the model has reached the preset number of training iterations or if the model has converged. If yes, end the training and use the trained model as the image processing model. If not, return to step S605 to continue extracting image features and training the model.
[0150] If the model is not for mixed scenes, but for a specific scene, then proceed to step S609, inputting the target image sample and background image sample into the network through two branches. Then proceed to step S610, using two different feature extractors to extract image features from the target image sample and background image sample respectively. Next, proceed to step S611, adjusting the parameters according to the preset loss function. Then proceed to step S612, determining whether the model has reached the preset number of training iterations or whether the model has converged. If yes, end the training and use the trained model as the image processing model. If not, return to step S610 and continue training the model using different feature extractors to extract image features.
[0151] In the solution provided by this invention, the electronic device can merge labeled target image samples and background image samples to obtain an image sample set without generating additional image samples, thus simplifying implementation. Furthermore, by allowing background image samples without targets to be used as training samples and setting an adaptive adjustment stage for training weights, the electronic device eliminates false detections and improves the imbalance between positive and negative samples, ensuring a high recall rate. In addition, the electronic device provides two training modes: scene mixing and feature scene training. In scene mixing training mode, image samples are input to the network without distinguishing between scenes; target image samples and background image samples share the network feature extractor, and the background learning weights are adaptively adjusted, making it suitable for general model training. In feature scene training mode, target image samples and background image samples are input in pairs; the background image samples are target-free images within the same scene as the target image samples, suitable for scenes with a single background. Moreover, changing scenes does not require retraining the model; only a new background image needs to be collected for use.
[0152] Corresponding to the above-described image processing model training method, this invention also provides an image processing model training apparatus. The following describes the image processing model training apparatus provided by this invention.
[0153] like Figure 7 As shown, a training device for an image processing model includes:
[0154] The image sample acquisition module 710 is used to acquire image samples, wherein the image samples include target image samples with calibration labels and background image samples without calibration labels;
[0155] The image feature extraction module 720 is used to input the image sample into the model to be trained and extract the image features of the target image sample and the image features of the background image sample.
[0156] The prediction label determination module 730 is used to determine the prediction label corresponding to the image sample based on the image features of the target image sample and the image features of the background image sample;
[0157] The model parameter adjustment module 740 is used to adjust the model parameters of the model to be trained according to the difference between the calibration label and the predicted label until the model to be trained converges to obtain an image processing model.
[0158] As can be seen, in the solution provided by the embodiments of the present invention, the electronic device can acquire image samples, wherein the image samples include target image samples with labels and background image samples without labels; the image samples are input into the model to be trained, and the image features of the target image samples and the background image samples are extracted; based on the image features of the target image samples and the background image samples, the predicted label corresponding to the image sample is determined; according to the difference between the labeled label and the predicted label, the model parameters of the model to be trained are adjusted until the model to be trained converges, thus obtaining the image processing model. Because the electronic device uses both labeled target image samples and unlabeled background image samples to train the model, the trained image processing model can effectively distinguish between the target and the background, greatly reducing the false detection rate of the image processing model and improving the accuracy of the image processing model in processing images. Furthermore, because existing image samples can be used for training without the need to generate additional image samples, the model training efficiency is also relatively high.
[0159] As one embodiment of the present invention, the image feature extraction module 720 described above may include:
[0160] The first image feature extraction unit is used to input the target image sample and the background image sample into the first image feature extractor when the image processing model is a model for mixed scenes, and extract the first image feature of the target image sample and the second image feature of the background image sample;
[0161] The second image feature extraction unit is used to input the target image sample into the second image feature extractor to extract the third image feature of the target image sample when the image processing model is a model for a specific scene, and to input the background image sample into the third image feature extractor to extract the fourth image feature of the background image sample, wherein the target image sample is an image acquired under the background corresponding to the background image sample.
[0162] As one embodiment of the present invention, the model parameter adjustment module 740 described above may include:
[0163] The learning weight adjustment unit is used to adjust the learning weight corresponding to the target position in the first image feature extractor according to a preset method when the current input image is a background image sample without a label, in the case that the image processing model is a model for mixed scenes, so as to reduce the learning weight. The target position is the position where the first image feature extractor extracts the second image feature from the background image sample.
[0164] The first loss determination unit is used to determine the category loss and coordinate regression loss corresponding to the current input image based on the difference between the calibration label and the predicted label and a preset loss function;
[0165] The backpropagation weight determination unit is used to determine the backpropagation weights corresponding to the category loss based on the adjusted learning weights and the category loss.
[0166] The first model parameter adjustment unit is used to adjust the model parameters of the model to be trained according to the backpropagation weights corresponding to the category loss and the first preset backpropagation weights corresponding to the coordinate regression loss.
[0167] As one embodiment of the present invention, the above-mentioned learning weight adjustment unit can be specifically used for:
[0168] The learning weight α corresponding to the target location in the first image feature extractor is determined according to the following formula:
[0169]
[0170] Where n is the number of background image samples included in the image sample, batch is the total number of image samples, and β is a preset user parameter.
[0171] As one embodiment of the present invention, the predicted label determination module 730 may include:
[0172] The image feature fusion unit is used to fuse the third image feature with the fourth image feature when the image processing model is a model for a specific scene, so as to obtain the fused image feature;
[0173] The prediction label determination unit is used to determine the prediction label corresponding to the image sample based on the fused image features.
[0174] As one embodiment of the present invention, the model parameter adjustment module 740 may further include:
[0175] The second loss determination unit is used to determine the category loss and coordinate regression loss corresponding to the target image sample based on the difference between the calibration label and the predicted label and a preset loss function, when the image processing model is a model for a specific scene.
[0176] The second model parameter adjustment unit is used to adjust the model parameters of the model to be trained based on the second preset backpropagation weights corresponding to the category loss and the third preset backpropagation weights corresponding to the coordinate regression loss.
[0177] As one embodiment of the present invention, the above-mentioned apparatus may further include:
[0178] The image acquisition module is used to acquire the image to be processed.
[0179] The processing result determination module is used to input the image to be processed into the image processing model to obtain the processing result output by the image processing model; or, it is used to obtain the background image corresponding to the image to be processed, input the image to be processed and the background image into the image processing model to obtain the processing result output by the image processing model.
[0180] This invention also provides an electronic device, such as... Figure 8 As shown, it includes a processor 801, a communication interface 802, a memory 803, and a communication bus 804. The processor 801, communication interface 802, and memory 803 communicate with each other via the communication bus 804.
[0181] Memory 803 is used to store computer programs;
[0182] When the processor 801 executes the program stored in the memory 803, it implements the training method steps of the image processing model described in any of the above embodiments.
[0183] As can be seen, in the solution provided by the embodiments of the present invention, the electronic device can acquire image samples, wherein the image samples include target image samples with labels and background image samples without labels; the image samples are input into the model to be trained, and the image features of the target image samples and the background image samples are extracted; based on the image features of the target image samples and the background image samples, the predicted label corresponding to the image sample is determined; according to the difference between the labeled label and the predicted label, the model parameters of the model to be trained are adjusted until the model to be trained converges, thus obtaining the image processing model. Because the electronic device uses both labeled target image samples and unlabeled background image samples to train the model, the trained image processing model can effectively distinguish between the target and the background, greatly reducing the false detection rate of the image processing model and improving the accuracy of the image processing model in processing images. Furthermore, because existing image samples can be used for training without the need to generate additional image samples, the model training efficiency is also relatively high.
[0184] The communication bus mentioned in the above electronic devices can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.
[0185] The communication interface is used for communication between the aforementioned electronic devices and other devices.
[0186] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
[0187] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0188] In another embodiment of the present invention, a computer-readable storage medium is also provided, which stores a computer program that, when executed by a processor, implements the training method steps of the image processing model described in any of the above embodiments.
[0189] In another embodiment of the present invention, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to execute the training method steps of the image processing model described in any of the above embodiments.
[0190] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid state disk (SSD)).
[0191] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0192] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the embodiments of apparatus, electronic devices, computer-readable storage media, and computer program products are basically similar to the method embodiments, and therefore the descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0193] The above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention are included within the scope of protection of the present invention.
Claims
1. A training method for an image processing model, characterized in that, The method includes: Obtain image sample pairs, wherein the image sample pairs include target image samples with calibration labels and background image samples without calibration labels, wherein the target image sample is an image acquired against the background corresponding to the background image sample; The image sample pairs are input into the model to be trained to extract the image features of the target image samples and the image features of the background image samples. Based on the image features of the target image sample and the image features of the background image sample, the predicted label corresponding to the image sample is determined; Based on the difference between the calibrated label and the predicted label, the model parameters of the model to be trained are adjusted until the model to be trained converges, thus obtaining the image processing model; Wherein, when the image processing model is a model for a specific scene, the step of determining the predicted label corresponding to the image sample based on the image features of the target image sample and the image features of the background image sample includes: The third image feature and the fourth image feature are fused to obtain the fused image feature. Based on the fused image feature, the predicted label corresponding to the image sample is determined. The third image feature is the image feature of the target image sample extracted by the second image feature extractor in the model to be trained, and the fourth image feature is the image feature of the background image sample extracted by the third image feature extractor in the model to be trained. Where the image processing model is a model for a specific scene, the method further includes: Obtain the background image corresponding to the image to be processed, input the image to be processed and the background image into the image processing model, and obtain the processing result output by the image processing model, wherein the image to be processed is an image acquired against the background image; When changing the application scenario of the image processing model, a background image without a target is acquired in the new scenario. The background image and the target image acquired in the new scenario are then input together as an image pair into the image processing model to obtain the processing result output by the image processing model.
2. The method according to claim 1, characterized in that, The step of inputting the image sample pair into the model to be trained and extracting the image features of the target image sample and the image features of the background image sample includes: If the image processing model is a model for mixed scenes, the target image sample and the background image sample are input into the first image feature extractor to extract the first image feature of the target image sample and the second image feature of the background image sample; If the image processing model is a model for a specific scene, the target image sample is input into the second image feature extractor to extract the third image feature of the target image sample, and the background image sample is input into the third image feature extractor to extract the fourth image feature of the background image sample.
3. The method according to claim 2, characterized in that, The image processing model is a model for mixed scenes. The step of adjusting the model parameters of the model to be trained based on the difference between the labeled label and the predicted label includes: If the current input image is a background image sample without a label, the learning weights corresponding to the target position in the first image feature extractor are adjusted according to a preset method to reduce the learning weights. The target position is the position where the first image feature extractor extracts the second image features from the background image sample. Based on the difference between the calibrated label and the predicted label and the preset loss function, the category loss and coordinate regression loss corresponding to the current input image are determined; The backpropagation weights corresponding to the category loss are determined based on the adjusted learning weights and the category loss. The model parameters of the model to be trained are adjusted according to the backpropagation weights corresponding to the category loss and the first preset backpropagation weights corresponding to the coordinate regression loss.
4. The method according to claim 3, characterized in that, The step of adjusting the learning weights corresponding to the target position in the first image feature extractor according to a preset method includes: The learning weights corresponding to the target positions in the first image feature extractor are determined according to the following formula. : in, The number of background image samples included in the image sample is denoted by 'batch', where 'batch' is the total number of image samples. These are preset user parameters.
5. The method according to claim 1, characterized in that, The image processing model is a model for a specific scene, and the step of adjusting the model parameters of the model to be trained based on the difference between the labeled label and the predicted label includes: Based on the difference between the calibrated label and the predicted label and a preset loss function, the category loss and coordinate regression loss corresponding to the target image sample are determined; The model parameters of the model to be trained are adjusted based on the second preset backpropagation weights corresponding to the category loss and the third preset backpropagation weights corresponding to the coordinate regression loss.
6. The method according to any one of claims 1-5, characterized in that, When the image processing model is a model for mixed scenes, the method further includes: Obtain the image to be processed; The image to be processed is input into the image processing model to obtain the processing result output by the image processing model.
7. A training device for an image processing model, characterized in that, The device includes: An image sample acquisition module is used to acquire image sample pairs, wherein the image sample pair includes a target image sample with a calibration label and a background image sample without a calibration label, and the target image sample is an image acquired against the background corresponding to the background image sample; The image feature extraction module is used to input the image sample pairs into the model to be trained, and extract the image features of the target image samples and the image features of the background image samples; The prediction label determination module is used to determine the prediction label corresponding to the image sample based on the image features of the target image sample and the image features of the background image sample; The model parameter adjustment module is used to adjust the model parameters of the model to be trained according to the difference between the calibration label and the predicted label until the model to be trained converges to obtain the image processing model. Wherein, when the image processing model is a model for a specific scene, the prediction label determination module is specifically used for: The third image feature and the fourth image feature are fused to obtain the fused image feature. Based on the fused image feature, the predicted label corresponding to the image sample is determined. The third image feature is the image feature of the target image sample extracted by the second image feature extractor in the model to be trained, and the fourth image feature is the image feature of the background image sample extracted by the third image feature extractor in the model to be trained. The device further includes: a to-be-processed image acquisition module, configured to acquire a to-be-processed image and a background image corresponding to the to-be-processed image when the image processing model is a model for a specific scene; a processing result determination module, configured to input the to-be-processed image and the background image into the image processing model to obtain a processing result output by the image processing model when the image processing model is a model for a specific scene, wherein the to-be-processed image is an image acquired against the background corresponding to the background image; the to-be-processed image acquisition module is further configured to acquire a background image without a target and a target image acquired in the new scene when the application scene of the image processing model is changed when the image processing model is a model for a specific scene; the processing result determination module is further configured to input the background image and the target image acquired in the new scene as an image pair into the image processing model when the image processing model is a model for a specific scene to obtain a processing result output by the image processing model.
8. The apparatus according to claim 7, characterized in that, The image feature extraction module includes: The first image feature extraction unit is used to input the target image sample and the background image sample into the first image feature extractor when the image processing model is a model for mixed scenes, and extract the first image feature of the target image sample and the second image feature of the background image sample; The second image feature extraction unit is configured to, when the image processing model is a model for a specific scene, input the target image sample into the second image feature extractor to extract the third image feature of the target image sample, and input the background image sample into the third image feature extractor to extract the fourth image feature of the background image sample, wherein the target image sample is an image acquired against the background corresponding to the background image sample; and / or, The model parameter adjustment module includes: The learning weight adjustment unit is used to adjust the learning weight corresponding to the target position in the first image feature extractor according to a preset method when the current input image is a background image sample without a label, in the case that the image processing model is a model for mixed scenes, so as to reduce the learning weight. The target position is the position where the first image feature extractor extracts the second image feature from the background image sample. The first loss determination unit is used to determine the category loss and coordinate regression loss corresponding to the current input image based on the difference between the calibration label and the predicted label and a preset loss function; The backpropagation weight determination unit is used to determine the backpropagation weights corresponding to the category loss based on the adjusted learning weights and the category loss. The first model parameter adjustment unit is used to adjust the model parameters of the model to be trained according to the backpropagation weights corresponding to the category loss and the first preset backpropagation weights corresponding to the coordinate regression loss; and / or, The learning weight adjustment unit is specifically used for: The learning weights corresponding to the target positions in the first image feature extractor are determined according to the following formula. : in, The number of background image samples included in the image sample is denoted by 'batch', where 'batch' is the total number of image samples. For preset user parameters; and / or, The model parameter adjustment module includes: The second loss determination unit is used to determine the category loss and coordinate regression loss corresponding to the target image sample based on the difference between the calibration label and the predicted label and a preset loss function, when the image processing model is a model for a specific scene. The second model parameter adjustment unit is used to adjust the model parameters of the model to be trained based on the second preset backpropagation weights corresponding to the category loss and the third preset backpropagation weights corresponding to the coordinate regression loss; and / or, When the image processing model is a model for a specific scenario, the image acquisition module is further configured to acquire the image to be processed; the processing result determination module is further configured to input the image to be processed into the image processing model to obtain the processing result output by the image processing model.
9. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the steps of the method described in any one of claims 1-6.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the method described in any one of claims 1-6.