Complex scene image recognition method, system, device and storage medium
Patent Information
- Application Number
- CN202610733878.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-26
- Publication Date
- 2026-08-18
AI Technical Summary
[0008]然而,该类方案存在以下不足:其一,模型通常采用固定深度和统一前向路径,对整幅图像所有区域执行相同强度的计算,缺乏针对困难区域重点分析、对简单区域减少处理的动态机制;其二,尽管深层卷积网络能够一定程度上增强复杂特征表达,但对远距离小目标、细粒度差异目标和严重遮挡目标的识别能力仍有限;其三,当模型为提高复杂场景精度而不断加深或加宽时,参数量和计算量快速增加,不利于在车载、边缘和实时场景中部署
[0052] Existing image recognition methods typically rely on single-scale features or fixed cross-layer fusion methods for target identification. While these methods can achieve certain results in general scenarios, they often struggle to simultaneously capture global contextual information and local fine structural information in complex environments. This is particularly true for small targets, blurred targets, occluded targets, and targets with fine-grained differences, where insufficient feature representation, blurred boundaries, and category confusion are common problems. This invention introduces a multi-scale feature modeling mechanism to uniformly extract and represent features from the input image at different resolutions and receptive fields. This enables the system to acquire global scene semantic information such as roads, buildings, and background layouts, while preserving local detail information such as traffic sign edges, defect textures, and the outlines of remotely sensed small targets. This mechanism allows the system to collaboratively model "scene-level information/region-level information/target-level details," achieving a crucial shift from "single-scale recognition" to "multi-scale joint perception," significantly improving target discriminability and recognition robustness in complex scenes.
Smart Images

