Visual model adaptive optimization method based on dynamic network structure
Patent Information
- Application Number
- CN202610835562.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-10
- Publication Date
- 2026-10-13
AI Technical Summary
[0004]针对现有技术存在的不足,本发明的目的在于提供一种基于动态网络结构的视觉模型自适应优化方法,通过构建双维度动态感知模块、三重自适应结构调整策略及动态平衡损失训练机制,结合泛化增强与硬件-任务双驱动阈值优化,解决传统视觉模型结构固定、场景适配性差、精度与效率无法协同优化、泛化能力弱、硬件适配性不足的技术问题
[0011]本发明的有益效果,本发明设计了全流程动态自适应优化框架,彻底突破传统视觉模型固定结构的设计局限,解决了现有模型无法适配输入场景变化、硬件资源差异的核心问题。本发明通过输入与状态双维度动态感知,精准捕捉数据复杂度与网络运行状态,依托三重柔性结构调整策略,实现网络结构的实时自适应优化,规避了传统局部微调方式优化效果差、易出现结构坍塌的问题。同时,本发明设计动态加权平衡损失函数,打破了视觉模型精度与效率相互制约的行业痛点,实现二者协同最优。
Smart Images

Figure REF-OBJ-1781082241468-000001 
Figure REF-OBJ-1781082241468-000002 
Figure REF-OBJ-1781082241468-000003
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer vision deep learning model optimization technology, and more specifically to an adaptive optimization method for visual models based on dynamic network structures. Background Technology
[0002] With the rapid development of deep learning technology, computer vision has been widely applied in fields such as security monitoring, intelligent transportation, medical image analysis, and industrial inspection. Mainstream architectures such as convolutional neural networks and visual Transformers have achieved significant performance breakthroughs in various vision tasks. However, existing vision models still face many key technical bottlenecks in practical deployment applications.
[0003] Current visual models generally employ fixed network structures, making it impossible to dynamically adjust them based on input complexity, task requirements, and operating environment after training. Adaptive adjustment mechanisms introduced in some studies can only make limited modifications to local parameters or attention weights, lacking global optimization capabilities and effective feedback mechanisms, resulting in poor adjustment performance. Furthermore, model performance is highly dependent on large-scale labeled data; recognition accuracy significantly decreases when faced with scenes not covered in training, lighting conditions, viewpoint changes, and cross-domain transfer. In addition, the trade-off between accuracy and efficiency consistently hinders large-scale deployment. Pursuing high accuracy requires increasing the number of parameters and computational complexity, making deployment on resource-constrained edge devices difficult; conversely, improving efficiency through compression and quantization results in accuracy loss. Current technologies struggle to achieve an ideal balance between these two aspects. Summary of the Invention
[0004] To address the shortcomings of existing technologies, the present invention aims to provide an adaptive optimization method for visual models based on dynamic network structures. By constructing a two-dimensional dynamic perception module, a triple adaptive structure adjustment strategy, and a dynamic balance loss training mechanism, combined with generalization enhancement and hardware-task dual-driven threshold optimization, this method solves the technical problems of traditional visual models, such as fixed structure, poor scene adaptability, inability to coordinate accuracy and efficiency optimization, weak generalization ability, and insufficient hardware adaptability.
[0005] To achieve the above objectives, the present invention provides the following technical solution: an adaptive optimization method for visual models based on dynamic network structures, comprising the following steps: Step 1, Model Initialization and Data Preprocessing: Construct a basic visual model and initialize network parameters; acquire visual training and testing data, perform size normalization, noise reduction, and data augmentation on the data, construct multi-scene training and testing datasets, and collect resource constraint parameters under different hardware environments. Step 2, Dynamic Perception Module Construction: Build an input characteristic perception unit and a network state perception unit to capture the complexity of input data, the activation intensity of network layers, parameter redundancy, and hardware resource usage in real time, and output perception features for subsequent structural adjustments; Step 3, Adaptive Structure Adjustment Strategy Design: Based on the dynamic perception results, a triple adjustment strategy is designed, which includes dynamic start and stop of network layers, dynamic pruning of channels, and dynamic switching of branches, to achieve flexible adaptive adjustment of the network structure and avoid the risk of structural collapse. Step 4, Global Optimization Training: Introduce an improved dynamic loss function to jointly train the network structure parameters and adjustment strategy parameters, optimize the dynamic adjustment threshold and weight allocation, and achieve synergistic optimization of accuracy and efficiency; Step 5, Generalization Enhancement and Validation: Introduce multi-scale adversarial training and domain adaptation mechanisms to improve the model's generalization ability; input test data into the optimized model to verify the optimization effect, fine-tune the parameters, and ensure that the model can achieve optimal performance in different scenarios and hardware environments.
[0006] As a further improvement of the present invention, the dynamic perception module constructed in step two adopts an input-state dual-dimensional dynamic perception mechanism, specifically including: Input data complexity awareness: Input images are jointly quantized using information entropy and gradient magnitude. complexity Where H is the height, W is the width, and C is the number of channels; in, These are the weighting coefficients. The information entropy of the input image, The gradient magnitude of the input image at position (i,j,k) is used to characterize the richness of detail in the image, such as edges and textures. Network state awareness: Quantify the activation intensity Al and parameter redundancy Rl of the l-th layer of the network, jointly generate the network state awareness value Sl, and introduce the dynamic utility value Ul derived from alternating gradient flow to improve the comprehensiveness of state awareness; in, , For the first Layer weights and biases For the first The output features of the layer For the first The number of features in a layer Let be the rank of the weight matrix. For the first Number of convolutional kernels in a layer For the first The number of channels in the layer Weighting coefficients ( ), To increase the number of training iterations, For loss function, Used to capture the structural importance of network layers and avoid redundant judgment bias; Two-dimensional perception fusion: Generates the final perception trigger signal (Trigger) to trigger subsequent structural adjustments. Where L is the total number of network layers, Trigger∈[0,1], the larger the value, the stronger the need for structural adjustment.
[0007] As a further improvement of the present invention, the adaptive structure adjustment strategy in step three includes a triple adjustment strategy of dynamic network layer start-up and shutdown, dynamic channel pruning, and dynamic branch switching. Based on dynamically sensed signals, the network structure is flexibly adjusted, and the concept of structure reparameterization is introduced, as follows: Dynamic start / stop of network layer: based on network state awareness values With preset threshold Control the first Layer start / stop status : in, , The start / stop threshold, For the first The start / stop status of this layer at any given time; Dynamic channel pruning: Based on channel importance scoring (Importc), where c is the channel index, redundant channels are pruned, key channels are retained, and AGF-guided channel importance correction is introduced to improve pruning accuracy. in, For the first Channel feature map, It is the variance function. For the first The dynamic utility value of the channel, For correction factor, This is the clipping threshold; Dynamic branch switching: Designing high-precision and lightweight branches based on input complexity. Hardware resource constraints Dynamically switch branches Meanwhile, a smooth transition for branch switching is achieved through structural reparameterization: in, , As the input complexity threshold, For hardware resource thresholds, , These are the weights for the high-precision and lightweight branches, respectively. To switch weights from and Dynamic adjustment This is the equivalent weight.
[0008] As a further improvement of the present invention, the dynamic balance total loss function in step four Due to accuracy loss Efficiency loss With structure regularization loss It consists of three weighted components, with the weights adaptively adjusted based on the dynamic perception results: in, For adaptive loss weights ( ), triggered by sensing signals Dynamic adjustment: , , The aforementioned loss of accuracy Efficiency loss With structure regularization loss Specifically as follows: Accuracy loss This approach combines cross-entropy loss and Dice loss to adapt to different visual tasks and balance foreground and background attention. in, For cross-entropy loss, For real labels, To predict probabilities, TP represents the number of categories, and FN and FP represent the number of true positive, false negative, and false positive samples, respectively. Efficiency loss Quantify model inference latency and parameter count to constrain efficiency and performance; draw inspiration from latency-aware dynamic networks to improve practical deployment efficiency. in, These are the weighting coefficients. For the current model inference delay, , These represent the minimum and maximum acceptable delays, respectively. The number of parameters in the current model. , These are the minimum and maximum acceptable parameter counts, respectively. Structure regularization loss To constrain the sparsity and stability of the network structure and prevent structural collapse, a structural regularization term derived from AGF is introduced. in, The KL divergence is used to constrain the rationality of the weight distribution. The regularization coefficient is . This represents the dynamic utility value of the network layer.
[0009] As a further improvement to the present invention, the multi-scale adversarial training and domain adaptation mechanism in step five is specifically as follows: Multi-scale interference generation: Constructing a multi-scale interference generator Generate scene disturbances of different scales and types to simulate complex scene changes: in, For interference scale, It is an interference type. The interference intensity coefficient, For interference generation function, For interference masking, The input image contains interference; Adversarial loss design: By training the generator and discriminator adversarially, the model is forced to learn robust features, while dynamically sensing signals are introduced to adjust the adversarial strength. in, For discriminator, The feature extraction function for the model. The distribution of normal input data, Let be the expected function. This is the dynamic resistance intensity coefficient; Domain-adaptive loss: Utilizes the maximum mean difference to measure the difference in feature distributions between the source and target domains, reducing the impact of distribution shift and improving generalization ability. in, , These are the feature representations of the source domain and the target domain, respectively. , These represent the number of samples in the source domain and the target domain, respectively. It is the L2 norm. The total loss for generalization enhancement is... It incorporates a dynamic equilibrium total loss function.
[0010] As a further improvement to the present invention, a dynamic threshold adjustment optimization step driven by both hardware and tasks is also included, as follows: Quantifying hardware resource constraints: quantifying hardware computing power ,Memory Quantified as resource constraint coefficient : in, , These are the maximum computing power and maximum memory of the hardware, respectively. These are the weighting coefficients. The higher the value, the more abundant the hardware resources. Task requirement weight quantification: based on the accuracy requirements of the vision task. With efficiency requirements Generate task requirement weights : in, , These represent maximum acceptable accuracy and efficiency, respectively. This refers to the task weighting coefficient; Dynamic threshold optimization: based on and Optimize start / stop thresholds With clipping threshold This achieves precise adaptation of thresholds to scenarios, while introducing pseudo-labels to assist in optimization and improve the rationality of thresholds. in, For pseudo-label weight coefficients, The confidence level of the pseudo-labels generated through self-supervised training is used to correct the threshold, ensuring that the threshold optimization is targeted. The more abundant the hardware resources and the higher the task accuracy requirements, the better. The higher, The lower, The lower the value, the more complex the model structure and the higher the accuracy; conversely, the lower the value, the simpler the model structure and the higher the efficiency.
[0011] The beneficial effects of this invention are as follows: This invention designs a full-process dynamic adaptive optimization framework, completely breaking through the design limitations of the fixed structure of traditional visual models and solving the core problem that existing models cannot adapt to changes in input scenarios and differences in hardware resources. This invention achieves real-time adaptive optimization of the network structure through dynamic perception of both input and state, accurately capturing data complexity and network operating status. Relying on a triple flexible structure adjustment strategy, it avoids the problems of poor optimization effect and structural collapse inherent in traditional local fine-tuning methods. Simultaneously, this invention designs a dynamic weighted balanced loss function, breaking the industry pain point of mutual constraint between accuracy and efficiency in visual models, achieving optimal synergy between the two.
[0012] This invention introduces multi-scale adversarial training and domain adaptation mechanisms, effectively improving the model's generalization ability in complex and cross-domain scenarios, solving the problems of weak generalization and low scenario adaptability of traditional models. The hardware-task dual-driven threshold optimization mechanism allows the model to adapt to hardware devices with different computing power and memory, balancing the needs of high-precision scenarios and lightweight deployment scenarios, greatly expanding the model's application scope. The collaborative and layered empowerment of various auxiliary modules further improves the model's perception accuracy, structural adjustment rationality, and training stability. The overall solution is highly versatile and robust, possessing excellent engineering application value. Detailed Implementation
[0013] The present invention will be further described in detail below with reference to the given embodiments.
[0014] The adaptive optimization method for visual models based on dynamic network structures in this embodiment includes the following steps: Step 1, Model Initialization and Data Preprocessing: Construct a basic visual model and initialize network parameters; acquire visual training and testing data, perform size normalization, noise reduction, and data augmentation on the data, construct multi-scene training and testing datasets, and collect resource constraint parameters under different hardware environments. Step 2, Dynamic Perception Module Construction: Build an input characteristic perception unit and a network state perception unit to capture the complexity of input data, the activation intensity of network layers, parameter redundancy, and hardware resource usage in real time, and output perception features for subsequent structural adjustments; Step 3, Adaptive Structure Adjustment Strategy Design: Based on the dynamic perception results, a triple adjustment strategy is designed, which includes dynamic start and stop of network layers, dynamic pruning of channels, and dynamic switching of branches, to achieve flexible adaptive adjustment of the network structure and avoid the risk of structural collapse. Step 4, Global Optimization Training: Introduce an improved dynamic loss function to jointly train the network structure parameters and adjustment strategy parameters, optimize the dynamic adjustment threshold and weight allocation, and achieve synergistic optimization of accuracy and efficiency; Step 5, Generalization Enhancement and Validation: Introduce multi-scale adversarial training and domain adaptation mechanisms to improve the model's generalization ability; input test data into the optimized model to verify the optimization effect, fine-tune the parameters, and ensure that the model can achieve optimal performance in different scenarios and hardware environments.
[0015] In practical application, this method first completes the basic preparation of the model and data, adapting to the basic conditions of multi-scenario and multi-hardware deployment. Then, it collects the features of model operation and input data in real time through a dual-dimensional perception module, providing accurate basis for structural adjustment. It relies on a triple dynamic adjustment strategy to achieve flexible adaptive optimization of the network structure, replacing the traditional fixed structure design. It optimizes model parameters through joint training using a dynamic loss function, balancing accuracy and efficiency. Finally, it improves the model's scene adaptability through a generalization enhancement mechanism, ultimately solving the problems of fixed model structure, poor scene adaptability, imbalance between accuracy and efficiency, and weak generalization ability in traditional models, achieving optimal performance output in multi-scenario and multi-hardware environments.
[0016] Furthermore, the dynamic perception module constructed in step two adopts an input-state dual-dimensional dynamic perception mechanism, specifically including: Input data complexity awareness: Input images are jointly quantized using information entropy and gradient magnitude. complexity ,in, For height, For width, Number of channels: in, These are the weighting coefficients. The information entropy of the input image, For the input image in The gradient magnitude at a location is used to characterize the richness of detail in image edges, textures, and other features; Network State Awareness: Quantizing the Network Layer activation intensity With parameter redundancy Jointly generate network state-aware values At the same time, the dynamic utility value derived from alternating gradient flow is introduced. Improve the comprehensiveness of state awareness: in, , For the first Layer weights and biases For the first The output features of the layer For the first The number of features in a layer Let be the rank of the weight matrix. For the first Number of convolutional kernels in a layer For the first The number of channels in the layer Weighting coefficients ( ), To increase the number of training iterations, For loss function, Used to capture the structural importance of network layers and avoid redundant judgment bias; Two-dimensional perception fusion: generating the final perception trigger signal Used to trigger subsequent structural adjustments: in, The total number of network layers. The larger the value, the stronger the need for structural adjustment. By jointly quantifying the complexity of the input image using information entropy and gradient magnitude, the system accurately identifies the richness and complexity of details in the input data under different scenarios. It also quantifies the network's operating state from multiple dimensions, including activation strength, parameter redundancy, and dynamic utility, avoiding the bias of judging by a single indicator. Finally, it fuses these two-dimensional features to generate an adjustment trigger signal, providing a quantitative basis for subsequent structural adjustments. This mechanism solves the problems of traditional adaptive models having a single perception dimension and inaccurate judgment, significantly improving the accuracy and targeting of structural adjustments, and ensuring the effectiveness of adaptive optimization from the source.
[0017] Furthermore, the adaptive structure adjustment strategy in step three includes a triple adjustment strategy of dynamic network layer start / stop, dynamic channel pruning, and dynamic branch switching. Based on dynamically sensed signals, the network structure is flexibly adjusted, while introducing the concept of structure reparameterization, as detailed below: Dynamic start / stop of network layer: based on network state awareness values With preset threshold Control the first Layer start / stop status : in, , The start / stop threshold, For the first The start / stop status of this layer at any given time; Dynamic Channel Clipping: Based on Channel Importance Scoring , For channel indexing, redundant channels are pruned, key channels are retained, and AGF-guided channel importance correction is introduced to improve pruning accuracy: in, For the first Channel feature map, It is the variance function. For the first The dynamic utility value of the channel, For correction factor, This is the clipping threshold; Dynamic branch switching: Designing high-precision and lightweight branches based on input complexity. Hardware resource constraints Dynamically switch branches Meanwhile, a smooth transition for branch switching is achieved through structural reparameterization: in, , As the input complexity threshold, For hardware resource thresholds, , These are the weights for the high-precision and lightweight branches, respectively. To switch weights from and Dynamic adjustment To achieve equivalent weights, the network structure is flexibly adjusted based on dynamically sensed signals, and a smooth transition is achieved by combining structural reparameterization. Dynamic start and stop of network layers enables global structural optimization at the network level, dynamic channel pruning enables fine-grained parameter simplification, and dynamic branch switching adapts to the differentiated task requirements of high and low precision and high and low efficiency. This triple strategy forms a comprehensive structural optimization system encompassing global, local, and task-specific aspects, solving the problems of traditional models that can only perform local fine-tuning, have a single optimization dimension, and are prone to structural collapse. It allows the network structure to flexibly adapt to the scene and hardware in real time.
[0018] Furthermore, in step four, a dynamic equilibrium total loss function is designed. Due to accuracy loss Efficiency loss With structure regularization loss It consists of three weighted components, with the weights adaptively adjusted based on the dynamic perception results: in, For adaptive loss weights ( ), triggered by sensing signals Dynamic adjustment: , , The aforementioned loss of accuracy Efficiency loss With structure regularization loss Specifically as follows: Accuracy loss This approach combines cross-entropy loss and Dice loss to adapt to different visual tasks and balance foreground and background attention. in, For cross-entropy loss, For real labels, To predict probabilities, TP represents the number of categories, and FN and FP represent the number of true positive, false negative, and false positive samples, respectively. Efficiency loss Quantify model inference latency and parameter count to constrain efficiency and performance; draw inspiration from latency-aware dynamic networks to improve practical deployment efficiency. in, These are the weighting coefficients. For the current model inference delay, , These represent the minimum and maximum acceptable delays, respectively. The number of parameters in the current model. , These are the minimum and maximum acceptable parameter counts, respectively. Structure regularization loss To constrain the sparsity and stability of the network structure and prevent structural collapse, a structural regularization term derived from AGF is introduced. in, The KL divergence is used to constrain the rationality of the weight distribution. The regularization coefficient is . This represents the dynamic utility value of the network layer. Combining cross-entropy and Dice loss improves model recognition accuracy, while latency and parameter quantification constrain model inference efficiency. Regularized loss ensures network structural stability. This dynamic loss mechanism addresses the problems of traditional model training failing to balance accuracy and efficiency, and exhibiting poor structural stability. It achieves a dynamic balance during training, precisely adapting to different optimization needs and ensuring optimal model performance.
[0019] Furthermore, step five involves setting up a multi-scale adversarial training and domain adaptation mechanism as follows: Multi-scale interference generation: Constructing a multi-scale interference generator Generate scene disturbances of different scales and types to simulate complex scene changes: in, For interference scale, It is an interference type. The interference intensity coefficient, For interference generation function, For interference masking, The input image contains interference; Adversarial loss design: By training the generator and discriminator adversarially, the model is forced to learn robust features, while dynamically sensing signals are introduced to adjust the adversarial strength. in, For discriminator, The feature extraction function for the model. The distribution of normal input data, Let be the expected function. This is the dynamic resistance strength coefficient; Domain-adaptive loss: Utilizes the maximum mean difference to measure the difference in feature distributions between the source and target domains, reducing the impact of distribution shift and improving generalization ability. in, , These are the feature representations of the source domain and the target domain, respectively. , These represent the number of samples in the source domain and the target domain, respectively. It is the L2 norm. The total loss for generalization enhancement is... This approach incorporates a dynamically balanced total loss function, simulates complex working conditions by generating multi-scale scene disturbances, and leverages adversarial training to enable the model to learn robust features. It also constrains the consistency of feature distribution across domains through maximum mean difference constraints. This mechanism effectively addresses the problem of traditional models experiencing a sharp drop in accuracy when facing unknown scenarios and cross-domain tasks, significantly improving the model's anti-interference ability and cross-scene generalization ability, and expanding the model's applicable scenarios.
[0020] Furthermore, this method also includes a hardware-task dual-driven dynamic threshold adjustment optimization step, as detailed below: Quantifying hardware resource constraints: quantifying hardware computing power ,Memory Quantified as resource constraint coefficient : in, , These are the maximum computing power and maximum memory of the hardware, respectively. These are the weighting coefficients. The higher the value, the more abundant the hardware resources. Task requirement weight quantification: based on the accuracy requirements of the vision task. With efficiency requirements Generate task requirement weights : in, , These represent maximum acceptable accuracy and efficiency, respectively. This refers to the task weighting coefficient; Dynamic threshold optimization: based on and Optimize start / stop thresholds With clipping threshold This achieves precise adaptation of thresholds to scenarios, while introducing pseudo-labels to assist in optimization and improve the rationality of thresholds. in, For pseudo-label weight coefficients, The confidence level of the pseudo-labels generated through self-supervised training is used to correct the threshold, ensuring that the threshold optimization is targeted. The more abundant the hardware resources and the higher the task accuracy requirements, the better. The higher, The lower, The lower the threshold, the more complex the model structure and the higher the accuracy; conversely, the higher the threshold, the simpler the model structure and the higher the efficiency. By quantifying the weights of hardware resource constraints and task requirements, the core thresholds of each adjustment module are adaptively optimized, and pseudo-labels are used to assist in correcting the threshold parameters. This mechanism allows the model adjustment strategy to accurately adapt to different hardware computing power and different task accuracy and efficiency requirements, solving the problems of poor adaptability and inability to adapt to differentiated deployment scenarios of traditional fixed thresholds, and further improving the model's adaptability and optimization accuracy.
[0021] Based on the above method, the following application example is provided in this embodiment: For target detection scenarios applied to edge devices (such as embedded cameras), the specifics are as follows: 1. Model initialization and data preprocessing: YOLOv8 was selected as the basic vision model, and the network parameters were initialized. A target detection dataset (containing samples of pedestrians, vehicles, obstacles, etc., totaling 10,000 images, of which 8,000 were in the training set and 2,000 were in the test set) was obtained. The images were normalized to 640×640 pixels, and Gaussian filtering (3×3 convolution kernel) was used for noise reduction. Data augmentation was performed by random flipping and illumination adjustment (brightness ±20%). The hardware resource parameters of the edge device (embedded camera) were collected: maximum computing power of 100 GFLOPS, maximum memory of 2GB, minimum acceptable inference latency of 50ms, and minimum acceptable parameter size of 50M.
[0022] 2. Construction of the dynamic perception module: Construct an input characteristic sensing unit and a network state sensing unit. , , , The complexity of capturing input images in real time State awareness values of each network layer Generate sensing trigger signal At the same time, AGF was introduced to analyze the dynamic utility value of network layers. This improves the accuracy of perception.
[0023] 3. Adaptive structural adjustment strategy design: Preset initial start / stop threshold , pruning threshold , Design high-precision branches (full YOLOv8 structure) and lightweight branches (YOLOv8 structure with 50% fewer channels), and achieve smooth branch switching through structure reparameterization, based on... The signal enables triple adjustments for network layer start / stop, channel pruning, and branch switching to prevent structural collapse.
[0024] 4. Global optimization training: The dynamic equilibrium loss function, which is the third innovation, is adopted. , Adaptive loss weights Dynamic adjustment; the optimizer uses AdamW, with a learning rate of 1e-5, a batch size of 16, and 80 training epochs. An early stopping strategy is adopted (training stops if the accuracy on the validation set does not improve for 5 consecutive epochs). At the same time, the threshold optimization method of innovation point 5 is introduced to optimize and adjust the threshold in combination with hardware resources and task requirements.
[0025] 5. Generalization Enhancement and Validation: Introducing the multi-scale adversarial generalization enhancement mechanism, which is innovation point 4. Interference scale The system generates illumination and occlusion interference samples, and performs domain-adaptive training (indoor samples as the source domain and outdoor samples as the target domain). Test data is input into the optimized model to verify the optimization effect: the target detection accuracy reaches 92.3%, a 3.7% improvement over the original YOLOv8; the inference latency is 38ms, a 42% reduction compared to the original model; the parameter size is 42M, meeting the memory constraints of edge devices; the detection accuracy in complex outdoor scenes (rain, strong light) reaches 89.8%, an 8.5% improvement over the original model, significantly improving generalization ability. Furthermore, pseudo-label-assisted threshold optimization further enhances the model's adaptability, verifying the effectiveness and superiority of this invention, and demonstrating its ability to meet the high-precision and high-efficiency requirements for target detection on edge devices.
[0026] In summary, this invention constructs a complete visual model optimization scheme that integrates dual-dimensional perception, triple structure adjustment, dynamic loss optimization, generalization enhancement, and threshold adaptive adaptation. It effectively solves the technical problems of existing visual models, such as rigid structure, poor scene adaptability, imbalance between accuracy and efficiency, weak generalization ability, and large hardware adaptation limitations. It achieves optimal synergy between accuracy and inference efficiency in different scenarios and hardware environments, significantly improves robustness and versatility, and meets the industrialization needs of various computer vision tasks.
[0027] The above description is merely a preferred embodiment of the present invention. The scope of protection of the present invention is not limited to the above embodiments. All technical solutions falling within the scope of the present invention's concept are within the scope of protection of the present invention. It should be noted that for those skilled in the art, any improvements and modifications made without departing from the principles of the present invention should also be considered within the scope of protection of the present invention.
Claims
1. An adaptive optimization method for visual models based on dynamic network structures, characterized in that: Includes the following steps: Step 1, Model Initialization and Data Preprocessing: Construct a basic visual model and initialize network parameters; acquire visual training and testing data, perform size normalization, noise reduction, and data augmentation on the data, construct multi-scene training and testing datasets, and collect resource constraint parameters under different hardware environments. Step 2, Dynamic Perception Module Construction: Build an input characteristic perception unit and a network state perception unit to capture the complexity of input data, the activation intensity of network layers, parameter redundancy, and hardware resource usage in real time, and output perception features for subsequent structural adjustments; Step 3, Adaptive Structure Adjustment Strategy Design: Based on the dynamic perception results, a triple adjustment strategy is designed, which includes dynamic start and stop of network layers, dynamic pruning of channels, and dynamic switching of branches, to achieve flexible adaptive adjustment of the network structure and avoid the risk of structural collapse. Step 4, Global Optimization Training: Introduce an improved dynamic loss function to jointly train the network structure parameters and adjustment strategy parameters, optimize the dynamic adjustment threshold and weight allocation, and achieve synergistic optimization of accuracy and efficiency; Step 5, Generalization Enhancement and Validation: Introduce multi-scale adversarial training and domain adaptation mechanisms to improve the model's generalization ability; input test data into the optimized model to verify the optimization effect, fine-tune the parameters, and ensure that the model can achieve optimal performance in different scenarios and hardware environments.
2. The adaptive optimization method for visual models based on dynamic network structures according to claim 1, characterized in that: The dynamic perception module constructed in step two adopts an input-state dual-dimensional dynamic perception mechanism, specifically including: Input data complexity awareness: Input images are jointly quantized using information entropy and gradient magnitude. complexity ,in, For height, For width, Number of channels: in, These are the weighting coefficients. The information entropy of the input image, For the input image in The gradient magnitude at a location is used to characterize the richness of detail in image edges, textures, and other features; Network State Awareness: Quantizing the Network Layer activation intensity With parameter redundancy Jointly generate network state-aware values At the same time, the dynamic utility value derived from alternating gradient flow is introduced. Improve the comprehensiveness of state awareness: in, , For the first Layer weights and biases For the first The output features of the layer For the first The number of features in a layer Let be the rank of the weight matrix. For the first Number of convolutional kernels in a layer For the first The number of channels in the layer Weighting coefficients ( ), To increase the number of training iterations, For loss function, Used to capture the structural importance of network layers and avoid redundant judgment bias; Two-dimensional perception fusion: generating the final perception trigger signal Used to trigger subsequent structural adjustments: in, The total number of network layers. The larger the value, the stronger the need for structural adjustment.
3. The adaptive optimization method for visual models based on dynamic network structures according to claim 2, characterized in that: The adaptive structure adjustment strategy in step three includes a triple adjustment strategy of dynamic network layer start / stop, dynamic channel pruning, and dynamic branch switching. Based on dynamically sensed signals, it flexibly adjusts the network structure and introduces the concept of structure reparameterization, as detailed below: Dynamic start / stop of network layer: based on network state awareness values With preset threshold Control the first Layer start / stop status : in, , The start / stop threshold, For the first The start / stop status of this layer at any given time; Dynamic Channel Clipping: Based on Channel Importance Scoring , For channel indexing, redundant channels are pruned, key channels are retained, and AGF-guided channel importance correction is introduced to improve pruning accuracy: in, For the first Channel feature map, It is the variance function. For the first The dynamic utility value of the channel, For correction factor, This is the clipping threshold; Dynamic branch switching: Designing high-precision and lightweight branches based on input complexity. Hardware resource constraints Dynamically switch branches Meanwhile, a smooth transition for branch switching is achieved through structural reparameterization: in, , As the input complexity threshold, For hardware resource thresholds, , These are the weights for the high-precision and lightweight branches, respectively. To switch weights from and Dynamic adjustment This is the equivalent weight.
4. The adaptive optimization method for visual models based on dynamic network structures according to claim 3, characterized in that: The dynamic balance total loss function in step four Due to accuracy loss Efficiency loss With structure regularization loss It consists of three weighted components, with the weights adaptively adjusted based on the dynamic perception results: in, For adaptive loss weights ( ), triggered by sensing signals Dynamic adjustment: , , The aforementioned loss of accuracy Efficiency loss With structure regularization loss Specifically as follows: Accuracy loss This approach combines cross-entropy loss and Dice loss to adapt to different visual tasks and balance foreground and background attention. in, For cross-entropy loss, For real labels, To predict probabilities, TP represents the number of categories, and FN and FP represent the number of true positive, false negative, and false positive samples, respectively. Efficiency loss Quantify model inference latency and parameter count to constrain efficiency and performance; draw inspiration from latency-aware dynamic networks to improve practical deployment efficiency. in, These are the weighting coefficients. For the current model inference delay, , These represent the minimum and maximum acceptable delays, respectively. The number of parameters in the current model. , These are the minimum and maximum acceptable parameter counts, respectively. Structure regularization loss To constrain the sparsity and stability of the network structure and prevent structural collapse, a structural regularization term derived from AGF is introduced. in, The KL divergence is used to constrain the rationality of the weight distribution. The regularization coefficient is . This represents the dynamic utility value of the network layer.
5. The adaptive optimization method for visual models based on dynamic network structures according to claim 4, characterized in that: The multi-scale adversarial training and domain adaptation mechanism in step five is as follows: Multi-scale interference generation: Constructing a multi-scale interference generator Generate scene disturbances of different scales and types to simulate complex scene changes: in, For interference scale, It is an interference type. The interference intensity coefficient, For interference generation function, For interference masking, The input image contains interference; Adversarial loss design: By training the generator and discriminator adversarially, the model is forced to learn robust features, while dynamically sensing signals are introduced to adjust the adversarial strength. in, For discriminator, The feature extraction function for the model. The distribution of normal input data, Let be the expected function. This is the dynamic resistance strength coefficient; Domain-adaptive loss: Utilizes the maximum mean difference to measure the difference in feature distributions between the source and target domains, reducing the impact of distribution shift and improving generalization ability. in, , These are the feature representations of the source domain and the target domain, respectively. , These represent the number of samples in the source domain and the target domain, respectively. It is the L2 norm. The total loss for generalization enhancement is... It incorporates a dynamic equilibrium total loss function.
6. The adaptive optimization method for visual models based on dynamic network structures according to claim 5, characterized in that: It also includes a dynamic threshold adjustment optimization step driven by both hardware and tasks, as detailed below: Quantifying hardware resource constraints: quantifying hardware computing power ,Memory Quantified as resource constraint coefficient : in, , These are the maximum computing power and maximum memory of the hardware, respectively. These are the weighting coefficients. The higher the value, the more abundant the hardware resources. Task requirement weight quantification: based on the accuracy requirements of the vision task. With efficiency requirements Generate task requirement weights : in, , These represent maximum acceptable accuracy and efficiency, respectively. This refers to the task weighting coefficient; Dynamic threshold optimization: based on and Optimize start / stop thresholds With clipping threshold This achieves precise adaptation of thresholds to scenarios, while introducing pseudo-labels to assist in optimization and improve the rationality of thresholds. in, For pseudo-label weight coefficients, The confidence level of the pseudo-labels generated through self-supervised training is used to correct the threshold, ensuring that the threshold optimization is targeted. The more abundant the hardware resources and the higher the task accuracy requirements, the better. The higher, The lower, The lower the value, the more complex the model structure and the higher the accuracy; conversely, the lower the value, the simpler the model structure and the higher the efficiency.