Method and device for performing field adaptive training on neural network
By extracting multi-dimensional anchor box features and performing cross-domain alignment in target detection, the problem of pseudo-label quality and feature alignment in unsupervised domain adaptation methods is solved, and more efficient target domain performance and training stability are achieved.
Patent Information
- Application Number
- CN202310204379.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-03
- Publication Date
- 2024-09-03
AI Technical Summary
Existing unsupervised domain adaptation methods have problems in target detection, such as the inability to improve pseudo-label quality with the training process, the inability to effectively achieve category-level feature alignment, and poor alignment of features of different sizes, resulting in reduced model performance.
By extracting multi-dimensional anchor box features, the anchor box features of the source domain and target domain are divided into category sets, and a loss function that minimizes intra-class distance and maximizes inter-class distance is used to align cross-domain features and dynamically update pseudo labels. , combined with moving average class center and undersampling technology, to achieve cross-domain multi-size anchor box feature alignment.
It improves the performance of the model in the target domain, enhances the accuracy and stability of feature alignment, avoids information loss caused by feature alignment of different sizes, and improves pseudo-label quality and training stability.
Smart Images

Figure CN118587550A
Abstract
Description
Technical Field
[0001] The present invention generally relates to domain adaptation, and more specifically, to a method and apparatus for unsupervised domain adaptation training of a neural network for performing object detection tasks. Background Art
[0002] Unsupervised domain adaptation refers to migrating a model trained with labeled source domain data to unlabeled target domain data, while maintaining the performance of the model in the target domain as much as possible. Due to the data bias between the source and target domains and the lack of labels in the target domain data, the performance of the model trained with source domain data in the target domain is often poor. The training process of unsupervised domain adaptation utilizes both labeled data in the source domain and unlabeled data in the target domain, which can effectively alleviate domain differences and improve the robustness of the model.
[0003] At present, many unsupervised domain adaptation methods have been proposed. They learn domain invariant features through self-training or adversarial training to solve the problem of data bias and improve the performance of the model in the target domain. However, the existing unsupervised domain adaptation methods for object detection have the following problems:
[0004] - Most self-training methods are based on static pseudo-labels, and thus cannot continuously improve the quality of pseudo-labels as the training process progresses;
[0005] -Most existing methods achieve feature distribution alignment, especially global feature distribution alignment at the image level, but cannot effectively achieve feature alignment at the category level;
[0006] -Most importantly, existing methods do not align features of different sizes separately. Since features of different sizes contain different levels of detail information, aligning the features of large objects with those of small objects will cause the large objects to lose feature information, thus affecting the final performance. As an example of existing methods, YOLOv5 does not consider the scale differences of each object in the image, extracts features for objects of different sizes, and then uses adversarial learning to achieve feature distribution alignment. Summary of the invention
[0007] In order to solve one or more of the above problems of existing unsupervised domain adaptation methods, the present disclosure proposes a new unsupervised domain adaptation training method for object detection neural networks.
[0008] According to one aspect of the present invention, a method for unsupervised domain adaptive training of a neural network performing target detection is provided, comprising: a) extracting multiple source domain anchor box features of multiple sizes based on a source domain image with a label, and extracting multiple target domain anchor box features of the multiple sizes based on a target domain image without a label; b) generating a prediction value of target detection for a corresponding anchor box in the source domain image based on the extracted source domain anchor box features, and generating a prediction value of target detection for a corresponding anchor box in the target domain image based on the extracted target domain anchor box features; for each of the multiple sizes: c) dividing the multiple source domain anchor box features of the size into multiple corresponding to the target, according to the label of the source domain image; The method comprises the steps of: selecting a plurality of source domain feature sets of the plurality of categories; d) dividing the plurality of target domain anchor box features having the size into a plurality of target domain feature sets corresponding to the plurality of categories respectively according to the pseudo labels of the target domain image; e) performing cross-domain feature alignment by minimizing the intra-class distance and maximizing the inter-class distance so that the distance between the source domain anchor box features and the target domain anchor box features included in the source domain feature set and the target domain feature set corresponding to the same category is reduced; f) receiving another source domain image with a label and another target domain image without a label; wherein, by repeatedly performing steps a)-f), the neural network is trained using a prediction loss function for the source domain image, a prediction loss function for the target domain image, and a feature alignment loss function.
[0009] According to another aspect of the present invention, there is provided an apparatus for performing unsupervised domain adaptive training on a neural network for performing target detection, comprising: a memory storing a program and one or more processors. The processors are configured to perform the following operations by executing the program: a) causing the neural network to extract multiple source domain anchor box features of multiple sizes based on a source domain image with a label, and extract multiple target domain anchor box features of the multiple sizes based on a target domain image without a label; b) causing the neural network to generate a prediction value of target detection for a corresponding anchor box in the source domain image based on the extracted source domain anchor box features, and to generate a prediction value of target detection for a corresponding anchor box in the target domain image based on the extracted target domain anchor box features; for each of the multiple sizes: c) according to the label of the source domain image, dividing the multiple source domain anchor box features of the size into multiple source domain feature sets corresponding to multiple categories of targets respectively; d) causing the neural network to generate a prediction value of target detection for a corresponding anchor box in the target domain image based on the extracted target domain anchor box features; for each of the multiple sizes: c) according to the label of the source domain image, dividing the multiple source domain anchor box features of the size into multiple source domain feature sets corresponding to multiple categories of targets respectively; ) according to the pseudo-label of the target domain image, divide the multiple target domain anchor box features with the size into multiple target domain feature sets corresponding to the multiple categories respectively; e) perform cross-domain feature alignment by minimizing the intra-class distance and maximizing the inter-class distance so that the distance between the source domain anchor box features and the target domain anchor box features included in the source domain feature set and the target domain feature set corresponding to the same category is reduced; f) enable the neural network to receive another source domain image with a label and another target domain image without a label; wherein the processor is configured to train the neural network by repeatedly executing steps a)-f) using a prediction loss function for the source domain image, a prediction loss function for the target domain image, and a feature alignment loss function.
[0010] According to another aspect of the present invention, there is provided a non-transitory computer-readable medium storing a program, which, when executed by a computer, causes the computer to perform the method for unsupervised domain adaptive training of a neural network performing target detection as described above. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] Figure 1 The cross-domain multi-scale anchor box feature alignment according to the present disclosure is schematically illustrated.
[0012] Figure 2 The specific process of cross-domain anchor frame feature alignment according to the present disclosure is schematically shown.
[0013] Figure 3 The training of an object detection neural network according to the present disclosure is schematically illustrated.
[0014] Figure 4 A flowchart of a domain adaptive training method for a neural network according to the present disclosure is shown.
[0015] Figure 5 A modular block diagram of a neural network and training apparatus according to the present disclosure is shown.
[0016] Figure 6 The training stability of various domain adaptation models is shown.
[0017] Figure 7 A block diagram showing an exemplary configuration of computer hardware for implementing the present invention is shown. DETAILED DESCRIPTION
[0018] The unsupervised domain adaptation method according to the content of the present disclosure can be applied to target detection neural networks based on anchor frames, such as YOLOvX (X=1, 2, 3, 4, 5), Yolact, Yolact++, Faster-RCNN, etc. An anchor frame refers to each area obtained by dividing an image according to a fixed size or a fixed aspect ratio, which serves as a priori frame for target detection. The image can be divided according to a variety of fixed sizes or a variety of fixed aspect ratios, thereby obtaining anchor frames of various sizes to detect targets of different sizes in the image. The label of each anchor frame can be calculated based on the label of the entire image. The label of the anchor frame can indicate whether the anchor frame is the background, the category of the target corresponding to the anchor frame, and the location information of the target, etc.
[0019] The present disclosure adds a multi-scale anchor frame feature alignment module to the existing target detection framework. Figure 1 To describe the cross-domain multi-scale anchor box feature alignment according to the present disclosure.
[0020] like Figure 1 As shown, the anchor-frame-based target detection framework generally includes a backbone network 110, a neck network 120, and optionally also includes a head network (head) (not shown). Both the source domain image with labels and the target domain image without labels are input to the backbone network 110, and the backbone network 110 extracts global features for the entire input image. The source domain image and the target domain image have been divided into anchor frames of various sizes to facilitate the detection of targets of different sizes in the image. The neck network 120 extracts features of source domain anchor frames of various sizes from the global features of the source domain image, and extracts features of target domain anchor frames of various sizes from the global features of the target domain image. Figure 1 Schematically shows “small anchor box feature”, “medium anchor box feature” and “large anchor box feature”, and each size of anchor box feature contains multiple features corresponding to multiple anchor boxes of corresponding sizes. As an example, Figure 1 The small, medium, and large anchor box features in can correspond to the anchor box features output from the 18th, 21st, and 24th layers of the YOLOv5 framework, respectively.
[0021] In addition, the head network (not shown) may generate a prediction value of target detection for the corresponding anchor box in the source domain image based on the features of the source domain anchor box extracted by the neck network 120, and generate a prediction value of target detection for the corresponding anchor box in the target domain image based on the features of the extracted target domain anchor box. The prediction value generated by the head network may include, for example, the probability that the anchor box is the foreground or background, the probability that the target corresponding to the anchor box belongs to a certain category, a prediction value about a positioning box, etc., where the positioning box indicates the position and size of the anchor box.
[0022] like Figure 1 As shown in Figure 2, cross-domain feature alignment is performed for anchor box features of each of the three sizes: large, medium, and small. Figure 2 To illustrate the specific process of cross-domain anchor box feature alignment, it is easy to understand that the same feature alignment process is performed for anchor box features of other sizes.
[0023] like Figure 2 As shown, the small anchor box features of the source domain image and the target domain image extracted by the neck network 120 are input. Optionally, the input small anchor box features can be L2-normalized so that the modulus length of the feature vector is 1.
[0024] Then, according to the known labels of the source domain image, multiple anchor box features of the source domain image (the “source domain anchor box feature space” shown) are divided into multiple source domain anchor box feature sets corresponding to multiple categories respectively. Figure 2 It is schematically shown that the anchor box features in the source domain anchor box feature space are divided into multiple sets, each of which may correspond to one of the categories such as background, pedestrian, car, etc.
[0025] For the anchor frame features in the target domain anchor frame feature space, firstly, a pseudo label related to the category and positioning information is set for each anchor frame feature according to the pseudo label of the target domain image. In the present disclosure, a dynamic self-training method is adopted to obtain the pseudo label of the target domain image (to be described later), and it is stored in a pseudo label database, for example. The pseudo label of the target domain image indicates the category and positioning information of all the objects to be detected in the target domain image.
[0026] Specifically, the intersection-over-union (IOU) of the area covered by each anchor frame in the target domain image and the coverage area of each target to be detected contained in the pseudo-label of the target domain image is calculated. If the calculated IOU is greater than a preset threshold, the pseudo-label of the target to be detected is set to the pseudo-label of the feature of the anchor frame. The intersection-over-union ratio can be calculated according to the following mathematical formula (1):
[0027]
[0028] After setting a pseudo label for each anchor box feature in the target domain anchor box feature space, these anchor box features can be divided into multiple sets corresponding to multiple categories, which is similar to the processing for the source domain anchor box features.
[0029] The following situation is considered in the present disclosure: there are anchor box features corresponding to certain categories in the previously input source domain or target domain image data, but the anchor box features corresponding to the category are missing in the currently input image data. In order to solve the problem of missing categories and avoid the problem of pseudo-label category errors, the present disclosure calculates the moving average class center for each set of the obtained source domain anchor box features and target domain anchor box features, and adds the calculated moving average class center to the corresponding set. Figure 2 The moving average cluster centers added to each set are schematically shown in FIG. 1 as solid circles and triangles, respectively.
[0030] The moving average cluster center can be calculated according to the following mathematical formulas (2)-(5).
[0031]
[0032]
[0033]
[0034]
[0035] Among them, x S represents the anchor box features in the source domain image, x T represents the anchor box features in the target domain image, represents the source domain anchor box feature set corresponding to the kth category, represents the target domain anchor box feature set corresponding to the kth category, and They represent the class centers of the source domain anchor box feature set and the target domain anchor box feature set corresponding to the kth category calculated in the current iteration, respectively. and They represent the moving average class centers of the source domain anchor box feature set and the target domain anchor box feature set corresponding to the kth category calculated in the previous iteration, and They represent the moving average class centers of the source domain anchor box feature set and the target domain anchor box feature set corresponding to the kth category calculated in the current iteration, and θ represents the moving average coefficient.
[0036] As shown in equations (4) and (5), the moving average class center of the corresponding category calculated in the previous iteration is used when calculating the moving average class center, and the moving average class center finally obtained in the current iteration is and is added to the corresponding set, so even if the current input image data lacks the anchor box features corresponding to a certain category in the previous iteration, the feature set corresponding to the category will not be missing in the result obtained in the current iteration. Figure 2 As shown, the anchor box features in the current target domain anchor box feature space are divided into four sets corresponding to four categories (missing the "pedestrian" category), and by adding the moving average class center, five sets corresponding to five categories (including the "pedestrian" category) can be obtained, where the feature set corresponding to the "pedestrian" category is formed by the moving average class center of the "pedestrian" category calculated in the previous iteration.
[0037] In addition, if Figure 2 As shown, the anchor box features in the source domain anchor box feature space are divided into five sets corresponding to five categories, and the number of anchor box features included in each set is different from each other, and even the difference is very large. This situation also exists in the target domain anchor box feature space. In order to alleviate the problem of feature imbalance between categories, the present disclosure limits the number of source domain anchor box features in each source domain anchor box feature set to a predetermined value by undersampling, and also limits the number of target anchor box features included in each target domain anchor box feature set to a predetermined value. As an example, the number of anchor box features in each set can be limited by randomly deleting one or more anchor box features. In addition, the same upper limit on the number of features can be set for the source domain anchor box feature set and the target domain anchor box feature set. For example, Figure 2 Schematically shows that some anchor box features in the source domain anchor box feature set corresponding to the “car” category are deleted to limit the number of features to 3.
[0038] After obtaining the source domain anchor frame feature set and the target domain anchor frame feature set corresponding to each category, cross-domain feature alignment can be performed. In the present disclosure, feature alignment is performed by minimizing the intra-class distance and maximizing the inter-class distance, so that the distance between the source domain anchor frame features and the target domain anchor frame features contained in the source domain anchor frame feature set and the target domain anchor frame feature set corresponding to the same category is reduced.
[0039] Specifically, the present disclosure utilizes an improved d-SNE method to perform feature alignment. The d-SNE method is introduced in the paper "d-SNE: Domain adaptation using stochastic neighborhood embedding" by Xu X, Zhou X, Venkatesan R et al. (IEEE / CVF Computer Vision and Pattern Recognition (CVPR) Conference Proceedings, 2019, pp. 2497-2506), which is currently the best performing feature alignment method based on sample points (such as objects in images). The d-SNE method uses the loss function shown in the following mathematical formula (6) to achieve feature-level alignment based on sample points by minimizing the maximum cross-domain intra-class distance and maximizing the minimum cross-domain inter-class distance at the same time:
[0040]
[0041] Among them, d(x s ,x t ) represents the source domain anchor box feature x s and target domain anchor box feature x t The square of the Euclidean distance in feature space, y s is x s The category label of x, k is t The category label of .
[0042] Usually, in order to improve computational efficiency, the d-SNE loss function shown in the following mathematical formula (7) is used:
[0043]
[0044] Wherein, m is a predetermined margin value.
[0045] However, the d-SNE loss function as described above only increases the relative difference between the maximum intra-class distance and the minimum inter-class distance, but does not maximize the absolute minimum inter-class distance. Therefore, the present disclosure proposes an improved loss function L A , as shown in the following mathematical formula (8):
[0046]
[0047] Compared with equation (7), equation (8) adds one more term: Where m2 is another predetermined margin value. This term is used to maximize the absolute minimum inter-class distance. Although an additional hyperparameter m2 is required, the loss function L according to the present disclosure is AIt can better separate the features corresponding to different categories.
[0048] The following will be combined Figure 3 The training method of the target detection neural network according to the present disclosure is described in detail. Figure 3 As shown, the target detection neural network 300 inputs the source domain image X S and the target domain image X T , the target detection neural network 300 extracts anchor box features with different sizes for the input image, and generates target detection prediction results P for the source domain and the target domain respectively based on the extracted features. S and P T The source domain image X S With label Y S , so we can use the label Y S And the prediction result P S To calculate the detection loss L for the source domain image S . Detection loss L S Can include classification loss L cls s and the localization loss L loc_s As an example, the classification loss L cls_s Can include cross entropy loss function, positioning loss L loc_s Can include L1, L2 or smooth L1 loss functions.
[0049] For the target domain image X without label T , according to the prediction result P T and previously generated pseudo-labels (e.g. stored in a pseudo-label database) to calculate the detection loss L for the target domain image. T . Detection loss L T Can include classification loss L cls_t and the localization loss L loc_t As an example, the classification loss L cls_t Can include cross entropy loss function, positioning loss L loc_t Can include L1, L2 or smooth L1 loss functions.
[0050] Therefore, the overall loss function L in the training according to the present disclosure can be expressed by the following mathematical formula (9):
[0051] L=α1L S +α2L T +α3L A (9)
[0052] Among them, L S represents the detection loss function for the source domain image, L Trepresents the detection loss function for the target domain image, L A represents the anchor box feature alignment loss function, and α1, α2, and α3 represent the weighting coefficients applied to the corresponding loss functions.
[0053] on the other hand, Figure 3 It also shows the generation of pseudo labels for target domain images through dynamic self-training. Figure 3 As shown, for the current input target domain image X T , according to the prediction result P T , the preset confidence threshold and IOU threshold, and the non-maximum suppression (NMS) algorithm is used to generate the target domain image X T 's pseudo-labels.
[0054] Specifically, the NMS algorithm can be executed by performing the following steps.
[0055] First, all anchor boxes predicted as foreground (i.e., target) in the current input target domain image are sorted in descending order according to confidence, where confidence refers to the predicted probability that the anchor box corresponds to the target. Then, anchor boxes with confidence lower than a preset threshold are deleted, and the remaining anchor boxes form the first set.
[0056] Next, the anchor box with the highest confidence is selected from the first set and added to the second set, and the anchor boxes whose IOU with the selected anchor box coverage area is greater than a preset threshold are deleted from the first set. This step is repeated until the first set is empty. At this point, the box anchors and their prediction results contained in the second set can be used as the target domain image X of the current input. T 's pseudo-labels.
[0057] In the target domain image X for the current input T After the pseudo-label is generated, it can be stored in the pseudo-label database to update the previously stored pseudo-label. In particular, the updated pseudo-label will be used for the target domain image X that is input later (e.g., in the next round of training). T Calculate the detection loss L T (like Figure 3 As shown) and determine the target domain anchor box feature set corresponding to each category (as shown Figure 2 As shown). For the current input target domain image X T Calculate the detection loss L T The previously stored pseudo-labels read from the pseudo-label database are still used.
[0058] Figure 4 A flowchart of a domain adaptive training method for a neural network according to the present disclosure is shown, Figure 5A modular block diagram of a neural network and a training apparatus according to the present disclosure is shown.
[0059] like Figure 4 As shown, in step S410, multiple source domain anchor frame features of multiple sizes are extracted based on the source domain image with labels, and multiple target domain anchor frame features of the multiple sizes are also extracted based on the target domain image without labels. This step can be performed by Figure 5 This is performed by the feature extraction unit 510 in the neural network shown.
[0060] In step S420, based on the extracted source domain anchor box features, a prediction value for object detection is generated for the corresponding anchor box in the source domain image. Similarly, based on the extracted target domain anchor box features, a prediction value for object detection is generated for the corresponding anchor box in the target domain image. This step can be performed by Figure 5 This is performed by the object detection unit 520 in the neural network shown.
[0061] Then, for each anchor box feature of the multiple sizes (e.g., small anchor box features), the source domain anchor box features of the size can be divided into multiple source domain feature sets corresponding to multiple categories of the target according to the label of the source domain image, as shown in step S430. Similarly, the target domain anchor box features of the size can be divided into multiple target domain feature sets corresponding to the multiple categories according to the pseudo-label of the target domain image, as shown in step S440. Steps S430 and S440 can be composed of Figure 5 The feature segmentation unit 530 in is used to perform the operation.
[0062] Then, in step S450, cross-domain anchor frame feature alignment is performed to reduce the distance between the source domain anchor frame features and the target domain anchor frame features included in the source domain feature set and the target domain feature set corresponding to the same category. This step can be performed by Figure 5 The feature alignment unit 540 in FIG.
[0063] At step S460 , the next source domain image with a label and the next target domain image without a label are received, and the method returns to step S410 .
[0064] By repeatedly executing steps S410-S460, based on the detection loss function L for the source domain image S , the detection loss function L for the target domain image T , and anchor box feature alignment loss function L A To train the neural network. Figure 5 The training unit 550 in controls the training process.
[0065] It should be noted that it is not necessary to follow Figure 4The training method of the present invention is performed in the order shown in . For example, steps S430 and S440 can be performed simultaneously. In addition, steps S430-S450 can be performed sequentially for each size of anchor box features, or steps S430-S450 can be performed in parallel for various sizes of anchor box features.
[0066] Table 1 shows the performance comparison of the neural network trained according to the method of the present disclosure and the model trained according to the existing method. The test image is a road image, and it is tested on two target domains (daytime image and nighttime image), and the mean average precision (mAP) is used as the evaluation index. In Table 1, the source domain model refers to the model trained with the source domain image data and its labels, which can achieve the best performance (99.8) on the source domain test set, but the performance on the target domain test set (daytime, nighttime) is greatly reduced (77.6, 48.6). The target domain model refers to the model trained with the target domain image data and its labels, and the performance of the model represents the upper limit of the performance that can be achieved on the target domain. The remaining four models are models trained using unsupervised domain adaptation methods, which are models trained using source domain image data and its labels, and target domain image data (excluding labels). As can be seen from Table 1, the model trained according to the method of the present disclosure (i.e., dynamic self-training + multi-scale anchor frame feature alignment) achieved the best performance on both target domain test sets. In addition, the dynamic self-training method can also achieve better performance than the static self-training method. Therefore, when combined with dynamic self-training, the cross-domain multi-scale anchor box feature alignment method can further improve the performance.
[0067] [Table 1]
[0068]
[0069] For unsupervised domain adaptation methods, due to the lack of a validation set for the target domain, it is not possible to use the validation set for the target domain to select the model with the best performance. In this case, training stability is crucial. Training stability means that the performance of the model steadily improves during the training process, and the performance of the model obtained by the last iteration is almost the same as the best performance that the model can achieve during the entire training process. Figure 6 The training stability of the four unsupervised domain adaptation models in Table 1 is shown, where the horizontal axis represents the epoch of training and the vertical axis represents mAP@0.5, that is, the mAP when IoU is set to 0.5. Figure 6 (a) is based on large target detection on the daytime target domain test set, and (b) is based on large target detection on the nighttime target domain test set. Figure 6It can be seen that the model according to the present disclosure (i.e., dynamic self-training + multi-scale anchor box feature alignment) has good training stability.
[0070] The unsupervised domain adaptive training method according to the present disclosure has been described above in combination with specific embodiments. The method has the following characteristics:
[0071] (1) Multi-scale anchor feature alignment. Because anchor features of different sizes contain details of different richness, aligning the source domain anchor features and target domain anchor features of the same size will not lose detail information.
[0072] (2) Dynamic self-training: The pseudo-labels of the target domain images are continuously updated during the training process, thereby improving the quality of the pseudo-labels.
[0073] (3) The anchor box features are aligned point by point based on high-quality pseudo-labels, rather than using feature distribution alignment methods. This can reduce the distance between anchor box features of the same category and expand the distance between anchor features of different categories.
[0074] (4) The moving average class center of each class is utilized to alleviate the negative impact caused by missing classes and incorrect labels in pseudo-labels.
[0075] (5) Undersampling: Undersampling the anchor box features of certain categories can alleviate the problem of imbalanced anchor box features between different categories.
[0076] The methods described in the above embodiments may be implemented by software, hardware, or a combination of software and hardware. The programs included in the software may be stored in advance in a storage medium provided inside or outside the device. As an example, during execution, these programs are written to a random access memory (RAM) and executed by a processor (e.g., CPU), thereby implementing the various methods and processes described herein.
[0077] Figure 7 An example configuration block diagram of computer hardware that executes the method of the present disclosure according to a program is shown, and the computer hardware is an example of a device for training a target detection neural network according to the present disclosure. In addition, the neural network of the present disclosure can also be implemented based on the computer hardware.
[0078] like Figure 7 As shown, in a computer 700 , a central processing unit (CPU) 701 , a read only memory (ROM) 702 , and a random access memory (RAM) 703 are connected to one another via a bus 704 .
[0079] The input / output interface 705 is further connected to the bus 704. The input / output interface 705 is connected with the following components: an input device 706 formed with a keyboard, a mouse, a microphone, etc.; an output device 707 formed with a display, a speaker, etc.; a storage device 708 formed with a hard disk, a nonvolatile memory, etc.; a communication device 709 formed with a network interface card (such as a local area network (LAN) card, a modem, etc.); and a drive 710 that drives a removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, or a semiconductor memory.
[0080] In the computer having the above-described structure, the CPU 701 loads the program stored in the storage device 708 into the RAM 703 via the input / output interface 705 and the bus 704 and executes the program so as to perform the method described above.
[0081] The program to be executed by the computer (CPU 701) may be recorded on a removable medium 711 as a package medium, which is formed in the form of, for example, a magnetic disk (including a floppy disk), an optical disk (including a compact disc-read only memory (CD-ROM)), a digital versatile disc (DVD), etc.), a magneto-optical disk, or a semiconductor memory. In addition, the program to be executed by the computer (CPU 701) may also be provided via a wired or wireless transmission medium such as a local area network, the Internet, or digital satellite broadcasting.
[0082] When the removable medium 711 is mounted in the drive 710, the program can be installed in the storage device 708 via the input / output interface 705. In addition, the program can be received by the communication device 709 via a wired or wireless transmission medium and installed in the storage device 708. Alternatively, the program can be pre-installed in the ROM 702 or the storage device 708.
[0083] The program executed by the computer may be a program that performs processing according to the sequence described in this specification, or may be a program that performs processing in parallel or performs processing when necessary such as when called.
[0084] The modules or devices described herein are only in a logical sense and do not strictly correspond to physical devices or entities. For example, the functions of each module described herein may be implemented by multiple physical entities, or the functions of multiple modules described herein may be implemented by a single physical entity. In addition, the features, components, elements, steps, etc. described in one embodiment are not limited to the embodiment, but may also be applied to other embodiments, such as replacing specific features, components, elements, steps, etc. in other embodiments, or combining them.
[0085] The scope of the present invention is not limited to the specific embodiments described herein. It should be understood by those skilled in the art that, depending on design requirements and other factors, various modifications or changes may be made to the embodiments herein without departing from the principles and spirit of the present invention. The scope of the present invention is defined by the appended claims and their equivalents.
[0086] In addition, the present disclosure may also include the following embodiments.
[0087] (1) A method for unsupervised domain adaptation training of a neural network for performing object detection, comprising:
[0088] a) extracting multiple source domain anchor box features of multiple sizes based on a source domain image with a label, and extracting multiple target domain anchor box features of the multiple sizes based on a target domain image without a label;
[0089] b) generating a prediction value of target detection for a corresponding anchor box in the source domain image based on the extracted source domain anchor box features, and generating a prediction value of target detection for a corresponding anchor box in the target domain image based on the extracted target domain anchor box features;
[0090] For each of the multiple dimensions:
[0091] c) dividing the plurality of source domain anchor box features having the size into a plurality of source domain feature sets corresponding to a plurality of categories of the target respectively according to the label of the source domain image;
[0092] d) dividing the plurality of target domain anchor box features having the size into a plurality of target domain feature sets corresponding to the plurality of categories respectively according to the pseudo-label of the target domain image;
[0093] e) performing cross-domain feature alignment by minimizing the intra-class distance and maximizing the inter-class distance so that the distance between the source domain anchor frame features and the target domain anchor frame features included in the source domain feature set and the target domain feature set corresponding to the same category is reduced;
[0094] f) receiving another source domain image with a label and another target domain image without a label;
[0095] Wherein, by repeatedly performing steps a)-f), the neural network is trained using a prediction loss function for a source domain image, a prediction loss function for a target domain image, and a feature alignment loss function.
[0096] (2) The method according to (1), further comprising:
[0097] e') generating a pseudo label of the target domain image according to the predicted values of the target detection generated for each anchor frame of the target domain image,
[0098] Therein, steps a)-e), e') and f) are repeatedly performed.
[0099] (3) The method according to (2), wherein a non-maximum suppression algorithm is used to generate a pseudo label of the target domain image according to the predicted values of each anchor box based on a confidence threshold and an intersection-over-union (IOU) threshold.
[0100] (4) A method according to (2), wherein the pseudo-label used in step d) is generated for the target domain image in a previous process, and wherein the pseudo-label of the target domain image generated in step e') is used to update the pseudo-label of the target domain image previously generated, and in subsequent processing the target domain feature set is determined for the target domain image based on the updated pseudo-label.
[0101] (5) According to the method described in (1),
[0102] Wherein, step c) further comprises calculating the moving average class center of each source domain feature set, and adding the calculated moving average class center to the corresponding source domain feature set,
[0103] Wherein, step d) further comprises calculating the moving average class center of each target domain feature set, and adding the calculated moving average class center to the corresponding target domain feature set, and
[0104] Wherein, step e) is performed based on the source domain feature set and the target domain feature set to which the moving average class center is added.
[0105] (6) The method according to (1), further comprising:
[0106] limiting the number of source domain anchor box features included in each source domain feature set generated in step c) to within a predetermined value, and
[0107] The number of target domain anchor box features included in each target domain feature set generated in step d) is limited to within the predetermined value,
[0108] Wherein, step e) is performed based on a source domain feature set and a target domain feature set whose number of anchor box features has been limited.
[0109] (7) The method according to (1), wherein a prediction loss function for the source domain image is established based on the label of the source domain image, and a prediction loss function for the target domain image is established based on the pseudo label of the target domain image, and
[0110] The feature alignment loss function L is established based on the following mathematical formula: A :
[0111]
[0112] Among them, x S represents the source domain anchor box feature, x T represents the target domain anchor box feature, O t represents the set of anchor box features in the target domain, d(x s ,x t ) represents the source domain anchor box feature x S and target domain anchor box feature x T The square of the Euclidean distance, y s is the source domain anchor box feature x s The category label of k is the target domain anchor box feature x t The class labels of , m and m2 are hyper parameters.
[0113] (8) The method according to (1) further includes: performing L2 normalization on the extracted source domain anchor box features and target domain anchor box features respectively, and performing steps c)-f) based on the normalized source domain anchor box features and target domain anchor box features.
[0114] (9) A device for performing unsupervised domain adaptive training of a neural network for performing target detection, comprising:
[0115] a memory storing a program; and
[0116] One or more processors, the processors being configured to perform the following operations by executing the program:
[0117] a) enabling the neural network to extract multiple source domain anchor box features of multiple sizes based on a source domain image with a label, and extract multiple target domain anchor box features of the multiple sizes based on a target domain image without a label;
[0118] b) enabling the neural network to generate a prediction value of target detection for a corresponding anchor box in the source domain image based on the extracted source domain anchor box features, and to generate a prediction value of target detection for a corresponding anchor box in the target domain image based on the extracted target domain anchor box features;
[0119] For each of the multiple dimensions:
[0120] c) dividing the plurality of source domain anchor box features having the size into a plurality of source domain feature sets corresponding to a plurality of categories of the target respectively according to the label of the source domain image;
[0121] d) dividing the plurality of target domain anchor box features having the size into a plurality of target domain feature sets corresponding to the plurality of categories respectively according to the pseudo-label of the target domain image;
[0122] e) performing cross-domain feature alignment by minimizing the intra-class distance and maximizing the inter-class distance so that the distance between the source domain anchor frame features and the target domain anchor frame features included in the source domain feature set and the target domain feature set corresponding to the same category is reduced;
[0123] f) allowing the neural network to receive another source domain image with a label and another target domain image without a label;
[0124] The processor is configured to train the neural network by repeatedly executing steps a)-f) using a prediction loss function for source domain images, a prediction loss function for target domain images, and a feature alignment loss function.
[0125] (10) The apparatus according to (9), wherein the processor is further configured to perform the following operations:
[0126] e') generating a pseudo label of the target domain image according to the predicted values of the target detection generated for each anchor frame of the target domain image,
[0127] Therein, steps a)-e), e') and f) are repeatedly performed.
[0128] (11). The device according to (10), wherein the processor is further configured to generate a pseudo label for the target domain image based on the prediction values of each anchor box using a non-maximum suppression algorithm based on a confidence threshold and an intersection-over-union (IOU) threshold.
[0129] (12). An apparatus according to (10), wherein the pseudo-label used in step d) is generated for the target domain image in a previous process, and wherein the processor is further configured to update the previously generated pseudo-label of the target domain image with the pseudo-label of the target domain image generated in step e'), and to determine the target domain feature set for the target domain image based on the updated pseudo-label in subsequent processing.
[0130] (13) According to the apparatus described in (9), the processor is further configured to:
[0131] In step c), the moving average class center of each source domain feature set is calculated, and the calculated moving average class center is added to the corresponding source domain feature set, and
[0132] In step d), the moving average class center of each target domain feature set is calculated, and the calculated moving average class center is added to the corresponding target domain feature set.
[0133] Wherein, step e) is performed based on the source domain feature set and the target domain feature set to which the moving average class center is added.
[0134] (14) According to the apparatus described in (9), the processor is further configured to:
[0135] limiting the number of source domain anchor box features included in each source domain feature set generated in step c) to within a predetermined value, and
[0136] The number of target domain anchor box features included in each target domain feature set generated in step d) is limited to within the predetermined value,
[0137] Wherein, step e) is performed based on a source domain feature set and a target domain feature set whose number of anchor box features has been limited.
[0138] (15) The apparatus according to (9), wherein a prediction loss function for the source domain image is established based on the label of the source domain image, and a prediction loss function for the target domain image is established based on the pseudo label of the target domain image, and
[0139] The feature alignment loss function L is established based on the following mathematical formula: A :
[0140]
[0141] Among them, x S represents the source domain anchor box feature, x T represents the target domain anchor box feature, O t represents the set of anchor box features in the target domain, d(x s ,x t ) represents the source domain anchor box feature x S and target domain anchor box feature x T The square of the Euclidean distance, y s is the source domain anchor box feature x s The category label of k is the target domain anchor box feature x t The class labels of , m and m2 are hyper parameters.
[0142] (16). According to the device described in (9), the processor is also configured to perform L2 normalization on the extracted source domain anchor box features and target domain anchor box features respectively, and perform steps c)-f) based on the normalized source domain anchor box features and target domain anchor box features.
[0143] (17) A non-transitory computer-readable medium storing a program, wherein when the program is executed by a computer, the computer performs a method for performing unsupervised domain adaptive training of a neural network performing target detection according to any one of (1) to (8).
Claims
1. A method for unsupervised domain adaptation training of a neural network for performing object detection, comprising: a) extracting multiple source domain anchor box features of multiple sizes based on a source domain image with a label, and extracting multiple target domain anchor box features of the multiple sizes based on a target domain image without a label; b) generating a prediction value of target detection for a corresponding anchor box in the source domain image based on the extracted source domain anchor box features, and generating a prediction value of target detection for a corresponding anchor box in the target domain image based on the extracted target domain anchor box features; For each of the multiple dimensions: c) dividing the plurality of source domain anchor box features having the size into a plurality of source domain feature sets corresponding to a plurality of categories of the target respectively according to the label of the source domain image; d) dividing the plurality of target domain anchor box features having the size into a plurality of target domain feature sets corresponding to the plurality of categories respectively according to the pseudo-label of the target domain image; e) performing cross-domain feature alignment by minimizing the intra-class distance and maximizing the inter-class distance so that the distance between the source domain anchor frame features and the target domain anchor frame features included in the source domain feature set and the target domain feature set corresponding to the same category is reduced; f) receiving another source domain image with a label and another target domain image without a label; Wherein, by repeatedly performing steps a)-f), the neural network is trained using a prediction loss function for a source domain image, a prediction loss function for a target domain image, and a feature alignment loss function.
2. The method according to claim 1, further comprising: e') generating a pseudo label of the target domain image according to the predicted values of the target detection generated for each anchor frame of the target domain image, Therein, steps a)-e), e') and f) are repeatedly performed.
3. The method according to claim 2, wherein: Based on a confidence threshold and an intersection-over-union (IOU) threshold, a non-maximum suppression algorithm is used to generate a pseudo label of the target domain image according to the predicted values of each anchor box.
4. The method according to claim 2, wherein: The pseudo-labels used in step d) are generated for the target domain images in a previous process, and The pseudo-label of the target domain image generated in step e') is used to update the pseudo-label of the target domain image previously generated, and in subsequent processing, the target domain feature set is determined for the target domain image according to the updated pseudo-label.
5. The method according to claim 1, in, Step c) further comprises calculating the moving average class center of each source domain feature set, and adding the calculated moving average class center to the corresponding source domain feature set. Wherein, step d) further comprises calculating the moving average class center of each target domain feature set, and adding the calculated moving average class center to the corresponding target domain feature set, and Wherein, step e) is performed based on the source domain feature set and the target domain feature set to which the moving average class center is added.
6. The method according to claim 1, further comprising: limiting the number of source domain anchor box features included in each source domain feature set generated in step c) to within a predetermined value, and The number of target domain anchor box features included in each target domain feature set generated in step d) is limited to within the predetermined value, Wherein, step e) is performed based on a source domain feature set and a target domain feature set whose number of anchor box features has been limited.
7. The method according to claim 1, wherein: A prediction loss function for the source domain image is established based on the label of the source domain image, and a prediction loss function for the target domain image is established based on the pseudo label of the target domain image, and The feature alignment loss function L is established based on the following mathematical formula: A : Among them, x S represents the source domain anchor box feature, x T represents the target domain anchor box feature, O t represents the set of anchor box features in the target domain, d(x s ,x t ) represents the source domain anchor box feature x S and target domain anchor box feature x T The square of the Euclidean distance, y s is the source domain anchor box feature x s The category label of k is the target domain anchor box feature x t The class labels of , m and m2 are hyper parameters.
8. The method according to claim 1, further comprising: The extracted source domain anchor box features and target domain anchor box features are L2 normalized respectively, and steps c)-f) are performed based on the normalized source domain anchor box features and target domain anchor box features.
9. An apparatus for unsupervised domain adaptive training of a neural network for performing object detection, comprising: A memory storing a program; as well as One or more processors, the processors being configured to perform the following operations by executing the program: a) enabling the neural network to extract multiple source domain anchor box features of multiple sizes based on the source domain image with labels, and extract multiple target domain anchor box features of the multiple sizes based on the target domain image without labels; b) enabling the neural network to generate a prediction value of target detection for a corresponding anchor box in the source domain image based on the extracted source domain anchor box features, and to generate a prediction value of target detection for a corresponding anchor box in the target domain image based on the extracted target domain anchor box features; For each of the multiple dimensions: c) dividing the plurality of source domain anchor box features having the size into a plurality of source domain feature sets corresponding to a plurality of categories of the target respectively according to the label of the source domain image; d) dividing the plurality of target domain anchor box features having the size into a plurality of target domain feature sets corresponding to the plurality of categories respectively according to the pseudo-label of the target domain image; e) performing cross-domain feature alignment by minimizing the intra-class distance and maximizing the inter-class distance so that the distance between the source domain anchor frame features and the target domain anchor frame features included in the source domain feature set and the target domain feature set corresponding to the same category is reduced; f) allowing the neural network to receive another source domain image with a label and another target domain image without a label; The processor is configured to train the neural network by repeatedly executing steps a)-f) using a prediction loss function for a source domain image, a prediction loss function for a target domain image, and a feature alignment loss function.
10. A non-transitory computer-readable medium storing a program, wherein when the program is executed by a computer, the computer executes the method for performing unsupervised domain adaptation training on a neural network performing target detection according to any one of claims 1 to 8.
