Open environment target detection method and apparatus, electronic device, and medium
By designing a scene-adaptive dynamic sparse hybrid expert system and a dual-stream detection head controller, the problems of low accuracy, low efficiency, and catastrophic forgetting in target detection of new categories in open environments are solved, achieving efficient and accurate target detection and adaptation to complex scenes.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING SHENZHOU EVERBRIGHT TECH CO LTD
- Filing Date
- 2025-12-29
- Publication Date
- 2026-06-02
AI Technical Summary
In open environment object detection, there are problems such as low accuracy and efficiency in detecting new categories and catastrophic forgetting. In particular, the static working mechanism of the expert network module is difficult to adapt to sudden scene changes, the decision-making error of the gating network leads to the error in detection results, the training of new expert networks and old expert networks under different data distributions leads to inconsistency between feature representation and decision-making, the large number of model parameters and high computational cost make it difficult to apply.
The system designs a scene-adaptive dynamic sparse hybrid expert system and a dual-stream detection head controller. It activates appropriate target networks through scene feature analysis, selects expert networks using dynamic gating networks, and combines general, detail-enhanced, and context-aware expert networks to perform feature fusion and weighting. The dual-stream detection head controller is used for dynamic resource allocation to generate the final detection feature map.
It improves the accuracy and efficiency of target detection, reduces computational overhead, enhances computational perception capabilities in complex scenes, alleviates the problem of catastrophic forgetting, and enables continuous discovery of unknown categories.
Smart Images

