Visual model training method and device, and electronic device
By generating teacher and student models, feature consistency training is performed on images in low-brightness scenes, which solves the problem of poor recognition performance in dark scenes after model transfer and improves recognition accuracy.
Patent Information
- Application Number
- CN202311628570.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-30
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2043-11-30
AI Technical Summary
Existing model transfer methods have poor recognition performance when transferring models from normal lighting conditions to dark scenes.
By generating teacher and student models, and using a visual encoder and progressive learning adapter, images in low-brightness scenes are darkened, image blended, and cropped. Training is performed based on feature consistency, the parameters of the visual encoder are frozen, and the progressive learning adapter is adjusted to reduce the influence of lighting conditions.
It improves the model's recognition accuracy in dark scenes, retains the model's original knowledge, and enhances the recognition performance of the transferred model.
Smart Images

Figure CN118038233B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and more specifically, to a visual model training method, apparatus, and electronic device. Background Technology
[0002] Model transfer is the process of transferring a model trained on source domain data to a target domain, enabling the model to recognize data in the target domain. For example, a model trained on photos under normal lighting conditions can be transferred to the domain of photos in dark scenes to recognize photos in dark scenes.
[0003] The existing transfer learning method is usually to obtain a model trained with photos under normal lighting conditions, and then fine-tune the model with photos of dark scenes to obtain the transferred model.
[0004] However, the recognition performance of the model obtained by using the above method is poor. Summary of the Invention
[0005] The embodiments of this application provide a visual model training method, apparatus, electronic device, and storage medium, which can improve the model's recognition performance of views in dark scenes.
[0006] The technical solution is as follows:
[0007] In a first aspect, this application provides a visual model training method, the method comprising: acquiring a first visual model to be transferred to a low-brightness scene, and generating a teacher model and a student model based on a visual encoder for extracting view features from the first visual model; acquiring an original view related to the low-brightness scene, and generating an enhanced view, a blended view, and a partial view; wherein the enhanced view is obtained by darkening the original view based on a visual darkening enhancement model; the blended view is obtained by blending a partial sub-image of the original view with a partial sub-image of the enhanced view; the partial view is obtained by cropping the original view; inputting the original view, the enhanced view, and the blended view as first input data into the teacher model to determine the first feature result of each view; inputting the original view, the enhanced view, the blended view, and the partial view as second input data into the student model to determine the second feature result of each view; adjusting the teacher model and the student model based on the consistency of the first feature result and the second feature result to determine the trained visual encoder, so as to obtain a second visual model transferred to the low-brightness scene.
[0008] Preferably, the lighting conditions of the low-brightness scene are the first lighting conditions. The step of obtaining the first visual model to be transferred to the low-brightness scene includes: obtaining the training view and view annotation of the scene related to the second lighting conditions, wherein the brightness of the second lighting conditions is higher than that of the first lighting conditions; inputting the training view into the initial visual model to be trained to obtain the view prediction result; and adjusting the initial visual model to be trained based on the difference between the view prediction result and the view annotation of the training view to determine the first visual model to be transferred to the low-brightness scene.
[0009] Preferably, adjusting the teacher model and student model based on the consistency of the first feature result and the second feature result includes: updating the student model in the manner of gradient backpropagation based on the consistency of the first feature result and the second feature result, and updating the teacher model in the manner of weighted moving average.
[0010] Preferably, the first update includes: determining cross-domain update parameters based on the feature consistency between the first feature result and the second feature result; determining intra-domain update parameters based on the feature consistency between the second feature result of the local view and the second feature result of the original view; and adjusting the student model based on the cross-domain update parameters and the intra-domain update parameters.
[0011] Preferably, determining the domain update parameters based on the feature consistency between the second feature results of the local view and the second feature results of the original view includes: determining the first action feature of the target object in the multiple local views based on the second feature results of the multiple local views within the target time period; determining the second action feature of the target object in the multiple original views based on the second feature results of the multiple original views within the target time period; and determining the domain update parameters based on the feature consistency between the first action feature and the second action feature.
[0012] Preferably, the first visual model further includes: a progressive learning adapter for extracting features from each layer of the visual encoder at different visual levels and performing context fusion based on a temporal self-attention mechanism; after determining the trained visual encoder, the method further includes: freezing the parameters of the trained visual encoder; acquiring training data related to low-brightness scenes and adjusting the parameters of the progressive learning adapter of the first visual model according to the training data; and determining a second visual model based on the frozen parameters of the visual encoder and the parameters of the progressive learning adapter trained on the training data.
[0013] Preferably, the method further includes: acquiring model fine-tuning data related to low-brightness scenes, the model fine-tuning data including fine-tuning input data and fine-tuning annotation results; inputting the fine-tuning input data into a second visual model to obtain fine-tuning prediction results; and adjusting the parameters of the visual encoder and progressive learning adapter of the second visual model based on the difference between the fine-tuning prediction results and the fine-tuning annotation results.
[0014] Preferably, the method further includes: acquiring view input data related to low-brightness scenes, inputting the view input data into a second visual model, and obtaining view analysis results and confidence levels of the view analysis results; using view analysis results with confidence levels meeting a preset threshold as labels for the view input data to form view training data; and adjusting the parameters of the visual encoder and progressive learning adapter of the second visual model based on the view training data.
[0015] Secondly, this application provides a visual model training device, the method comprising: a first model acquisition module, configured to acquire a first visual model to be transferred to a low-brightness scene, and generate a teacher model and a student model based on a visual encoder for extracting view features from the first visual model; a scene view acquisition module, configured to acquire an original view related to the low-brightness scene, and generate an enhanced view, a blended view, and a partial view; wherein the enhanced view is obtained by darkening the original view based on a visual darkening enhancement model; the blended view is obtained by blending a partial sub-image of the original view with a partial sub-image of the enhanced view; the partial view is obtained by cropping the original view; a first feature analysis module, configured to input the original view, the enhanced view, and the blended view as first input data into the teacher model, and determine the first feature result of each view; a second feature analysis module, configured to input the original view, the enhanced view, the blended view, and the partial view as second input data into the student model, and determine the second feature result of each view; and a first model training module, configured to adjust the teacher model and the student model based on the consistency of the first feature result and the second feature result, to determine the trained visual encoder, so as to obtain a second visual model transferred to the low-brightness scene.
[0016] Thirdly, an electronic device includes at least one processor and at least one memory, wherein computer-readable instructions are stored on the memory; the computer-readable instructions are executed by one or more of the processors to cause the electronic device to perform the method described above.
[0017] Fourthly, a storage medium having computer-readable instructions stored thereon, the computer-readable instructions being executed by one or more processors to implement the method described above.
[0018] Fifthly, a computer program product comprising computer-readable instructions stored in a storage medium, wherein one or more processors of an electronic device read the computer-readable instructions from the storage medium, load and execute the computer-readable instructions, causing the electronic device to perform the method described above.
[0019] The beneficial effects of the technical solution provided in this application are:
[0020] The proposed solution can be applied to model transfer scenarios, specifically transferring a model trained on a normally lit view to a dark scene, enabling the transferred model to achieve better recognition performance in dark scenes. This solution generates teacher and student models based on the model to be transferred, and performs de-darkening, image blending, and cropping on the low-brightness (dark) image to remove the influence of lighting conditions on the view. Feature recognition is then performed using the teacher and student models, and training is conducted according to the feature consistency of views under different lighting conditions, ultimately resulting in the transferred model. This solution eliminates the influence of different lighting conditions on the model, improving the recognition accuracy of the transferred model.
[0021] Specifically, this solution can obtain a first visual model to be transferred to a low-brightness scene. This first visual model can be a model trained on a view under normal lighting conditions. The first visual model can be an image (or view) recognition-related model, such as a model for recognizing and predicting the actions, poses, and behaviors of target objects in an image. The first visual model includes a visual encoder, which extracts features from the view input to the model to determine the analysis results. This solution can generate teacher and student models based on the visual encoder of the first visual model. This scheme can acquire the original view related to the low-brightness scene, perform darkening processing on the original view to obtain the enhanced view, crop the original view to obtain the partial view, and stitch the sub-images of the original view and the enhanced view to obtain the blended view. The original view and the enhanced view can be cropped into sub-images of a specified size and randomly stitched together, and the difference in the number of sub-images between the original view and the enhanced view can be less than a specified value (e.g., 1). This scheme can use the original view, enhanced view, and blended view as the first input data, inputting them into the teacher model to determine the first feature result of each view; and use the original view, enhanced view, blended view, and partial view as the second input data, inputting them into the student model to determine the second feature result of each view. Then, based on the consistency of the first and second feature results, the teacher model and the student model are adjusted to determine the trained visual encoder, thus obtaining a second visual model transferred to the low-brightness scene. Attached Figure Description
[0022] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments of this application will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0023] Figure 1 This is a schematic diagram illustrating the steps of a visual model training method according to an embodiment of this application;
[0024] Figure 2 This is a schematic diagram illustrating the steps of a feature extraction process for a visual model according to an embodiment of this application;
[0025] Figure 3 This is a flowchart illustrating a visual model training method according to an embodiment of this application;
[0026] Figure 4 This is a schematic diagram of the structure of a visual model training device according to an embodiment of this application;
[0027] Figure 5 This is a hardware structure diagram of a server according to an exemplary embodiment;
[0028] Figure 6 This is a structural block diagram of an electronic device according to an exemplary embodiment. Detailed Implementation
[0029] The embodiments of this application are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals identify the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain this application, and should not be construed as limiting this application.
[0030] Those skilled in the art will understand that, unless specifically stated otherwise, the singular forms “a,” “an,” “the,” and “the” used herein may also include the plural forms, while “a plurality” refers to two or more, and other quantifiers are similarly understood. It should be further understood that the word “comprising” as used in this application’s specification means the presence of the stated feature, integer, step, operation, element, and / or component, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof. It should be understood that when we say an element is “connected” or “coupled” to another element, it can be directly connected or coupled to the other element, or there may be intermediate elements. Furthermore, “connected” or “coupled” as used herein can include wireless connection or wireless coupling. The word “and / or” as used herein describes the relationship between related objects, indicating that three relationships can exist; for example, A and / or B can represent: A alone, A and B simultaneously, and B alone. The character “ / ” generally indicates that the preceding and following related objects are in an “or” relationship.
[0031] The proposed solution can be applied to model transfer scenarios, specifically transferring a model trained on a normally lit view to a dark scene, enabling the transferred model to achieve better recognition performance in dark scenes. This solution generates a teacher model and a student model based on the model to be transferred. It then processes the low-brightness (dark scene) image through de-darkening, image blending, and cropping to remove the influence of lighting conditions on the view. Feature recognition is performed using the teacher and student models, and training is conducted according to the feature consistency of views under different lighting conditions, ultimately resulting in the transferred model. This solution removes the influence of different lighting conditions on the model, improving the recognition accuracy of the transferred model. The model to be transferred in this solution can include a visual encoder and a progressive learning adapter. The visual encoder extracts view features, and the progressive learning adapter extracts features from different visual levels at each layer of the visual encoder and performs context fusion based on a temporal self-attention mechanism. This solution can train the visual encoder based on the feature consistency of multiple processed views. Furthermore, during further training, the parameters of the visual encoder can be frozen, and the progressive learning adapter can be fine-tuned. Some training methods directly adjust the overall parameters of the model using training data from the target domain (dark scene) to complete model transfer. However, this approach adjusts the parameters of some feature extraction modules, which can destroy the model's original knowledge and affect the recognition effect. This approach trains the first visual model by training the visual encoder and freezing the visual encoder while adjusting the progressive learning adapter. This preserves the model's original knowledge and improves the recognition effect of the transferred model.
[0032] Specifically, this solution can obtain a first visual model to be transferred to a low-brightness scene. This first visual model can be a model trained on a view under normal lighting conditions. The first visual model can be an image (or view) recognition-related model, such as a model for recognizing and predicting the actions, poses, and behaviors of target objects in an image. The first visual model includes a visual encoder, which extracts features from the view input to the model to determine the analysis results. This solution can generate teacher and student models based on the visual encoder of the first visual model. This scheme can acquire the original view related to the low-brightness scene, perform darkening processing on the original view to obtain the enhanced view, crop the original view to obtain the partial view, and stitch the sub-images of the original view and the enhanced view to obtain the blended view. The original view and the enhanced view can be cropped into sub-images of a specified size and randomly stitched together, and the difference in the number of sub-images between the original view and the enhanced view can be less than a specified value (e.g., less than 1). This scheme can use the original view, enhanced view, and blended view as the first input data, inputting them into the teacher model to determine the first feature result of each view; and use the original view, enhanced view, blended view, and partial view as the second input data, inputting them into the student model to determine the second feature result of each view. Then, based on the consistency of the first and second feature results, the teacher model and the student model are adjusted to determine the trained visual encoder, thus obtaining a second visual model transferred to the low-brightness scene. In addition, this scheme can freeze the parameters of the trained visual encoder and adjust the parameters of the progressive learning adapter of the first visual model based on the training data related to low-brightness scenes; then, the second visual model is determined based on the frozen parameters of the visual encoder and the parameters of the progressive learning adapter trained on the training data.
[0033] The following is an explanation of the key technologies involved in this solution:
[0034] Dark domain transfer learning primarily explores how to robustly train models in dark scenes. It typically involves two approaches: fully supervised (or supervised) behavior recognition with ample data and domain adaptation with limited data. The key challenge lies in the discrepancy between the video data used in the dark domain and the pre-training data used in the pre-trained model. This means that directly fine-tuning the model doesn't yield satisfactory results, and direct recognition in dark environments is significantly more difficult for the model. Furthermore, in domain adaptation scenarios, it's necessary to explore how to transfer models trained in well-lit environments to low-light conditions.
[0035] Video self-supervised learning (or unsupervised learning) primarily learns the inherent features of unlabeled video data. Early methods involved designing proxy tasks similar to predicting the order of different frames. However, with the introduction of contrastive learning, the performance of video self-supervised learning has been significantly improved. The approach presented in this paper can be categorized as pseudo-contrast learning. Our paradigm involves using a pre-trained model and then re-pre-training it in the target domain. This paradigm has been widely explored in natural language processing, but its application in computer vision has been less developed.
[0036] Explanation of relevant technical fields:
[0037] Domain adaptation involves training a model in a supervised manner on a source domain dataset, and then providing an unlabeled target domain training set. The target domain dataset and the source domain dataset often have a large domain difference, such as a normal photo and a sketch photo. The goal is to enable the model to transfer to the target domain in an unsupervised manner.
[0038] Self-distillation learning is a form of self-supervised learning where two visual encoder models look exactly alike. Then, a loss is obtained using contrastive learning. During the update process, the student model performs normal gradient backpropagation updates, while the teacher model performs EMA (weighted moving average) updates.
[0039] Contrastive learning aims to make features obtained from different views of the same video as close as possible in semantic space, while keeping features from different videos as far apart as possible.
[0040] This application's solution primarily trains the model through the following methods: Cross-domain self-distillation pre-training learns the consistency of video data representations under different lighting scenarios, thereby reducing the impact of the dark domain on video data. In the domain adaptation domain, an external data augmentation model is used to obtain an augmented view. Then, through self-supervised learning, the model is transferred to the dark domain. Finally, pseudo-labels are used for fine-tuning in the target dark domain. However, directly using the natural language processing-based post-training paradigm would destroy the original generalization ability of the pre-trained model, leading to poor results. To maintain the model's original capabilities during knowledge distillation while acquiring new domain knowledge, this solution proposes a progressive learning adapter and freezes the visual backbone during knowledge distillation. The progressive learning adapter collects multi-level features from each visual backbone layer, providing more trainable features for knowledge distillation, thereby promoting the model's learning of the target domain knowledge.
[0041] Specifically, the following is a concrete example to describe the solution of this application:
[0042] Step 1: From Figure 1 As shown, this scheme first generates multiple views to obtain the original view of the dark scene; after using a visual darkening enhancement model, the enhanced view after darkening is obtained; then the original view and the enhanced view are divided into 14*14 squares, and then randomly selected and combined from the two views to form a hybrid view, wherein the difference in the number of squares from the enhanced view and the original view is no greater than 1; finally, image processing is used to crop the local view of the original view to obtain the local view.
[0043] Step 2: In this step, cross-domain self-distillation pre-training is performed. First, the visual encoder is replicated into a teacher model and a student model, both with the same gradients and frame. The teacher model's input includes the original view, augmented view, and blended view, while the student model's input includes the original view, augmented view, local view, and blended view. After obtaining features from different views, the two models perform self-distillation learning with the goal of making the features from different views within the same video as close as possible. In cross-domain (dark data and de-darkened normal data) consistency self-distillation learning, the goal is to reduce the impact of low-light scenes on vision by ensuring the consistency of visual representations under different lighting conditions. For intra-domain consistency learning (local view and global view), the goal is to learn the consistency of motion and spatial changes of the same action.
[0044] Step 3: In self-distillation, which is the re-pre-training of the pre-trained model in the target domain, allowing the entire visual encoder to be fine-tuned would destroy the model's original knowledge, resulting in poor fine-tuning results. Therefore, this solution introduces a progressive learning adapter, such as... Figure 2 As shown, during the entire pre-training phase, the visual encoder is locked, and only the progressive learning adapter is fine-tuned. Specifically, the progressive learning adapter extracts features from different visual levels at each layer of the visual encoder and then performs a cross-attention mechanism with learnable vectors (called domain-adapted cue blocks). Specifically, the visual information extracted from each layer serves as the key and value for the cross-attention, while the domain-adapted cue blocks serve as the query. This approach allows for the acquisition of more learnable features while freezing the model backbone, learning features from different levels of the visual encoder (compared to directly freezing the backbone network and then adding learnable modules at the end).
[0045] Step 4: After obtaining the visual encoder through cross-domain self-distillation learning, the model can robustly handle videos in dark scenes. Under fully supervised conditions, the model can be directly fine-tuned and tested (using the original video without needing to darken it). In domain adaptation scenarios, high-confidence pseudo-labels can be obtained from the training set first, then these pseudo-labels can be used for fine-tuning, and finally, testing can be performed. It is worth mentioning that the fine-tuning method uses multimodal matching, using semantic features obtained from text output as the classification target. In this scheme, the output obtained by the visual model after recognizing the view can be text (such as the pose or action description of the target object in the view). This scheme can extract semantic features from the text through semantic recognition as the classification target to perform cross-modal (from text to image, from image to text, or from video to text, etc.) matching.
[0046] Specifically, embodiments of this application provide a visual model training method, such as... Figure 3 As shown, the method includes:
[0047] Step 302: Obtain the first visual model to be transferred to the low-brightness scene, and generate the teacher model and student model based on the visual encoder used to extract view features from the first visual model.
[0048] Step 304: Obtain the original view related to the low-brightness scene, and generate an enhanced view, a blended view, and a partial view; wherein, the enhanced view is obtained by darkening the original view based on a visual darkening enhancement model; the blended view is obtained by blending a partial sub-image of the original view with a partial sub-image of the enhanced view; and the partial view is obtained by cropping the original view.
[0049] Step 306: Input the original view, enhanced view, and blended view as the first input data into the teacher model to determine the first feature result of each view.
[0050] Step 308: Input the original view, enhanced view, blended view, and partial view as the second input data into the student model to determine the second feature result of each view.
[0051] Step 310: Based on the consistency between the first feature result and the second feature result, adjust the teacher model and the student model to determine the trained visual encoder, so as to obtain the second visual model transferred to the low brightness scene.
[0052] The proposed solution can be applied to model transfer scenarios, specifically transferring a model trained on a normally lit view to a dark scene, enabling the transferred model to achieve better recognition performance in dark environments. This solution generates teacher and student models based on the model to be transferred, and performs image de-darkening, image blending, and cropping on the low-brightness scene image to remove the influence of lighting conditions on the view. Feature recognition is then performed using the teacher and student models, and training is conducted according to the feature consistency of views under different lighting conditions, ultimately resulting in the transferred model. This solution eliminates the influence of different lighting conditions on the model, improving the recognition accuracy of the transferred model.
[0053] Specifically, this solution can obtain a first visual model to be transferred to a low-brightness scene. This first visual model can be a model trained on a view under normal lighting conditions. The first visual model can be an image (or view) recognition-related model, such as a model for recognizing and predicting the actions, poses, and behaviors of target objects in an image. The first visual model includes a visual encoder, which extracts features from the view input to the model to determine the analysis results. This solution can generate teacher and student models based on the visual encoder of the first visual model. This scheme can acquire the original view related to the low-brightness scene, perform darkening processing on the original view to obtain the enhanced view, crop the original view to obtain the partial view, and stitch the sub-images of the original view and the enhanced view to obtain the blended view. This scheme can use the original view, enhanced view, and blended view as the first input data and input them into the teacher model to determine the first feature result of each view; use the original view, enhanced view, blended view, and partial view as the second input data and input them into the student model to determine the second feature result of each view; then, based on the consistency of the first feature result and the second feature result, the teacher model and the student model are adjusted to determine the trained visual encoder, so as to obtain the second visual model transferred to the low-brightness scene.
[0054] The first visual model in this application can be an untrained model or a model obtained through supervised or unsupervised training using views under normal lighting conditions. Specifically, as an optional embodiment, the lighting conditions of the low-brightness scene are the first lighting conditions. Obtaining the first visual model to be transferred to the low-brightness scene includes: obtaining training views and view annotations of the scene related to the second lighting conditions, where the brightness of the second lighting conditions is higher than that of the first lighting conditions; inputting the training views into the initial visual model to be trained to obtain view prediction results; and adjusting the initial visual model to be trained based on the difference between the view prediction results and the view annotations of the training views to determine the first visual model to be transferred to the low-brightness scene. The first lighting conditions can be the lighting conditions of a dark scene, and the second lighting conditions can be a scene with relatively bright light (a scene with normal lighting). This application can obtain training views and view annotations of a normal lighting scene and perform supervised training on the initial visual model (a model trained without data under normal lighting conditions) to obtain a first view model for transfer training to the dark scene domain.
[0055] This scheme can learn using a self-distillation method, then obtain the loss using contrastive learning. During the update process, the student model performs normal gradient backpropagation updates, while the teacher model performs weighted moving average updates. Specifically, as an optional embodiment, the adjustment of the teacher and student models based on the consistency of the first and second feature results includes: updating the student model using gradient backpropagation based on the consistency of the first and second feature results, and updating the teacher model using weighted moving averages. This scheme can adjust the parameters of the student model in reverse based on feature consistency, and then compare and analyze the student model with the teacher model for a second update. The teacher model can also be called a teacher model, etc. For updating the student model, this scheme can perform cross-domain analysis based on the consistency of feature analysis results of different models, or perform intra-domain analysis based on the consistency of original view features and local view features obtained from the student model analysis. Specifically, as an optional embodiment, the first update includes: determining cross-domain update parameters based on the feature consistency of the first feature result and the second feature result; determining intra-domain update parameters based on the feature consistency of the second feature result of the local view and the second feature result of the original view; and adjusting the student model based on the cross-domain update parameters and the intra-domain update parameters.
[0056] This solution, during feature consistency analysis, can analyze the feature consistency of original views, enhanced views, hybrid views, and partial views corresponding to a single view within a single model or two models. It can also analyze the feature consistency of original views, enhanced views, hybrid views, and partial views corresponding to multiple views within a single model or two models, thereby determining the parameter adjustment amount for the model. In a specific solution, the expanded views from multiple views can be analyzed within a single model to determine the behavioral consistency of the target object. Specifically, as an optional embodiment, determining the domain update parameters based on the feature consistency of the second feature results of the partial views and the second feature results of the original views includes: determining the first action feature of the target object in the multiple partial views based on the second feature results of the multiple partial views within the target time period; determining the second action feature of the target object in the multiple original views based on the second feature results of the multiple original views within the target time period; and determining the domain update parameters based on the feature consistency of the first action feature and the second action feature.
[0057] In self-distillation, which is essentially re-pre-training a pre-trained model in the target domain, allowing the entire visual encoder to be fine-tuned would destroy the model's original knowledge, resulting in poor fine-tuning performance. Therefore, this solution introduces a progressive learning adapter. During training, the visual encoder can be frozen, and the progressive learning adapter can be trained and adjusted. Specifically, as an optional embodiment, the first visual model further includes a progressive learning adapter for extracting features from different visual levels at each layer of the visual encoder and performing context fusion based on a temporal self-attention mechanism. After determining the trained visual encoder, the method further includes: freezing the parameters of the trained visual encoder; acquiring training data related to low-brightness scenes and adjusting the parameters of the progressive learning adapter of the first visual model based on the training data; and determining the second visual model based on the frozen parameters of the visual encoder and the parameters of the progressive learning adapter trained on the training data. The training data can be labeled or unlabeled views. Furthermore, the training data can be the original view, enhanced view, blended view, and local view generated by this solution, with the progressive adapter adjusted based on the consistency of multiple views.
[0058] After obtaining the visual encoder through cross-domain self-distillation learning, the model can robustly process videos in dark scenes. Therefore, this solution can perform supervised or unsupervised training based on the second visual model to further fine-tune the model and improve its recognition accuracy. During supervised training, fine-tuning can be performed based on labeled data. Specifically, as an optional embodiment, the method further includes: acquiring model fine-tuning data related to low-brightness scenes, including fine-tuning input data and fine-tuning annotation results; inputting the fine-tuning input data into the second visual model to obtain fine-tuned prediction results; and adjusting the parameters of the visual encoder and progressive learning adapter of the second visual model based on the difference between the fine-tuned prediction results and the fine-tuning annotation results. In the unsupervised training process, high-confidence pseudo-labels can be obtained first through the training set, then these pseudo-labels can be used for fine-tuning, and finally testing can be performed. Specifically, as an optional embodiment, the method further includes: acquiring view input data related to low-brightness scenes and inputting the view input data into the second visual model, view analysis results and the confidence of the view analysis results; using view analysis results with confidence levels that meet a preset threshold as labels for the view input data to form view training data; and adjusting the parameters of the visual encoder and progressive learning adapter of the second visual model based on the view training data.
[0059] Based on the above embodiments, this application also provides a visual model training device, such as... Figure 4 As shown, the method includes:
[0060] The first model acquisition module 402 is used to acquire the first visual model to be transferred to the low-brightness scene, and to generate the teacher model and student model based on the visual encoder for extracting view features from the first visual model.
[0061] The scene view acquisition module 404 is used to acquire the original view related to the low-brightness scene and generate an enhanced view, a blended view, and a partial view; wherein, the enhanced view is obtained by darkening the original view based on a visual darkening enhancement model; the blended view is obtained by blending a partial sub-image of the original view with a partial sub-image of the enhanced view; and the partial view is obtained by cropping the original view.
[0062] The first feature analysis module 406 is used to input the original view, enhanced view and hybrid view as the first input data into the teacher model to determine the first feature result of each view.
[0063] The second feature analysis module 408 is used to input the original view, enhanced view, blended view and partial view as second input data into the student model to determine the second feature results of each view.
[0064] The first model training module 410 is used to adjust the teacher model and the student model based on the consistency of the first feature result and the second feature result, so as to determine the trained visual encoder and obtain the second visual model transferred to the low brightness scene.
[0065] The implementation methods of this application are similar to those of the above method embodiments. For specific implementation methods, please refer to the specific implementation methods of the above method embodiments, which will not be repeated here.
[0066] Figure 5 A schematic diagram of a server structure is shown according to an exemplary embodiment. It should be noted that this server is merely an example adapted to this application and should not be construed as providing any limitation on the scope of use of this application. Furthermore, this server should not be interpreted as requiring or depending on any specific feature. Figure 5 One or more components of the exemplary server 2000 shown.
[0067] The hardware architecture of Server 2000 can vary significantly due to differences in configuration or performance, such as... Figure 5 As shown, the server 2000 includes: a power supply 210, an interface 230, at least one memory 250, and at least one central processing unit (CPU) 270.
[0068] Specifically, power supply 210 is used to provide operating voltage for the various hardware devices on server 2000.
[0069] Interface 230 includes at least one wired or wireless network interface 231 for interacting with external devices. Of course, in other examples adapted in this application, interface 230 may further include at least one serial-to-parallel conversion interface 233, at least one input / output interface 235, and at least one USB interface 237, etc. Figure 5 As shown, this does not constitute a specific limitation.
[0070] The memory 250 serves as a carrier for resource storage and can be a read-only memory, random access memory, disk, or optical disk, etc. The resources stored on it include the operating system 251, application programs 253, and data 255, etc., and the storage method can be temporary storage or permanent storage.
[0071] The operating system 251 is used to manage and control the various hardware devices and application programs 253 on the server 2000, so as to enable the central processing unit 270 to perform calculations and processing on the massive data 255 in the memory 250. It can be Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.
[0072] Application 253 is a computer-readable instruction based on operating system 251 that performs at least one specific task, and may include at least one module ( Figure 5 (Not shown), each module may contain computer-readable instructions for server 2000. For example, the visual model training device may be considered as application 253 deployed on server 2000.
[0073] Data 255 can be photos, images, etc. stored on a disk, or visual models, etc., stored in memory 250.
[0074] The central processing unit 270 may include one or more processors and is configured to communicate with the memory 250 via at least one communication bus to read computer-readable instructions stored in the memory 250, thereby enabling the computation and processing of massive amounts of data 255 in the memory 250. For example, a visual model training method may be implemented by the central processing unit 270 reading a series of computer-readable instructions stored in the memory 250.
[0075] Furthermore, this application can also be implemented through hardware circuits or a combination of hardware circuits and software. Therefore, the implementation of this application is not limited to any specific hardware circuit, software, or combination thereof.
[0076] Please see Figure 6 This application provides an electronic device 4000, which may include: a desktop computer, a laptop computer, a server, etc.
[0077] exist Figure 6 In this context, the electronic device 4000 includes at least one processor 4001 and at least one memory 4003.
[0078] The data interaction between the processor 4001 and the memory 4003 can be achieved through at least one communication bus 4002. This communication bus 4002 may include a path for transmitting data between the processor 4001 and the memory 4003. The communication bus 4002 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. The communication bus 4002 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0079] Optionally, the electronic device 4000 may further include a transceiver 4004, which can be used for data interaction between the electronic device and other electronic devices, such as sending and / or receiving data. It should be noted that in practical applications, the transceiver 4004 is not limited to one type, and the structure of the electronic device 4000 does not constitute a limitation on the embodiments of this application.
[0080] Processor 4001 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It can implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. Processor 4001 may also be a combination that implements computational functions, such as including one or more microprocessor combinations, a combination of a DSP and a microprocessor, etc.
[0081] The memory 4003 may be a ROM (Read Only Memory) or other type of static storage device capable of storing static information and instructions, RAM (Random Access Memory) or other type of dynamic storage device capable of storing information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), CD-ROM (Compact Disc Read Only Memory) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium capable of carrying or storing desired program instructions or code in the form of instructions or data structures and accessible by the electronic device 400, but not limited thereto.
[0082] The memory 4003 stores computer-readable instructions, and the processor 4001 can read the computer-readable instructions stored in the memory 4003 through the communication bus 4002.
[0083] The computer-readable instructions are executed by one or more processors 4001 to implement the visual model training methods in the above embodiments.
[0084] Furthermore, this application provides a storage medium storing computer-readable instructions that are executed by one or more processors to implement the visual model training method described above.
[0085] This application provides a computer program product including computer-readable instructions stored in a storage medium. One or more processors of an electronic device read the computer-readable instructions from the storage medium, load and execute the computer-readable instructions, so that the electronic device implements the visual model training method as described above.
[0086] The proposed solution can be applied to model transfer scenarios, specifically transferring a model trained on a normally lit view to a dark scene, enabling the transferred model to achieve better recognition performance in dark environments. This solution generates teacher and student models based on the model to be transferred, and performs image de-darkening, image blending, and cropping on the low-brightness scene image to remove the influence of lighting conditions on the view. Feature recognition is then performed using the teacher and student models, and training is conducted according to the feature consistency of views under different lighting conditions, ultimately resulting in the transferred model. This solution eliminates the influence of different lighting conditions on the model, improving the recognition accuracy of the transferred model.
[0087] Specifically, this solution can obtain a first visual model to be transferred to a low-brightness scene. This first visual model can be a model trained on a view under normal lighting conditions. The first visual model can be an image (or view) recognition-related model, such as a model for recognizing and predicting the actions, poses, and behaviors of target objects in an image. The first visual model includes a visual encoder, which extracts features from the view input to the model to determine the analysis results. This solution can generate teacher and student models based on the visual encoder of the first visual model. This scheme can acquire the original view related to the low-brightness scene, perform darkening processing on the original view to obtain the enhanced view, crop the original view to obtain the partial view, and stitch the sub-images of the original view and the enhanced view to obtain the blended view. This scheme can use the original view, enhanced view, and blended view as the first input data and input them into the teacher model to determine the first feature result of each view; use the original view, enhanced view, blended view, and partial view as the second input data and input them into the student model to determine the second feature result of each view; then, based on the consistency of the first feature result and the second feature result, the teacher model and the student model are adjusted to determine the trained visual encoder, so as to obtain the second visual model transferred to the low-brightness scene.
[0088] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage and optical storage) containing computer-usable program code.
[0089] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-executable instructions. These computer-executable instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0090] These processor-executable instructions may also be stored in a processor-readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the processor-readable memory produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0091] These processors can execute instructions that can also be loaded onto a computer or other programmable data processing device, causing a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable device for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0092] It should be understood that although the steps in the flowcharts of the accompanying figures are shown sequentially as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the accompanying figures may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0093] The above description is only a partial embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. A visual model training method, characterized in that, The method includes: Obtain the first visual model to be transferred to the low-brightness scene, and generate teacher and student models based on the visual encoder of the first visual model for extracting view features; The process involves acquiring an original view related to a low-brightness scene and generating an enhanced view, a blended view, and a partial view. The enhanced view is obtained by darkening the original view using a visual darkening enhancement model. The blended view is obtained by blending a subset of the original view with a subset of the enhanced view. The partial view is obtained by cropping the original view. The original view, enhanced view, and blended view are used as the first input data and fed into the teacher model to determine the first feature result of each view; The original view, enhanced view, blended view, and partial view are used as the second input data and fed into the student model to determine the second feature result of each view; Based on the consistency between the first feature result and the second feature result, the student model is updated first by gradient backpropagation, and the teacher model is updated second by weighted moving average, so as to determine the trained visual encoder and obtain the second visual model transferred to the low brightness scene. The first update includes: Based on the feature consistency between the first feature result and the second feature result, the cross-domain update parameters are determined; Based on the second feature results of multiple local views within the target time period, the first action feature of the target object in the multiple local views is determined; based on the second feature results of multiple original views within the target time period, the second action feature of the target object in the multiple original views is determined; based on the feature consistency of the first action feature and the second action feature, the update parameters within the domain are determined. The student model is adjusted based on cross-domain update parameters and intra-domain update parameters.
2. The method according to claim 1, characterized in that, The lighting conditions of the low-brightness scene are the first lighting conditions. The step of obtaining the first visual model to be transferred to the low-brightness scene includes: Obtain training views and view annotations of the scene related to the second lighting condition, where the brightness of the second lighting condition is higher than that of the first lighting condition; The training view is input into the initial visual model to be trained to obtain the view prediction result; Based on the difference between the view prediction results and the view annotations of the training view, the initial visual model to be trained is adjusted to determine the first visual model to be transferred to the low-brightness scene.
3. The method according to claim 1, characterized in that, The first visual model further includes: a progressive learning adapter for extracting features from different visual levels from each layer of the visual encoder and performing context fusion based on a temporal self-attention mechanism; After determining the trained visual encoder, the method further includes: Freeze the parameters of the trained visual encoder; Acquire training data related to low-brightness scenes, and adjust the parameters of the progressive learning adapter of the first vision model based on the training data; The second visual model is determined based on the parameters of the frozen visual encoder and the parameters of the progressive learning adapter trained on the training data.
4. The method according to claim 3, characterized in that, The method further includes: Acquire model fine-tuning data related to low-brightness scenes, the model fine-tuning data including fine-tuning input data and fine-tuning annotation results; The fine-tuning input data is fed into the second visual model to obtain the fine-tuned prediction results; Based on the difference between the fine-tuned prediction results and the fine-tuned annotation results, the parameters of the visual encoder and progressive learning adapter of the second vision model are adjusted.
5. The method according to claim 3, characterized in that, The method further includes: Acquire view input data related to low-brightness scenes, input the view input data into the second visual model, and analyze the view analysis results and the confidence level of the view analysis results; View analysis results with confidence levels meeting preset thresholds are used as labels for view input data to form view training data. The parameters of the visual encoder and progressive learning adapter of the second vision model are adjusted based on the view training data.
6. A visual model training device, characterized in that, The device includes: The first model acquisition module is used to acquire the first visual model to be transferred to the low-brightness scene, and to generate teacher and student models based on the visual encoder of the first visual model for extracting view features. The scene view acquisition module is used to acquire the original view related to the low-brightness scene and generate an enhanced view, a blended view, and a partial view. The enhanced view is obtained by darkening the original view based on a visual darkening enhancement model. The blended view is obtained by blending a partial sub-image of the original view with a partial sub-image of the enhanced view. The partial view is obtained by cropping the original view. The first feature analysis module is used to input the original view, enhanced view, and hybrid view as the first input data into the teacher model to determine the first feature result of each view; The second feature analysis module is used to input the original view, enhanced view, blended view and partial view as second input data into the student model to determine the second feature results of each view; Based on the consistency between the first and second feature results, the student model is updated using gradient backpropagation, and the teacher model is updated using a weighted moving average to determine the trained visual encoder and obtain a second visual model transferred to the low-brightness scene. The first update includes: determining cross-domain update parameters based on the feature consistency between the first and second feature results; determining the first action features of the target object in multiple local views based on the second feature results of multiple local views within the target time period; determining the second action features of the target object in multiple original views based on the second feature results of multiple original views within the target time period; determining intra-domain update parameters based on the feature consistency between the first and second action features; and adjusting the student model based on the cross-domain and intra-domain update parameters.
7. An electronic device, characterized in that, include: At least one processor and at least one memory, wherein, The memory stores computer-readable instructions; The computer-readable instructions are executed by one or more of the processors, causing the electronic device to implement the visual model training method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Mode removal for improved multi-modal background subtraction
CN102917159A
