Obstacle detection method, device, electronic device and storage medium
By combining the feature extraction network of the EfficientViT and FasterNet modules and the feature fusion network of the refined convolutional layer, the problem of insufficient real-time performance and accuracy of obstacle detection in complex scenes in the existing technology is solved, and more efficient obstacle detection is achieved. Effect.
Patent Information
- Application Number
- CN202411026123.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-30
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2044-07-30
AI Technical Summary
Existing obstacle detection methods have insufficient real-time performance and accuracy in scenarios with complex light conditions, diverse types of obstacles, and unclear contrast between obstacles and the background environment, making it difficult to meet the requirements of high efficiency and high accuracy.
The feature extraction network and feature fusion network of the pre-trained obstacle detection model are used to extract features through the combination of EfficientViT module and FasterNet module, and the refined convolution layer (RefineConv convolution layer) is used in the feature fusion network for processing to improve the model Feature extraction efficiency and accuracy.
It improves the real-time and accuracy of obstacle detection, enhances the adaptability to complex and changeable scenes, and can more effectively identify and locate obstacles.
Smart Images

Figure CN118552860B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to an obstacle detection method, device, electronic equipment and storage medium. Background Art
[0002] Obstacle detection has been increasingly widely used. Through obstacle detection, artificial intelligence robots can effectively identify and avoid various obstacles to ensure the continuity and safety of robot operations.
[0003] Computer vision technology is usually used in the existing technology for obstacle detection. However, for applicable scenarios with complex lighting conditions, various obstacle types, and unclear contrast between obstacles and the background environment, such as greenhouses, when using existing obstacle detection methods to handle such complex applicable scenarios, there are usually problems with insufficient real-time and accuracy, and it is difficult to meet the requirements of high efficiency and high precision of obstacle detection. Summary of the invention
[0004] The present invention provides an obstacle detection method, device, electronic device and storage medium to improve the real-time and accuracy of obstacle detection and improve the adaptability of obstacle detection to complex and changeable application scenarios.
[0005] In a first aspect, an embodiment of the present invention provides an obstacle detection method, the method comprising:
[0006] Acquire the image to be detected in real time;
[0007] Extracting features of the image to be detected by using a feature extraction network of a pre-trained obstacle detection model to obtain an intermediate image;
[0008] The intermediate image is processed through the refined convolution layer in the feature fusion network of the obstacle detection model to obtain an obstacle detection result matching the image to be detected.
[0009] In a second aspect, an embodiment of the present invention further provides an obstacle detection device, the device comprising:
[0010] The image acquisition module to be detected is used to acquire the image to be detected in real time;
[0011] A feature extraction module, used to extract features from the image to be detected by using a feature extraction network of a pre-trained obstacle detection model to obtain an intermediate image;
[0012] The obstacle detection result determination module is used to process the intermediate image through the refined convolution layer in the feature fusion network of the obstacle detection model to obtain an obstacle detection result matching the image to be detected.
[0013] In a third aspect, an embodiment of the present invention further provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, an obstacle detection method as described in any one of the embodiments of the present invention is implemented.
[0014] In a fourth aspect, an embodiment of the present invention further provides a storage medium storing computer executable instructions, wherein the computer executable instructions, when executed by a computer processor, are used to execute the obstacle detection method as described in any one of the embodiments of the present invention.
[0015] The technical solution of the embodiment of the present invention extracts features from the image to be detected acquired in real time through the feature extraction network of the obstacle detection model to obtain an intermediate image, and processes the intermediate image through a feature fusion network including a refined convolution layer to obtain an obstacle detection result. The present invention solves the problem of insufficient real-time and accuracy of the obstacle detection method in the prior art when dealing with complex applicable scenes such as complex lighting conditions, various obstacle types, and unclear contrast between obstacles and background environments, thereby improving the real-time and accuracy of obstacle detection and the adaptability of obstacle detection to complex and changeable applicable scenes.
[0016] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0018] Figure 1 is a flow chart of an obstacle detection method provided in Embodiment 1 of the present invention;
[0019] Figure 2 is a structural schematic diagram of an obstacle detection model provided in Embodiment 1 of the present invention;
[0020] Figure 3 1 is a schematic diagram of the structure of a feature extraction network of an obstacle detection model provided in the first embodiment of the present invention;
[0021] Figure 4 It is a schematic diagram of the structure of a refined convolutional layer provided in the first embodiment of the present invention;
[0022] Figure 5 is a structural schematic diagram of an obstacle detection device provided in Embodiment 2 of the present invention;
[0023] Figure 6 It is a structural schematic diagram of an electronic device provided in Embodiment 3 of the present invention. DETAILED DESCRIPTION
[0024] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0025] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices. In the embodiments of the present application, some existing solutions in the industry such as certain software, components, models, etc. may be mentioned, and they should be considered as exemplary, and their purpose is only to illustrate the feasibility of the implementation of the technical solution of the present application, but it does not mean that the applicant has or must use the solution.
[0026] The acquisition, transmission, storage, use, and processing of data in the technical solution of this application comply with the relevant provisions of national laws and regulations.
[0027] Embodiment 1
[0028] Figure 1 A flowchart of an obstacle detection method is provided for the first embodiment of the present invention. This embodiment is applicable to the situation where obstacle detection is performed in complex applicable scenarios such as complex lighting conditions, various obstacle types, and unclear contrast between obstacles and background environments. The method can be executed by an obstacle detection device, which can be implemented in the form of hardware and / or software. The obstacle detection device can be configured in a server and used in conjunction with an artificial intelligence robot, and can also be directly configured in the artificial intelligence robot, wherein the artificial intelligence robot is also configured with a shooting device.
[0029] like Figure 1 As shown, the method includes:
[0030] S110, acquiring the image to be detected in real time.
[0031] The image to be detected is an image acquired in real time by a shooting device, and can be an image obtained by real-time shooting at a set shooting frequency, or a frame of image in a recorded video.
[0032] The image to be detected in this embodiment can be an image obtained by a shooting device shooting the current environment. Typically, the current environment can be a complex environment such as a greenhouse with facilities: the light in the greenhouse is complex, the types of obstacles are various (including crops, tools, other mechanical equipment, etc.), and the contrast between obstacles and the environmental background is not obvious. Complex application scenarios put forward higher requirements on the real-time and accuracy of obstacle detection. The technical solution of this embodiment has good applicability to the above and similar complex application scenarios.
[0033] In this embodiment, the number of image channels of the image to be detected may be 3. For example, the image to be detected may be 640 640 3 images, of which 640 640 represents the resolution of the image to be detected, that is, the width of the image to be detected is 640 pixels, and the height is also 640 pixels, and 3 represents the number of channels of the image to be detected is 3. However, this embodiment does not limit the resolution and the number of channels of the image to be processed.
[0034] S120 , extracting features from the image to be detected by using a feature extraction network of a pre-trained obstacle detection model to obtain an intermediate image.
[0035] The obstacle detection model can be obtained by training an improved YOLOv8 model through sample images, in which the convolution layer of the feature fusion network is replaced by a refinement convolution layer, namely, a RefineConv convolution layer (hereinafter, the refinement convolution layer is represented by the RefineConv convolution layer). The feature extraction network is used to extract image features in the image to be detected, and the intermediate image is a feature image obtained after the feature extraction network performs feature extraction processing on the image to be detected.
[0036] Furthermore, the feature extraction network includes an EfficientViT module and a FasterNet module; the EfficientViT module includes a multi-scale attention module (hereinafter the multi-scale attention module is represented by the EfficientViT module), and the FasterNet module includes a local convolution layer (hereinafter the local convolution layer is represented by the FasterNet module); wherein a feature processing module is set before the EfficientViT module, and a feature processing module is set before the FasterNet module.
[0037] This embodiment improves the structure of the feature extraction network of the YOLOv8 model, and forms a feature extraction network by combining the EfficientViT module and the FasterNet module, and a feature processing module is set before each EfficientViT module and FasterNet module. The EfficientViT module can achieve global receptive field and multi-scale learning while maintaining efficient operation through the lightweight, multi-scale linear attention mechanism of the multi-scale attention module. The FasterNet module realizes a fast and effective network structure through a simple and efficient local convolution layer (PConv convolution layer).
[0038] This embodiment can effectively improve the model's feature extraction efficiency and accuracy by combining the high-speed feature extraction capability of the FasterNet module and the deep visual perception of the EfficientViT module. By adding a feature processing module, it can optimize feature preprocessing and enhance the model's ability to handle complex scenes. At the same time, the FasterNet module and the EfficientViT module are combined to optimize the feature extraction network. Compared with a single FasterNet module or a single EfficientViT module, it can better handle changing environments and obstacle types, provide higher information processing capabilities and complexity management, and effectively avoid the problems of difficulty in convergence and decreased accuracy caused by simply increasing the depth of the model.
[0039] Figure 2 A structural diagram of an obstacle detection model is provided, such as Figure 2 As shown in the figure, the feature extraction network of the YOLOv8 model is replaced by a combination of the EfficientViT module and the FasterNet module, and a feature processing module is set before each EfficientViT module and FasterNet module. The feature processing module can be an embedding layer or a merging layer. The convolution layer in the feature fusion module is replaced by the RefineConv convolution layer.
[0040] Figure 3A structural diagram of the feature extraction network of an obstacle detection model is provided, such as Figure 3 As shown in the figure, the feature extraction network contains two FasterNet modules and two EfficientViT modules. An embedding layer is set before the first FasterNet module, a merging layer is set before the second FasterNet module, a merging layer and a moving inverted bottleneck convolution layer (MBConv convolution layer) are set before the first EfficientViT module, and a merging layer and an MBConv convolution layer are set before the second EfficientViT module. l1-l4 represent different hierarchical structures (Layers). l1 represents the first layer in the first stage, usually the input layer, responsible for preliminary processing of the input image; l2 represents the second layer in the second stage, usually the layer processed by the FasterNet module, responsible for extracting more complex features; l3 represents the third layer in the third stage, usually the layer processed by the MBConv convolution layer, further optimizing the feature representation; l4 represents the fourth layer in the fourth stage, usually the last processing layer, responsible for generating feature maps. C1-C4 represent the number of channels of the image after each stage of processing.
[0041] Furthermore, the number of floating-point operations of the FasterNet module and the EfficientViT module can be expressed by the following formula: ; Where h and w represent the height and width of the input image of the FasterNet module and the EfficientViT module, respectively, c represents the number of channels, and k represents the size of the convolution kernel.
[0042] Furthermore, S120 may include:
[0043] A1. Processing the image to be detected through the embedding layer and the first layer FasterNet module, as well as the merging layer and the second layer FasterNet module in the feature extraction network of the obstacle detection model to obtain a first intermediate image;
[0044] A2, processing the first intermediate image through a merging layer, a moving inverted bottleneck convolution layer, and a first layer of EfficientViT module in a feature extraction network to obtain a second intermediate image;
[0045] A3. Process the second intermediate image through the merging layer, the moving inverted bottleneck convolution layer and the second layer EfficientViT module in the feature extraction network to obtain a third intermediate image.
[0046] like Figure 2 As shown in the figure, the feature extraction network is divided into four stages when extracting features from the image to be detected: the first stage, 640 640 3 is processed by the embedding layer and the first layer FasterNet module; in the second stage, the image processed by the first layer FasterNet module is processed by the merging layer and the second layer FasterNet module to obtain the first intermediate image P3; in the third stage, the first intermediate image is processed by the merging layer, the MBConv convolution layer and the first layer EfficientViT module to obtain the second intermediate image P4; in the fourth stage, the second intermediate image is processed by the merging layer, the MBConv convolution layer and the second layer EfficientViT module to obtain the third intermediate image P5. The first intermediate image, the second intermediate image and the third intermediate image are used as the output of the feature extraction network.
[0047] S130: Process the intermediate image through the feature fusion network of the obstacle detection model to obtain an obstacle detection result that matches the image to be detected.
[0048] The convolution layer in the feature fusion network is a refinement convolution layer. The refinement convolution layer is also called RefineConv convolution layer. Figure 2 As shown in Figure 2, the convolutional layer in the feature fusion network is replaced by the RefineConv convolutional layer.
[0049] In this embodiment, the role of introducing the RefineConv convolutional layer into the feature fusion network is to further reduce the complexity of the model and the consumption of computing resources, improve the detection accuracy, make the model more robust, and optimize the feature extraction capability of the model in complex environments.
[0050] Furthermore, the number of floating-point operations of the RefineConv convolutional layer is expressed by the following formula: ; Where n represents the number of channels of the input image of the RefineConv convolutional layer, h' and w' are the height and width of the output image of the RefineConv convolutional layer, c is the number of input channels, k is the convolution kernel size, Represents a coefficient that is dynamically adjusted based on feature complexity.
[0051] Furthermore, the refining convolution layer includes a dynamic adjustment module and a local response enhancement module; the dynamic adjustment module is used to determine the feature processing depth according to the image features of the input image of the refining convolution layer; the local response enhancement module is used to perform local response normalization processing and small-scale feature extraction processing on the input image of the refining convolution layer.
[0052] Among them, feature processing depth refers to the number of convolution kernels. Each convolution kernel can extract a specific feature of the input image. Through the action of different convolution kernels, different types of features can be extracted from the input image. The number of types of extracted image features corresponds to the feature processing depth. Local response normalization (LRN) is a method of normalizing the output of the convolution layer, which can enhance the generalization and robustness of the model. Small-scale feature extraction refers to the use of convolution operations to extract feature information in local, small areas from the input image. Small-scale features can include edges, corners, textures, etc. Small-scale features are the basis for more complex, macroscopic features. By continuously extracting and combining small-scale features, higher-level feature representations can be gradually learned.
[0053] Figure 4 A structural diagram of a refined convolutional layer is provided, such as Figure 4 As shown in Figure 1, the input features are the image features of the input image of the RefineConv convolution layer, and the output features are the image features of the output image of the RefineConv convolution layer. The dynamic adjustment module and the local response enhancement module process the image features of the input image respectively, and then process them through the merging layer to obtain the output features. The dynamic adjustment module and the local response enhancement module are both processed by 1 1 convolution is performed.
[0054] In this embodiment, the dynamic adjustment module can determine the complexity of the image features of each input image of the RefineConv convolution layer, and dynamically adjust the feature processing depth according to the complexity of the image features of different input images. Further, the complexity of the image features of the input image can be expressed by the following aspects: spatial dimension, such as the height, width, number of channels, etc. of the input image; feature diversity, that is, different types of features or feature combinations; feature correlation, that is, the relationship and degree of dependence between image features; feature distribution, that is, the distribution of the eigenvalues of image features, whether there is a trend of concentration or dispersion, etc.; detail level, the richness of the detail information contained in the image features. The local response enhancement module can enhance the expression ability of local features through local response normalization processing and small-scale feature extraction processing. The RefineConv convolution layer effectively reduces the computational burden of the model by combining the dynamic adjustment module and the local response enhancement module, while maintaining the expression ability required to process complex data, so that the model can reduce the consumption of computing resources while ensuring performance. The RefineConv convolution layer pays more attention to details in feature processing depth adjustment and local response enhancement, and can extract obstacle features more accurately in complex environments.
[0055] Furthermore, the calculation formula for each input channel of the refined convolutional layer is: ;in, is the output image of the refined convolutional layer, is the convolution kernel parameter of the g-th group, The first The input value of the channel, G is based on Dynamically adjusted number of groups, It represents the coefficient dynamically adjusted based on the feature complexity, J is the height of the convolution kernel, and K is the width of the convolution kernel.
[0056] Furthermore, S130 may include:
[0057] B1. Processing the third intermediate image through a spatial pyramid pooling layer, a convolution layer, and an upsampling layer in a feature fusion network, and splicing the processed image with the second intermediate image;
[0058] B2. Processing the image after being spliced with the second intermediate image through the refinement convolution layer, the convolution layer, and the upsampling layer in the feature fusion network, and splicing the processed image with the first intermediate image;
[0059] B3, processing the image concatenated with the first intermediate image through a refining convolution layer to obtain a first output feature map;
[0060] B4, processing the first output feature map through a refinement convolution layer, and merging the processed image and the image obtained by splicing the refined convolution layer with the second intermediate image for the first time;
[0061] B5. Process the image after the first merging through the refining convolution layer to obtain the second output feature map;
[0062] B6. Processing the second output feature map through a refining convolution layer, and merging the processed image with the image obtained by processing the third intermediate image through a spatial pyramid pooling layer for a second time;
[0063] B7. Process the image after the second merge through the refinement convolution layer to obtain the third output feature map.
[0064] like Figure 2As shown, after the third intermediate image is processed by the spatial pyramid pooling layer, the information is compressed by the convolution layer. The information compression of the convolution layer can further improve the efficiency of information processing, help restore spatial resolution and capture more details, so as to accurately locate obstacles. After compression, it is processed by the upsampling layer and then concat operation is performed with the second intermediate image, that is, splicing operation. The concat operation helps to fuse feature information at different levels, so as to improve the accuracy of obstacle detection. After the concat operation, it is processed by the RefineConv convolution layer, and then the information is compressed by the convolution layer and processed by the upsampling layer, and then concat operation is performed with the first intermediate image. After the concat operation, it is processed by the RefineConv convolution layer to obtain the first output feature map P3' (80 80). The first output feature map is then processed by the RefineConv convolution layer and the ADD operation is performed with the image after the first RefineConv convolution layer processing, that is, the merging operation. The ADD operation can merge feature maps from different paths and effectively make up for possible lost information. After the ADD operation, it is processed by the RefineConv convolution layer again to obtain the second output feature map P4' (40 40). The second output feature map is then processed by the RefineConv convolution layer, and the ADD operation is performed with the image processed by the spatial pyramid pooling layer, and finally processed by the RefineConv convolution layer to obtain the third output feature map P5' (20 20). The first output feature map, the second output feature map, and the third output feature map, as outputs of the obstacle detection model, can provide detailed information such as the location and category probability of the obstacle, thereby achieving accurate identification and positioning of the obstacle.
[0065] The above embodiment describes the process of obtaining obstacle detection results by processing the image to be detected through the obstacle detection model. This embodiment also provides a training process of the obstacle detection model:
[0066] C1. Determine the sample image;
[0067] C2. Training the improved YOLOv8 model using the sample images;
[0068] Specifically, the feature extraction network in the improved YOLOv8 model is replaced by a combination of the EfficientViT module and the FasterNet module, and a feature processing module is set before each EfficientViT module and FasterNet module. The feature processing module can be an embedding layer or a merging layer. The convolution layer in the feature fusion module is replaced by the RefineConv convolution layer.
[0069] C3. Determine the model loss of the YOLOv8 model through the loss function, adjust the model parameters, and repeat C2-C3 until the model loss meets the requirements.
[0070] Among them, in order to better adapt to complex applicable scenarios, when determining the sample image, a simulated applicable scenario can be built, obstacles of different materials, sizes and colors can be set at different positions and heights, and different lighting conditions can be simulated to enhance the robustness of the model to different environmental conditions.
[0071] Table 1 provides a schematic diagram of model training parameters, but this embodiment does not limit the setting of model training parameters.
[0072] Table 1
[0073]
[0074] The obstacle detection model trained based on the improved YOLOv8 model has significantly improved recall and accuracy, and has a smaller number of parameters, lower computational complexity, and faster model inference speed, and can better handle obstacle detection in changing environments and obstacle types.
[0075] Furthermore, the loss function in the training process of the obstacle detection model is expressed by the following formula:
[0076] ;
[0077] ;
[0078] Among them, IoU is the intersection area of the predicted box and the true box divided by the union area of the predicted box and the true box, and γ is a parameter that controls the degree of outlier suppression. is the IoU loss, is the distance loss, is the aspect ratio loss, ρ(·) is the Euclidean distance between the two, and b is Respectively represent the center point positions of the predicted box and the real box, and Represent the width and height of the minimum bounding box covering the predicted box and the real box, w and Respectively represent the width of the predicted box and the width of the real box, h and Represent the height of the predicted box and the true box respectively.
[0079] in, Usually used to measure the similarity between the predicted box and the real box. , A and B represent the predicted box and the true box respectively. The square of the Euclidean distance between the center point of the predicted box and the true box is divided by the square of the size of the minimum enclosing rectangle to enhance the accuracy of the model when regressing the predicted box position. By minimizing the difference in width and height between the predicted box and the target box, the model is forced to learn a more accurate bounding box shape.
[0080] In this embodiment, Divide into , as well as , can more comprehensively evaluate the geometric difference between the prediction box and the target box, and directly optimize the size of the prediction box to make it closer to the target box, thereby achieving faster convergence speed and better positioning effect. Reweighting can make More focus on higher quality frames.
[0081] In this embodiment, by As the loss function during YOLOv8 model training, it can enhance the position accuracy of the model in the bounding box regression stage, allowing the model to converge quickly during the training process. When faced with complex and changeable obstacle detection scenarios, it can not only effectively deal with the problem of category imbalance, but also ensure high-quality output of bounding box regression, thereby enhancing the overall accuracy and robustness of the model.
[0082] The technical solution of the embodiment of the present invention extracts features from the image to be detected acquired in real time through the feature extraction network of the obstacle detection model to obtain an intermediate image, and processes the intermediate image through a feature fusion network including a refined convolution layer to obtain an obstacle detection result. The present invention solves the problem of insufficient real-time and accuracy of the obstacle detection method in the prior art when dealing with complex applicable scenes such as complex lighting conditions, various obstacle types, and unclear contrast between obstacles and background environments, thereby improving the real-time and accuracy of obstacle detection and the adaptability of obstacle detection to complex and changeable applicable scenes.
[0083] Embodiment 2
[0084] Figure 5 FIG. 1 is a schematic diagram of the structure of an obstacle detection device provided in Embodiment 2 of the present invention. Figure 5 As shown, the device includes: an image acquisition module 210 to be detected, a feature extraction module 220 and an obstacle detection result determination module 230. Among them:
[0085] The image acquisition module 210 is used to acquire the image to be detected in real time;
[0086] A feature extraction module 220, configured to extract features from the image to be detected by using a feature extraction network of a pre-trained obstacle detection model to obtain an intermediate image;
[0087] The obstacle detection result determination module 230 is used to process the intermediate image through the feature fusion network of the obstacle detection model to obtain an obstacle detection result matching the image to be detected;
[0088] Among them, the convolution layer in the feature fusion network is a refined convolution layer.
[0089] The technical solution of the embodiment of the present invention extracts features from the image to be detected acquired in real time through the feature extraction network of the obstacle detection model to obtain an intermediate image, and processes the intermediate image through a feature fusion network including a refined convolution layer to obtain an obstacle detection result. The present invention solves the problem of insufficient real-time and accuracy of the obstacle detection method in the prior art when dealing with complex applicable scenes such as complex lighting conditions, various obstacle types, and unclear contrast between obstacles and background environments, thereby improving the real-time and accuracy of obstacle detection and the adaptability of obstacle detection to complex and changeable applicable scenes.
[0090] Based on the above embodiment, the refined convolution layer includes a dynamic adjustment module and a local response enhancement module;
[0091] The dynamic adjustment module is used to determine the feature processing depth according to the image features of the input image of the refining convolution layer;
[0092] The local response enhancement module is used to perform local response normalization processing and small-scale feature extraction processing on the input image of the refined convolution layer.
[0093] Based on the above embodiment, the calculation formula for each input channel of the refined convolutional layer is:
[0094] ;
[0095] in, is the output image of the refined convolutional layer, is the convolution kernel parameter of the g-th group, The first The input value of the channel, G is based on Dynamically adjusted number of groups, It represents the coefficient dynamically adjusted based on the feature complexity, J is the height of the convolution kernel, and K is the width of the convolution kernel.
[0096] Based on the above embodiment, the feature extraction network includes an EfficientViT module and a FasterNet module;
[0097] The EfficientViT module includes a multi-scale attention module, and the FasterNet module includes a local convolutional layer;
[0098] Among them, a feature processing module is set before the EfficientViT module, and a feature processing module is set before the FasterNet module.
[0099] Based on the above embodiment, the feature extraction module 220 includes:
[0100] A first intermediate image determining unit, configured to process the image to be detected through an embedding layer and a first layer FasterNet module, and a merging layer and a second layer FasterNet module in a feature extraction network of an obstacle detection model to obtain a first intermediate image;
[0101] a second intermediate image determining unit, configured to process the first intermediate image through a merging layer, a moving inverted bottleneck convolution layer, and a first layer of an EfficientViT module in a feature extraction network to obtain a second intermediate image;
[0102] The third intermediate image determination unit is used to process the second intermediate image through the merging layer, the moving inverted bottleneck convolution layer and the second layer EfficientViT module in the feature extraction network to obtain the third intermediate image.
[0103] Based on the above embodiment, the obstacle detection result determination module 230 includes:
[0104] A first splicing unit is used to process the third intermediate image through a spatial pyramid pooling layer, a convolution layer, and an upsampling layer in a feature fusion network, and splice the processed image with the second intermediate image;
[0105] A first refining convolution layer processing unit, used to process the image after being spliced with the second intermediate image through the refining convolution layer, the convolution layer and the upsampling layer in the feature fusion network, and splice the processed image with the first intermediate image;
[0106] A second refining convolutional layer processing unit, used to process the image after being spliced with the first intermediate image through a refining convolutional layer to obtain a first output feature map;
[0107] a third refining convolutional layer processing unit, configured to process the first output feature map through the refining convolutional layer, and to merge for the first time the processed image and the image obtained by processing the image obtained by splicing the refined convolutional layer with the second intermediate image;
[0108] A fourth refining convolutional layer processing unit, used for processing the image after the first merging through a refining convolutional layer to obtain a second output feature map;
[0109] a fifth refining convolutional layer processing unit, configured to process the second output feature map through the refining convolutional layer, and merge the processed image with the image obtained by processing the third intermediate image by the spatial pyramid pooling layer for a second time;
[0110] The sixth refining convolutional layer processing unit is used to process the image after the second merging through the refining convolutional layer to obtain a third output feature map.
[0111] Based on the above embodiment, the loss function in the training process of the obstacle detection model is expressed by the following formula:
[0112] ;
[0113] ;
[0114] Among them, IoU is the intersection area of the predicted box and the true box divided by the union area of the predicted box and the true box, and γ is a parameter that controls the degree of outlier suppression. is the IoU loss, is the distance loss, is the aspect ratio loss, ρ(·) is the Euclidean distance between the two, and b is Respectively represent the center point positions of the predicted box and the real box, and Represent the width and height of the minimum bounding box covering the predicted box and the real box, w and Respectively represent the width of the predicted box and the width of the real box, h and Represent the height of the predicted box and the true box respectively.
[0115] The obstacle detection device provided in the embodiment of the present invention can execute the obstacle detection method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0116] Embodiment 3
[0117] Figure 6A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0118] like Figure 6 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. The input / output (I / O) interface 15 is also connected to the bus 14.
[0119] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0120] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 performs the various methods and processes described above, such as the obstacle detection method.
[0121] In some embodiments, the obstacle detection method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the obstacle detection method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the obstacle detection method in any other appropriate manner (e.g., by means of firmware).
[0122] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0123] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0124] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, device, or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0125] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0126] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0127] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0128] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0129] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. An obstacle detection method, characterized in that: include: Acquire the image to be detected in real time; Extracting features of the image to be detected by using a feature extraction network of a pre-trained obstacle detection model to obtain an intermediate image; The feature extraction network includes an EfficientViT module and a FasterNet module; The EfficientViT module includes a multi-scale attention module, and the FasterNet module includes a local convolutional layer; Wherein, a feature processing module is set before the EfficientViT module, and a feature processing module is set before the FasterNet module; The feature extraction network of the obstacle detection model obtained by pre-training is used to extract features from the image to be detected to obtain an intermediate image, including: The image to be detected is processed by an embedding layer and a first-layer FasterNet module, and a merging layer and a second-layer FasterNet module in a feature extraction network of an obstacle detection model to obtain a first intermediate image; Processing the first intermediate image through a merging layer, a moving inverted bottleneck convolution layer, and a first layer of EfficientViT module in a feature extraction network to obtain a second intermediate image; Processing the second intermediate image through a merging layer, a moving inverted bottleneck convolution layer, and a second layer of EfficientViT module in a feature extraction network to obtain a third intermediate image; Processing the intermediate image through a feature fusion network of the obstacle detection model to obtain an obstacle detection result matching the image to be detected; Wherein, the convolution layer in the feature fusion network is a refined convolution layer; The intermediate image is processed by the feature fusion network of the obstacle detection model to obtain an obstacle detection result matching the image to be detected, including: Processing the third intermediate image through a spatial pyramid pooling layer, a convolution layer, and an upsampling layer in a feature fusion network, and splicing the processed image with the second intermediate image; Processing the image after being spliced with the second intermediate image through the refinement convolution layer, the convolution layer, and the upsampling layer in the feature fusion network, and splicing the processed image with the first intermediate image; Processing the image concatenated with the first intermediate image through a refining convolution layer to obtain a first output feature map; The first output feature map is processed by a refinement convolution layer, and the processed image and the image obtained by splicing the refined convolution layer with the second intermediate image are first merged; The image after the first merge is processed through a refinement convolution layer to obtain a second output feature map; Processing the second output feature map through a refining convolution layer, and merging the processed image with the image obtained by processing the third intermediate image through a spatial pyramid pooling layer for a second time; The image after the second merge is processed by the refinement convolution layer to obtain the third output feature map.
2. The method according to claim 1, characterized in that The refined convolution layer includes a dynamic adjustment module and a local response enhancement module; The dynamic adjustment module is used to determine the feature processing depth according to the image features of the input image of the refining convolution layer; The local response enhancement module is used to perform local response normalization processing and small-scale feature extraction processing on the input image of the refined convolution layer.
3. The method according to claim 1, characterized in that: The calculation formula for each input channel of the refined convolutional layer is: ; in, is the output image of the refined convolutional layer, is the convolution kernel parameter of the g-th group, The first The input value of the channel, G is based on Dynamically adjusted number of groups, It represents the coefficient dynamically adjusted based on the feature complexity, J is the height of the convolution kernel, and K is the width of the convolution kernel.
4. The method according to claim 1, characterized in that: The loss function during the training process of the obstacle detection model is expressed by the following formula: ; ; Among them, IoU is the intersection area of the predicted box and the true box divided by the union area of the predicted box and the true box, and γ is a parameter that controls the degree of outlier suppression. is the IoU loss, is the distance loss, is the aspect ratio loss, ρ(·) is the Euclidean distance between the two, and b is Respectively represent the center point positions of the predicted box and the real box, and Represent the width and height of the minimum bounding box covering the predicted box and the real box, w and Respectively represent the width of the predicted box and the width of the real box, h and Represent the height of the predicted box and the true box respectively.
5. An obstacle detection device, characterized in that: include: The image acquisition module to be detected is used to acquire the image to be detected in real time; A feature extraction module, used to extract features from the image to be detected by using a feature extraction network of a pre-trained obstacle detection model to obtain an intermediate image; The feature extraction network includes an EfficientViT module and a FasterNet module; The EfficientViT module includes a multi-scale attention module, and the FasterNet module includes a local convolutional layer; Wherein, a feature processing module is set before the EfficientViT module, and a feature processing module is set before the FasterNet module; Feature extraction module, including: A first intermediate image determining unit, configured to process the image to be detected through an embedding layer and a first layer FasterNet module, and a merging layer and a second layer FasterNet module in a feature extraction network of an obstacle detection model to obtain a first intermediate image; a second intermediate image determining unit, configured to process the first intermediate image through a merging layer, a moving inverted bottleneck convolution layer, and a first layer of an EfficientViT module in a feature extraction network to obtain a second intermediate image; a third intermediate image determining unit, configured to process the second intermediate image through a merging layer, a moving inverted bottleneck convolution layer, and a second layer of an EfficientViT module in a feature extraction network to obtain a third intermediate image; An obstacle detection result determination module is used to process the intermediate image through a refined convolution layer in a feature fusion network of the obstacle detection model to obtain an obstacle detection result matching the image to be detected; Wherein, the convolution layer in the feature fusion network is a refined convolution layer; The obstacle detection result determination module includes: A first splicing unit is used to process the third intermediate image through a spatial pyramid pooling layer, a convolution layer, and an upsampling layer in a feature fusion network, and splice the processed image with the second intermediate image; A first refining convolution layer processing unit, used to process the image after being spliced with the second intermediate image through the refining convolution layer, the convolution layer and the upsampling layer in the feature fusion network, and splice the processed image with the first intermediate image; A second refining convolutional layer processing unit, used to process the image after being spliced with the first intermediate image through a refining convolutional layer to obtain a first output feature map; a third refining convolutional layer processing unit, configured to process the first output feature map through the refining convolutional layer, and to merge for the first time the processed image and the image obtained by processing the image obtained by splicing the refined convolutional layer with the second intermediate image; A fourth refining convolutional layer processing unit, used for processing the image after the first merging through a refining convolutional layer to obtain a second output feature map; a fifth refining convolutional layer processing unit, configured to process the second output feature map through the refining convolutional layer, and merge the processed image with the image obtained by processing the third intermediate image by the spatial pyramid pooling layer for a second time; The sixth refining convolutional layer processing unit is used to process the image after the second merging through the refining convolutional layer to obtain a third output feature map.
6. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the obstacle detection method as described in any one of claims 1 to 4 is implemented.
7. A storage medium storing computer executable instructions, characterized in that: The computer executable instructions are used to perform the obstacle detection method as described in any one of claims 1 to 4 when executed by a computer processor.
Citation Information
Patent Citations
Rail transit train obstacle detection method based on convolutional neural network
CN114973199A
Acquisition method and classification method of flow cytometry classification model and related equipment
CN117392672A