Figure CN122135003A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of target detection technology, and in particular to a target detection method, apparatus, electronic device, and medium in an open environment. Background Technology
[0002] Open-domain object detection is an advanced task in computer vision, differing from traditional object detection tasks in its datasets, model training, model inference, and application environment. Traditional object detection typically operates in a closed environment, using static models trained on specific data, and is unable to identify new, unseen class samples. In contrast, open-domain object detection can identify new, unseen class samples and possesses continuous adaptability to unknown, dynamic environments.
[0003] Object detection in open environments faces numerous challenges, such as object diversity, attribute variation, complex backgrounds, and catastrophic forgetting. To address these issues, researchers have conducted extensive studies. The MoE-OW method employs an explicit MoE architecture, training multiple different expert networks to handle known categories. A gating network dynamically selects and weights relevant experts based on the input for the output. When a new category is introduced, a new expert network is added specifically to learn these new category samples. The parameters of the original expert networks are frozen during training, thus mitigating catastrophic forgetting. Another open-world object detection method constructs a dynamic expert network selection system based on uncertainty assessment. For known categories, a gating decision module analyzes image features in real time and calculates the fit of different expert networks. When all expert networks produce inconsistent results for a certain region, it is classified as an unknown object. When learning new categories, a dynamic expansion mechanism is used, introducing a new expert network and combining it with knowledge distillation to achieve incremental learning. Simultaneously, the parameters of the old expert networks are frozen to mitigate catastrophic forgetting.
[0004] While the above methods have achieved the learning of new categories and mitigated the catastrophic forgetting of the model, the following problems still exist: (1) The static working mechanism of the expert network module is difficult to adapt to sudden changes in the scenario.
[0005] (2) The performance of the entire system is highly dependent on the decision of the gating network. When the gating network makes an incorrect decision, all subsequent detection results will be incorrect. (3) When learning new categories, the newly added expert network and the old expert network are trained under different data distributions, which will lead to inconsistencies and conflicts in their feature representations and decisions; (4) When a new category appears, an expert system is added. As new categories continue to appear, the number of expert networks grows linearly, resulting in a large number of model parameters, high computational cost, slow inference speed, and difficulty in application. Summary of the Invention
[0006] This invention provides a method, apparatus, electronic device, and medium for target detection in open environments, which addresses the shortcomings of existing technologies in target detection for open environments, such as low accuracy, low efficiency, and catastrophic forgetting in the detection of new categories. It aims to improve the accuracy and efficiency of target detection, reduce computational overhead, and enhance the computational perception capabilities of complex scenes.
[0007] This invention provides a target detection method in an open environment, comprising: Receive images to be detected in an open environment; Scene feature analysis is performed on the image to be detected to obtain scene complexity index and the proportion of target objects that meet the preset size; The activated target network is determined based on the scene complexity index and the proportion of target objects that meet the preset size. Based on the target network, feature extraction and feature fusion are performed on the image to be detected to generate an adaptive scene feature map; The adaptive scene feature map is input into the dual-stream detection head controller to generate the final detection feature map; The final detection feature map is then subjected to target detection and classification to obtain the target detection result of the image to be detected.
[0008] In one possible implementation, the method further includes: Scene feature analysis is performed on the image to be detected to obtain the texture richness, target occlusion degree and background clutter of the image to be detected; Based on the texture richness, target occlusion degree, and background clutter, the scene complexity index and the proportion of target objects that meet the preset size are calculated.
[0009] In one possible implementation, the method further includes: The target network includes a general expert network, a context-aware expert network, and a detail-enhancing expert network; The general expert network remains active while performing target detection on the image to be detected. When the scene complexity index is greater than the first threshold, the context-aware expert network is activated. When the proportion of the target object that meets the preset size is greater than the second threshold, the detail enhancement expert network is activated.
[0010] In one possible implementation, the method further includes: The basic features of the image to be detected are output based on the general expert network. Based on the detail enhancement expert network, the network outputs detail enhancement features in the image to be detected that are related to the target object that meets the preset size. The context-aware expert network outputs adaptive contextual features of occluded or truncated targets in the image to be detected, wherein the adaptive contextual features are extracted based on pyramid pooling and channel attention mechanisms. The basic features, detail enhancement features, and adaptive context features are weighted and fused to generate an adaptive scene feature map.
[0011] In one possible implementation, the method further includes: The dual-stream detection head controller includes a basic route, an enhanced route, and a route controller; The adaptive scene feature map is input into the dual-stream detection head controller, a basic feature map is generated through the basic route, an enhanced feature map is generated through the enhanced route, and an energy index is calculated through the route controller; Decision coefficients are generated based on the energy index; The base feature map and the enhanced feature map are weighted and fused based on the decision coefficients to generate the final detection feature map.
[0012] In one possible implementation, the method further includes: The final detected feature map contains the target's location information, confidence level, and category label. The target detection result of the image to be detected is determined based on the target location information, confidence level, and category label.
[0013] The present invention also provides an environmental target detection device, comprising the following modules: The receiving module is used to receive images to be detected in an open environment; The analysis module is used to perform scene feature analysis on the image to be detected, and obtain scene complexity index and the proportion of target objects that meet the preset size. The determination module is used to determine the activated target network based on the scene complexity index and the proportion of the target objects that meet the preset size. The generation module is used to extract features from the image to be detected based on the target network and perform feature fusion to generate an adaptive scene feature map; The generation module is used to input the adaptive scene feature map into the dual-stream detection head controller to generate the final detection feature map; The detection module is used to perform target detection and classification on the final detection feature map to obtain the target detection result of the image to be detected.
[0014] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the open environment target detection method as described above.
[0015] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the open environment target detection method as described above.
[0016] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the open environment target detection method as described above.
[0017] The present invention provides an open environment target detection method, apparatus, electronic device, and medium that receives an image to be detected in an open environment; performs scene feature analysis on the image to be detected to obtain a scene complexity index and the proportion of target objects conforming to a preset size; determines an activated target network based on the scene complexity index and the proportion of target objects conforming to the preset size; extracts and fuses features from the image to be detected based on the target network to generate an adaptive scene feature map; inputs the adaptive scene feature map into a dual-stream detection head controller to generate a final detection feature map; and performs target detection and classification on the final detection feature map to obtain the target detection result of the image to be detected. Compared with the shortcomings of existing technologies in open environment target detection, such as low accuracy, low efficiency, and catastrophic forgetting in new category detection, this solution, based on the characteristics of open environment data, designs a scene-adaptive dynamic sparse hybrid network and a dual-stream detection head controller, thereby improving target detection accuracy and efficiency, reducing computational overhead, and improving computational perception capabilities in complex scenes. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0019] Figure 1 This is one of the flowcharts of the open environment target detection method provided by the present invention.
[0020] Figure 2This is the second flowchart of the open environment target detection method provided by the present invention.
[0021] Figure 3 This is a structural diagram of the DSA-YOLOv8 model provided by the present invention.
[0022] Figure 4 This is a diagram of the scene-adaptive dynamic sparse hybrid expert network system provided by the present invention.
[0023] Figure 5 This is a structural diagram of the dual-flow detection head controller provided by the present invention.
[0024] Figure 6 This is a schematic diagram of the open environment target detection device provided by the present invention.
[0025] Figure 7 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0026] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0027] To facilitate understanding of the embodiments of the present invention, further explanations and descriptions will be provided below with reference to the accompanying drawings and specific embodiments. These embodiments do not constitute a limitation on the embodiments of the present invention.
[0028] Figure 1 This is one of the flowcharts of the open environment target detection method provided by the present invention, such as... Figure 1 As shown, the method includes the following: S11. Receive the image to be detected in an open environment.
[0029] This invention addresses the problems of low accuracy in detecting new categories and catastrophic forgetting in open environment target detection by proposing a new open environment target detection method. This method uses YOLOv8 as the baseline model and designs two modules: a scene-adaptive dynamic sparse hybrid expert system and a dual-stream detection head controller. This model is used for image target detection in open environments. The model training process will not be detailed here.
[0030] First, the system receives a single image or video frame sequence from an open environment. This image data can be an RGB three-channel color image, converted to a standardized tensor representation to meet the requirements of the model's input layer. The input data sources are diverse, encompassing real-time footage from surveillance cameras, drone aerial images, images captured by vehicle vision systems, or photos taken by mobile devices. The open environment specifically refers to an unknown application scenario relative to the closed training dataset, characterized by the potential inclusion of new categories of target objects not labeled during training, dynamically changing background conditions, and unpredictable occlusion and lighting variations. The input images require no pre-labeling or preprocessing and are directly fed into the model for subsequent analysis, demonstrating the method's adaptability to open environment data.
[0031] S12. Perform scene feature analysis on the image to be detected to obtain scene complexity index and the proportion of target objects that meet the preset size.
[0032] This step is the core perception step, which uses lightweight and fast feedforward analysis to quantitatively evaluate the inherent attributes of the input image.
[0033] The calculation of scene complexity index is based on multi-dimensional feature fusion: first, the image texture entropy value is extracted to quantify the texture richness; second, the background clutter is evaluated by edge density detection; and finally, the topological complexity of the target occlusion relationship is analyzed by semantic segmentation mask. After the three dimensions are weighted and fused, they are normalized to the [0,1] interval, where the critical threshold for context-aware expert activation can be set to 0.4.
[0034] The proportion of small objects is rapidly estimated by constructing a scale pyramid: the image is divided into 32×32 pixel candidate grids, and the proportion of grids with saliency responses higher than a preset response threshold is counted. When this proportion exceeds 15%, the detail enhancement expert activation condition is triggered. This analysis process has extremely low computational overhead and can be completed within 10ms using GPU parallel acceleration, ensuring it does not become a system bottleneck.
[0035] S13. Determine the activated target network based on the scene complexity index and the proportion of target objects that meet the preset size.
[0036] The sparse activation strategy is executed based on the quantization analysis results of S12. The target network is the scene-adaptive dynamic sparse hybrid expert system, which contains three parallel heterogeneous expert network modules: a general expert network, a detail-enhancing expert network, and a context-aware expert network.
[0037] The decision-making logic follows a combination of forced activation and conditional activation: the general expert network is not constrained by scene analysis results and forces activation on all input samples to ensure the integrity of basic feature extraction; the detail enhancement expert network adopts a threshold triggering mechanism, only connecting to the computation graph when small objects account for more than 15%, focusing on enhancing high-frequency detail information in shallow feature maps; the context-aware expert network is activated based on scene complexity, starting when the complexity index exceeds 0.4, and infers semantic relationships, spatial layout, and overall scene context information between objects in the image through pyramid pooling and channel attention mechanisms. The dynamic gating network is implemented based on a rule engine, avoiding the trainable parameters of traditional gating networks and eliminating the risk of cascading errors caused by gating misjudgments. Moreover, by activating the corresponding expert networks, the dynamic gating network can keep the parameters of each expert from being disturbed by new tasks, maintaining their performance on old tasks, and further mitigating the catastrophic forgetting problem of the model.
[0038] S14. Based on the target network, extract features from the image to be detected and perform feature fusion to generate an adaptive scene feature map.
[0039] The activated expert network modules share the input image but perform differentiated processing: the general expert network uses a standard architecture to extract hierarchical semantic features, outputting a basic feature map with 256 channels; if the detail enhancement expert network is activated, it adaptively adjusts the receptive field to focus on small target regions and blurred target regions through deformable convolutional kernels, outputting a detail enhancement feature map; if the context-aware expert network is activated, it uses pyramid pooling and channel attention to model the semantic relationships, spatial layout, and overall scene context information between objects, outputting an important context feature map. Feature fusion adopts an importance-weighted mechanism, and the weights of each expert network are not fixed, but dynamically evaluated based on their historical performance on the validation set: the general expert weight is its mAP value on the known class validation set, the detail enhancement expert weight is the small target recall rate, and the context-aware expert weight is the occluded object detection accuracy. The fusion process uses 1×1 convolution to achieve channel alignment and weighted summation, generating a unified adaptive scene feature map. This feature map integrates multi-scale and multi-granular information and has a stronger generalization response to unknown categories.
[0040] S15. Input the adaptive scene feature map into the dual-stream detection head controller to generate the final detection feature map.
[0041] The dual-stream detection head controller comprises three parallel sub-paths: a base route, an enhancement route, and a route controller. The base route uses standard 3×3 convolutional stacking, focusing on high-quality, simple feature regions; the enhancement route uses a CBAM attention mechanism, focusing on low-quality, complex feature regions. The route controller consists of two MLPs. Upon receiving the adaptive scene feature map, it dynamically switches between the base route and the enhancement route based on the characteristics of the input feature map. The base route generates a base feature map, the enhancement route generates an enhancement feature map, and the route controller calculates an energy index. Decision coefficients are generated based on the energy index. The base and enhancement feature maps are then weighted and fused based on the decision coefficients to generate the final detection feature map.
[0042] S16. Perform target detection and classification on the final detection feature map to obtain the target detection result of the image to be detected.
[0043] The final detected feature map is fed into the decoupled detection head branch: the classification branch outputs the class probability distribution through a fully connected layer, and the regression branch predicts the bounding box coordinate offset. For known classes, the Top-1 class labels and confidence scores are directly output; for unknown classes, this method uses an open set recognition mechanism. When the maximum classification probability is lower than a dynamic threshold (usually set to 0.3) but the target score is higher than 0.5, the target is marked as "unknown class" and its bounding box is output, achieving continuous discovery of new classes. All detection results are post-processed with non-maximum suppression to eliminate redundant boxes, and a structured detection result list is finally output. Each item includes bounding box coordinates, class labels (including unknown), confidence scores, and scene complexity labels, providing data support for subsequent manual annotation and incremental learning.
[0044] The open environment target detection method provided by this invention receives an image to be detected in an open environment; performs scene feature analysis on the image to obtain a scene complexity index and the proportion of target objects conforming to a preset size; determines the activated target network based on the scene complexity index and the proportion of target objects conforming to the preset size; extracts and fuses features from the image to be detected based on the target network to generate an adaptive scene feature map; inputs the adaptive scene feature map into a dual-stream detection head controller to generate a final detection feature map; and performs target detection and classification on the final detection feature map to obtain the target detection result of the image to be detected. Compared with the shortcomings of existing technologies in open environment target detection, such as low accuracy, low efficiency, and catastrophic forgetting of new categories, this method, based on the characteristics of open environment data, designs a scene-adaptive dynamic sparse hybrid network and a dual-stream detection head controller, thereby improving target detection accuracy and efficiency, reducing computational overhead, and improving computational perception capabilities in complex scenes.
[0045] Figure 2This is the second flowchart of the open environment target detection method provided by the present invention, as shown below. Figure 2 As shown, the method includes the following: First, let me explain the training process of the open environment target detection model in this embodiment of the invention: The open environment target detection model uses YOLOv8 as the baseline model and designs two modules: a scene-adaptive dynamic sparse hybrid expert system and a dual-stream detection head controller. Its structure is as follows: Figure 3 As shown. Specific improvements are as follows: (1) A scene-adaptive dynamic sparse hybrid expert system module was designed in the backbone network. Based on the characteristics of the open environment, a general expert network, a detail-enhancing expert network and a context-aware expert network were designed to improve the adaptability and robustness of the model in the discovery of unknown categories, understanding of complex scenes and multi-scale target detection. At the same time, in order to reduce the computational overhead, a dynamic gating network based on expert importance evaluation was designed to sparse the above expert systems.
[0046] (2) A dual-flow detection head controller was designed in the detection head part to realize the dynamic and lightweight design of the detection head. It can not only better cope with targets of different scales, appearances and complexities in open environments, but also dynamically allocate resources according to the characteristics of these environments, thereby improving the detection head's computational perception capability for complex scenes.
[0047] Specifically, in real-world open environments, samples are diverse in type, scale, and morphology, presenting core challenges for object detection, including low accuracy in detecting new categories, catastrophic forgetting, and computational inefficiency. To effectively alleviate these problems, this invention proposes a Scene-Adaptive Dynamic Sparse Mixture of Experts (SDSME) system. SDSME aims to improve the model's adaptability to the complexity and uncertainty of open environments through a "divide and conquer" expert network hybrid strategy. The structure is as follows: Figure 4As shown, SDSME consists of a general expert network, a detail enhancement expert network, a context-aware expert network, and dynamic gating units. The general expert system is the foundation for robust recognition of common targets, and it consists of 3x3 convolutions, BN layers, and ReLU from YOLOv8. The detail enhancement expert focuses on capturing subtle features to address the challenges of small targets, blurriness, and occlusion, and consists of deformable convolutions and a coordinate attention mechanism. The context-aware expert performs logical reasoning to compensate for insufficient appearance information by understanding the semantic relationships between objects and the scene. It consists of 1x1 global average pooling, 2x2 adaptive pooling, 4x4 adaptive pooling, and a channel attention mechanism. The 1x1 global average pooling is used to extract global context information, the 2x2 adaptive pooling is used to extract medium-sized region context information, and the 4x4 adaptive pooling is used to extract local region context. This parallel multi-scale pooling is concatenated and then fused using 1x1 convolutions. The fused result is then processed by the SENet channel attention mechanism to extract adaptive context information. The collaborative work of these three expert networks can effectively overcome the performance bottleneck of a single model and significantly improve the model's adaptability and robustness in unknown category discovery, complex scene understanding, and multi-scale object detection.
[0048] Furthermore, to achieve the optimal balance between computational efficiency and model performance in open environment target detection, this invention designs a dynamic gating network based on expert importance assessment, directly utilizing gating weights for expert selection. This dynamic gating consists of two parts: first, expert importance assessment, and then dynamic gating routing. The expert importance assessment metric comprises a generality score. Sensitivity to details and contextual relevance Composition. The importance evaluation metric for the general expert is its mAP on the known class validation set, the importance evaluation metric for the detail enhancement expert is its recall rate for small targets, and the importance evaluation metric for the context-aware expert is its detection performance for occluded or truncated objects. The evaluation metrics for each expert are shown in Formula (1). The dynamic gating routing strategy is the one that all samples of the general expert must pass through, and it is activated by default. The detail enhancement expert is activated when the proportion of small objects is greater than 15%, and the context-aware expert is activated when the scene complexity is greater than a set threshold.
[0049] (1) in, This represents the general score of the i-th expert. This represents the detail sensitivity of the i-th expert. This represents the contextual relevance of the i-th expert. , as well as The scene complexity threshold is set to 0.4.
[0050] Traditional detection heads use a fixed structure for detection output, which cannot flexibly adjust the allocation of computing resources according to the needs of actual scenarios. To solve this problem, this invention designs a Dual-Stream HeadController (DSHC) to enable the detection head to perform computational perception of complex scenarios. Its structure is as follows: Figure 5 As shown. DSHC consists of three parts: basic routing, enhanced routing, and routing controller. The basic routing branch is designed to maintain the processing capability for simple samples, focusing on high-quality, simple feature regions (such as large targets), and is composed of two 3x3 convolutional layers. The enhanced routing branch is designed to maintain the processing capability for difficult samples, focusing on low-quality, complex feature regions (such as small targets, occlusions), and is composed of the CBAM attention mechanism. To achieve on-demand allocation of computing resources, the routing controller dynamically switches between these two branches according to the characteristics of the input feature map. The routing controller is composed of two MLPs (Multilayer Perceptrons). Specifically, firstly, the energy index of the input feature map is calculated, as shown in formula (2); then, the decision coefficient is calculated based on the energy index, as shown in formula (3); finally, the final output feature map is calculated based on the decision coefficient for detection and classification, and the final output feature map is calculated as shown in formula (4).
[0051] (2) (3) (4) in, The feature map energy index is used to determine the information density of the feature map. Indicates the input feature map, , and Representing feature maps respectively Height, width, and number of channels, Represents the input feature map The total number of all non-zero elements in the set. Represents the input feature map The variance is used to reflect the degree of fluctuation of the feature. and This represents the weight matrix.
[0052] The model training steps are as follows: Step 1: Divide the labeled dataset into three parts: training set, validation set, and test set. The training set and validation set are used for model training, and the test set is used for model testing.
[0053] Step 2: Build the DSA-YOLOv8 open environment object detection model based on the PyTorch deep learning framework. The model mainly consists of three parts: the backbone feature extraction network, the Neck feature fusion module, and the Detection head.
[0054] In the backbone network, a Hybrid Expert System (SDSME) module is introduced, comprising four parts: a general expert system, a detail enhancement expert system, a context-aware expert system, and a dynamic gating unit. The general expert system forms the foundation for robust recognition of common targets; the detail enhancement expert system focuses on capturing subtle features to address the challenges of small targets, blurriness, and occlusion; the context-aware expert system compensates for insufficient appearance information by understanding the semantic relationships between objects and the scene and performing logical reasoning; and the dynamic gating network is used to sparsify the expert system, achieving an optimal balance between computational efficiency and model performance in open environment target detection.
[0055] In the detection head section, a DSHC (Dual Stream Detection Head Controller) module is introduced, which includes three parts: basic routing, enhanced routing, and routing controller, to enable the detection head to have computational perception capabilities for complex scenes and lightweight processing of the model.
[0056] Step 3: Design model hyperparameters such as learning efficiency, batch normalization, and training epochs.
[0057] Step 4: Use the weights trained on the general dataset by the backbone network as the pre-training weights of the model to initialize the model parameters.
[0058] Step 5: Determine whether the model has reached the expected accuracy or the maximum number of training rounds. If so, stop training and automatically save the trained weight file.
[0059] Step 6: Test the test set using the trained model weight file, and output the recognition results and target location information.
[0060] The following details the process of image object detection using a pre-trained open-environment object detection model: S21. Receive the image to be detected in an open environment, perform scene feature analysis on the image to be detected, and obtain the texture richness, target occlusion degree and background clutter of the image to be detected.
[0061] The system receives RGB three-channel tensor data as images to be detected, with dimensionality adapted to the input layer reduction of the model. Sources include open environment data sources such as real-time streams from surveillance cameras, drone aerial sequences, vehicle surround-view systems, and images captured by mobile devices. Texture richness is calculated using the gray-level co-occurrence matrix to determine entropy and contrast, quantifying the heterogeneity and complexity of local image textures. Target occlusion is assessed by generating foreground masks using a lightweight instance segmentation head, analyzing the IoU overlap topology between masks, and statistically analyzing the proportion of occluded pixels. Background clutter is evaluated by extracting global edge density and orientation distribution entropy using an edge detector, assessing the scene's structurality. These three metrics are calculated in parallel, with total processing time controlled within milliseconds to ensure real-time performance. This analysis forms the basis for subsequent dynamic expert activation decisions; its computational accuracy directly impacts the effectiveness of sparse routing. The analysis results are stored as a 128-dimensional scene description vector for use by the gating network.
[0062] S22. Based on the texture richness, target occlusion degree and background clutter, calculate the scene complexity index and the proportion of target objects that meet the preset size.
[0063] S23. When the scene complexity index is greater than the first threshold, determine to activate the context-aware expert network.
[0064] S24. When the proportion of the target object that meets the preset size is greater than the second threshold, the detail enhancement expert network is activated.
[0065] The discrete scene features of S21 are aggregated into quantifiable routing decision variables.
[0066] The scene complexity index is calculated through adaptive weighted fusion: Complexity = 0.4 × texture entropy + 0.3 × occlusion index + 0.3 × background clutter. The weights are determined through ablation experiments to highlight the importance of textures. The results are normalized to the [0,1] interval, and 0.4 is set as the critical threshold for context-aware expert activation.
[0067] The proportion of target objects that meet the preset size is quickly filtered through scale space: an image pyramid is constructed to 1 / 8 resolution, a pre-trained target filter is applied at each scale, and the number of candidate regions with a response value higher than 0.5 and a bounding box area of less than 1024 pixels (32×32) is counted. The ratio of this number to the total number of candidates is the proportion of small objects. When the ratio exceeds 15%, the detail enhancement expert activation condition is triggered.
[0068] S25. Output the basic features of the image to be detected based on the general expert network.
[0069] S26. Based on the detail enhancement expert network, output the detail enhancement features in the image to be detected that are related to the target object that meets the preset size.
[0070] S27. Based on the context-aware expert network, output the adaptive context features of the occluded or truncated targets in the image to be detected.
[0071] The activated expert network modules share the input image but perform differentiated processing: the general expert network uses a standard architecture to extract hierarchical semantic features, outputting a basic feature map with 256 channels; if the detail enhancement expert network is activated, it adaptively adjusts the receptive field to focus on small target regions through deformable convolutional kernels, outputting a detail enhancement feature map; if the context-aware expert network is activated, it uses pyramid pooling and channel attention to model the semantic relationships, spatial layout, and overall scene context information between objects, outputting an important context feature map. Feature fusion adopts an importance-weighted mechanism, and the weights of each expert network are not fixed but dynamically evaluated based on their historical performance on the validation set: the general expert weight is its mAP value on the known class validation set, the detail enhancement expert weight is the small target recall rate, and the context-aware expert weight is the occluded object detection accuracy. The fusion process uses 1×1 convolution to achieve channel alignment and weighted summation, generating a unified adaptive scene feature map. This feature map integrates multi-scale and multi-granular information and has a stronger generalization response to unknown categories.
[0072] S28. The basic features, detail enhancement features and adaptive context features are weighted and fused to generate an adaptive scene feature map.
[0073] The fusion layer employs channel concatenation and 1×1 convolutional dimensionality reduction. Basic features serve as the backbone (weight 0.5), detail enhancement features (if activated) have a weight of 0.25, and context features (if activated) have a weight of 0.25. These weights are dynamically fine-tuned based on the expert's historical performance on the validation set; for example, for every 1% increase in recall of the detail enhancement expert on the small target validation set, its fusion weight increases by 0.01. The fusion operation uses element-wise weighted summation, followed by batch normalization and SiLU activation, generating a 256-dimensional adaptive scene feature map. This feature map maintains general representation while dynamically injecting scene-specific information, significantly improving the model's robustness to open environments.
[0074] S29. Input the adaptive scene feature map into the dual-stream detection head controller, generate a basic feature map through the basic route, generate an enhanced feature map through the enhanced route, and calculate the energy index through the route controller.
[0075] S210. Generate decision coefficients based on the energy index, and perform weighted fusion of the basic feature map and the enhanced feature map based on the decision coefficients to generate the final detection feature map.
[0076] The dual-stream detection head controller comprises three parallel sub-paths: the basic route, the enhancement route, and the route controller. The basic route uses standard 3×3 convolution stacking to handle high-quality, simple samples; the enhancement route consists of a CBAM attention mechanism to handle low-quality, difficult samples.
[0077] After receiving the adaptive scene feature map, the routing controller first calculates its energy index E. E is mathematically defined as the spatial mean of the sum of squares of all elements in the feature map. This index effectively reflects the visual information entropy and detection difficulty of the scene. Based on the energy index, a decision coefficient α is generated through a normalized exponential function. The final detection feature map is generated through dynamic weighted fusion (Formula 4). This mechanism ensures that in simple scenes, α approaches 0, relying primarily on basic routing to guarantee real-time performance (speed improvement of over 30%), while in complex scenes, α approaches 1, relying primarily on enhanced routing to guarantee detection accuracy (mAP improvement of 2-3 percentage points).
[0078] S211. Detect the target location information, confidence level and category label of the target contained in the final detection feature map.
[0079] S212. Determine the target detection result of the image to be detected based on the target location information, confidence level, and category label.
[0080] The final detected feature map is fed into the decoupled detection head branch: the classification branch outputs the class probability distribution through a fully connected layer, and the regression branch predicts the bounding box coordinate offset. For known classes, the Top-1 class labels and confidence scores are directly output; for unknown classes, this method uses an open set recognition mechanism. When the maximum classification probability is lower than a dynamic threshold (usually set to 0.3) but the target score is higher than 0.5, the target is marked as "unknown class" and its bounding box is output, achieving continuous discovery of new classes. All detection results are post-processed with non-maximum suppression to eliminate redundant boxes, and a structured detection result list is finally output. Each item includes bounding box coordinates, class labels (including unknown), confidence scores, and scene complexity labels, providing data support for subsequent manual annotation and incremental learning.
[0081] The open-environment target detection method provided in this invention, based on the characteristics of open-environment data, designs two modules: a scene-adaptive dynamic sparse hybrid expert system and a dual-stream detection head controller. The scene-adaptive dynamic sparse hybrid expert system module, by designing different experts and a dynamic gating network based on the importance of each expert, not only effectively improves the model's adaptability and robustness in unknown category discovery, complex scene understanding, and multi-scale target detection, but also achieves a balance between accuracy and computational resources in open-environment target detection. The dual-stream detection head controller, through dynamic feature perception and path selection mechanisms, achieves fine-grained allocation of computational resources; secondly, by adopting differentiated path design, it effectively improves performance in complex scenes while ensuring basic efficiency, solving the dual pain points of static computational redundancy and insufficient dynamic scene adaptability in traditional detection heads.
[0082] The open environment target detection device provided by the present invention is described below. The open environment target detection device described below can be referred to in correspondence with the open environment target detection method described above.
[0083] Figure 6 This is a schematic diagram of the open environment target detection device provided by the present invention, specifically including: The receiving module 601 is used to receive the image to be detected in an open environment. For detailed explanations, please refer to the relevant descriptions in the above method embodiments; they will not be repeated here.
[0084] The analysis module 602 is used to perform scene feature analysis on the image to be detected, and obtain a scene complexity index and the proportion of target objects that meet a preset size. For detailed explanations, please refer to the relevant descriptions in the above method embodiments, which will not be repeated here.
[0085] The determination module 603 is used to determine the activated target network based on the scene complexity index and the proportion of target objects that meet the preset size. For detailed explanations, please refer to the relevant descriptions in the above method embodiments; they will not be repeated here.
[0086] The generation module 604 is used to extract features from the image to be detected based on the target network and perform feature fusion to generate an adaptive scene feature map. For detailed explanations, please refer to the relevant descriptions in the above method embodiments; they will not be repeated here.
[0087] The generation module 604 is used to input the adaptive scene feature map into the dual-stream detection head controller to generate the final detection feature map. For detailed explanations, please refer to the relevant descriptions in the above method embodiments; they will not be repeated here.
[0088] The detection module 605 is used to perform target detection and classification on the final detection feature map to obtain the target detection result of the image to be detected. For detailed explanations, please refer to the relevant descriptions in the above method embodiments; they will not be repeated here.
[0089] Figure 7 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 7 As shown, the electronic device may include a processor 710, a communications interface 720, a memory 730, and a communication bus 740, wherein the processor 710, communications interface 720, and memory 730 communicate with each other via the communication bus 740. The processor 710 can call logical instructions in the memory 730 to execute an open environment target detection method. This method includes: receiving an image to be detected in an open environment; performing scene feature analysis on the image to be detected to obtain a scene complexity index and the proportion of target objects conforming to a preset size; determining an activated target network based on the scene complexity index and the proportion of target objects conforming to the preset size; extracting features from the image to be detected based on the target network and performing feature fusion to generate an adaptive scene feature map; inputting the adaptive scene feature map into a dual-stream detection head controller to generate a final detection feature map; and performing target detection and classification on the final detection feature map to obtain the target detection result of the image to be detected.
[0090] Furthermore, the logical instructions in the aforementioned memory 730 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0091] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the open environment target detection method provided by the above methods. The method includes: receiving an image to be detected in an open environment; performing scene feature analysis on the image to be detected to obtain a scene complexity index and the proportion of target objects of a preset size; determining an activated target network based on the scene complexity index and the proportion of target objects of the preset size; extracting features from the image to be detected based on the target network and performing feature fusion to generate an adaptive scene feature map; inputting the adaptive scene feature map into a dual-stream detection head controller to generate a final detection feature map; and performing target detection and classification on the final detection feature map to obtain the target detection result of the image to be detected.
[0092] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the open environment target detection method provided by the above methods. The method includes: receiving an image to be detected in an open environment; performing scene feature analysis on the image to be detected to obtain a scene complexity index and the proportion of target objects conforming to a preset size; determining an activated target network based on the scene complexity index and the proportion of target objects conforming to the preset size; extracting features from the image to be detected based on the target network and performing feature fusion to generate an adaptive scene feature map; inputting the adaptive scene feature map into a dual-stream detection head controller to generate a final detection feature map; and performing target detection and classification on the final detection feature map to obtain the target detection result of the image to be detected.
[0093] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0094] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0095] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A target detection method in an open environment, characterized in that, include: Receive images to be detected in an open environment; Scene feature analysis is performed on the image to be detected to obtain scene complexity index and the proportion of target objects that meet the preset size; The activated target network is determined based on the scene complexity index and the proportion of target objects that meet the preset size. Based on the target network, feature extraction and feature fusion are performed on the image to be detected to generate an adaptive scene feature map; The adaptive scene feature map is input into the dual-stream detection head controller to generate the final detection feature map; The final detection feature map is then subjected to target detection and classification to obtain the target detection result of the image to be detected.
2. The method according to claim 1, characterized in that, The step of performing scene feature analysis on the image to be detected to obtain scene complexity indicators and the proportion of target objects conforming to a preset size includes: Scene feature analysis is performed on the image to be detected to obtain the texture richness, target occlusion degree and background clutter of the image to be detected; Based on the texture richness, target occlusion degree, and background clutter, the scene complexity index and the proportion of target objects that meet the preset size are calculated.
3. The method according to claim 1 or 2, characterized in that, The target network includes a general expert network, a context-aware expert network, and a detail-enhancing expert network; The general expert network remains active while performing target detection on the image to be detected. The step of determining the activated target network based on the scene complexity index and the proportion of target objects conforming to a preset size includes: When the scene complexity index is greater than the first threshold, the context-aware expert network is activated. When the proportion of the target object that meets the preset size is greater than the second threshold, the detail enhancement expert network is activated.
4. The method according to claim 3, characterized in that, The step of extracting and fusing features from the image to be detected based on the target network to generate an adaptive scene feature map includes: The basic features of the image to be detected are output based on the general expert network. Based on the detail enhancement expert network, the network outputs detail enhancement features in the image to be detected that are related to the target object that meets the preset size. The context-aware expert network outputs adaptive contextual features of occluded or truncated targets in the image to be detected, wherein the adaptive contextual features are extracted based on pyramid pooling and channel attention mechanisms. The basic features, detail enhancement features, and adaptive context features are weighted and fused to generate an adaptive scene feature map.
5. The method according to claim 4, characterized in that, The dual-stream detection head controller includes a basic route, an enhanced route, and a route controller; The step of inputting the adaptive scene feature map into the dual-stream detection head controller to generate the final detection feature map includes: The adaptive scene feature map is input into the dual-stream detection head controller, a basic feature map is generated through the basic route, an enhanced feature map is generated through the enhanced route, and an energy index is calculated through the route controller; Decision coefficients are generated based on the energy index; The base feature map and the enhanced feature map are weighted and fused based on the decision coefficients to generate the final detection feature map.
6. The method according to claim 5, characterized in that, The step of performing target detection and classification on the final detection feature map to obtain the target detection result of the image to be detected includes: The final detected feature map contains the target's location information, confidence level, and category label. The target detection result of the image to be detected is determined based on the target location information, confidence level, and category label.
7. An open-environment target detection device, characterized in that, include: The receiving module is used to receive images to be detected in an open environment; The analysis module is used to perform scene feature analysis on the image to be detected, and obtain scene complexity index and the proportion of target objects that meet the preset size. The determination module is used to determine the activated target network based on the scene complexity index and the proportion of the target objects that meet the preset size. The generation module is used to extract features from the image to be detected based on the target network and perform feature fusion to generate an adaptive scene feature map; The generation module is used to input the adaptive scene feature map into the dual-stream detection head controller to generate the final detection feature map; The detection module is used to perform target detection and classification on the final detection feature map to obtain the target detection result of the image to be detected.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the open environment target detection method as described in any one of claims 1 to 6.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the open environment target detection method as described in any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the open environment target detection method as described in any one of claims 1 to 6.