Target detection model training method and system based on model transfer learning
By determining the configuration strategy of the frozen layer and fine-tuning layer in the object detection model, and combining adaptive regularization and meta-learning methods, the problems of poor transfer effect and negative transfer caused by dataset differences in transfer learning are solved, and the model achieves efficient adaptation and accurate detection in the target domain.
Patent Information
- Application Number
- CN202510865000.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-25
- Publication Date
- 2025-11-07
AI Technical Summary
Existing fixed fine-tuning strategies for object detection model transfer learning are limited by the specificity of the dataset and the generalization ability of the model. Especially when the target dataset and the source dataset are significantly different, they may lead to poor transfer performance and negative transfer phenomenon. Furthermore, if the hyperparameter settings are not optimized, the detection accuracy will be affected.
By acquiring a pre-trained object detection model and a target domain dataset, the configuration strategies for the frozen layer and fine-tuning layer are determined. An adaptive regularization formula is constructed and integrated into the loss function to dynamically adjust the model training process. Meta-learning methods are combined to optimize the model's adaptability and generalization ability in the target domain.
This improves the model's performance on the target domain task, avoids overfitting or negative transfer, and obtains a high-quality model that is adapted to the target domain task.
Smart Images

Figure CN120913028A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of transfer learning, and particularly relates to a target detection model training method and system based on model transfer learning. BACKGROUND
[0002] In modern computer vision tasks, the application of target detection models is becoming more and more widespread, from autonomous driving to security monitoring, to medical image analysis, all of which cannot do without efficient and accurate target detection technology.
[0003] Nowadays, transfer learning is carried out using the fixed fine-tuning strategy of Faster R-CNN. The fixed fine-tuning strategy of Faster R-CNN mainly alternately trains the RPN (Region Proposal Network) and the Fast R-CNN detection network based on the pre-trained model, and realizes the sharing of convolutional features. Specifically, first, the RPN is trained to generate candidate regions, and then the Fast R-CNN detection network is trained using these candidate regions. Next, the RPN is initialized using the network tuned by the Fast R-CNN, and the process is iterated to realize the sharing and fine-tuning of the convolutional layers between the two networks.
[0004] However, the fixed fine-tuning strategy mainly alternately fine-tunes the region proposal network (RPN) and the target detection network based on the pre-trained model to realize the sharing of convolutional features and improve detection accuracy. However, this strategy may be limited by the specificity of the data set and the generalization ability of the model. Specifically, when the target data set is significantly different from the source data set, fixed fine-tuning may not fully adapt to the characteristics of new data, resulting in poor transfer effect, i.e. negative transfer phenomenon may occur. In addition, the fine-tuning process of Faster R-CNN is sensitive to hyperparameters, such as the balancing strategy of positive and negative samples, etc. The setting of these parameters may not always be optimal, especially when facing different tasks and data sets. SUMMARY
[0005] In order to solve the technical problems of the prior art, the present disclosure provides a target detection model training method and system based on model transfer learning. The present disclosure solves the technical problems that the fixed fine-tuning strategy nowadays mainly alternately fine-tunes the region proposal network (RPN) and the target detection network based on the pre-trained model to realize the sharing of convolutional features and improve detection accuracy. However, this strategy may be limited by the specificity of the data set and the generalization ability of the model. Specifically, when the target data set is significantly different from the source data set, fixed fine-tuning may not fully adapt to the characteristics of new data, resulting in poor transfer effect, i.e. negative transfer phenomenon may occur. In addition, the fine-tuning process of Faster R-CNN is sensitive to hyperparameters, such as the balancing strategy of positive and negative samples, etc. The setting of these parameters may not always be optimal, especially when facing different tasks and data sets.
[0006] According to a first aspect of the present disclosure, a model migration learning-based target detection model training method is provided, comprising: obtaining a pre-trained target detection model and a target domain dataset, determining scale data and complexity data of the target domain dataset, determining a configuration strategy of a frozen layer and a fine-tuning layer of the pre-trained target detection model according to the scale data and the complexity data;
[0007] training the pre-trained target detection model according to the configuration strategy to obtain source domain model parameters and target domain model parameters of the pre-trained target detection model, determining parameter weight differences of the source domain model parameters and the target domain model parameters, and determining a regularization parameter and a negative migration parameter according to the parameter weight differences;
[0008] constructing an adaptive regularization formula according to the target domain model parameters, the regularization parameter and the negative migration parameter, integrating the adaptive regularization formula into a preset loss function, and continuing to train the pre-trained target detection model according to the integrated preset loss function;
[0009] updating the preset loss function after each training cycle, calculating a first performance indicator of the pre-trained target detection model on a source domain dataset and a second performance indicator of the pre-trained target detection model on a target domain dataset after each training cycle, and determining whether negative migration detection is needed for the pre-trained target detection model according to the first performance indicator and the second performance indicator;
[0010] if negative migration detection is needed, determining a negative migration relief measure according to the first performance indicator and the second performance indicator, and retraining the pre-trained target detection model according to the negative migration relief measure and the updated preset loss function in the next training cycle until the pre-trained target detection model reaches a preset model training standard.
[0011] According to a second aspect of the present disclosure, a model migration learning-based target detection model training system is provided, configured to perform the method of the first aspect, comprising: a configuration strategy determination module configured to obtain a pre-trained target detection model and a target domain dataset, determine scale data and complexity data of the target domain dataset, and determine a configuration strategy of a frozen layer and a fine-tuning layer of the pre-trained target detection model according to the scale data and the complexity data;
[0012] a parameter determination module configured to train the pre-trained target detection model according to the configuration strategy to obtain source domain model parameters and target domain model parameters of the pre-trained target detection model, determine parameter weight differences of the source domain model parameters and the target domain model parameters, and determine a regularization parameter and a negative migration parameter according to the parameter weight differences;
[0013] The integration module is configured to construct an adaptive regularization formula according to the target domain model parameter, the regularization parameter and the negative transfer parameter, integrate the adaptive regularization formula into a preset loss function, and continue training the pre-trained target detection model according to the integrated preset loss function.
[0014] The negative transfer detection module is configured to update the preset loss function after each training cycle, calculate a first performance index of the pre-trained target detection model on the source domain data set and a second performance index of the pre-trained target detection model on the target domain data set after each training cycle, and determine whether the pre-trained target detection model needs to be subjected to negative transfer detection according to the first performance index and the second performance index.
[0015] The model training module is configured to, if the pre-trained target detection model needs to be subjected to negative transfer detection, determine a negative transfer relief measure according to the first performance index and the second performance index, and retrain the pre-trained target detection model according to the negative transfer relief measure and the updated preset loss function in the next training cycle until the pre-trained target detection model reaches a preset model training standard.
[0016] According to a third aspect of the present disclosure, an electronic device is provided, which comprises a memory and a processor, the memory having a computer program stored thereon, and the processor implementing the method as described above when executing the program.
[0017] In the target detection model training method, system and device based on model transfer learning provided above, the embodiments of the present disclosure can improve the performance of the model on the target domain task and avoid overfitting or negative transfer through accurate strategies and dynamic adjustment, and finally obtain a high-quality model that can both retain the source domain knowledge and adapt to the target domain task. BRIEF DESCRIPTION OF DRAWINGS
[0018] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure or the prior art, the drawings needed in the embodiments or prior art description will be briefly introduced. Obviously, the drawings in the following description are some embodiments of the present disclosure, and other drawings can also be obtained by those skilled in the art without creative labor.
[0019] Figure 1 A flowchart of a target detection model training method based on model transfer learning is shown according to an embodiment of the present disclosure;
[0020] Figure 2 A schematic block diagram of a target detection model training system based on model transfer learning is shown according to an embodiment of the present disclosure;
[0021] Figure 3 A block diagram of an exemplary electronic device according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0022] Various exemplary embodiments of the present disclosure will now be described in detail below with reference to the accompanying drawings. Note that the relative arrangement, numerical expressions, and numerical values of components and steps set forth in these embodiments are not limiting to the scope of the present disclosure unless specifically stated otherwise.
[0023] Those skilled in the art can understand that the terms "first", "second", and the like in the embodiments of the present disclosure are only used to distinguish different steps, devices, or modules, and do not represent any specific technical meaning, nor do they represent a logical order between them. It should also be understood that in the embodiments of the present disclosure, "multiple" can mean two or more, and "at least one" can mean one, two, or more. It should also be understood that for any component, data, or structure mentioned in the embodiments of the present disclosure, unless specifically limited or given the opposite implication by the context, it can be understood as one or more in general. In addition, the term "and / or" in the present disclosure is only a description of the association relationship of the associated objects, which means that there can be three relationships, for example, A and / or B can represent the existence of A alone, the existence of A and B together, and the existence of B alone. In addition, the character " / " in the present disclosure generally represents an "or" relationship between the front and rear associated objects. It should also be understood that the description of various embodiments of the present disclosure emphasizes the differences between the various embodiments, and the same or similar parts can be referred to each other, and for the sake of brevity, they will not be repeated.
[0024] It should be understood that the sizes of the various portions shown in the drawings are not necessarily drawn to scale for the sake of convenience. The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way limiting to the scope of the disclosure or its application or uses. Techniques, methods, and devices known to those of ordinary skill in the relevant art can not be discussed in detail, but where appropriate, the techniques, methods, and devices should be considered as part of the description. It should be noted that like reference numerals and letters refer to like items in the following drawings, and therefore, once an item is defined in one drawing, it need not be discussed further in subsequent drawings.
[0025] In order to make the objects, technical solutions, and advantages of the embodiments of the present disclosure clearer, the technical solutions in the embodiments of the present disclosure will be described clearly and completely below with reference to the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those of ordinary skill in the art without creative labor fall within the scope of protection of the present disclosure.
[0026] Figure 1A flowchart of a model transfer learning-based target detection model training method is provided for the embodiments of the present disclosure. The method of the embodiments of the present disclosure aims to achieve accurate detection of large and small targets in pictures.
[0027] In S101, a pre-trained target detection model and a target domain dataset are obtained, the size data and the complexity data of the target domain dataset are determined, and the configuration strategy of the frozen layer and the fine-tuning layer of the pre-trained target detection model is determined according to the size data and the complexity data.
[0028] The pre-trained target detection model can be a model that has been trained on a large-scale source domain dataset. These models have learned basic image features and object detection capabilities, such as using common frameworks (such as YOLO, FasterR-CNN, RetinaNet, etc.) for target detection. The pre-trained model usually contains a convolutional neural network (CNN) as its backbone network, and learns the weights using the source domain dataset. The role of the pre-trained model is to transfer the knowledge from the source domain to the target domain through transfer learning in the target detection task.
[0029] The target domain dataset can refer to a specific dataset on which target detection is to be performed. These datasets may come from different data sources than the source domain. For example, the target domain dataset may contain data of specific scenes, objects or environments that you want to detect, such as remote sensing images, medical images or pedestrian detection data in autonomous driving. The task of the target domain dataset is similar to that of the source domain dataset, but has different features or backgrounds, and the model needs to adapt to these data.
[0030] The size data can be the size of the target domain dataset, which can be the number of samples or the resolution of the image. The size data can affect the training time, the demand for computing resources, and the generalization ability of the model. For example, whether the dataset contains thousands of images or only a few hundred images, and what the resolution is, etc., all of which will affect the difficulty of model training.
[0031] The complexity data can be the diversity and difficulty of the target domain data. For example, the number of target types in the image, the appearance variation of the target, the background complexity, the labeling difficulty, etc. A dataset with high complexity may contain multiple classes, occlusion, overlap, low resolution, etc. features, which make the target detection task more challenging.
[0032] The frozen layer can refer to the model layer that remains unchanged during training. This is usually the first few layers in a deep convolutional network, which are responsible for extracting low-level features (such as edges, textures, etc.). Because these low-level features are generally common between different tasks, the parameters of these layers are not updated in the transfer learning of the target detection model.
[0033] Fine-tuning layers can refer to the model layers that will be updated during the training process. These are usually the last few layers or fully connected layers of the model, which are responsible for extracting higher-level features or performing the final task classification. When fine-tuning on the target domain dataset, these layers will be adjusted according to the characteristics of the target domain to adapt to the needs of the target domain.
[0034] The configuration strategy can be to determine which layers should be frozen and which layers should be fine-tuned according to the size and complexity of the target domain dataset. In actual operation, the selection of frozen layers and fine-tuning layers is usually determined according to the characteristics of the target domain data: for simpler and smaller datasets, only a few layers may need to be fine-tuned, while more layers are frozen. For complex and large-scale datasets, more fine-tuning layers may be needed to adapt to the complexity and diversity of the target domain.
[0035] You can choose a pre-trained object detection model that has already been trained on a large-scale dataset such as COCO, ImageNet, Pascal VOC, etc. Common pre-trained object detection models include: YOLO (You Only Look Once): YOLOv3, YOLOv4, YOLOv5, etc. Faster R-CNN: a region proposal network (RPN) based object detection model. RetinaNet: a focal loss (FocalLoss) based object detection model. SSD (Single Shot Multibox Detector): suitable for real-time object detection tasks. Many deep learning frameworks (such as TensorFlow, PyTorch) provide pre-trained models, or you can obtain the corresponding pre-trained object detection model from open source libraries. These pre-trained models usually contain network structures and weights trained on large-scale datasets. Many deep learning frameworks (such as TensorFlow, PyTorch) provide pre-trained models, or you can obtain the corresponding pre-trained object detection model from open source libraries. These pre-trained models usually contain network structures and weights trained on large-scale datasets. If the target dataset is publicly available (such as the COCO test set), you can directly use these datasets. If it is a custom dataset, you need to label the images (label the position and category of the object). The dataset should contain enough samples (pictures) and labeling information. The size of the dataset reflects the size of the target domain dataset and the relevant features of the images, mainly including the number of samples in the dataset, and the number of images in the target domain dataset can be counted. Common evaluation criteria are the total number of images, or the number of labeled object instances. Small dataset: a few hundred to a few thousand images, suitable for smaller tasks. Medium dataset: a few thousand to a few ten thousand images, suitable for medium-sized tasks. Large dataset: tens of thousands to hundreds of thousands of images, suitable for large-scale, multi-class tasks. If the target domain dataset is small, it is prone to overfitting, and more low-level features need to be frozen to avoid the model relying too much on limited samples. If the dataset is large, you can appropriately increase the number of layers for fine-tuning. It also includes image resolution, which can count the resolution of images in the dataset, analyze whether there is consistency, whether the resolution needs to be unified, or whether there are large differences in image size. Low-resolution images: usually require less computing resources, suitable for real-time detection. High-resolution images: more detailed features, suitable for processing complex object detection, but require more computing resources. If the image resolution in the target domain dataset is high, the model may require more memory and computing resources, and may also require more fine-grained feature extraction, suitable for fine-tuning more network layers.Complexity data assessment evaluates the difficulty of the target domain dataset, object variation, and data diversity. This primarily includes the number of categories: This involves counting the number of different object categories in the dataset. Low-category datasets have fewer categories, making model training simpler and potentially easier to complete the task. High-category datasets have more categories, requiring stronger generalization capabilities and more complex network structures to handle multi-category tasks. For datasets with fewer categories, freezing more layers can reduce the risk of overfitting, while high-category datasets may require more fine-tuning, especially higher-level network layers. It also includes object scale variation, analyzing the scale changes of objects in the image, especially the size differences between objects. Small-scale objects typically require higher-resolution input images and finer-grained feature extraction. Large-scale objects require stronger context awareness. If the target domain dataset has significant object scale variation, the model may need more layers to be fine-tuned, especially multi-scale feature extraction layers (e.g., FPN, SSD), to adapt to objects of different scales. This also includes object occlusion and overlap. Occlusion in the dataset can be checked manually or using automated tools. Mild occlusion or overlap (few occlusions or overlaps) allows the model to easily identify objects. Severe occlusion or overlap (objects are partially or completely obscured, or multiple objects overlap, increasing the complexity of the detection task). If the target domain dataset has a large amount of occlusion or overlap, the model may need more layers to capture contextual information, and data augmentation techniques (such as cropping, flipping, etc.) may be needed during training. Background complexity is also considered, analyzing whether there are significant changes in the image background or whether there are complex scene backgrounds. Simple background: Objects in the image are clearly prominent, and the background is relatively simple. Complex background: The background is cluttered or dynamically changing (e.g., street scenes, forests), making it difficult to distinguish objects from the background. For datasets with complex backgrounds, the model needs more contextual understanding and may require more layers for fine-tuning, especially at higher-level feature learning. Data annotation quality is also considered, which can be checked manually to confirm the accuracy of the annotations and whether there are any mislabeled or missing annotations. High-quality annotations: The annotations are accurate, and the dataset is suitable for training. Low-quality annotations: The annotations contain errors or inconsistencies, and data cleaning may be necessary. For datasets with low annotation quality, data cleaning or re-annotation may be necessary, and the training strategy should be adjusted according to the quality of the dataset.
[0036] According to the size data and complexity data of the target domain dataset, the configuration strategy of the frozen layer and the fine-tuning layer of the pre-trained target detection model can be adjusted according to the following principles: dataset size data: small dataset (a few hundred to a few thousand images): freeze more low-layer networks (such as convolutional layers), because a smaller dataset is prone to overfitting, freezing low layers can avoid overfitting. Fine-tune the high layer (such as the detection head part). This strategy can maximize the generalization ability of the model on limited data.
[0037] medium-sized dataset (a few thousand to a few ten thousand images): freeze low and part of the middle layer network, so that the model can adapt to more feature learning. Fine-tune the middle and high layer network, optimize the features specific to the target domain. The model can learn specific task features with more data.
[0038] large dataset (a few ten thousand to a few hundred thousand images): freeze fewer low-layer networks, because the data is sufficient, the model can learn target domain features at more levels. Fine-tune most of the middle and high layers, especially the parts related to the detection task, such as the classification and positioning head.
[0039] dataset complexity data: number of categories: low category (2-5 categories): freeze more low-layer convolutional layers, only fine-tune the classification and positioning head part. High category (more than 10 categories): freeze fewer layers, fine-tune more high-layer feature extraction layers to adapt to the detection needs of more categories. Object scale variation: small scale object: freeze more low layers, fine-tune multi-scale feature extraction layers (such as FPN) to better capture the details of small objects. Large scale object: freeze more low layers, fine-tune high layer feature learning part to optimize large object detection ability. Object occlusion and overlap: mild occlusion: freeze more low layers, fine-tune only the classification and positioning head. Severe occlusion or overlap: freeze fewer layers, fine-tune more high-layer networks to enhance the model's context understanding ability. Background complexity: simple background: freeze more low layers, fine-tune the detection head to reduce background interference. Complex background: freeze fewer low layers, fine-tune more layers to enhance background understanding ability. Image resolution: low resolution image: freeze more low layers, fine-tune high layers to reduce computational resource consumption.
[0040] high resolution image: freeze fewer low layers, fine-tune more layers, especially multi-scale feature extraction layers, to adapt to the higher resolution detail requirements. Data annotation quality: high-quality annotation: freeze more low layers, fine-tune classification and positioning head. Low-quality annotation: freeze more layers to avoid model overfitting to incorrect annotations, while fine-tune more layers to enhance the model's ability to adapt to noise.
[0041] On the basis of the above technical solutions, the selection process of the pre-trained target detection model can include:
[0042] obtaining a source domain dataset and a target domain dataset, determining first feature distribution data of the source domain dataset, and determining second feature distribution data of the target domain dataset;
[0043] determining feature difference data according to the first feature distribution data and the second feature distribution data, and determining a pre-training target detection model according to the feature difference data.
[0044] In this solution, the source domain dataset can be a dataset used to train a preliminary pre-training model. These data usually come from a domain similar to but not exactly the same as the target task. The source domain dataset contains labeled data related to the target detection task (e.g., object categories, bounding box positions, etc.), but these data are usually not directly from the target domain application scenario. The goal is to train a general-purpose target detection model using source domain data.
[0045] The first feature distribution data can be the feature data distribution in the source domain dataset, which describes the statistical distribution of features and samples in the source domain. These features can include image pixel values, color histograms, texture information, edge detection, region features, etc. The first feature distribution data mainly focuses on the distribution characteristics and data structure features of various types of data in the source domain, which helps to understand the overall performance of the source domain data.
[0046] The second feature distribution data can be the feature data distribution in the target domain dataset, which describes the statistical distribution of features and samples in the target domain. These features can also be image pixel values, color histograms, texture information, edge detection, etc. Unlike the feature distribution of the source domain, the feature distribution data of the target domain reflects the actual characteristics and possible challenges of the target domain data, such as different lighting, occlusion, object shape, or background interference.
[0047] Feature difference data can refer to the difference between the source domain and the target domain in terms of feature distribution. These differences can manifest as differences in data distribution, such as significant differences in color distribution, texture patterns, or object shape between the source domain and the target domain. By analyzing the differences between the first feature distribution data of the source domain and the second feature distribution data of the target domain, the distribution inconsistency or feature difference between the two can be evaluated. Feature difference data is used to quantify the relationship between the source domain and the target domain, helping the model adjust during the transfer learning process to adapt to the target domain and avoid performance degradation due to distribution differences.
[0048] The source domain dataset can be from a publicly available standard dataset, or a dataset similar but not identical to your target task. These data usually contain rich annotation information, which can be used to train the target detection model. For example, common source domain datasets include COCO, PASCAL VOC, etc. Specifically, you can use publicly available target detection datasets such as COCO, PASCAL VOC. Use existing annotation data in a specific field, or obtain it through synthetic data, etc. The target domain dataset can be obtained by collecting annotated data in a specific field, capturing new data through a camera in the target scene, and annotating and using data augmentation techniques to generate diverse target domain data.
[0049] The first feature distribution data of the source domain dataset can be obtained by the following steps: standardization, normalization, etc. of the source domain data. Use the target detection model (e.g. pre-trained convolutional neural network (CNN)) to extract high-dimensional features from the source domain dataset, such as image color histogram, texture feature, edge feature, shape information, etc. Calculate the feature distribution of different classes or different image regions in the source domain data. Statistical data such as mean, variance, covariance of feature vectors can be used to represent these feature distributions. For example, calculate the mean and standard deviation of the feature map output by each layer of the convolutional network, or use PCA (principal component analysis) to reduce the dimension of the features to obtain a statistical feature distribution.
[0050] The extraction method of the second feature distribution data of the target domain dataset is similar to that of the source domain, but special attention should be paid to the different characteristics of the target domain data. It can be obtained by the following steps: pre-processing the target domain data similar to the source domain (such as image scaling, cropping, etc.). Extract the feature vector in the target domain data through the pre-trained target detection model. As with the source domain data, calculate the mean, variance, etc. of each class of features in the target domain, or perform PCA or other dimensionality reduction analysis. The calculation of the target domain feature distribution may be different, as the feature space of the target domain may differ from the source domain, especially in terms of object classes, background, or shooting conditions.
[0051] The difference can be quantified by calculating the distance between the source domain and the target domain feature distribution. Common calculation methods include Kullback-Leibler (KL) divergence: measures the difference in probability distribution between the source domain and the target domain. Maximum Mean Discrepancy (MMD): calculates the difference between the source domain and the target domain feature distribution. Wasserstein distance: calculates the minimum work distance between the source domain and the target domain feature distribution. According to the calculated feature difference data, it can be determined whether to select a specific pre-trained target detection model. Small feature difference: if the feature difference between the source domain and the target domain is not large, a standard pre-trained model (e.g., a model pre-trained using COCO or ImageNet) can be selected. In this case, there is usually no need for too much fine-tuning. If the feature difference between the source domain and the target domain is large, a model more suitable for the target domain may need to be selected, or some strategies can be used to reduce this difference: transfer learning: select a model that has been pre-trained on a similar task for fine-tuning. Adversarial training: use adversarial training methods (e.g., Domain-Adversarial Neural Network, DANN) to reduce the feature difference between the source domain and the target domain, so that the model can adapt to the features of both domains. Multi-task learning: through multi-task learning, the model is optimized on both the source domain and the target domain tasks, thereby improving the performance of the target domain.
[0052] In this solution, by analyzing the feature difference between the source domain and the target domain, the characteristics of the target domain can be better understood, ensuring that the model can be optimized according to the features of the target domain, rather than relying solely on the source domain dataset. This helps to improve the adaptability and generalization ability of the target detection model in practical applications.
[0053] On the basis of the above technical solution, optionally, after determining the configuration strategy of the pre-trained target detection model's frozen layer and fine-tuning layer according to the scale data and complexity data, the method further comprises:
[0054] Obtain a source domain dataset, and construct a meta-task set according to the source domain dataset;
[0055] Update the configuration strategy according to each meta-task of the meta-task set using a meta-learning model;
[0056] Correspondingly, training the pre-trained target detection model according to the configuration strategy comprises:
[0057] Training the pre-trained target detection model according to the updated configuration strategy.
[0058] In this solution, the meta-task set can be a series of small-scale task sets constructed from the source domain dataset. Each meta-task is used to train the meta-learning model to learn cross-task knowledge and improve the model's generalization ability. For example: Task 1: Train the object detection model using a portion of the data and test its performance on unseen object categories. Task 2: Train the object detection model using data with different shooting angles and test its performance on unseen angles. Task 3: Train the object detection model under different environmental lighting conditions and test its adaptability.
[0059] A meta-task can be a single task in the meta-task set, usually composed of a small-scale training set (Support Set) and a small-scale test set (Query Set). For example: Support Set: a subset of tasks used to train the meta-learning model. Query Set: used to evaluate the adaptability of the meta-learning model on the task. The core goal of the meta-task is to enable the model to quickly adapt to new tasks after learning a small number of samples
[0060] A meta-learning model can be a model that learns "how to learn". It trains the model on multiple meta-tasks to enable it to quickly adapt to new object detection tasks. Common meta-learning methods include: Model optimization method: learn a universal initialization parameter to enable the model to quickly converge on new tasks. Metric learning method: learn a metric space that measures the similarity of samples to enable the model to detect through a small number of samples. Meta-learning based on self-supervised learning: combine self-supervised tasks (such as image rotation prediction, contrastive learning) to enhance the adaptability of the model.
[0061] The source domain data can be selected from a large-scale target detection dataset (such as COCO and Pascal VOC). The data is preprocessed, including image enhancement, normalization, etc. The source domain dataset is divided into multiple small-scale meta-tasks, each task containing a support set: used to train the model. Query set: used to test the generalization ability of the model. Different tasks are constructed in the following ways: class division method: each meta-task contains different classes (such as task 1 trains cats and dogs, and task 2 trains cars and bicycles). Environmental change method: each meta-task corresponds to a different shooting environment (such as light conditions and perspective changes). Data volume control method: each meta-task contains only a small number of samples to simulate a small sample learning scenario. Then select a suitable meta-learning algorithm (such as MAML and ProtoNet). Train the model on each meta-task to obtain the initial target detection capability. Test the model performance on the query set and calculate the loss. Adjust the parameters of the meta-learning model through gradient update so that it can quickly learn on new tasks. According to the performance of the meta-learning model on different meta-tasks, update the configuration strategy, including the selection of frozen layers and fine-tuning layers. Learning rate, regularization parameter, and other hyperparameter settings. Transfer learning weight adjustment. Finally, use the best initialization parameters generated by the meta-learning model. Train according to the updated configuration strategy to improve the generalization ability and cross-domain adaptation ability of the model.
[0062] In this scheme, the commonness between different tasks is learned through meta-task set learning, so that the model can adapt to new target domain data. In the case of limited target domain data, the detection accuracy can be maintained. Using the meta-task construction method, the model can continuously adapt to new detection tasks during training.
[0063] S102, training the pre-trained target detection model according to the configuration strategy to obtain source domain model parameters and target domain model parameters of the pre-trained target detection model, determining the parameter weight difference between the source domain model parameters and the target domain model parameters, and determining the regularization parameter and the negative transfer parameter according to the parameter weight difference.
[0064] The source domain model parameters can be all the parameters in a pre-trained model trained based on a source domain dataset. Generally, the source domain dataset is a large-scale, general-purpose dataset (such as COCO, ImageNet, etc.) used to pre-train the model's basic knowledge. The source domain model parameters include the weights of all network layers such as convolutional layers, fully connected layers, classification heads, regression heads, etc. Through training on the source domain dataset, the model has learned the basic features of object detection. Instead of directly training a target detection model using the source domain dataset, a model that has been pre-trained using the source domain dataset is relied on. This pre-trained model is trained on a large-scale source domain dataset (such as COCO or ImageNet), so its source domain model parameters already contain general features and pattern recognition capabilities. In other words, the source domain dataset has been used to train a basic model, and the parameters of this model can be used as a starting point for fine-tuning in the target domain. In the subsequent fine-tuning process, the model is adjusted for the target domain data to obtain target domain model parameters. By comparing the differences between the source domain model parameters and the target domain model parameters, the performance of the target model can be optimized through regularization and negative transfer adjustment strategies. Therefore, although the source domain dataset does not participate in the training process of the target domain, the parameters of the source domain model still provide important initialization information for the training of the target domain.
[0065] The target domain model parameters can be the model parameters obtained after fine-tuning on the target domain dataset. The target domain dataset may differ from the source domain dataset in terms of specific scenarios, object categories, image resolutions, etc. Through fine-tuning, the target domain model parameters reflect the specific performance of the model in the target task.
[0066] The parameter weight difference can be the difference between the source domain model parameters and the target domain model parameters. Due to the differences between the characteristics of the target domain dataset and the source domain dataset, the pre-trained parameters of the source domain model may not fully adapt to the specific needs of the target domain. By comparing the weight differences between the two sets of model parameters, it is possible to identify which layers or parameters have undergone significant changes during the transfer from the source domain to the target domain. The parts with large weight differences may be due to the different feature distributions of the source domain dataset and the target domain dataset, causing the model to need to make greater adjustments.
[0067] Regularization refers to a technique that constrains the complexity of the model during training, aiming to reduce overfitting and improve the generalization ability of the model. Regularization is usually achieved by adding a penalty term to the model's loss function, which controls the model's parameters to make them smoother and simpler, avoiding the model's excessive "memory" or fitting to the training data.
[0068] The regularization parameter can be a hyperparameter related to regularization, used to control the strength of regularization. Common regularization methods include: L1 regularization (Lasso): sparsifies the model by penalizing the weights, thus selecting the most important features. L2 regularization (Ridge): makes the weights of the model more evenly distributed by penalizing the square of the weights. Dropout: randomly drops some nodes in the neural network during training to avoid the model over-reliance on certain specific nodes.
[0069] The negative transfer parameter can be a parameter that evaluates whether there is a negative transfer phenomenon by calculating the difference between the source domain model parameters and the target domain model parameters during target detection training. The negative transfer parameter can help determine the part of the model that needs to be adjusted to reduce the performance decline in the target task. For example, if the weight difference of some layers is large, it may indicate that these layers are the part that produces a negative effect in the transfer process between the source domain and the target domain.
[0070] The target detection model pre-trained on the source domain dataset can be used as the initial model. Load the pre-trained source domain model parameters and freeze certain low-level network layers according to the configuration strategy. The parameters of the frozen layers will not participate in the training on the target domain dataset, and only the parameters of the fine-tuning layers will be updated. The configuration strategy will configure the fine-tuning network layers according to the complexity of the target domain dataset. For complex target domain datasets (e.g. multi-class, large scale variation, complex background, etc.), the middle and high layers of the model can be fine-tuned. For simple target domain datasets, only the high layers can be fine-tuned. Then start fine-tuning the model on the target domain dataset. In this process, the features of the target domain dataset will affect the loss function, and then update the parameters of the fine-tuning layers. These fine-tuning layer parameters will be adjusted during training to adapt to the characteristics of the target domain data. The frozen layers (i.e. low-level feature extraction layers) will remain unchanged and will not participate in gradient update, so as to ensure that the general features learned from the source domain model can be stably applied to the target domain task. Then set appropriate learning rates for the fine-tuned layers according to the configuration strategy. During fine-tuning, a lower learning rate is usually used for fine-tuning layers to avoid excessive parameter updates on the target domain data and prevent overfitting. At the same time, for those frozen layers, their learning rate is zero and they will not participate in the update. When loading the pre-trained target detection model, the parameters of the source domain model have been loaded into the model. These parameters are trained on the source domain dataset and reflect the features and patterns learned from the source domain. After fine-tuning on the target domain dataset, the parameters of the model will be adjusted according to the characteristics of the target domain dataset. These adjustments are mainly concentrated in the fine-tuning network layers, and the parameters of the frozen layers will not be updated, so the parameters of the target domain model are mainly derived from the adjustment of the fine-tuning layers. After the fine-tuning layers are adjusted, the target domain model parameters are obtained. Then calculate the parameter weight difference:
[0071] ΔW = |Wtarget -W source |;
[0072] Where ΔW represents the difference in parameter weights; W target For the target domain model parameters; W source These are the parameters of the source domain model.
[0073] Regularization is typically used to control model complexity and prevent overfitting. The strength of regularization can be adjusted based on the magnitude of the difference in parameter weights. For example, if the features of the target domain dataset differ significantly from those of the source domain dataset, a stronger regularization parameter may be needed to constrain excessive changes in model parameters. For network layers with large weight differences, a higher regularization parameter may be required to limit overfitting of these changes. Negative transfer occurs during knowledge transfer between the source and target domains, where the target domain model performs worse than the source domain model, usually due to significant inconsistencies between target and source domain features. The degree of negative transfer can be determined based on the magnitude of the weight differences. If the weight differences of certain network layers are large, it can be assumed that the feature representations of these layers have changed significantly, which may be the source of negative transfer. Therefore, to address such large differences, a larger negative transfer parameter is needed to adjust the model, suppressing inconsistencies between the source and target domains and reducing the negative impact of source domain features on the target domain task.
[0074] S103, construct an adaptive regularization formula based on the target domain model parameters, regularization parameters, and negative transfer parameters, integrate the adaptive regularization formula into the preset loss function, and continue training the pre-trained target detection model based on the integrated preset loss function.
[0075] Adaptive regularization formulas adjust the training process of a target domain model by using regularization parameters and negative transfer parameters. This ensures the model adapts to the features of the target domain and avoids over-reliance on source domain features. Its purpose is to dynamically adjust the model's learning process based on the differences between the target domain data and the source domain data.
[0076] The preset loss function can be the loss function most commonly used by the object detection model during training.
[0077] The purpose of the adaptive regularization formula is to balance the training of the model on the target domain, both to maintain the effectiveness of the source domain transfer knowledge and to adapt to the characteristics of the target domain. This formula adjusts the regularization strength according to the performance of the target domain model, helping the model avoid overfitting and negative transfer. Specifically, the regularization strategy is designed according to the following points: target domain model parameters: as the target domain data is fine-tuned, some parameters of the model may undergo significant changes, especially when the characteristics of the target domain data are significantly different from those of the source domain data. These changes need to be controlled through regularization to prevent the model from overfitting to the specific features of the target domain. Regularization parameter: the main purpose of regularization is to prevent the model from overfitting. During training, we introduce a regularization parameter to constrain the target domain model parameters, so that the weights of the model are not too large, thus maintaining the generalization ability of the model. According to the complexity of the target domain data, adjust the strength of the regularization parameter, so that the regularization parameter on simple tasks is smaller, and the regularization parameter on complex tasks is larger. Negative transfer parameter: when there is a large difference between the source domain and the target domain, negative transfer may occur. Negative transfer means that the features of the source domain model at some levels are not helpful for learning on the target domain, and may even have adverse effects. The role of the negative transfer parameter is to reduce the influence of the source domain model features and reduce the negative transfer of source domain knowledge. According to the weight difference between the source domain and the target domain, adjust the negative transfer parameter to help the model learn better on the target domain. By integrating the above parameters, an adaptive regularization formula can be constructed, which can dynamically adjust the influence of regularization and negative transfer, ensuring that the target detection model performs well on the target domain data without being disturbed by irrelevant features from the source domain. After determining the adaptive regularization formula, input the adaptive regularization formula into the pre-set loss function, and then use the loss function to continue training the pre-trained target detection model. Specifically, when fine-tuning on the target domain data, the loss function will guide the model to optimize the classification and regression loss while balancing the influence of regularization and negative transfer. In this way, the model will not only learn from the data of the target domain, but also be constrained by the regularization and negative transfer terms, ensuring the stability and generalization ability of the model. As the training progresses, the model will adjust the parameters according to the characteristics of the target domain, while the adaptive regularization formula will dynamically adjust its influence. For example, if the target domain data is relatively simple, the influence of the regularization term may be small; if the target domain data is complex, the regularization term may need stronger influence to prevent overfitting.
[0078] On the basis of the above technical solutions, optionally, the adaptive regularization formula is:
[0079]
[0080] wherein, is the regularization loss term; a is the regularization parameter; W is the target domain model parameter; Wneg is a negative migration parameter.
[0081] If W = [2, 3, -1, 4],
[0082] If W neg = [1, -1, 2, 3],
[0083]
[0084] On the basis of the above technical solutions, before the adaptive regularization formula is integrated into the preset loss function, the method further includes:
[0085] obtaining a source domain data set and a target domain data set, determining a source domain loss according to the source domain data set and the source domain model parameter;
[0086] determining a target domain loss according to the target domain model parameter and the target domain data set;
[0087] Correspondingly, integrating the adaptive regularization formula into the preset loss function includes:
[0088] integrating the adaptive regularization formula, the source domain loss and the target domain loss into the preset loss function.
[0089] In the present solution, the source domain loss can be a parameter for measuring the error of the model on the source domain data set.
[0090] The target domain loss can be a parameter for measuring the error of the model on the target domain data set.
[0091] The source domain data set can be input to the target detection model. The classification loss (cross-entropy loss) between the predicted category and the real category is calculated. The regression loss (SmoothL1 or IoU loss) between the predicted bounding box and the real bounding box is calculated. The two are summarized to obtain the source domain loss. The target domain data set is input to the target detection model. The classification loss (cross-entropy loss) between the predicted category and the real category is calculated. The regression loss (SmoothL1 or IoU loss) between the predicted bounding box and the real bounding box is calculated. The two are summarized to obtain the target domain loss. Then, the source domain loss, the target domain loss and the adaptive regularization term are integrated into the total loss function in a weighted manner.
[0092] In the present solution, it can be ensured that the model adapts to the target domain data while not losing the knowledge of the source domain, thereby improving the effect of transfer learning and reducing the risk of negative migration.
[0093] On the basis of the above technical solutions, optionally, the preset loss function is:
[0094]
[0095] wherein, is a total loss function; λ s is a preset source domain loss weight coefficient; L source is a source domain loss; λ t is a preset target domain loss weight coefficient; L target is a target domain loss; β is a preset regularization weight coefficient; is a regularization loss term.
[0096] In this scheme, λ s can control the contribution of the source domain loss to the total loss, preventing the model from completely forgetting the source domain knowledge when adapting to the target domain data (i.e., the "catastrophic forgetting" problem). Generally set to 1 to ensure basic learning ability of the source domain. If the amount of source domain data is much larger than the amount of target domain data, it can be appropriately reduced (e.g., 0.5-0.8). If the amount of source domain data is much smaller than the amount of target domain data, it can be appropriately increased (e.g., 1.2-2.0). λ t controls the influence of the target domain loss on the total loss, making the model adapt to the target domain data faster. Generally set to 1, if the target domain data is less, then increase λ t (e.g., 1.5-2.0) to ensure that the model adapts to the target domain data as soon as possible. If the target domain data is more, then appropriately reduce λ t (e.g., 0.8-1.2). β controls the contribution of the regularization loss in the total loss, preventing overfitting and alleviating negative transfer problems. Generally set to 0.01-0.1 to maintain a moderate regularization effect and prevent overfitting. If the source domain and target domain model parameters change significantly, β can be appropriately increased (e.g., 0.1-0.5). If the parameter changes are small, then reduce β.
[0097] On the basis of the above technical solutions, optionally, before continuing to train the pre-trained target detection model according to the integrated preset loss function, the method further comprises:
[0098] obtaining an incremental target domain data set, determining feature information of the incremental target domain data set, and determining an incremental update layer of the pre-trained target detection model according to the feature information;
[0099] obtaining an original data set of the memory bank, and using knowledge distillation to perform incremental updating on the incremental update layer of the pre-trained target detection model according to the original data set and the target domain data set;
[0100] Correspondingly, continuing to train the pre-trained target detection model according to the integrated preset loss function comprises:
[0101] The pre-trained target detection model is further trained according to the integrated preset loss function.
[0102] In this solution, the incremental target domain dataset can refer to the target domain data collected gradually over time, rather than the complete dataset obtained at once. For example, in the autonomous driving scenario, new road images are continuously collected to update the target detection model.
[0103] The feature information can refer to the key information extracted from the target domain dataset, such as object categories, textures, shapes, and context environments. It can be used to analyze the distribution characteristics of the data to determine which layers need to be updated to adapt to changes in the target domain.
[0104] The incremental update layer can refer to the part of the target detection model that is adjusted according to the new target domain data. For example: only fine-tune the detection head (DetectionHead), and keep the Backbone structure unchanged. Only update the high-level feature extraction layer, while freeze the low-level feature extraction layer. Use an elastic parameter freezing strategy to dynamically adjust which layers need to be updated according to the importance of the new data.
[0105] The memory bank can store the key knowledge learned by the model during the historical training process, preventing the model from forgetting the features of the early data during the incremental learning process. It can include a subset of early training data. The prediction results of the old model on the samples. The feature representation of the key samples.
[0106] The original dataset can be the historical data in the memory bank, i.e., the dataset used when the model was initially trained. When incrementally updating, using this part of the data can prevent the model from forgetting the knowledge learned earlier.
[0107] Knowledge distillation can be a way to transfer knowledge from a pre-trained teacher model (old model) to a student model (incrementally updated new model). It can include SoftTarget distillation: let the new model learn the prediction results of the old model on the original data, rather than just the labels. Feature matching distillation: let the intermediate features of the new model be as consistent as possible with the old model, reducing the dramatic changes in parameters. Attention distillation: match the attention distribution of the new and old models during feature extraction.
[0108] The incremental target domain dataset can be acquired through real-time data stream acquisition (e.g., a self-driving vehicle acquires new street images). Periodic sampling (e.g., in industrial detection, new defect samples are acquired at regular intervals). Active learning selection (using model uncertainty evaluation to select the most representative new data) acquires an incremental target domain dataset. The feature information of the incremental target domain dataset is determined by: statistical histogram analysis: calculate the statistical information of target categories, sizes, colors, etc. in the new data set, and compare with the existing data set. Clustering analysis: use PCA, t-SNE, etc. to reduce the dimensionality of the features and observe the changes in the data distribution. Model uncertainty analysis: detect the prediction confidence of the new data. If the uncertainty is high, it may indicate that the new data is different from the existing data distribution. By analyzing the feature changes of the incremental target domain dataset, it is determined which layers to update: if the low-level features (such as edges, textures) change greatly: update the first few layers of the Backbone. If the target shape and semantic features change greatly: update the deep feature extraction layer and the detection head. If only the class distribution changes: only update the classification layer or the detection head. The memory stores key original data during model training to prevent the model from forgetting previously learned knowledge. Knowledge distillation is used to let the new model retain the knowledge of the old model while adapting to new data: let the old model (teacher model) predict the original data to obtain soft targets. When training the new model (student model), let it not only learn the true label, but also learn the output of the teacher model. Only update the incremental update layer to reduce catastrophic forgetting. Finally, the updated loss function is used to continue training the updated model, and the performance on the target domain data is monitored to ensure that the model adapts to new data without losing original capabilities.
[0109] In this scheme, combined with memory and knowledge distillation, it can be ensured that the model will not forget the features of the old data when learning new data. According to the changes of data features, only the necessary model layers are updated, reducing the training overhead.
[0110] S104, updating the preset loss function after each training cycle, and calculating the first performance index of the pre-trained target detection model on the source domain dataset and the second performance index on the target domain dataset after each training cycle, and determining whether the pre-trained target detection model needs to be subjected to negative transfer detection according to the first performance index and the second performance index.
[0111] A training cycle can be a process in which a target detection model completes a complete forward propagation and back propagation process on the entire target domain dataset and updates the model parameters. In a training cycle, the dataset is usually divided into multiple small batches, each batch is calculated through the model, and then the error is calculated according to the loss function, and then the model parameters are adjusted through gradient descent and other optimization methods. The number of training cycles is usually set by experiment to ensure that the model can converge and achieve the best performance.
[0112] The source domain dataset can be the dataset on which the pre-trained object detection model was initially trained. This dataset can have a large amount of labeled data and is typically used to train a general-purpose object detection model. For example, if the source domain dataset is COCO (a general-purpose object detection dataset), the pre-trained model has already learned the features and class information of the objects in the COCO dataset. The features of this dataset can have some similarity with the target domain dataset, but there can also be significant differences.
[0113] The first performance indicator can be used to measure the performance of the pre-trained object detection model on the source domain dataset. The choice of this indicator is usually related to the object detection task and can include mAP: mean average precision, which measures the detection accuracy of the model on different classes. IoU: intersection over union, which measures the overlap between the predicted bounding box and the true bounding box. Precision & Recall: measure the accuracy and coverage of the detection results. The role of the first performance indicator is to monitor the stability of the model on the source domain dataset. If the first performance indicator decreases significantly, it may mean that the model has learned features incompatible with the source domain on the target domain data, causing the source domain knowledge to be forgotten (i.e., the catastrophic forgetting problem).
[0114] The second performance indicator can be used to measure the performance of the pre-trained object detection model on the target domain dataset. The calculation method of this indicator is similar to the first performance indicator, which can also be mAP, IoU, Precision & Recall, etc., but its goal is to evaluate the generalization ability of the model on the target domain dataset.
[0115] The second performance indicator is used to measure the performance of the pre-trained object detection model on the target domain dataset. The calculation method of this indicator is similar to the first performance indicator, which can also be mAP, IoU, Precision & Recall, etc., but its goal is to evaluate the generalization ability of the model on the target domain dataset.
[0116] The main role of the second performance indicator is to monitor the adaptability of the model on the target domain. If the second performance indicator does not significantly improve or changes abnormally, it may indicate that the model's learning on the target domain is not sufficient, or it has been affected by negative transfer, resulting in performance degradation.
[0117] At the end of each training cycle, the weight changes of the model parameters on the source domain and the target domain can be calculated, including calculating the difference between the target domain model parameters and the source domain pre-training model parameters to measure the change amplitude. If the parameters of some layers change greatly, it may indicate that the model is forgetting the source domain features or that the target domain data has a great impact on the model. If the source domain model parameters change greatly, the regularization parameter is appropriately increased to constrain the target domain model parameters so that they do not deviate too much from the source domain knowledge. If the learning of the target domain model is stable and the second performance indicator continues to rise, the regularization parameter can be appropriately reduced to allow the model to better adapt to the target domain data. The size of the negative transfer parameter depends on the difference between the source domain model parameters and the target domain model parameters. If the model performs well on the target domain (the second performance indicator rises), but the source domain performance does not decrease significantly, the negative transfer parameter can be reduced. If the source domain performance decreases significantly, it indicates that the negative transfer has a greater impact, and the negative transfer parameter needs to be increased to make the model more inclined to keep the source domain features stable. Finally, the adjusted loss function will be used in the next round of training to ensure that the model adapts to the target domain while still retaining the source domain knowledge. After each training cycle, the model is allowed to reason on the source domain dataset (without gradient update). The first performance indicator is calculated, for example: mAP (mean average precision): measures the model's target detection ability on the source domain. IoU (intersection over union): measures the overlap between the predicted box and the true box. Precision and Recall: evaluate the classification accuracy of the model. Then calculate the second performance indicator, specifically, let the model reason on the target domain dataset, and calculate the same indicators (mAP, IoU, Precision, Recall). If the target domain dataset is complex, the detection speed (FPS), false positive rate (False Positive Rate) and other indicators can also be measured. Then compare the change trend of the first performance indicator and the second performance indicator to determine whether negative transfer detection is needed. If the source domain performance decreases significantly and the target domain performance does not improve, negative transfer adjustment is needed. By increasing the regularization, freezing part of the layers, adjusting the negative transfer penalty term, etc., the impact of negative transfer is reduced. If both the source domain and the target domain remain stable, the training can continue, or the regularization strength can be reduced to improve the target domain adaptability.
[0118] On the basis of the above technical solutions, the pre-set loss function can be updated after each training cycle, including:
[0119] The source domain model parameters and the target domain model parameters are updated after each training cycle, the parameter weight difference is updated according to the updated source domain model parameters and the target domain model parameters, and the regularization parameter and the negative transfer parameter are updated according to the updated parameter weight difference;
[0120] The adaptive regularization formula is updated according to the updated target domain model parameters, the regularization parameter, and the negative transfer parameter, and the preset loss function is updated according to the updated adaptive regularization formula.
[0121] In this scheme, after each training cycle, the parameters of the source domain and target domain models are updated based on the current data and training progress. This is usually done through standard optimization processes such as gradient descent, adjusting the weights and biases in the model to better adapt to the training data. Source domain model parameters: these are the parameters obtained by training on the source domain dataset. Target domain model parameters: these are the parameters obtained by training on the target domain dataset. Parameter weight difference refers to the difference between the source domain model parameters and the target domain model parameters. As each training cycle progresses, the models of the source domain and the target domain will change, so it is necessary to calculate the weight difference between the two after each cycle. The weight difference can be measured by calculating the Euclidean distance, mean absolute error, etc. between the source domain and target domain parameters, reflecting the difference in knowledge transfer between the source domain and the target domain. The regularization parameter is a hyperparameter used to control the complexity of the model and prevent overfitting. For example, in L2 regularization, the regularization parameter is used to control the weight size. After each training cycle, based on the updated weight difference, the regularization strength can be adjusted to avoid overfitting the model to the target domain. The regularization parameter can be adjusted according to the parameter weight difference. If the weight difference is large, the regularization parameter may need to be increased to limit the change of model parameters; if the weight difference is small, the regularization parameter can be reduced to make the model more adaptable. The negative transfer parameter is used to control the influence of the source domain knowledge on the target domain. If the knowledge of the source domain does not adapt to the target domain, it may cause negative transfer. Based on the parameter weight difference between the source domain and the target domain, the negative transfer parameter can be adjusted. If the weight difference is large, it indicates that the model may overfit the target domain, and the negative transfer effect may be strong, so the negative transfer parameter needs to be increased. If the weight difference is small, it indicates that the source domain knowledge is similar to the target domain, and the negative transfer parameter can be appropriately reduced. By inputting the updated target domain model parameters, regularization parameters, and negative transfer parameters into the adaptive regularization formula, the formula will adjust the regularization strength according to the training state to reduce the impact of overfitting or negative transfer. Finally, the updated adaptive regularization formula is integrated into the preset loss function. After each training cycle, based on the updated adaptive regularization formula, the form of the loss function will be dynamically adjusted to ensure the stability and adaptability of the model training.
[0122] In this scheme, by dynamically adjusting the regularization parameter and the negative transfer parameter after each training cycle, the negative impact of the source domain knowledge on the target domain can be effectively reduced. Negative transfer usually causes the model to perform poorly on the target domain, and dynamically adjusting these parameters helps to avoid model overfitting or not adapting to the data characteristics of the target domain.
[0123] S105, if negative transfer detection is needed, determining a negative transfer mitigation measure according to the first performance indicator and the second performance indicator, and retraining the pre-trained target detection model according to the negative transfer mitigation measure and the updated preset loss function in the next training period until the pre-trained target detection model reaches the preset model training standard.
[0124] When negative transfer is detected (i.e., the source domain performance drops significantly and the target domain performance does not improve significantly), negative transfer mitigation measures need to be taken to ensure stable learning and adaptation of the model to the target domain data. Negative transfer mitigation measures include enhancing source domain regularization and improving knowledge retention: enhancing L2 regularization: increasing source domain weight constraints in the loss function to reduce the drastic changes of model parameters during target domain fine-tuning.
[0125] Introducing knowledge distillation: let the target domain model learn from the source domain model during training to maintain the stability of the original feature representation.
[0126] Increase adversarial training: by introducing adversarial samples, reduce the damage to source domain features during target domain adaptation.
[0127] Adjust the negative transfer penalty term to control the model update direction: if the source domain performance drops too fast, increase the negative transfer penalty term to make the model more inclined to retain source domain knowledge.
[0128] If the target domain performance improves slowly, reduce the negative transfer penalty term to make the model more freely adapt to the target domain data.
[0129] Adaptive adjustment strategy: dynamically adjust the influence of the negative transfer penalty term according to the change trend of the source domain and target domain performance indicators.
[0130] Selective freezing of model layers to reduce the impact of negative transfer: freezing low-level feature extraction layers: if the target domain task is similar to the source domain task, freeze the first few layers of weights to maintain the stability of the general features.
[0131] Partially unfreezing middle and high layer parameters: gradually unfreezing network layers that are more adaptable to target domain features, so that they can adapt to new data distribution.
[0132] Gradual unfreezing strategy: first freeze all layers, only fine-tune the fully connected layer, and then gradually unfreeze the convolutional layer to improve the target domain adaptation ability.
[0133] Adjusting training hyperparameters to optimize learning strategy: reducing learning rate: reducing parameter update amplitude to make model changes more stable and avoid overfitting to target domain data and losing source domain information.
[0134] Increase training data: through data augmentation, improve the diversity of target domain data and reduce the risk of model overfitting.
[0135] Synthetic more target domain samples using GAN or style transfer to improve model generalization.
[0136] Adjust BatchNormalization strategy: use domain adaptive BN
[0137] (DomainAdaptiveBatchNormalization), let the BN layer recalculate the mean and variance on the target domain, reduce the influence of domain bias.
[0138] Use domain adaptive methods to improve target domain adaptation: Adversarial domain adaptation: through adversarial training, make the model feature distribution more consistent in source and target domains.
[0139] Contrastive learning: use similar samples in target and source domains to optimize model feature representation and improve cross-domain generalization.
[0140] Cross-domain consistency regularization: let the model maintain similar high-level feature representation on source and target domain data, reduce migration conflicts.
[0141] To ensure that the model training achieves the expected migration effect, specific preset model training standards need to be defined, which can include performance indicator stability: source domain performance indicator (first performance indicator) is stable within a certain threshold: for example, source domain mAP (mean average precision) decreases by no more than 5%. Recall and precision are maintained within a certain range (e.g. 90% ± 2%). Target domain performance indicators (second performance indicators) continue to rise: target domain mAP reaches the expected value (e.g. no less than 85%). IoU (intersection over union) is greater than the set threshold (e.g. IoU>0.5). The target detection error rate is reduced to the set range.
[0142] Negative transfer mitigation effect is good: after negative transfer mitigation measures, the source domain performance no longer decreases or decreases within an acceptable range. The target domain performance improves significantly, proving that the model has adapted to the target domain data. The weight difference between the source and target domains tends to be stable and no longer fluctuates dramatically.
[0143] Training convergence: loss function stable decline: target domain loss (classification loss + bounding box loss) gradually converges and no longer fluctuates dramatically. The influence of negative transfer penalty term tends to be stable and no longer interferes with target domain learning. Model parameter update amplitude decreases: if the model parameter change amplitude is small in multiple consecutive training periods, it indicates that the training tends to be stable.
[0144] Target domain task meets business requirements: detection speed (FPS) meets target requirements: for example, real-time target detection requires FPS > 30. Model inference efficiency meets expectations: for example, deployed on embedded devices with limited computing resources, but still maintains high detection accuracy. Detection accuracy of specific target categories meets requirements: for example, certain key categories (such as pedestrians, vehicles) must meet specific mAP values (such as mAP > 90%).
[0145] If negative transfer detection is required, different negative transfer mitigation measures are taken according to the changes in the first performance indicator and the second performance indicator. If the first performance indicator decreases significantly and the second performance indicator does not improve significantly, it may be that the target domain is over-fitted during the migration process, causing forgetting of source domain knowledge (catastrophic forgetting). The weights of the key layers change too much, and the negative transfer effect is serious. Negative transfer mitigation measures can include freezing some key layers: only fine-tuning some high-level feature extraction layers, while keeping the low-level convolutional layers unchanged, to reduce the forgetting of source domain features, thereby stabilizing the first performance indicator. Increase the regularization effort: increase the L2 regularization weight to reduce the excessive bias of parameters to the target domain, to ensure that the first performance indicator does not continue to decline. Use Dropout to improve model generalization ability and prevent over-fitting of the target domain affecting the first performance indicator. Introduce distillation learning: let the new model learn in the target domain by retaining source domain features through knowledge distillation (Knowledge Distillation) to improve the first performance indicator.
[0146] If the first performance indicator does not decrease significantly and the second performance indicator decreases, it may be that the features of the transfer learning cannot effectively adapt to the target domain, resulting in a decrease in generalization ability. The difference between the target domain data distribution and the source domain is too large, making it difficult to effectively improve the second performance indicator. Negative transfer mitigation measures can include optimizing target domain feature extraction: appropriately unfreezing more high-level parameters to make them more suitable for target domain features, thereby improving the second performance indicator. Improve target domain sample weight: appropriately increase the weight of target domain samples in the training loss function, so that the model pays more attention to target domain features, thereby optimizing the second performance indicator. Use adversarial training: through domain adversarial neural network (DANN), introduce adversarial loss to reduce the difference between domain distributions, so that the model is more suitable for the target domain, thereby improving the second performance indicator.
[0147] If both the first performance indicator and the second performance indicator decrease, it may be that the training process is unstable, the learning rate is too high, or the gradient update method is inappropriate, causing both performance indicators to decrease. The feature difference between the target domain and the source domain is too large, causing the model to fail to find a suitable feature expression method between the two. Negative transfer mitigation measures can include adjusting the learning rate scheduling strategy: using the Warm-up + cosine annealing strategy to prevent parameter changes from being too drastic, thereby stabilizing both the first performance indicator and the second performance indicator. Adding a domain adaptation layer: introducing a domain adaptation module in the feature extraction part to make the model better adapt to the target domain while maintaining its adaptability to the source domain to improve the first performance indicator and the second performance indicator. Gradient alignment: control the gradient direction to enable the model to find the best trade-off point between the source domain and the target domain, balance the first performance indicator and the second performance indicator, and prevent negative transfer from continuing to worsen. According to the negative transfer mitigation measures, adjust the model layers that need to be frozen or unfrozen to balance the feature learning of the source domain and the target domain. Set a new optimization strategy, such as adjusting the learning rate and optimizing the gradient update method, to ensure stable training of the model. Train using the updated preset loss function to enhance the adaptability to negative transfer. If the source domain performance decreases significantly, increase the weight of the source domain data; if the target domain performance is low, increase the weight of the target domain data and possibly introduce an adversarial loss to optimize feature alignment. Perform forward propagation with the updated loss function to calculate the target detection error and perform backpropagation to optimize the model parameters. During the training process, dynamically monitor the performance indicators of the source domain and the target domain to ensure that the training direction meets the optimization goal. At the end of each training cycle, evaluate the model's performance indicators on the source domain and the target domain to determine whether the pre-set model training standards have been met. If the model still does not meet the standards, further adjust the negative transfer mitigation measures and the loss function, and enter the next training cycle until the pre-set training standards are met.
[0148] In the embodiments of the present application, the pre-trained target detection model and the target domain data set are obtained, the scale data and the complexity data of the target domain data set are determined, and the configuration strategy of the frozen layer and the fine-tuning layer of the pre-trained target detection model is determined according to the scale data and the complexity data. The pre-trained target detection model is trained according to the configuration strategy, the source domain model parameters and the target domain model parameters of the pre-trained target detection model are obtained, the parameter weight difference of the source domain model parameters and the target domain model parameters is determined, the regularization parameter and the negative transfer parameter are determined according to the parameter weight difference. The adaptive regularization formula is constructed according to the target domain model parameters, the regularization parameter and the negative transfer parameter, the adaptive regularization formula is integrated into the preset loss function, and the pre-trained target detection model is further trained according to the integrated preset loss function. The preset loss function is updated after each training period, and the first performance index of the pre-trained target detection model on the source domain data set and the second performance index on the target domain data set are calculated after each training period. Whether the pre-trained target detection model needs to be detected for negative transfer is determined according to the first performance index and the second performance index. If negative transfer detection is needed, the negative transfer relief measures are determined according to the first performance index and the second performance index, and the pre-trained target detection model is retrained according to the negative transfer relief measures and the updated preset loss function in the next training period, until the pre-trained target detection model reaches the preset model training standard. Through the above target detection model training method based on model transfer learning, the performance of the model on the target domain task can be improved through accurate strategy and dynamic adjustment, and overfitting or negative transfer can be avoided, and finally a high-quality model that can retain source domain knowledge and adapt to target domain tasks is obtained.
[0149] Figure 2 A schematic block diagram of a target detection model training system based on model transfer learning is provided for the embodiments of the present disclosure. The system comprises:
[0150] The configuration strategy determination module 201 is configured to obtain a pre-trained target detection model and a target domain data set, determine scale data and complexity data of the target domain data set, and determine a configuration strategy of a frozen layer and a fine-tuning layer of the pre-trained target detection model according to the scale data and the complexity data.
[0151] The parameter determination module 202 is configured to train the pre-trained target detection model according to the configuration strategy, obtain source domain model parameters and target domain model parameters of the pre-trained target detection model, determine a parameter weight difference of the source domain model parameters and the target domain model parameters, and determine a regularization parameter and a negative transfer parameter according to the parameter weight difference.
[0152] The integration module 203 is configured to construct an adaptive regularization formula according to the target domain model parameter, the regularization parameter and the negative transfer parameter, integrate the adaptive regularization formula into a preset loss function, and continue training the pre-trained target detection model according to the integrated preset loss function.
[0153] The negative transfer detection module 204 is configured to update the preset loss function after each training cycle, calculate a first performance index of the pre-trained target detection model on the source domain data set and a second performance index of the pre-trained target detection model on the target domain data set after each training cycle, and determine whether the pre-trained target detection model needs to be subjected to negative transfer detection according to the first performance index and the second performance index.
[0154] The model training module 205 is configured to, if the pre-trained target detection model needs to be subjected to negative transfer detection, determine a negative transfer relief measure according to the first performance index and the second performance index, and retrain the pre-trained target detection model according to the negative transfer relief measure and the updated preset loss function in the next training cycle until the pre-trained target detection model reaches a preset model training standard.
[0155] Figure 3 A schematic block diagram of an electronic device 300 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptops, desktops, tablets, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular telephones, smartphones, wearable devices, and other similar computing devices. The components shown here, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the present disclosure described and / or claimed in this document.
[0156] The electronic device 300 includes a computing unit 301 that can perform various appropriate actions and processes according to a computer program stored in a ROM 302 or a computer program loaded into a RAM 303 from a storage unit 308. Various programs and data required for the operation of the electronic device 300 can also be stored in the RAM 303. The computing unit 301, the ROM 302, and the RAM 303 are connected to each other through a bus 304. An I / O interface 305 is also connected to the bus 304.
[0157] A plurality of components in the electronic device 300 are connected to the I / O interface 305, including: an input unit 306, such as a keyboard, a mouse, etc.; an output unit 307, such as various types of displays, speakers, etc.; a storage unit 308, such as a magnetic disk, an optical disk, etc.; and a communication unit 309, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 309 allows the electronic device 300 to exchange information / data with other devices through a computer network, such as the Internet, and / or various telecommunication networks.
[0158] The computing unit 301 can be various general and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 301 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The computing unit 301 performs various methods and processes described above, such as the model transfer learning based object detection model training method. For example, in some embodiments, the model transfer learning based object detection model training method can be implemented as a computer software program, which is tangibly embodied in a machine-readable medium, such as the storage unit 308. In some embodiments, part or all of the computer program can be loaded and / or installed onto the electronic device 300 via the ROM 302 and / or the communication unit 309. When the computer program is loaded onto the RAM 303 and executed by the computing unit 301, one or more steps of the model transfer learning based object detection model training method described above can be performed. Alternatively, in other embodiments, the computing unit 301 can be configured to perform the model transfer learning based object detection model training method by any other appropriate means, such as by means of firmware.
[0159] Various implementations of the systems and techniques described above can be realized in digital electronic circuitry, integrated circuitry, a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on a chip (SOC), a programmable logic device (PLD), a computer hardware, firmware, software, and / or combinations thereof. These various implementations can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.
[0160] Program code for carrying out methods of the present disclosure can be written in any combination of one or more programming languages. The program code can be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the program code, when executed by the processor or controller, produces a means for implementing the functions / acts specified in the flowcharts and / or block diagrams. The program code can be executed entirely on a machine, partially on a machine, partially on a machine and partially on a remote machine or entirely on a remote machine or server.
[0161] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable storage medium can include, without limitation, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of the machine-readable storage medium will include one or more lines of electrical connections, portable computer disks, hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or Flash memory), optical fibers, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the foregoing.
[0162] To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having a display device for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.
[0163] The systems and techniques described here can be implemented in a computing system that includes a back end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front end component (e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.
[0164] The computer system can include clients and servers. This relationship can be. The servers are typically remote from the clients with the interactions between them occurring over a communication network. The relationship between a client and a server is one of client-server. The server can be a cloud server, a server of a distributed system, or a server incorporating a blockchain.
[0165] It should be understood that the various forms of flow shown above can be re-ordered, added to, or deleted from without departing from the scope of the present disclosure. For example, the steps recited in the present disclosure can be performed in parallel, in series, or in a different order, as long as the desired results of the technology disclosed in the present disclosure are achieved, and the present disclosure is not limited herein.
[0166] The specific embodiments described above are not intended to be limiting. One of skill in the art will understand that various modifications, combinations, sub-combinations, and alternatives can be made to the specific embodiments described above without departing from the scope of the disclosure. Any modifications, combinations, sub-combinations, and alternatives falling within the spirit and principles of the disclosure are intended to be included in the scope of the disclosure.
Claims
1. A method for training a target detection model based on model transfer learning, characterized in that, The method comprises: obtaining a pre-training target detection model and a target domain data set, determining scale data and complexity data of the target domain data set, and determining a configuration strategy of a frozen layer and a fine-tuning layer of the pre-training target detection model according to the scale data and the complexity data; training the pre-training target detection model according to the configuration strategy to obtain source domain model parameters and target domain model parameters of the pre-training target detection model, determining parameter weight differences of the source domain model parameters and the target domain model parameters, and determining a regularization parameter and a negative transfer parameter according to the parameter weight differences; constructing an adaptive regularization formula according to the target domain model parameters, the regularization parameter and the negative transfer parameter, integrating the adaptive regularization formula into a preset loss function, and continuing to train the pre-training target detection model according to the integrated preset loss function; updating the preset loss function after each training cycle, calculating a first performance indicator of the pre-training target detection model on the source domain data set and a second performance indicator of the pre-training target detection model on the target domain data set after each training cycle, and determining whether the pre-training target detection model needs to be subjected to negative transfer detection according to the first performance indicator and the second performance indicator; if the negative transfer detection is needed, determining a negative transfer relief measure according to the first performance indicator and the second performance indicator, and retraining the pre-training target detection model according to the negative transfer relief measure and the updated preset loss function in the next training cycle until the pre-training target detection model reaches a preset model training standard.
2. The method of claim 1, wherein, Wherein, the selection process of the pre-training target detection model comprises: obtaining a source domain data set and a target domain data set, determining first feature distribution data of the source domain data set, and determining second feature distribution data of the target domain data set; determining feature difference data according to the first feature distribution data and the second feature distribution data, and determining the pre-training target detection model according to the feature difference data.
3. The method of claim 1, wherein, Wherein, updating the preset loss function after each training cycle comprises: updating the source domain model parameters and the target domain model parameters after each training cycle, updating the parameter weight differences according to the updated source domain model parameters and the target domain model parameters, and updating the regularization parameter and the negative transfer parameter according to the updated parameter weight differences; updating the adaptive regularization formula according to the updated target domain model parameters, the regularization parameter and the negative transfer parameter, and updating the preset loss function according to the updated adaptive regularization formula.
4. The method of claim 1, wherein, Wherein, the adaptive regularization formula is: wherein, is a regularization loss term; a is a regularization parameter; W is the target domain model parameter; W neg is a negative transfer parameter.
5. The method of claim 1, wherein, wherein, before integrating the adaptive regularization formula into the preset loss function, the method further comprises: obtaining a source domain data set and a target domain data set, determining a source domain loss according to the source domain data set and the source domain model parameters; determining a target domain loss according to the target domain model parameters and the target domain data set; correspondingly, integrating the adaptive regularization formula into the preset loss function comprises: integrating the adaptive regularization formula, the source domain loss and the target domain loss into the preset loss function.
6. The method of claim 5, wherein, Wherein, the preset loss function is: wherein, Ltotalis the total loss function; λ s Lsourceis the source domain loss; λ source Lsourceis the source domain loss; λ t Ltargetis the target domain loss; β target Ltargetis the target domain loss; β Lregis the regularization loss term.
7. The method of claim 1, wherein, wherein, After determining the configuration strategy of the frozen layer and the fine-tuning layer of the pre-training target detection model according to the scale data and the complexity data, the method further comprises: obtaining a source domain data set, and constructing a meta-task set according to the source domain data set; updating the configuration strategy according to each meta-task of the meta-task set by using a meta-learning model; correspondingly, training the pre-training target detection model according to the configuration strategy, comprising: training the pre-training target detection model according to the updated configuration strategy.
8. The method of claim 1, wherein, wherein, before continuing to train the pre-training target detection model according to the integrated preset loss function, the method further comprises: obtaining an incremental target domain data set, determining the feature information of the incremental target domain data set, and determining the incremental update layer of the pre-training target detection model according to the feature information; obtaining an original data set of a memory bank, and performing incremental update on the incremental update layer of the pre-training target detection model according to the original data set and the target domain data set by using knowledge distillation; correspondingly, continuing to train the pre-training target detection model according to the integrated preset loss function, comprising: continuing to train the pre-training target detection model after incremental update according to the integrated preset loss function. 9.A target detection model training system based on model transfer learning, configured to perform the method of any one of claims 1-8. The system comprises: a configuration strategy determination module configured to obtain a pre-training target detection model and a target domain data set, determine scale data and complexity data of the target domain data set, and determine a configuration strategy of a frozen layer and a fine-tuning layer of the pre-training target detection model according to the scale data and the complexity data; a parameter determination module configured to train the pre-training target detection model according to the configuration strategy, obtain source domain model parameters and target domain model parameters of the pre-training target detection model, determine parameter weight differences of the source domain model parameters and the target domain model parameters, determine a regularization parameter and a negative transfer parameter according to the parameter weight differences; an integration module configured to construct an adaptive regularization formula according to the target domain model parameters, the regularization parameter and the negative transfer parameter, integrate the adaptive regularization formula into a preset loss function, and continue to train the pre-training target detection model according to the integrated preset loss function; a negative transfer detection module configured to update the preset loss function after each training cycle, calculate a first performance indicator of the pre-training target detection model on the source domain data set and a second performance indicator of the pre-training target detection model on the target domain data set after each training cycle, and determine whether the pre-training target detection model needs to be subjected to negative transfer detection according to the first performance indicator and the second performance indicator; a model training module configured to, if the pre-training target detection model needs to be subjected to negative transfer detection, determine a negative transfer relief measure according to the first performance indicator and the second performance indicator, and retrain the pre-training target detection model according to the negative transfer relief measure and the updated preset loss function in the next training cycle until the pre-training target detection model reaches a preset model training standard.
10. An electronic device comprising: at least one processor; and a memory connected in communication with the at least one processor; wherein, The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-8.