Figure CN122597962A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of artificial intelligence technology and relates to a method, system, device and storage medium for complex scene image recognition, especially a method, system and device and storage medium for complex scene image recognition based on multi-scale adaptive recursive computation. Background Technology
[0002] With the continuous development of artificial intelligence, deep learning, and computer vision technologies, image recognition technology is increasingly being applied in fields such as autonomous driving, intelligent security, industrial visual inspection, remote sensing image analysis, robot autonomous perception, and edge intelligent terminals. Image recognition tasks are also gradually expanding from standardized classification problems in laboratory environments to more challenging scenarios such as target recognition, state discrimination, anomaly detection, and fine-grained semantic understanding in real-world, complex scenes. In these scenarios, systems often need to not only identify "what's in" the image, but also stably, quickly, and accurately identify and judge key targets under conditions such as complex backgrounds, scale variations, partial occlusion, image blurring, dense targets, and limited computing power.
[0003] Especially in image recognition tasks facing real-world, complex environments, such as long-range traffic sign recognition in autonomous driving, long-range person and vehicle recognition in complex surveillance scenarios, detection of minute defects on industrial surfaces, and small target recognition and classification in remote sensing images, the target to be recognized in the image typically occupies only a local area and is often accompanied by problems such as occlusion, low resolution, weak texture, blurred boundaries, and strong background interference. Meanwhile, most areas in the image may only be roads, sky, building surfaces, equipment surfaces, or ground backgrounds, contributing little directly to the final recognition task. If the traditional method of performing uniform depth, scale, and budget calculations on all areas of the entire image is still adopted, it easily leads to insufficient analysis of key and difficult areas, while simple background areas consume a large amount of redundant computational resources, ultimately resulting in a dilemma between recognition accuracy and computational efficiency.
[0004] Current mainstream image recognition paradigms typically include image preprocessing, feature extraction, semantic encoding, target classification, or recognition output. In traditional implementations, models rely heavily on fixed network depth and inference paths to complete the forward computation of the entire image, or improve recognition capabilities in complex scenes by stacking deeper networks, wider channels, and larger model parameters. With the development of convolutional neural networks, visual Transformers, and multi-scale feature fusion technologies, the industry has begun to explore enhancing visual representation capabilities in complex scenes through feature pyramids, cross-layer connections, attention mechanisms, and multi-branch structures to improve the recognition of small and blurred targets. However, in real-world complex image recognition scenarios, simply relying on deeper networks or stronger feature representations cannot fundamentally solve the problems of "different recognition difficulties in different regions, different importance of information at different scales, and the need for dynamic allocation of computational resources." Therefore, how to balance multi-scale representation capabilities, regional difficulty perception capabilities, progressive refinement analysis capabilities, and computational efficiency control capabilities in the image recognition process has become a crucial research direction and a key challenge for industrial application in the field of complex scene image recognition.
[0005] Specifically, in the process of image recognition in complex real-world scenarios, the system often needs to simultaneously meet two requirements: First, the model should possess sufficient multi-scale representation capabilities and fine-grained discrimination capabilities to maintain high recognition accuracy among small targets, occluded targets, blurred targets, and targets with complex backgrounds; second, the model should have good computational resource control capabilities and deployment adaptability, enabling the recognition process to adapt to resource-constrained environments such as vehicle-mounted devices, edge terminals, industrial terminals, and real-time sensing systems. Although existing technologies have made some progress in deep feature modeling, multi-scale fusion, attention mechanisms, and visual reasoning, there are still significant shortcomings in the coordination between "multi-scale difference modeling," "regional difficulty perception," "adaptive recursive computation," "multi-scale and recursive collaboration," and "closed-loop mechanisms for unified optimization of accuracy and efficiency." This results in image recognition methods in complex scenarios often remaining at the level of "overall feature enhancement" or "unified computation enhancement," making it difficult to meet the comprehensive requirements of high accuracy, high efficiency, and high deployment feasibility in real-world application environments.
[0006] Specifically, the existing solutions most relevant to this invention mainly fall into the following categories: 1. A complex scene image recognition scheme based on a fixed-depth convolutional neural network.
[0007] These approaches typically construct multi-layer convolutional networks around the input image, extracting image features layer by layer through convolution, pooling, normalization, and non-linear activation operations. At the network's end, a classification or recognition head predicts the target category. Some approaches further enhance feature representation in complex scenes by increasing the number of network layers, adding residual connections, introducing dilated convolutions, or expanding the receptive field. The advantages of these methods lie in their mature network structure, stable training methods, and low engineering implementation costs, making them suitable for large-scale image classification, object detection, and general scene visual recognition tasks.
[0008] However, this type of approach has the following shortcomings: First, the model usually adopts a fixed depth and a uniform forward path, performing the same intensity of computation on all regions of the entire image, lacking a dynamic mechanism for focusing on difficult regions and reducing processing on simple regions; Second, although deep convolutional networks can enhance the expression of complex features to some extent, their ability to recognize distant small targets, fine-grained differences, and severely occluded targets is still limited; Third, when the model is continuously deepened or widened to improve the accuracy of complex scenes, the number of parameters and computational load increases rapidly, which is not conducive to deployment in vehicle, edge, and real-time scenarios.
[0009] 2. Multi-scale image recognition schemes based on feature pyramids or cross-layer fusion.
[0010] To enhance the representation of targets at different scales, some existing solutions employ multi-scale feature extraction structures, such as feature pyramid networks, cross-layer skip connections, multi-branch scale fusion modules, or multi-level attention fusion modules. These combine shallow detail features with deep semantic features to improve the model's ability to perceive small and complex targets. These methods perform well in target detection, fine-grained classification, and complex scene recognition tasks. Their advantage lies in their ability to simultaneously utilize high-resolution local details and low-resolution global semantic information, thus addressing the problem of insufficient single-scale feature representation.
[0011] However, this type of approach still has significant shortcomings: First, although existing multi-scale methods achieve feature fusion, most of them adopt fixed fusion paths and fixed scale combinations, lacking the ability to dynamically adjust the scale attention intensity based on the input sample content and regional difficulty; Second, multi-scale fusion emphasizes "using multiple scales simultaneously," but lacks explicit modeling of "which scale is more important in the current region"; Third, when multi-scale features are processed uniformly, complex regions and simple regions often still share the same computational intensity, resulting in insufficiently refined computational allocation and difficulty in achieving a better balance between efficiency and accuracy.
[0012] 3. Image recognition schemes based on visual Transformer or global attention mechanisms.
[0013] With the development of visual Transformers, some existing solutions have begun to adopt image recognition models based on token representation and global self-attention mechanisms. By dividing images into patch sequences and performing global modeling, these methods improve long-range dependency modeling capabilities and context awareness in complex scenes. These approaches show strong potential in large-scale datasets and complex vision tasks. Their advantages lie in their ability to uniformly model the relationships between different regions in an image, more naturally express global semantic information, and provide a flexible foundation for subsequent multi-scale expansion and attention reweighting.
[0014] However, this type of approach still has the following shortcomings: First, although global attention helps to enhance contextual modeling, it usually adopts a uniform attention update and uniform computation depth for all tokens, lacking differentiated computation strategies for key and simple regions; Second, the visual Transformer's recognition performance for small and weakly textured targets often still relies on external multi-scale structural support, otherwise it is prone to insufficient capture of local details; Third, due to the high computational cost of attention, when the model is deployed on resource-constrained devices, the globally uniform computation method can easily lead to large latency and resource consumption.
[0015] 4. Image recognition schemes based on early termination mechanisms, dynamic reasoning, or adaptive computation.
[0016] To reduce computational overhead, some existing technologies introduce early termination mechanisms, dynamic layer selection, token pruning, region filtering, or conditional computation modules. These mechanisms enable the model to dynamically decide whether to continue computation based on the difficulty of the input sample or the confidence level of intermediate features, thereby optimizing inference efficiency to some extent. Such solutions have certain advantages in edge deployment and real-time recognition scenarios. Their core idea is to reduce computation for simple samples and increase computation for difficult samples.
[0017] However, such approaches still have significant limitations: First, most methods focus on dynamic exit at the sample level or network layer level, i.e., deciding whether the entire image continues to propagate forward, without explicitly characterizing the differences in recognition difficulty between different regions within the image; second, although some approaches introduce token pruning or region filtering, their main purpose is to reduce computational load rather than enhance the ability to discriminate complex regions through recursive refinement mechanisms; third, existing dynamic inference methods typically fail to integrate multi-scale feature modeling, region difficulty assessment, and recursive analysis mechanisms, making it difficult to simultaneously achieve the dual goals of "key region refinement enhancement" and "overall computational savings."
[0018] 5. Visual reasoning schemes based on loop, iteration, or recursive updates.
[0019] To enhance the reasoning capabilities of models, some existing research and industrial solutions attempt to introduce mechanisms such as recurrent neural networks, iterative optimization, recursive state updates, or repeated computation with shared parameters. These mechanisms enable the model to gradually refine intermediate representations and recognition results through multiple rounds of updates. Such solutions have potential applications in reasoning tasks, visual question answering, complex scene parsing, and fine structure recognition. Their advantage lies in achieving a progressively refined recognition process from coarse to fine, rather than relying solely on a single forward propagation.
[0020] However, this type of method still has key shortcomings: First, existing recursive or iterative mechanisms mostly focus on updating the overall hidden state, while lacking explicit computation allocation strategies that directly correspond to the difficulty of local image regions; Second, the recursive process often operates on a unified feature representation, lacking deep linkage with multi-scale features, making it difficult to fully leverage the synergistic effect of coarse-scale global information and fine-scale local details; Third, when the number of recursions is fixed, the model may still have invalid repeated computations for simple samples or simple regions, while it may have insufficient refinement for extremely difficult regions.
[0021] In summary, while existing complex scene image recognition schemes similar to this invention have made significant progress in deep feature modeling, multi-scale fusion, global attention, adaptive computation, and visual recursive reasoning, they still face the following technical bottlenecks that urgently need to be overcome in order to meet the needs of real-world complex application scenarios: First, they lack fine-grained modeling and dynamic coordination mechanisms for target scale differences in complex scenes, making it difficult to achieve a stable balance between global semantics and local details; second, they lack explicit detection and quantification methods for differences in recognition difficulty within image regions, making it impossible to accurately identify which regions require focused analysis; third, they lack adaptive recursive computation mechanisms driven by region difficulty, making it difficult to implement a dynamic reasoning strategy of "more computation for difficult regions and less computation for simple regions"; fourth, they lack a deep bidirectional coordination mechanism between multi-scale features and the recursive update process, making it difficult to achieve progressive representation enhancement from coarse to fine and from global to local; fifth, they lack a closed-loop recognition mechanism that balances recognition accuracy, computational efficiency, and engineering deployment feasibility, making it difficult to stably output high-quality recognition results suitable for complex environments and resource-constrained devices.
[0022] Against this backdrop, there is an urgent need for a novel technical solution that can explicitly model target scale differences, dynamically assess the difficulty of region recognition, adaptively allocate recursive computing resources according to the difficulty, and gradually refine the representation of key regions through a collaborative mechanism of multi-scale features and recursive states. This would enable the system to improve the accuracy of complex target recognition while maintaining high computational efficiency and good practical deployment capabilities, thereby meeting the needs of various real-world application scenarios such as intelligent driving, security monitoring, industrial quality inspection, remote sensing analysis, and edge vision. Summary of the Invention
[0023] To address the problems existing in current technologies, this invention proposes a method, system, device, and storage medium for complex scene image recognition. It achieves a shift from the traditional fixed-depth, uniform-budget, and average-processing approach to a dynamic recognition paradigm that balances complex target recognition capabilities, computational resource utilization efficiency, and practical deployment feasibility. When performing image recognition on targets of different scenes, scales, and difficulty levels, it reduces invalid background computation, enhances the ability to analyze key target details, and suppresses the impact of occlusion, blurring, and interference backgrounds on recognition results. Furthermore, it improves the stability and reliability of the recognition process through a joint optimization mechanism of multi-scale and recursive computation. Simultaneously, by introducing regional difficulty perception and adaptive recursive refinement mechanisms, it significantly improves the recognition accuracy, resource utilization efficiency, and engineering application value of complex scene image recognition in scenarios such as intelligent driving, security monitoring, industrial visual inspection, remote sensing analysis, and edge intelligent perception. This provides key technical support for building a new generation of complex scene visual recognition systems that combine high-precision perception capabilities with high-efficiency deployment capabilities.
[0024] To achieve the above objectives, the present invention provides the following technical solution: A method for image recognition in complex scenes, characterized by the following steps: S1: Perform multi-scale feature extraction on the input image to obtain a multi-scale feature map, and expand the multi-scale feature map to obtain a multi-scale token set; S2: Based on the multi-scale token set, obtain the initial global classification state and the initial recursive hidden state set; S3: Based on the multi-scale token set, the initial global classification state and the initial recursive hidden state set, calculate the initial difficulty score of each token at each scale in the multi-scale token set, and combine the classification uncertainty term and the cross-scale difference term to construct the comprehensive difficulty score of each token at each scale. S4: Based on the comprehensive difficulty score, generate adaptive recursive control parameters for each token at each scale; S5: Based on the adaptive recursive control parameters, perform multi-scale adaptive recursive calculation to form a recursive multi-scale token set, a recursive global classification state, and a recursive hidden state set. S6: Perform multi-scale recursive fusion on each token at each scale in the recursive multi-scale token set to form the recursive fusion feature; S7: Based on the recursive fusion features, the recursive global classification state, and the recursive hidden state set, the recursive global classification state is enhanced to obtain the enhanced global classification state. S8: Based on the enhanced global classification state after the recursion ends, the recognition result is obtained.
[0025] Preferably, step S2 specifically includes: S21: Perform global pooling on the multi-scale token set to obtain a global semantic vector; S22: Perform a linear transformation based on the global semantic vector to obtain the initial global classification state; S23: Perform a linear transformation based on the global semantic vector to obtain an initial set of hidden states; S24: Add position encoding to each initial hidden state in the initial hidden state set to obtain an enhanced hidden state, and use the enhanced hidden state as the final initial recursive hidden state to obtain the final initial recursive hidden state set.
[0026] Preferably, step S3 specifically includes: S31: For each token at each scale in the multi-scale token set, calculate its initial difficulty score based on its feature vector, initial global classification state, and initial set of recursive hidden states:
[0027] in, Indicates the first The first scale The initial difficulty score for each token; Indicates the first The first scale The feature vector of each token; Indicates the initial global classification state; This represents the aggregate representation of the initial set of recursive hidden states; This indicates vector concatenation; Represents the learnable weight matrix; Represents a learnable bias vector; For the Sigmoid function; S32: Determine the uncertainty term:
[0028] in, Indicates the first The first scale The uncertainty of each token; Indicates the total number of categories; Indicates the first The first scale The token is paired with the first... Predicted probability of class category; S33: Determine cross-scale differences:
[0029] in, Indicates the first The first scale Cross-scale differences of each token; Indicates the first The first scale The feature vector of each token In other words, Indicates in relation to the first The first at different scales At the first scale and the first The first scale The corresponding token Feature vectors of each token; Represents a cross-scale mapping function; S34: Construct a comprehensive difficulty score:
[0030] in, Indicates the first The first scale The overall difficulty score of each token; It is a weighting coefficient and satisfies .
[0031] Preferably, step S4 specifically includes: S41: Based on the comprehensive difficulty score, generate the number of recursive steps for each token at each scale:
[0032] in, Indicates the first The first scale The number of recursive steps for each token; Indicates the first The first scale The overall difficulty score of each token; and These represent the minimum and maximum number of recursive steps, respectively. S42: Based on the recursive step count, generate recursive gating variables for each token at each scale:
[0033] in, Indicates the first In the recursive round The first scale Whether a token participates in the recursive gating variable update; S43: Based on the feature vectors of each token at each scale, generate token-level scale fusion weights for each token at each scale:
[0034] in, Indicates the first The first scale Token-level scalar fusion weight for each token; , Indicates the first The first scale A query vector for each token. Represents a learnable linear transformation matrix , Indicates the first The first scale A key vector of tokens, Represents a learnable linear transformation matrix; Indicates the first The first scale Feature vectors of each token; Indicates the total number of scales across multiple scales; Indicates the first The first scale Feature vectors of each token; Indicates the scale index during aggregation; S44: Priority coefficient for structural regions:
[0035]
[0036] in, Indicates the first The first scale The regional priority coefficient of each token; Indicates the first The first scale Each token and the initial global classification state The correlation score; Represents a learnable linear transformation matrix; Represent the weight coefficients and satisfy .
[0037] Preferably, step S5 specifically includes: S51: In each round of recursion, the recursive hidden state of the previous round is used to perform cross-scale context aggregation on the feature vectors of each scale to obtain the context representation of the current round of recursion:
[0038] in, Indicates the first Contextual representation of round recursion; Indicates the total number of scales across multiple scales; Indicates the first The set of hidden recursive states after round recursion; Indicates the first After the recursion, the first round Eigenvectors at various scales; This represents the attention calculation function, which utilizes the first... The set of hidden recursive states after round recursion As a query vector, and using the first After the recursion, the first round eigenvectors at each scale As key vectors and value vectors, feature vectors at various scales are retrieved and aggregated. S52: Update the feature vectors of each token at each scale based on the recursive gating variable to obtain the feature vectors after each round of recursion:
[0039] in, Indicates the first After the recursion, the first round The first scale Feature vectors of each token; Indicates the first In the recursive round The first scale Whether a token participates in the recursive gating variable update; Indicates the first The first scale The regional priority coefficient of each token; Indicates the first The global classification state after round recursion; Indicates the first After the recursion, the first round The first scale Feature vectors of each token; The update function representing the feature vector of the token; S53: Update the recursive hidden state set based on the recursive feature vector:
[0040] in, Indicates the first The set of hidden recursive states after round recursion; Indicates the first The set of feature vectors at each scale after round recursion; This represents a recursive hidden state update function; S54: Update the global classification state based on the updated set of recursive latent states:
[0041] in, Indicates the first The global classification state after round recursion; This represents the global classification state update function.
[0042] Preferably, step S6 specifically includes: S61: Generate scale-level fusion weights based on the token-level scale fusion weights of each token at each scale:
[0043] in, Indicates the first In the recursive round Fusion weights at each scale; Indicates the first In the recursive round The first scale Whether a token participates in the recursive gating variable update; Indicates the first The first scale The regional priority coefficient of each token; Indicates the first The first scale Token-level scalar fusion weight for each token; Indicates the first The total number of tokens under each scale; Indicates the first In the recursive round The first scale Whether a token participates in the recursive gating variable update; Indicates the first The first scale The regional priority coefficient of each token; Indicates the first The first scale Token-level scalar fusion weight for each token; Indicates the first The total number of tokens under each scale; Indicates the total number of scales across multiple scales; Indicates the scale index during aggregation; Indicates the token index during aggregation; S62: Based on the scale-level fusion weights, the feature vectors of each scale after each round of recursion are fused to obtain the fused features after each round of recursion:
[0044] in, Indicates the first Fusion characteristics after round recursion; Indicates the first In the recursive round Fusion weights at each scale; Indicates a scale alignment operation; Indicates the first After the recursion, the first round Eigenvectors of various scales.
[0045] Preferably, step S8 specifically includes: S81: Based on the enhanced global classification state after the recursion ends, calculate the output vector:
[0046] in, Indicates the output vector; This represents the enhanced global classification state after the recursion ends; and These represent the learnable weight matrix and the learnable bias vector, respectively. S82: Based on the output vector, obtain the classification probability distribution. :
[0047] S83: Based on the classification probability distribution, obtain the identification category. :
[0048] in, Indicates the first Predicted probability of class category.
[0049] Furthermore, the present invention also provides a complex scene image recognition system, characterized in that it includes: A multi-scale feature extraction module is used to extract multi-scale features from the input image to obtain a multi-scale feature map, and to expand the multi-scale feature map to obtain a multi-scale token set. An initialization module is used to obtain an initial global classification state and an initial recursive hidden state set based on the multi-scale token set; The comprehensive difficulty score calculation module is used to calculate the initial difficulty score of each token at each scale in the multi-scale token set based on the multi-scale token set, the initial global classification state and the initial recursive hidden state set, and to construct the comprehensive difficulty score of each token at each scale by combining the classification uncertainty term and the cross-scale difference term. An adaptive recursive control parameter generation module is used to generate adaptive recursive control parameters for each token at each scale based on the comprehensive difficulty score. The multi-scale adaptive recursive computation module is used to perform multi-scale adaptive recursive computation based on the adaptive recursive control parameters to form a recursive multi-scale token set, a recursive global classification state, and a recursive recursive hidden state set. A multi-scale recursive fusion module is used to perform multi-scale recursive fusion on each token at each scale in the recursed multi-scale token set to form a recursed fusion feature. A global classification state enhancement module is used to enhance the recursive global classification state based on the recursive fusion features, the recursive global classification state, and the recursive latent state set to obtain an enhanced global classification state. The classification and recognition module is used to obtain the recognition result based on the enhanced global classification state after the recursion ends.
[0050] Furthermore, the present invention also provides a complex scene image recognition device, characterized in that it includes: One or more processors; Memory, used to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the complex scene image recognition method as described above. Finally, the present invention also provides a computer-readable storage medium having a computer program stored thereon, characterized in that the program, when executed by a processor, implements the steps of the complex scene image recognition method as described above.
[0051] Compared with existing complex scene image recognition schemes that mainly rely on fixed-depth convolutional networks, unified-budget visual Transformers, static multi-scale fusion based on feature pyramids, sample-level dynamic exit mechanisms, or recursive updates but lack regional difficulty awareness and multi-scale collaborative mechanisms, the complex scene image recognition method, system, device, and storage medium proposed in this invention based on multi-scale adaptive recursive computation have the following significant advantages in terms of complex target recognition capability, multi-scale information utilization capability, regional computing resource allocation capability, recursive refinement inference capability, and system real-time performance and engineering deployment adaptability: (1) Multi-scale feature modeling mechanism to achieve collaborative expression of global semantics and local details in complex scenarios.
[0052] Existing image recognition methods typically rely on single-scale features or fixed cross-layer fusion methods for target identification. While these methods can achieve certain results in general scenarios, they often struggle to simultaneously capture global contextual information and local fine structural information in complex environments. This is particularly true for small targets, blurred targets, occluded targets, and targets with fine-grained differences, where insufficient feature representation, blurred boundaries, and category confusion are common problems. This invention introduces a multi-scale feature modeling mechanism to uniformly extract and represent features from the input image at different resolutions and receptive fields. This enables the system to acquire global scene semantic information such as roads, buildings, and background layouts, while preserving local detail information such as traffic sign edges, defect textures, and the outlines of remotely sensed small targets. This mechanism allows the system to collaboratively model "scene-level information / region-level information / target-level details," achieving a crucial shift from "single-scale recognition" to "multi-scale joint perception," significantly improving target discriminability and recognition robustness in complex scenes.
[0053] (2) Regional difficulty perception mechanism to achieve precise identification and explicit modeling of key and difficult areas.
[0054] Existing image recognition solutions for complex scenes typically assume that the importance and recognition difficulty of all regions in the entire image are approximately the same, lacking an explicit difficulty quantification mechanism for complex regions, occluded regions, small target regions, and weakly textured regions. This easily leads to simple backgrounds and difficult targets being treated equally during the calculation process, resulting in insufficient refinement of key targets. This invention introduces a region or token-level difficulty perception mechanism, combining region features, uncertainty information, and cross-scale difference information to detect, quantify, and model the recognition difficulty of different regions in the image, thereby effectively distinguishing between simple background regions and high-value, high-difficulty regions. This mechanism enables the system to differentiate between "simple regions / complex regions / high-risk, easily confused regions," achieving a key improvement from "uniform processing of the entire image" to "refined analysis based on region difficulty," significantly enhancing the system's discrimination ability in scenes with complex backgrounds, small targets, occluded targets, and blurred targets.
[0055] (3) Based on the difficulty-driven adaptive recursive calculation mechanism, the ability to identify complex regions is improved and invalid calculations are suppressed.
[0056] Most existing image recognition methods employ a fixed number of layers and a fixed inference process, performing the same number of feature transformations and semantic updates on all input samples and all image regions. While this approach is simple to implement, it leads to significant computational redundancy in simple regions, while difficult regions often fail to receive sufficient detailed analysis. This invention further introduces a difficulty-driven adaptive recursive computation mechanism based on the region difficulty assessment results. This mechanism dynamically allocates recursion steps, gating variables, and scale-related weights to different regions, enabling the model to perform more rounds of context aggregation and feature refinement for difficult regions, while stopping updates or reducing processing for simple background regions earlier. This mechanism shifts the optimization approach from "averaging the computational budget across the entire image" to "concentrating the computational budget on key and difficult regions," significantly improving the model's accuracy in recognizing complex targets under limited computing power, while reducing ineffective computational consumption on irrelevant backgrounds and low-difficulty regions.
[0057] (4) Multi-scale and recursive refinement synergistic mechanism to improve the stability and refinement of target representation by gradual convergence.
[0058] Existing multi-scale methods and recursive inference methods are often designed separately and relatively independently. The multi-scale module is responsible for providing features at different resolutions, while the recursive module is responsible for performing multiple rounds of updates. However, there is a lack of deep bidirectional collaboration between the two, making it difficult to form a continuous interaction between scale information and recursive states. This invention constructs a collaborative refinement mechanism based on multi-scale features and recursive hidden states. In each round of recursion, the model can selectively extract the most relevant contextual information from different scale features based on the state of the previous round, and use the updated multi-scale representation to reverse-correct the recursive hidden state and the global classification state. As a result, the system achieves a key improvement from "static fusion of multi-scale features" to "dynamic collaboration between multi-scale features and recursive inference," enabling high-difficulty targets to gradually converge from coarse-grained candidate regions to fine-grained discriminative targets. This significantly improves the stability, continuity, and interpretability of the recognition process for small targets, occluded targets, and blurred targets in complex scenes.
[0059] (5) Dynamic stopping and closed-loop optimization mechanism to achieve a unified improvement in recognition accuracy and reasoning efficiency.
[0060] Existing image recognition solutions for complex scenes often focus on optimizing a single objective, such as improving recognition accuracy, compressing model computation, or enhancing local feature representation. However, they lack a closed-loop optimization mechanism that can simultaneously address multi-scale feature representation, region difficulty analysis, recursive refinement depth, and overall inference cost within the same framework. This invention integrates multi-scale representation, region difficulty assessment, adaptive recursive control, progressive refinement inference, and dynamic stopping decisions into a unified recognition closed loop. This allows the system to dynamically control and provide feedback corrections on recognition quality and computational resource usage at each stage of image recognition. On the recognition side, the system improves the ability to discern details of key targets; on the computation side, it reduces redundant computation in low-value regions; and on the deployment side, the stopping decision mechanism controls overall latency and resource consumption. This closed-loop mechanism transforms the image recognition process from a single static forward propagation into a dynamic optimization process for complex real-world scenarios, significantly improving the stability and engineering practicality of the system output.
[0061] (6) Low-intrusion, integrable solution that is compatible with existing visual recognition systems and has good scalability.
[0062] Compared to solutions that require a complete reconstruction of the existing visual perception chain or rely on massive model stacking, the core mechanism of this invention primarily functions in multi-scale feature processing, region difficulty assessment, recursive control, and stopping criteria. It can be integrated as a modular capability into existing image classification systems, target recognition systems, vehicle-mounted visual perception systems, industrial inspection platforms, security monitoring platforms, or edge vision terminals. It is compatible with convolutional networks, visual Transformers, hybrid visual backbone networks, and existing visual recognition frameworks with multi-scale feature output. The system only needs to add steps such as region difficulty assessment, adaptive recursive computation, and dynamic stopping to the original feature extraction and recognition process to significantly improve the ability to recognize complex targets and the efficiency of computational utilization. Furthermore, this invention supports dynamic adjustment of parameters such as the upper limit of recursive steps, difficulty weight coefficient, scale fusion weight, gating threshold, and stopping threshold. It can be flexibly configured according to different device computing power levels, real-time requirements of different application scenarios, different target scale distributions, and different complex background conditions, possessing strong versatility, scalability, and engineering deployment adaptability.
[0063] In summary, the core advantages of this invention compared to existing technologies lie in its ability to finely distinguish and explicitly model targets of different scales and regions of varying difficulty in complex scene images. It dynamically allocates recursive computational resources based on the difficulty of region recognition, correcting the efficiency and accuracy issues arising from the traditional uniform budget processing method's "one-size-fits-all" approach to simple and complex regions. Furthermore, it introduces a collaborative update mechanism of multi-scale features and recursive states during the recognition process, and achieves unified control over recognition quality and computational overhead through dynamic stopping and closed-loop optimization. When performing complex scene image recognition for different scenarios, targets of different scales, and different device environments, this method effectively avoids common problems in traditional solutions such as insufficient detail representation, inadequate refinement of key targets, excessive background redundancy calculations, and high deployment costs. This significantly improves the recognition accuracy, computational efficiency, stability, and engineering application value of complex scene image recognition systems. Attached Figure Description
[0064] Figure 1 This is a flowchart of the complex scene image recognition method of the present invention.
[0065] Figure 2 This is a schematic diagram of the complex scene image recognition system of the present invention.
[0066] Figure 3 This is a structural block diagram of the complex scene image recognition device of the present invention. Detailed Implementation
[0067] Before detailing any embodiment of the invention, it should be understood that the invention, in its application, is not limited to the details of the construction and arrangement of the components set forth in the following description or illustrated in the following figures. The invention can have other embodiments and can be practiced or carried out in various ways. Furthermore, it should be understood that the wording and terminology used herein are for descriptive purposes and should not be considered limiting. The use of “comprising” or “having” and variations thereof in this invention is intended to cover the items set forth below and their equivalents, as well as any additional items. Unless otherwise specified or limited, the terms “installation,” “connection,” “support,” and “linkage,” and variations thereof are used broadly and cover both direct and indirect installation, connection, support, and linking. Moreover, “connection” and “linkage” are not limited to physical or mechanical connections or links. Furthermore, firstly, in the disclosure of this invention, the terms "longitudinal," "lateral," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are only for the convenience of describing this invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, the above terms should not be construed as limiting this invention. Secondly, the term "a" should be understood as "at least one" or "one or more," that is, in one embodiment, the number of an element can be one, while in another embodiment, the number of the element can be multiple. The term "a" should not be construed as a limitation on the quantity.
[0068] To address the problems existing in current technologies, this invention proposes a method, system, device, and storage medium for complex scene image recognition based on multi-scale adaptive recursive computation. By constructing a closed-loop recognition mechanism encompassing multi-scale feature extraction, global state initialization, region difficulty assessment, recursive control parameter generation, multi-scale adaptive recursive refinement, dynamic stopping determination, and recognition result output, the model achieves a combined consideration of differences in target scale, region difficulty, computational resource allocation, and the need for progressive refinement in the process of complex scene image recognition. Its core ideas include the following five aspects: (1) Multi-scale feature modeling mechanism.
[0069] In the image recognition process, this invention addresses the characteristics of complex scenes where target scale changes significantly and both global semantics and local details are equally important. It constructs a multi-scale feature extraction mechanism to encode features of the input image at different resolutions and receptive fields, forming a unified multi-scale feature representation. Compared to traditional methods that rely solely on single-scale features or simple cross-layer stitching, this invention can simultaneously capture scene-level contextual information and target-level fine-grained structural information, providing a more comprehensive and stable visual representation foundation for subsequent complex region recognition and recursive refinement.
[0070] (2) Regional difficulty perception mechanism.
[0071] To address the significant differences in recognition difficulty across different regions in complex images, this invention introduces a region- or token-level difficulty assessment mechanism based on multi-scale features. This mechanism explicitly detects and quantifies the uncertainty, cross-scale differences, and discrimination difficulty of each region in the current recognition task. Through this mechanism, the system can distinguish between simple background regions and high-difficulty key regions, identifying which regions require focused analysis and which regions can have their computation reduced, thus providing a basis for subsequent recursive control and resource allocation.
[0072] (3) Difficulty-driven adaptive recursive calculation mechanism.
[0073] To address the issue that traditional fixed-depth inference methods cannot balance precise recognition of complex regions with overall computational efficiency, this invention introduces an adaptive recursive computation mechanism based on the difficulty assessment results. This mechanism dynamically allocates recursive steps, gating variables, and scale-related weights according to the difficulty score of each region or token. This allows the model to perform more rounds of feature updates and detail refinement for difficult regions during the recognition process, while stopping or reducing processing for simpler regions earlier. Therefore, the model no longer distributes computational resources evenly across the entire image, but instead concentrates computational resources on key regions, thereby improving the balance between recognition capability and computational efficiency in complex scenes.
[0074] (4) Multi-scale and recursive refinement synergistic mechanism.
[0075] This invention constructs a progressive target refinement mechanism based on multi-scale features and recursive states. This allows the recursive process to selectively refocus on the most relevant image regions and discriminative information from features at each scale based on the previous recognition state, and to perform progressive representation updates from coarse to fine granular for challenging targets. Furthermore, this invention performs cross-scale context aggregation of multi-scale features through recursive hidden states, and simultaneously uses the updated multi-scale representation to reverse-correct the recursive hidden states and the global classification state. This forms a bidirectional synergy between multi-scale information and recursive inference, avoiding the disconnect between scale information and the recursive process in traditional methods, and improving the refinement and stability of target recognition in complex scenes.
[0076] (5) A closed-loop mechanism for unified optimization of recognition accuracy and computational efficiency.
[0077] This invention integrates multi-scale representation, regional difficulty assessment, adaptive recursive control, progressive refinement reasoning, and stopping decision into a unified closed-loop process, achieving optimized control over the entire process of image recognition results and computational resource usage. During recognition, the system not only enhances target representation capabilities through multi-scale information but also improves the analysis depth of key regions through a difficulty-driven recursive allocation mechanism and controls redundant computation through a dynamic stopping mechanism. This achieves the comprehensive optimization goals of "more accurate recognition of complex targets," "more efficient allocation of computational resources," and "better adaptation to actual deployment scenarios," enabling the system to stably output high-quality recognition results and meet the deployment requirements of edge devices, real-time systems, and complex environments.
[0078] Figure 1 A flowchart of the complex scene image recognition method of the present invention is shown. Figure 1 As shown, the complex scene image recognition method of the present invention includes the following steps: S1: Multi-scale feature extraction.
[0079] In this invention, the first step is to acquire the input image to be recognized, denoted as: .in, Indicates the image height; Indicates the image width; Indicates the number of channels.
[0080] Then, for the input image Preprocessing is performed to obtain the preprocessed input image. : .in, This represents a preprocessing function, which includes one or more of the following: image scaling, pixel normalization, noise reduction, brightness correction, and color normalization.
[0081] In one implementation, the pixel normalization process can be expressed as:
[0082] in, Indicates the first Pixel spatial coordinates within each channel The normalized pixel value at that location; Indicates the first Pixel spatial coordinates within each channel The original pixel value at that location; and They represent the first The pixel mean and pixel standard deviation of each channel.
[0083] Preprocessing can reduce the impact of lighting changes, noise interference, and resolution differences on the subsequent recognition process, enabling subsequent feature extraction and recursive calculations to be based on a unified and stable data foundation.
[0084] For example, in one specific instance, an autonomous vehicle was traveling along a city road at dusk, and its forward-facing camera captured a frame of the road image. Due to backlighting and vehicle movement, the image was slightly blurred, and the edges of the traffic sign on the right front were not clear. Therefore, the image was first processed by resizing, brightness normalization, and noise suppression to prepare for subsequent recognition of the small traffic sign.
[0085] Next, multi-scale feature extraction can be performed on the preprocessed input image. Specifically, the preprocessed input image... Inputting the multi-scale feature extraction network yields... Feature maps at various scales. .in, Indicates the first Feature extraction mappings at various scales are typically the output of a layer in a convolutional neural network (CNN), such as different stages of ResNet. Indicates the first Feature maps at each scale, with shape as follows , It is the first The height of the feature map at each scale It is the first The width of the feature map at each scale, It is the first The number of channels in the feature map at each scale; Indicates the scale index, from 1 to ,correspond Different feature scales.
[0086] Feature maps at different scales can be mapped to a unified dimension. : .in, Indicates the first A dimension mapping function of several scales, typically a 1×1 convolution or linear layer; Represents the first dimension after dimensional unification The feature map is at each scale and has the following shape. .
[0087] Therefore, feature maps of different scales and different numbers of channels can be uniformly mapped to the same dimension. This prepares for subsequent cross-scale interactions.
[0088] Finally, the feature maps of each scale after dimensionality unification are unfolded into a token sequence: .in, Indicates the first A sequence of tokens of various scales; Indicates the first The number of tokens at each scale ; This indicates a flattening operation, which transforms the spatial dimensions. Merge into a single sequence dimension.
[0089] Therefore, the multi-scale token set is: in, This represents a multi-scale token set that contains all A sequence of tokens of various scales.
[0090] Therefore, this invention, through multi-scale feature extraction, can extract feature representations for input images at different resolutions, receptive fields, or spatial granularities. Its purpose is to simultaneously acquire global semantic information at the low-resolution scale and local detail information at the high-resolution scale, thereby enhancing the comprehensive representation capability of large targets, small targets, occluded targets, and blurred targets in complex scenes.
[0091] For example, in the above example, in the current road image, low-resolution features mainly describe road direction, vehicle and building distribution, medium-resolution features begin to highlight the circular candidate target area in the right front, while high-resolution features preserve the edge contours and internal digital structure of traffic signs. Through multi-scale feature extraction, the entire road scene and key small targets in the distance can be seen simultaneously.
[0092] S2: Initialization.
[0093] Based on the multi-scale token set, an initial global classification state and an initial recursive hidden state set are obtained, which specifically include: 1. For the multi-scale token set Perform global pooling to obtain the global semantic vector. .
[0094] Specifically, in, Represents the global semantic vector; This represents the pooling function, typically global average pooling or global max pooling, which pools the entire multi-scale token set. Compress it into a vector.
[0095] 2. Based on the aforementioned global semantic vector Perform a linear transformation to obtain the initial global classification state. .
[0096] The global classification state refers to the intermediate state representation of the overall category semantics or target recognition conclusion of the input image at a certain recursive stage. This state is not the final output label itself, but rather an internal semantic vector reflecting the current overall judgment. It is continuously updated and corrected during the recursive process. Its purpose is to establish a connection between local refinement and overall decision-making, so that local region updates can be continuously fed back into the overall recognition judgment.
[0097] Specifically, .in, , which represents the initial global classification state; It represents a learnable weight matrix used to process the global semantic vector. Perform a linear transformation; , which represents the learnable bias vector.
[0098] 3. Perform a linear transformation based on the global semantic vector to obtain the initial set of hidden states.
[0099] Specifically, an initial set of hidden states is obtained by performing a linear transformation based on the global semantic vector: Each hidden state satisfies: in, Indicates the first An initial hidden state; Indicates the number of initial hidden states; Indicates the first The learnable weight matrix corresponding to each initial hidden state; Indicates the first The learnable bias vectors corresponding to the initial hidden states.
[0100] 4. Add position encoding to each initial hidden state in the initial hidden state set to obtain an enhanced hidden state, and use the enhanced hidden state as the initial recursive hidden state to obtain an initial recursive hidden state set.
[0101] In this context, recursive hidden states refer to the state representations used to store, transmit, and update intermediate visual reasoning information during the recursive recognition process. Recursive hidden states can aggregate contextual information, key region features, and intermediate judgment results obtained in the previous round of recognition, and continue to participate in feature querying, state updates, and result corrections in subsequent recursions. Their purpose is to support the system in performing continuous recognition and progressive reasoning from coarse to fine.
[0102] Specifically, position encoding can be added to each initial hidden state. To obtain the enhanced hidden state: .in, Indicates the first An enhanced hidden state; Indicates the first The position encoding of the initial hidden state can be directly set as a trainable parameter, defined as follows: , of which each These are all trainable positional encoding vectors, which are automatically learned through backpropagation during the training process.
[0103] Therefore, an initial state for recursive reasoning can be established. The initial global classification state represents the initial judgment of the overall semantics of the image, while the initial recursive hidden state stores intermediate memory information that is continuously updated during subsequent recursion.
[0104] For example, in the example above, an initial judgment is made based on the entire road image: the current scene is a normal urban road, and there may be traffic facilities to the right front. At this time, the initial global classification state cannot clearly determine whether the target is a speed limit sign or other circular target, but the initial recursive hidden state has already preserved the candidate region location and background context information, providing a basis for subsequent difficulty assessment and recursive control.
[0105] S3: Calculation of overall difficulty score.
[0106] In this invention, a regional difficulty assessment is performed to detect, quantify, and score the recognition difficulty of different regions, locations, or tokens in the input image for the current recognition task. The regional difficulty comprehensively reflects the region's uncertainty, confusion level, cross-scale differences, and local feature complexity. Its purpose is to identify which regions require focused analysis and which regions can have their computation reduced. To this end, a comprehensive difficulty score needs to be calculated. This score is a comprehensive rating result calculated for a specific region or token in the image based on information such as local features, classification uncertainty, cross-scale differences, and relevance to the current recognition state. This score characterizes the processing priority and recursive refinement requirements of that region during the recognition process. A higher comprehensive difficulty score indicates that the region requires more recursive computational resources.
[0107] Meanwhile, in this invention, the initial difficulty score of each token at each scale in the multi-scale token set can be calculated based on the multi-scale token set, the initial global classification state, and the initial recursive hidden state set. Furthermore, by combining the classification uncertainty term and the cross-scale difference term, a comprehensive difficulty score for each token at each scale can be constructed, specifically including: 1. For each token at each scale in the multi-scale token set, calculate its initial difficulty score based on its feature vector, initial global classification state, and initial set of recursive hidden states.
[0108] Specifically, for the first The first scale Each token, based on its feature vector Initial global classification state and the initial set of recursive hidden states Calculate its initial difficulty score.
[0109]
[0110] in, Indicates the first The first scale The initial difficulty score for each token; Indicates the first The first scale The feature vector of each token; Indicates the initial global classification state; Represents the initial set of recursive hidden states. Aggregate representation, for example, for the initial set of recursive hidden states. The aggregated vector after average pooling; This indicates vector concatenation; Represents the learnable weight matrix; Represents a learnable bias vector; This is the Sigmoid function, used to map the output to a value between 0 and 1. The larger the value, the higher the initial difficulty of the token.
[0111] S32: Determine the uncertainty term.
[0112] Specifically, for the first The first scale Each token has an uncertainty term calculated using cross-entropy.
[0113]
[0114] in, Indicates the first The first scale The uncertainty of each token; Indicates the total number of categories; Indicates the first The first scale The token is paired with the first... Predicted probability of class category.
[0115] S33: Determine the cross-scale difference term.
[0116] Specifically, for the first The first scale Each token has an uncertainty term calculated using the L2 norm.
[0117]
[0118] in, Indicates the first The first scale Cross-scale differences of each token; Indicates the first The first scale The feature vector of each token In other words, Indicates in relation to the first The first at different scales At the first scale and the first The first scale The corresponding token Feature vectors of each token; This represents a cross-scale mapping function, such as upsampling, downsampling, or linear projection, used to map features from other scales to the space of the current scale. This represents the L2 norm, used to calculate the Euclidean distance between two eigenvectors.
[0119] 4. Construct a comprehensive difficulty score.
[0120] Specifically, for the first The first scale Each token is used to construct its overall difficulty score.
[0121]
[0122] in, Indicates the first The first scale The overall difficulty score of each token; These are weighting coefficients, which respectively control the proportion of the initial difficulty score, uncertainty term, and cross-scale difference term in the total score and satisfy the following conditions: .
[0123] Therefore, based on the comprehensive difficulty score, it is possible to identify which regions in the image are semantically clear and easy to judge, and which regions are occluded, blurred, have small targets, or have background interference, thus providing a basis for subsequent adaptive allocation of recursive computing resources.
[0124] For example, in the above example, after assessing the difficulty of each region in the image, it was found that the sky, road surface, and building exterior walls had stable features and were of low difficulty; while the small circular target in the foreground on the right was identified as a high-difficulty region due to its high uncertainty and significant cross-scale feature differences caused by partial occlusion by tree branches, blurred edges, and proximity to a billboard. At this point, the system had identified the core regions that needed to be calculated in the subsequent stages.
[0125] S4: Adaptive recursive control parameter generation.
[0126] Based on the comprehensive difficulty score, adaptive recursive control parameters are generated for each token at each scale, specifically including: 1. Based on the comprehensive difficulty score, generate the number of recursive steps for each token at each scale.
[0127] The recursive step count refers to the number of times a recursive update is performed for a specific region, token, or scale during image recognition. In this invention, the recursive step count is not fixed but can be dynamically adjusted according to the difficulty of region recognition. The purpose is to gradually refine the representation of high-difficulty regions through multiple rounds of state updates and reduce redundant and repetitive calculations on low-difficulty regions.
[0128] Specifically,
[0129] in, Indicates the first The first scale The number of recursive steps for each token; Indicates the first The first scale The overall difficulty score of each token; and These represent the minimum and maximum number of recursive steps, respectively. This represents the floor function, ensuring that the number of steps is an integer.
[0130] Therefore, tokens with higher difficulty are allocated more recursive steps, while tokens with lower difficulty are allocated fewer recursive steps, achieving adaptive computation allocation with more iterations for difficult examples and fewer iterations for easy examples.
[0131] 2. Based on the number of recursive steps, generate recursive gating variables for each token at each scale.
[0132]
[0133] in, Indicates the first In the recursive round The first scale Whether a token participates in the recursive gating variable update; This indicates the current recursive iteration.
[0134] Right now, At that time, the token was in the [number]th [year]. Participate in updates during round recursion; when The token was in the The update stops during the recursive round, and the state from the previous round is retained. Therefore, the state can be determined based on the number of recursive steps of the token. This controls from which round it stops updating, avoiding meaningless duplicate calculations.
[0135] 3. Based on the feature vectors of each token at each scale, generate token-level scale fusion weights for each token at each scale.
[0136]
[0137]
[0138]
[0139] in, Indicates the first The first scale Token-level scalar fusion weight for each token; Indicates the first The first scale Query vectors for each token; Let represent the learnable linear transformation matrix, which is the learnable query projection matrix. Indicates the first The first scale A key vector of tokens; Let represent a learnable linear transformation matrix, which is a learnable key projection matrix; Indicates the first The first scale Feature vectors of each token; Indicates the total number of scales across multiple scales; Indicates the first The first scale Feature vectors of each token; This represents the scale index during aggregation.
[0140] 4. Construct the priority coefficient of the region.
[0141] In this invention, a regional priority coefficient for each token can be further constructed.
[0142]
[0143]
[0144] in, Indicates the first The first scale The region priority coefficient of each token is used to represent the processing priority of the token in subsequent recursive calculations. The larger the value, the more difficult, strongly related, and detailed the region of the token is. Indicates the first The first scale Each token and the initial global classification state The correlation score; Represents a learnable linear transformation matrix used to project the feature vector of the token into the same space as the initial global classification state; Represent the weight coefficients and satisfy .
[0145] Therefore, the final set of adaptive recursive control parameters is formed. for: . Therefore, the abstract concept of "difficulty level" can be transformed into a practically executable recursive control strategy, which clearly specifies how many steps to calculate in each region, at which scales to focus on calculation, and which regions to prioritize.
[0146] For example, in the above example, in the road image, the area of the traffic sign on the right front is assigned a larger number of recursion steps, such as 5 steps, because it is the most difficult; the sky and road surface are assigned only 1 or 2 steps. At the same time, since a high-resolution scale is more conducive to observing the internal digital contours of the traffic sign, this area is given greater weight at the high-resolution scale. In this way, the system has already decided to concentrate the main computational resources on the small target area on the right front before it actually begins recursion.
[0147] S5: Multi-scale adaptive recursive computation.
[0148] Adaptive recursive computation refers to a computational approach that dynamically determines whether to continue recursive updates, how many rounds of recursion to execute, and at which scales to focus on recursive refinement based on the overall difficulty score of different regions or scales in an image. Its purpose is to avoid distributing computational resources evenly across the entire image, enabling the system to perform more computation on difficult regions and less or stop computation early on simpler regions.
[0149] In this invention, based on the aforementioned adaptive recursive control parameters, multi-scale adaptive recursive computation is performed to form a recursively multi-scale token set, a recursively global classification state, and a recursively recursive hidden state set, specifically including: 1. In each round of recursion, the feature vectors of each scale are aggregated across scales using the set of recursive hidden states from the previous round to obtain the context representation of the current round of recursion.
[0150] Specifically, in the first In the round of recursion, the previous round (the first round) is used. The recursive hidden state set of the round performs cross-scale context aggregation on features at each scale to obtain the context representation of the current recursive stage:
[0151] in, Indicates the first Contextual representation of round recursion; Indicates the total number of scales across multiple scales; Indicates the first The set of hidden recursive states after round recursion; Indicates the first After the recursion, the first round eigenvectors at each scale , Indicates the first After the recursion, the first round The first scale The feature vector of each token Indicates the first The number of tokens under each scale; This represents the attention calculation function, which utilizes the first... The set of hidden recursive states after round recursion As a query vector, and using the first After the recursion, the first round eigenvectors at each scale As key and value vectors, feature vectors at various scales are retrieved and aggregated to extract the most relevant image context information for the current recognition task.
[0152] 2. Update the feature vector of each token at each scale based on the recursive gating variable to obtain the feature vector after each round of recursion.
[0153] Specifically, for the first The first scale The token is updated based on the recursive gating variable to obtain the first token. After the recursion, the first round The first scale The feature vector of each token.
[0154]
[0155] in, Indicates the first After the recursion, the first round The first scale Feature vectors of each token; Indicates the first In the recursive round The first scale Whether a token participates in the recursive gating variable update; Indicates the first The first scale The regional priority coefficient of each token; Indicates the first The global classification state after round recursion; Indicates the first After the recursion, the first round The first scale Feature vectors of each token; The update function representing the feature vector of the token is typically an attention / MLP module.
[0156] By combining the updated feature vectors of all tokens at this scale, we obtain the th... The first round of recursion Eigenvectors at each scale: in, Indicates the first The first round of recursion Eigenvectors at various scales; Indicates the first After the recursion, the first round The first scale Feature vectors of each token; Indicates the first The number of tokens under each scale.
[0157] 3. Update the recursive hidden state based on the feature vector after recursion.
[0158]
[0159] in, Indicates the first The set of hidden recursive states after round recursion; Indicates the first The set of feature vectors at each scale after round recursion. ; This represents a recursive hidden state update function, typically found in attention / MLP modules.
[0160] 4. Update the global classification state based on the updated set of recursive hidden states.
[0161]
[0162] in, Indicates the first The global classification state after round recursion; This represents the global classification state update function, typically a linear layer or attention module. It combines the global classification state from the previous round with the new set of recursive hidden states to generate the updated global classification state.
[0163] Therefore, a recursive approach can be used to refine the analysis of complex regions in an image round by round. Specifically, based on the judgment of the previous round, the most useful contextual information is extracted from multi-scale features. Then, the tokens of key regions are updated using a gating mechanism. Finally, the recursive hidden state and the global classification state are corrected simultaneously, so that the model's perception of the target converges from coarse to fine, improving the ability to recognize small targets, occluded targets, and blurred targets in complex scenes.
[0164] For example, in the above example, during the first recursion, based on the initial judgment of the previous round, the focus is on extracting contextual information from the candidate area to the right front, and most background areas such as the sky and road surface are quickly regarded as low-relevance areas, with only the suspected traffic sign area receiving focused updates. During the second recursion, the circular boundary and red outer ring features of this area are further enhanced, making it closer to the structural representation of a traffic sign. During the third recursion, high-resolution scale information is combined to further refine the analysis of the internal digital area of the sign, gradually converging the target from a "fuzzy circular target" to a "traffic sign with a red ring and internal digital structure," providing a discriminative representation for subsequent accurate category recognition.
[0165] S6: Multi-scale recursive fusion.
[0166] The recursive multi-scale token set is recursively fused at each scale to form a recursive fused feature, which specifically includes: 1. Generate scale-level fusion weights based on the token-level scale fusion weights of each token at each scale.
[0167]
[0168] in, Indicates the first In the recursive round Fusion weights at each scale; Indicates the first In the recursive round The first scale Whether a token participates in the recursive gating variable update; Indicates the first The first scale The regional priority coefficient of each token; Indicates the first The first scale Token-level scalar fusion weight for each token; Indicates the first The total number of tokens under each scale; Indicates the first In the recursive round The first scale Whether a token participates in the recursive gating variable update; Indicates the first The first scale The regional priority coefficient of each token; Indicates the first The first scale Token-level scalar fusion weight for each token; Indicates the first The total number of tokens under each scale; Indicates the total number of scales across multiple scales; Indicates the scale index during aggregation; This indicates the token index used during aggregation.
[0169] 2. In the multi-scale adaptive recursive calculation process, the feature vectors of each scale after each round of recursion are fused based on the scale-level fusion weights to obtain the fused features after each round of recursion.
[0170]
[0171] in, Indicates the first Fusion characteristics after round recursion; Indicates the first In the recursive round Fusion weights at each scale; Indicates a scale alignment operation; Indicates the first After the recursion, the first round Eigenvectors at various scales; This indicates the total number of scales across multiple scales.
[0172] S7: Global classification state enhancement.
[0173] To avoid fusion features after recursion In this invention, the result is only used as an intermediate and does not participate in the subsequent identification process. This can be further used to enhance the global classification state. Specifically, it can first be used to... Perform global pooling to obtain the fused semantic vector. : .in, This represents the global pooling function, usually global average pooling or global max pooling, which compresses the entire multi-scale fused feature into a one-dimensional vector.
[0174] Then, based on the fused semantic vector The global classification state after recursion and the set of recursive hidden states Enhance global classification status To obtain the enhanced global classification state .
[0175]
[0176] in, Indicates the first The enhanced global classification state after round recursion; This represents the fusion state update function, which can be implemented by a multilayer perceptron, a gated loop unit, or a Transformer cross-attention module.
[0177] Therefore, information at different scales can be combined, with the coarse scale providing scene context and the fine scale providing local structural details, thereby improving the system's ability to distinguish between small targets, distant targets, and occluded targets.
[0178] For example, in the example above, low-scale features continuously tell the system that the target is located in the area of legal traffic facilities on the right side of the road, mid-scale features stably depict the circular boundary, and high-scale features gradually distinguish the shape of the numbers. Through multi-scale fusion, the system no longer just knows "there is a round sign there", but gradually approaches "this is a speed limit sign, and the internal number is closer to 60".
[0179] Meanwhile, in this invention, the entire multi-scale adaptive recursive process, namely steps S5-S7, is repeated until the termination condition is met, at which point the recursion terminates.
[0180] Specifically, after each round of recursion, the stopping probability is calculated: .in, Indicates the first The stopping probability after round recursion; Indicates the first The enhanced global classification state after round recursion; Represents the learnable weight matrix; This represents a learnable bias vector.
[0181] The recursion terminates when any of the following conditions are met: or or .in, Indicates the first The classification probability distribution after round recursion; Indicates the first The classification probability distribution after round recursion; Indicates the stopping threshold; This represents the stability threshold.
[0182] After terminating the recursion, the enhanced global classification state after the recursion ends is obtained. .
[0183] Therefore, the computational load can be controlled while ensuring recognition accuracy, avoiding unnecessary recursion on already stable regions, thereby improving overall efficiency and real-time performance.
[0184] For example, in the example above, after the fifth recursion, the classification probability of the traffic sign area on the right front has basically stabilized, and the probability of "speed limit 60" is significantly higher than other categories. Therefore, the system determines that there is no need to continue recursion. At the same time, the sky and road areas have stopped updating in earlier rounds, thereby reducing the total computational cost of the entire image.
[0185] S8: Classification and recognition.
[0186] After the recursion is terminated, the recognition result is obtained based on the enhanced global classification state after the recursion ends.
[0187] Specifically, after the recursion terminates, the final global classification state is determined. Calculate the output vector : .in, Indicates the output vector; Represents the learnable weight matrix; This represents a learnable bias vector.
[0188] Then, based on the output vector The classification probability distribution is obtained as follows: .in, Represents the classification probability distribution. , Indicates the first Predicted probability of class category This indicates the total number of categories.
[0189] Based on the classification probability distribution, the final identification category is obtained. :
[0190] Therefore, the final state after multi-scale recursive refinement can be transformed into a directly usable image recognition result for use by control, decision-making, or alarm modules.
[0191] For example, in the example above, the system ultimately correctly identified the small, blurry, and partially obscured traffic sign on the right front as "Speed Limit 60". This result can then be sent to the autonomous driving decision module to limit the vehicle's speed or trigger a driving assistance warning.
[0192] In this invention, the entire complex scene image recognition method can be integrated into a single image recognition module. Furthermore, this image recognition module can be trained to perform joint optimization during the training phase.
[0193] Constructing the total loss function during the training phase :
[0194] in, Indicates classification loss; This indicates the calculation of constraint loss; Indicates cessation of loss; Indicates the difficulty of monitoring losses; This is the loss weight.
[0195] Classification loss Defined as:
[0196] in, Indicates the total number of categories; Indicates the first The true label of the class; For the first Predicted probability of class category.
[0197] The constraint loss is defined as follows:
[0198] Stop loss is defined as:
[0199] in, This indicates the target stop signal, meaning it should be at the [number]th [time]. The recursion stops; Indicates the first The stopping probability after round recursion.
[0200] The difficulty supervision loss is defined as:
[0201] in, Indicates the first The first scale The target difficulty label for each token or the reference difficulty value generated by the teacher model.
[0202] Figure 2 A schematic diagram of the complex scene image recognition system of the present invention is shown. Figure 2 As shown, the complex scene image recognition system of the present invention includes: 1. Multi-scale feature extraction module.
[0203] The multi-scale feature extraction module is used to extract multi-scale features from the input image to obtain a multi-scale feature map, and to expand the multi-scale feature map to obtain a multi-scale token set.
[0204] 2. Initialize the module.
[0205] The initialization module is used to obtain the initial global classification state and the initial recursive hidden state set based on the multi-scale token set.
[0206] 3. Overall Difficulty Score Calculation Module.
[0207] The comprehensive difficulty score calculation module is used to calculate the initial difficulty score of each token at each scale in the multi-scale token set based on the multi-scale token set, the initial global classification state, and the initial recursive hidden state set, and to construct the comprehensive difficulty score of each token at each scale by combining the classification uncertainty term and the cross-scale difference term.
[0208] 4. Adaptive recursive control parameter generation module.
[0209] The adaptive recursive control parameter generation module is used to generate adaptive recursive control parameters for each token at each scale based on the comprehensive difficulty score.
[0210] 5. Multi-scale adaptive recursive calculation module.
[0211] The multi-scale adaptive recursive calculation module is used to perform multi-scale adaptive recursive calculation based on the adaptive recursive control parameters, forming a recursive multi-scale token set, a recursive global classification state, and a recursive hidden state set.
[0212] 6. Multi-scale recursive fusion module.
[0213] The multi-scale recursive fusion module is used to perform multi-scale recursive fusion on each token at each scale in the recursed multi-scale token set to form the recursed fusion feature.
[0214] 7. Global classification status enhancement module.
[0215] The global classification state enhancement module is used to enhance the recursive global classification state based on the recursive fusion features, the recursive global classification state, and the recursive hidden state set, so as to obtain the enhanced global classification state.
[0216] 8. Classification and Recognition Module.
[0217] The classification and recognition module is used to obtain the recognition result based on the enhanced global classification state after the recursion ends.
[0218] Furthermore, the present invention also provides an image recognition device for complex scenes. For example... Figure 3As shown, the complex scene image recognition device of the present invention includes: a memory 11 for storing one or more programs; one or more processors 12; when the one or more programs are executed by the one or more processors 12, the one or more processors 12 implement the complex scene image recognition method of the present invention. Finally, the present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the complex scene image recognition method of the present invention.
[0219] The computer-readable storage medium includes both permanent and non-permanent, removable and non-removable media, and information storage can be achieved by any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transfer medium that can be used to store information accessible by a computing device. As defined in this invention, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0220] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed in this invention can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0221] The steps of the methods or algorithms described in conjunction with the embodiments disclosed in this invention can be implemented in hardware, software modules executed by a processor, or a combination of both. The software modules can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disks, removable disks, CD-ROMs, or any other form of storage medium known in the art.
[0222] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit the scope of protection of the present invention. Those skilled in the art can modify or make equivalent substitutions to the technical solutions of the present invention based on the concept of the present invention, without departing from the essence and scope of the technical solutions of the present invention.
Claims
1. A method for image recognition in complex scenes, characterized in that, Includes the following steps: S1: Perform multi-scale feature extraction on the input image to obtain a multi-scale feature map, and expand the multi-scale feature map to obtain a multi-scale token set; S2: Based on the multi-scale token set, obtain the initial global classification state and the initial recursive hidden state set; S3: Based on the multi-scale token set, the initial global classification state and the initial recursive hidden state set, calculate the initial difficulty score of each token at each scale in the multi-scale token set, and combine the classification uncertainty term and the cross-scale difference term to construct the comprehensive difficulty score of each token at each scale. S4: Based on the comprehensive difficulty score, generate adaptive recursive control parameters for each token at each scale; S5: Based on the adaptive recursive control parameters, perform multi-scale adaptive recursive calculation to form a recursive multi-scale token set, a recursive global classification state, and a recursive hidden state set. S6: Perform multi-scale recursive fusion on each token at each scale in the recursive multi-scale token set to form the recursive fusion feature; S7: Based on the recursive fusion features, the recursive global classification state, and the recursive hidden state set, the recursive global classification state is enhanced to obtain the enhanced global classification state. S8: Based on the enhanced global classification state after the recursion ends, the recognition result is obtained.
2. The complex scene image recognition method according to claim 1, characterized in that, Step S2 specifically includes: S21: Perform global pooling on the multi-scale token set to obtain a global semantic vector; S22: Perform a linear transformation based on the global semantic vector to obtain the initial global classification state; S23: Perform a linear transformation based on the global semantic vector to obtain an initial set of hidden states; S24: Add position encoding to each initial hidden state in the initial hidden state set to obtain an enhanced hidden state, and use the enhanced hidden state as the initial recursive hidden state to obtain an initial recursive hidden state set.
3. The complex scene image recognition method according to claim 1, characterized in that, Step S3 specifically includes: S31: For each token at each scale in the multi-scale token set, calculate its initial difficulty score based on its feature vector, initial global classification state, and initial set of recursive hidden states: in, Indicates the first The first scale The initial difficulty score for each token; Indicates the first The first scale The feature vector of each token; Indicates the initial global classification state; This represents the aggregate representation of the initial set of recursive hidden states; This indicates vector concatenation; Represents the learnable weight matrix; Represents a learnable bias vector; For the Sigmoid function; S32: Determine the uncertainty term: in, Indicates the first The first scale The uncertainty of each token; Indicates the total number of categories; Indicates the first The first scale The token is paired with the first Predicted probability of class category; S33: Determine cross-scale differences: in, Indicates the first The first scale Cross-scale differences of each token; Indicates the first The first scale The feature vector of each token That is to say, Indicates in relation to the first The first at different scales At the first scale and the first The first scale The corresponding token is the first Feature vectors of each token; Represents a cross-scale mapping function; S34: Construct a comprehensive difficulty score: in, Indicates the first The first scale The overall difficulty score of each token; It is a weighting coefficient and satisfies .
4. The complex scene image recognition method according to claim 1, characterized in that, Step S4 specifically includes: S41: Based on the comprehensive difficulty score, generate the number of recursive steps for each token at each scale: in, Indicates the first The first scale The number of recursive steps for each token; Indicates the first The first scale The overall difficulty score of each token; and These represent the minimum and maximum number of recursive steps, respectively. S42: Based on the recursive step count, generate recursive gating variables for each token at each scale: in, Indicates the first In the recursive round The first scale Whether a token participates in the recursive gating variable update; S43: Based on the feature vectors of each token at each scale, generate token-level scale fusion weights for each token at each scale: in, Indicates the first The first scale Token-level scalar fusion weight for each token; , Indicates the first The first scale A query vector for each token. Represents a learnable linear transformation matrix , Indicates the first The first scale A key vector of tokens, Represents a learnable linear transformation matrix; Indicates the first The first scale Feature vectors of each token; Indicates the total number of scales across multiple scales; Indicates the first The first scale Feature vectors of each token; Indicates the scale index during aggregation; S44: Priority coefficient for structural regions: in, Indicates the first The first scale The regional priority coefficient of each token; Indicates the first The first scale Each token and the initial global classification state The correlation score; Represents a learnable linear transformation matrix; Indicates the initial global classification state; Represent the weight coefficients and satisfy .
5. The complex scene image recognition method according to claim 1, characterized in that, Step S5 specifically includes: S51: In each round of recursion, the feature vectors at each scale are aggregated across scales using the set of recursive hidden states from the previous round to obtain the context representation of the current round of recursion: in, Indicates the first Contextual representation of round recursion; Indicates the total number of scales across multiple scales; Indicates the first The set of hidden recursive states after round recursion; Indicates the first After the recursion, the first round Eigenvectors at various scales; This represents the attention calculation function, which utilizes the first... The set of hidden recursive states after round recursion As a query vector, and using the first After the recursion, the first round eigenvectors at each scale As key vectors and value vectors, feature vectors at various scales are retrieved and aggregated. S52: Update the feature vectors of each token at each scale based on the recursive gating variable to obtain the feature vectors after each round of recursion: in, Indicates the first After the recursion, the first round The first scale Feature vectors of each token; Indicates the first In the recursive round The first scale Whether a token participates in the recursive gating variable update; Indicates the first The first scale The regional priority coefficient of each token; Indicates the first The global classification state after round recursion; Indicates the first After the recursion, the first round The first scale Feature vectors of each token; The update function representing the feature vector of the token; S53: Update the recursive hidden state set based on the recursive feature vector: in, Indicates the first The set of hidden recursive states after round recursion; Indicates the first The set of feature vectors at each scale after round recursion; This represents a recursive hidden state update function; S54: Update the global classification state based on the updated set of recursive latent states: in, Indicates the first The global classification state after round recursion; This represents the global classification state update function.
6. The complex scene image recognition method according to claim 1, characterized in that, Step S6 specifically includes: S61: Generate scale-level fusion weights based on the token-level scale fusion weights of each token at each scale: in, Indicates the first In the recursive round Fusion weights at each scale; Indicates the first In the recursive round The first scale Whether a token participates in the recursive gating variable update; Indicates the first The first scale The regional priority coefficient of each token; Indicates the first The first scale Token-level scalar fusion weight for each token; Indicates the first The total number of tokens under each scale; Indicates the first In the recursive round The first scale Whether a token participates in the recursive gating variable update; Indicates the first The first scale The regional priority coefficient of each token; Indicates the first The first scale Token-level scalar fusion weight for each token; Indicates the first The total number of tokens under each scale; Indicates the total number of scales across multiple scales; Indicates the scale index during aggregation; Indicates the token index during aggregation; S62: Based on the scale-level fusion weights, fuse the feature vectors of each scale after each round of recursion to obtain the fused features after each round of recursion: in, Indicates the first Fusion characteristics after round recursion; Indicates the first In the recursive round Fusion weights at each scale; Indicates a scale alignment operation; Indicates the first After the recursion, the first round Eigenvectors of various scales.
7. The complex scene image recognition method according to claim 1, characterized in that, Step S8 specifically includes: S81: Based on the enhanced global classification state after the recursion ends, calculate the output vector: in, Indicates the output vector; This represents the enhanced global classification state after the recursion ends; and These represent the learnable weight matrix and the learnable bias vector, respectively. S82: Based on the output vector, obtain the classification probability distribution. : S83: Based on the classification probability distribution, obtain the identification category. : in, Indicates the first Predicted probability of class category.
8. A complex scene image recognition system, characterized in that, include: A multi-scale feature extraction module is used to extract multi-scale features from the input image to obtain a multi-scale feature map, and to expand the multi-scale feature map to obtain a multi-scale token set. An initialization module is used to obtain an initial global classification state and an initial recursive hidden state set based on the multi-scale token set; The comprehensive difficulty score calculation module is used to calculate the initial difficulty score of each token at each scale in the multi-scale token set based on the multi-scale token set, the initial global classification state and the initial recursive hidden state set, and to construct the comprehensive difficulty score of each token at each scale by combining the classification uncertainty term and the cross-scale difference term. An adaptive recursive control parameter generation module is used to generate adaptive recursive control parameters for each token at each scale based on the comprehensive difficulty score. The multi-scale adaptive recursive computation module is used to perform multi-scale adaptive recursive computation based on the adaptive recursive control parameters to form a recursive multi-scale token set, a recursive global classification state, and a recursive recursive hidden state set. A multi-scale recursive fusion module is used to perform multi-scale recursive fusion on each token at each scale in the recursed multi-scale token set to form a recursed fusion feature. A global classification state enhancement module is used to enhance the recursive global classification state based on the recursive fusion features, the recursive global classification state, and the recursive latent state set to obtain an enhanced global classification state. The classification and recognition module is used to obtain the recognition result based on the enhanced global classification state after the recursion ends.
9. A complex scene image recognition device, characterized in that, include: One or more processors; Memory, used to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the complex scene image recognition method as described in any one of claims 1-7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the steps of the complex scene image recognition method as described in any one of claims 1-7.