Object detection method and related device thereof
By introducing the target model in the target detection method, multi -layered feature extraction, fusion, and enhancement of the target image solve the problem of low accuracy of object location information in the existing technology, and achieve more accurate target testing.
Patent Information
- Application Number
- PCT/CN2024/107500
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-07-27
- Filing Date
- 2024-07-25
- Publication Date
- 2025-01-30
AI Technical Summary
The existing target detection methods are single considerations when locating objects, resulting in low accuracy of object position information and cannot accurately complete target detection.
Through the target model, the target image is extracted by multi -layered features, and the feature fusion and enhancement are performed. Finally, it is detected based on the enhanced features to improve the accuracy of the location information of the object.
By considering multi -level and multi -dimensional feature information, the target model can output more accurate object location information to ensure the accuracy of target detection.
Smart Images

Figure CN2024107500_30012025_PF_FP_ABST
Abstract
Description
A target detection method and related equipment
[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office on July 27, 2023, with application number 202310940169.4 and invention name “A target detection method and related equipment”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The embodiments of the present application relate to artificial intelligence (AI) technology, and in particular to a target detection method and related equipment. Background Art
[0003] As a fundamental computer vision task, object detection is increasingly required in a growing number of scenarios. To meet user needs for object detection in various application scenarios, neural network models in the AI field can be used to complete object detection tasks. These results are then provided to users for viewing and use, improving the user experience.
[0004] In related technologies, when it is necessary to locate an object in a scene, a target image representing the scene can be obtained first and then input into a neural network model. The neural network model can then extract features from the target image, thereby obtaining features at different levels. The neural network model can then fuse the features at different levels to obtain a feature fusion result. The neural network model can then perform detection based on the feature fusion result to obtain the object's position information in the target image, which is equivalent to obtaining the object's position information in the scene.
[0005] In the above process, the neural network model directly obtains the location information of the object based on the feature fusion results, and the factors considered are relatively simple. This will result in the accuracy of the object location information finally output by the model being low, and the target detection cannot be completed accurately.
[0006] Summary of the Invention
[0007] The embodiments of the present application provide a target detection method and related equipment. During the target detection process, the factors considered are relatively comprehensive, so the position information of the object finally obtained has sufficient accuracy to accurately complete the target detection.
[0008] A first aspect of an embodiment of the present application provides a target detection method, which can be implemented using a target model. The method includes:
[0009] When target detection is required for a certain scene, the scene may be photographed first to obtain a target image for presenting the scene. The scene presented by the target image contains the object to be detected.
[0010] After obtaining the target image, it can be input into the target model. The target model can first perform feature extraction on the target image to obtain the first feature, and then further perform feature extraction on the first feature to obtain the second feature. It should be noted that the target model can extract features at multiple levels for the target image, and the first and second features can be features from adjacent levels within the multiple levels. For example, the first feature is the feature at the second-to-last level, and the second feature is the feature at the last level.
[0011] After obtaining the first and second features, the target model can perform a first fusion on the first and second features to obtain a first fusion result. After obtaining the first fusion result, the target model can use the first fusion result to enhance the first and second features, thereby obtaining enhanced first and second features. After obtaining the enhanced first and second features, the target model can use the enhanced first and second features to perform detection, thereby obtaining and outputting the position information of these objects in the target image, which is equivalent to obtaining the position of these objects in the scene.
[0012] It can be seen from the above method that the target model obtains the position information of the object in the target image based on the enhanced first feature and the enhanced second feature, wherein the enhanced first feature is obtained based on the first feature and the first fusion result, and the enhanced second feature is obtained based on the second feature and the first fusion result. The first feature and the second feature represent different local information of the target image, and the first fusion result represents the low-dimensional global information of the target image. Therefore, the target model considers more comprehensive factors in the process of target detection, so the position information of the object finally output by the target model has sufficient accuracy and can accurately complete target detection.
[0013] In one possible implementation, based on the first fusion result, the first feature and the second feature are enhanced to obtain the enhanced first feature and the enhanced second feature, including: injecting the first fusion result into the first feature to obtain the enhanced first feature, and determining the second feature as the enhanced second feature; or injecting the first fusion result into the first feature to obtain the enhanced first feature, and injecting the first fusion result into the second feature to obtain the enhanced second feature; or determining the first feature as the enhanced first feature, and injecting the first fusion result into the second feature to obtain the enhanced second feature. In the above implementation, the target model can complete data enhancement in a variety of ways: (1) Assuming that the target model only includes a data enhancement function for the first feature, the target model can inject the first fusion result into the first feature to perform data enhancement on the first feature, thereby obtaining the enhanced first feature. Since the target model does not include a data enhancement function for the second feature, the target model can directly determine the second feature as the enhanced second feature without processing the second feature. (2) Assuming that the target model includes data enhancement functions for the first feature and the second feature, the target model can inject the first fusion result into the first feature to perform data enhancement on the first feature, thereby obtaining the enhanced first feature. Similarly, the target model can also inject the first fusion result into the second feature to perform data enhancement on the second feature, thereby obtaining the enhanced second feature. (3) Assuming that the target model only includes data enhancement functions for the second feature, the target model can inject the first fusion result into the second feature to perform data enhancement on the second feature, thereby obtaining the enhanced second feature. Since the target model does not include data enhancement functions for the first feature, the target model can directly determine the first feature as the enhanced first feature without processing the first feature.
[0014] In one possible implementation, injecting the first fusion result into the first feature to obtain the enhanced first feature includes: processing the first fusion result and the first feature based on a cross-attention mechanism to obtain the enhanced first feature. In the aforementioned implementation, the target model may perform point-by-point convolution on the first feature to obtain the sixth feature. At the same time, the target model may also perform point-by-point convolution and activation function-based processing on the first fusion result to obtain the seventh feature. At the same time, the target model may also perform point-by-point convolution only on the first fusion result to obtain the eighth feature. Then, the target model may multiply the sixth feature and the seventh feature to obtain the ninth feature, and add the eighth feature and the ninth feature to obtain the tenth feature. Finally, the target model performs reparameterized convolution-based processing on the tenth feature to obtain the eleventh feature, which is the enhanced first feature.
[0015] In one possible implementation, injecting the first fusion result into the second feature to obtain the enhanced second feature includes: performing cross-attention-based processing on the first fusion result and the second feature to obtain the enhanced second feature. In the aforementioned implementation, the target model may perform point-by-point convolution on the second feature to obtain the twelfth feature. At the same time, the target model may also perform point-by-point convolution, activation function-based processing, and linear interpolation on the first fusion result to obtain the thirteenth feature. At the same time, the target model may also perform point-by-point convolution and linear interpolation only on the first fusion result to obtain the fourteenth feature. Then, the target model may multiply the twelfth feature and the thirteenth feature to obtain the fifteenth feature, and add the fourteenth feature and the fifteenth feature to obtain the sixteenth feature. Finally, the target model performs reparameterized convolution-based processing on the sixteenth feature to obtain the seventeenth feature, which is the enhanced second feature.
[0016] In one possible implementation, the method further includes: preprocessing the first feature based on the second feature to obtain a preprocessed first feature, the preprocessing comprising at least one of alignment, concatenation, or convolution; and performing cross-attention processing on the first fusion result and the first feature to obtain an enhanced first feature, comprising: performing cross-attention processing on the first fusion result and the preprocessed first feature to obtain an enhanced first feature. In the aforementioned implementation, the target model may align the second feature with the first feature to obtain an eighteenth feature, and perform pointwise convolution on the first feature to obtain a nineteenth feature. Next, the target model may concatenate the eighteenth and nineteenth features to obtain a twentieth feature. Next, the target model may perform pointwise convolution on the twentieth feature to obtain a twenty-first feature, which is the preprocessed first feature. After obtaining the preprocessed first feature, the target model may perform pointwise convolution on the preprocessed first feature to obtain a sixth feature. Simultaneously, the target model may also perform pointwise convolution and activation function-based processing on the first fusion result to obtain a seventh feature. At the same time, the target model can also perform point-by-point convolution on only the first fusion result to obtain the eighth feature. Then, the target model can multiply the sixth and seventh features to obtain the ninth feature, and add the eighth and ninth features to obtain the tenth feature. Finally, the target model performs a reparameterized convolution-based process on the tenth feature to obtain the eleventh feature, which is the enhanced first feature.
[0017] In one possible implementation, the method further includes: preprocessing the second feature based on the first feature to obtain a preprocessed second feature, where the preprocessing includes at least one of alignment, concatenation, or convolution; and performing cross-attention processing on the first fusion result and the second feature to obtain an enhanced second feature, including: performing cross-attention processing on the first fusion result and the preprocessed second feature to obtain an enhanced second feature. In the aforementioned implementation, the target model may align the first feature with the second feature to obtain a twenty-second feature, and perform pointwise convolution on the second feature to obtain a twenty-third feature. Next, the target model may concatenate the twenty-second and twenty-third features to obtain a twenty-fourth feature. Next, the target model may perform pointwise convolution on the twenty-fourth feature to obtain a twenty-fifth feature, which is the preprocessed second feature. After obtaining the preprocessed second feature, the target model may perform pointwise convolution on the preprocessed second feature to obtain a twelfth feature. Simultaneously, the target model may also perform pointwise convolution, activation function-based processing, and linear interpolation on the first fusion result to obtain a thirteenth feature. At the same time, the target model can also perform point-by-point convolution and linear interpolation on only the first fusion result to obtain the fourteenth feature. Then, the target model can multiply the twelfth feature and the thirteenth feature to obtain the fifteenth feature, and add the fourteenth feature and the fifteenth feature to obtain the sixteenth feature. Finally, the target model performs a reparameterized convolution-based process on the sixteenth feature to obtain the seventeenth feature, which is the enhanced second feature.
[0018] In one possible implementation, the first fusion includes at least one of the following: alignment, concatenation, or convolution. In the aforementioned implementation, after obtaining the first and second features, the target model may first align the second feature to the first feature to obtain the third feature. Next, the target model may concatenate the first and third features to obtain the fourth feature. The target model may then convolve the fourth feature to obtain the fifth feature, which is the first fusion result.
[0019] In one possible implementation, the method further includes: performing a second fusion on the enhanced first feature and the enhanced second feature to obtain a second fusion result; obtaining the position information of the object in the target image based on the enhanced first feature and the enhanced second feature includes: enhancing the enhanced first feature and the enhanced second feature based on the second fusion result to obtain a second enhanced first feature and a second enhanced second feature; and obtaining the position information of the object in the target image based on the second enhanced first feature and the second enhanced second feature. In the aforementioned implementation, after obtaining the enhanced first feature and the enhanced second feature, the target model may perform a second fusion on the enhanced first feature and the enhanced second feature to obtain a second fusion result. After obtaining the second fusion result, the target model may use the second fusion result to enhance the enhanced first feature and the enhanced second feature to obtain a second enhanced first feature and a second enhanced second feature. After obtaining the second enhanced first feature and the second enhanced second feature, the target model may use the second enhanced first feature and the second enhanced second feature to perform detection, thereby obtaining and outputting the position information of the objects in the target image, which is equivalent to obtaining the position of the objects in the scene. It can be seen that the target model can obtain the position information of the object in the target image based on the first feature after secondary enhancement and the second feature after secondary enhancement, wherein the first feature after secondary enhancement is obtained based on the first feature, the first fusion result and the second fusion result, and the second feature after secondary enhancement is obtained based on the second feature, the first fusion result and the second fusion result. The first feature and the second feature represent different local information of the target image, the first fusion result represents the low-dimensional global information of the target image, and the second fusion result represents the high-dimensional global information of the target image. Therefore, the target model considers more comprehensive factors in the process of target detection, so the position information of the object finally output by the target model can have higher accuracy, and the target detection can be completed more correctly.
[0020] In one possible implementation, the second fusion includes at least one of the following: alignment, splicing, processing based on a self-attention mechanism, processing based on a feedforward network, or addition. In the aforementioned implementation, after obtaining the enhanced first feature and the enhanced second feature, the target model may first align the first feature to the second feature to obtain the twenty-sixth feature. Then, the target model may splice the second feature and the twenty-sixth feature to obtain the twenty-seventh feature. Then, the target model may perform self-attention-based processing, feedforward network-based processing, and addition on the twenty-seventh feature to obtain the twenty-eighth feature, which is the second fusion result.
[0021] A second aspect of an embodiment of the present application provides a model training method, which includes: obtaining a training image, where the training image contains an object to be detected; processing the training image through a model to be trained to obtain position information of the object in the training image, where the model to be trained is used to: perform feature extraction on the training image to obtain a first feature, and perform feature extraction on the first feature to obtain a second feature; perform a first fusion on the first feature and the second feature to obtain a first fusion result; based on the first fusion result, enhance the first feature and the second feature to obtain an enhanced first feature and an enhanced second feature; obtain position information based on the enhanced first feature and the enhanced second feature; and train the model to be trained based on the position information and the actual position information of the object in the training image to obtain a target model.
[0022] The target model obtained by the above method has a target detection function. When target detection is required, a target image containing the object to be detected can be obtained and the target image can be input into the target model. Next, the target model can perform feature extraction on the target image to obtain a first feature, and further perform feature extraction on the first feature to obtain a second feature. Then, the target model can perform a first fusion on the first feature and the second feature to obtain a first fusion result. Subsequently, the target model can enhance the first feature and the second feature based on the first fusion result to obtain an enhanced first feature and an enhanced second feature. Finally, the target model can use the enhanced first feature and the enhanced second feature for detection to obtain the position information of the object in the target image. At this point, the target detection is completed. In the above process, the target model obtains the position information of the object in the target image based on the enhanced first feature and the enhanced second feature, wherein the enhanced first feature is obtained based on the first feature and the first fusion result, and the enhanced second feature is obtained based on the second feature and the first fusion result. The first feature and the second feature represent different local information of the target image, and the first fusion result represents the low-dimensional global information of the target image. Therefore, the target model considers more comprehensive factors in the process of target detection, so the position information of the object finally output by the target model has sufficient accuracy to accurately complete target detection.
[0023] In one possible implementation, the model to be trained is used to: inject the first fusion result into the first feature to obtain the enhanced first feature, and determine the second feature as the enhanced second feature; or, inject the first fusion result into the first feature to obtain the enhanced first feature, and inject the first fusion result into the second feature to obtain the enhanced second feature; or, determine the first feature as the enhanced first feature, and inject the first fusion result into the second feature to obtain the enhanced second feature.
[0024] In one possible implementation, the model to be trained is used to process the first fusion result and the first feature based on a cross-attention mechanism to obtain an enhanced first feature.
[0025] In one possible implementation, the model to be trained is used to process the first fusion result and the second feature based on a cross-attention mechanism to obtain an enhanced second feature.
[0026] In one possible implementation, the model to be trained is also used to preprocess the first feature based on the second feature to obtain the preprocessed first feature, where the preprocessing includes at least one of the following: alignment, splicing, or convolution; the model to be trained is used to process the first fusion result and the preprocessed first feature based on a cross-attention mechanism to obtain an enhanced first feature.
[0027] In one possible implementation, the model to be trained is also used to preprocess the second feature based on the first feature to obtain the preprocessed second feature, and the preprocessing includes at least one of the following: alignment, splicing or convolution; the model to be trained is used to process the first fusion result and the preprocessed second feature based on the cross-attention mechanism to obtain the enhanced second feature.
[0028] In a possible implementation, the first fusion includes at least one of the following: alignment, concatenation, or convolution.
[0029] In one possible implementation, the model to be trained is also used to perform a second fusion on the enhanced first feature and the enhanced second feature to obtain a second fusion result; the model to be trained is used to: based on the second fusion result, enhance the enhanced first feature and the enhanced second feature to obtain a second-enhanced first feature and a second-enhanced second feature; based on the second-enhanced first feature and the second-enhanced second feature, obtain the position information of the object in the training image.
[0030] In one possible implementation, the second fusion includes at least one of the following: alignment, concatenation, processing based on a self-attention mechanism, processing based on a feedforward network, or addition.
[0031] A third aspect of an embodiment of the present application provides a target detection device, which includes a target model and comprises: an acquisition module for acquiring a target image, wherein the target image includes an object to be detected; an extraction module for performing feature extraction on the target image to obtain a first feature, and performing feature extraction on the first feature to obtain a second feature; a fusion module for performing a first fusion on the first feature and the second feature to obtain a first fusion result; an enhancement module for enhancing the first feature and the second feature based on the first fusion result to obtain an enhanced first feature and an enhanced second feature; and a detection module for obtaining position information of the object in the target image based on the enhanced first feature and the enhanced second feature.
[0032] It can be seen from the above device that when target detection is required, a target image containing the object to be detected can be obtained and the target image can be input into the target model. Next, the target model can perform feature extraction on the target image to obtain a first feature, and further perform feature extraction on the first feature to obtain a second feature. Then, the target model can perform a first fusion on the first feature and the second feature to obtain a first fusion result. Subsequently, the target model can enhance the first feature and the second feature based on the first fusion result to obtain an enhanced first feature and an enhanced second feature. Finally, the target model can use the enhanced first feature and the enhanced second feature for detection to obtain the position information of the object in the target image. At this point, the target detection is completed. In the above process, the target model obtains the position information of the object in the target image based on the enhanced first feature and the enhanced second feature, wherein the enhanced first feature is obtained based on the first feature and the first fusion result, and the enhanced second feature is obtained based on the second feature and the first fusion result. The first feature and the second feature represent different local information of the target image, and the first fusion result represents the low-dimensional global information of the target image. Therefore, the target model considers more comprehensive factors in the process of target detection, so the position information of the object finally output by the target model has sufficient accuracy to accurately complete target detection.
[0033] In one possible implementation, the enhancement module is used to: inject the first fusion result into the first feature to obtain the enhanced first feature, and determine the second feature as the enhanced second feature; or inject the first fusion result into the first feature to obtain the enhanced first feature, and inject the first fusion result into the second feature to obtain the enhanced second feature; or determine the first feature as the enhanced first feature, and inject the first fusion result into the second feature to obtain the enhanced second feature.
[0034] In one possible implementation, the enhancement module is used to process the first fusion result and the first feature based on a cross-attention mechanism to obtain an enhanced first feature.
[0035] In one possible implementation, the enhancement module is used to process the first fusion result and the second feature based on a cross-attention mechanism to obtain an enhanced second feature.
[0036] In one possible implementation, the device also includes: a first preprocessing model, used to preprocess the first feature based on the second feature to obtain a preprocessed first feature, the preprocessing including at least one of the following: alignment, splicing or convolution; an enhancement module, used to process the first fusion result and the preprocessed first feature based on a cross-attention mechanism to obtain an enhanced first feature.
[0037] In one possible implementation, the device also includes: a second preprocessing module, used to preprocess the second feature based on the first feature to obtain a preprocessed second feature, where the preprocessing includes at least one of the following: alignment, splicing, or convolution; an enhancement module, used to process the first fusion result and the preprocessed second feature based on a cross-attention mechanism to obtain an enhanced second feature.
[0038] In a possible implementation, the first fusion includes at least one of the following: alignment, concatenation, or convolution.
[0039] In one possible implementation, the device also includes: a second fusion module, used to perform a second fusion on the enhanced first feature and the enhanced second feature to obtain a second fusion result; a detection module, used to: enhance the enhanced first feature and the enhanced second feature based on the second fusion result to obtain a second-enhanced first feature and a second-enhanced second feature; based on the second-enhanced first feature and the second-enhanced second feature, obtain the position information of the object in the target image.
[0040] In one possible implementation, the second fusion includes at least one of the following: alignment, splicing, processing based on a self-attention mechanism, processing based on a feedforward network, or addition.
[0041] The fourth aspect of an embodiment of the present application provides a model training device, which includes: an acquisition module for acquiring a training image, where the training image contains an object to be detected; a processing module for processing the training image through a model to be trained to obtain position information of the object in the training image, where the model to be trained is used to: perform feature extraction on the training image to obtain a first feature, and perform feature extraction on the first feature to obtain a second feature; perform a first fusion on the first feature and the second feature to obtain a first fusion result; based on the first fusion result, enhance the first feature and the second feature to obtain an enhanced first feature and an enhanced second feature; obtain position information based on the enhanced first feature and the enhanced second feature; a training module for training the model to be trained based on the position information and the actual position information of the object in the training image to obtain a target model.
[0042] The target model obtained by training the above-mentioned device has a target detection function. When target detection is required, a target image containing the object to be detected can be obtained and the target image can be input into the target model. Then, the target model can perform feature extraction on the target image to obtain a first feature, and further perform feature extraction on the first feature to obtain a second feature. Then, the target model can perform a first fusion on the first feature and the second feature to obtain a first fusion result. Subsequently, the target model can enhance the first feature and the second feature based on the first fusion result to obtain an enhanced first feature and an enhanced second feature. Finally, the target model can use the enhanced first feature and the enhanced second feature for detection to obtain the position information of the object in the target image. At this point, the target detection is completed. In the above process, the target model obtains the position information of the object in the target image based on the enhanced first feature and the enhanced second feature, wherein the enhanced first feature is obtained based on the first feature and the first fusion result, and the enhanced second feature is obtained based on the second feature and the first fusion result. The first feature and the second feature represent different local information of the target image, and the first fusion result represents the low-dimensional global information of the target image. Therefore, the target model considers more comprehensive factors in the process of target detection, so the position information of the object finally output by the target model has sufficient accuracy to accurately complete target detection.
[0043] In one possible implementation, the model to be trained is used to: inject the first fusion result into the first feature to obtain the enhanced first feature, and determine the second feature as the enhanced second feature; or, inject the first fusion result into the first feature to obtain the enhanced first feature, and inject the first fusion result into the second feature to obtain the enhanced second feature; or, determine the first feature as the enhanced first feature, and inject the first fusion result into the second feature to obtain the enhanced second feature.
[0044] In one possible implementation, the model to be trained is used to process the first fusion result and the first feature based on a cross-attention mechanism to obtain an enhanced first feature.
[0045] In one possible implementation, the model to be trained is used to process the first fusion result and the second feature based on a cross-attention mechanism to obtain an enhanced second feature.
[0046] In one possible implementation, the model to be trained is also used to preprocess the first feature based on the second feature to obtain the preprocessed first feature, where the preprocessing includes at least one of the following: alignment, splicing, or convolution; the model to be trained is used to process the first fusion result and the preprocessed first feature based on a cross-attention mechanism to obtain an enhanced first feature.
[0047] In one possible implementation, the model to be trained is also used to preprocess the second feature based on the first feature to obtain the preprocessed second feature, and the preprocessing includes at least one of the following: alignment, splicing or convolution; the model to be trained is used to process the first fusion result and the preprocessed second feature based on the cross-attention mechanism to obtain the enhanced second feature.
[0048] In a possible implementation, the first fusion includes at least one of the following: alignment, concatenation, or convolution.
[0049] In one possible implementation, the model to be trained is also used to perform a second fusion on the enhanced first feature and the enhanced second feature to obtain a second fusion result; the model to be trained is used to: based on the second fusion result, enhance the enhanced first feature and the enhanced second feature to obtain a second-enhanced first feature and a second-enhanced second feature; based on the second-enhanced first feature and the second-enhanced second feature, obtain the position information of the object in the training image.
[0050] In one possible implementation, the second fusion includes at least one of the following: alignment, splicing, processing based on a self-attention mechanism, processing based on a feedforward network, or addition.
[0051] A fifth aspect of an embodiment of the present application provides a target detection device, which includes a memory and a processor; the memory stores code, and the processor is configured to execute the code. When the code is executed, the target detection device executes the method described in the first aspect or any possible implementation method of the first aspect.
[0052] A sixth aspect of an embodiment of the present application provides a model training device, which includes a memory and a processor; the memory stores code, and the processor is configured to execute the code. When the code is executed, the model training device executes the method described in the second aspect or any possible implementation method of the second aspect.
[0053] A seventh aspect of an embodiment of the present application provides a circuit system, which includes a processing circuit, and the processing circuit is configured to execute the method described in the first aspect, any possible implementation of the first aspect, the second aspect, or any possible implementation of the second aspect.
[0054] An eighth aspect of an embodiment of the present application provides a chip system, which includes a processor for calling a computer program or computer instructions stored in a memory so that the processor executes a method as described in the first aspect, any possible implementation of the first aspect, the second aspect, or any possible implementation of the second aspect.
[0055] In a possible implementation, the processor is coupled to the memory through an interface.
[0056] In one possible implementation, the chip system further includes a memory in which computer programs or computer instructions are stored.
[0057] A ninth aspect of an embodiment of the present application provides a computer storage medium storing a computer program, which, when executed by a computer, enables the computer to implement the method described in the first aspect, any possible implementation of the first aspect, the second aspect, or any possible implementation of the second aspect.
[0058] A tenth aspect of an embodiment of the present application provides a computer program product, which stores instructions that, when executed by a computer, enable the computer to implement the method described in the first aspect, any possible implementation of the first aspect, the second aspect, or any possible implementation of the second aspect.
[0059] In an embodiment of the present application, when target detection is required, a target image containing the object to be detected can be obtained, and the target image can be input into the target model. Then, the target model can perform feature extraction on the target image to obtain a first feature, and further perform feature extraction on the first feature to obtain a second feature. Then, the target model can perform a first fusion on the first feature and the second feature to obtain a first fusion result. Subsequently, the target model can enhance the first feature and the second feature based on the first fusion result to obtain an enhanced first feature and an enhanced second feature. Finally, the target model can use the enhanced first feature and the enhanced second feature for detection to obtain the position information of the object in the target image. At this point, the target detection is completed. In the above process, the target model obtains the position information of the object in the target image based on the enhanced first feature and the enhanced second feature, wherein the enhanced first feature is obtained based on the first feature and the first fusion result, and the enhanced second feature is obtained based on the second feature and the first fusion result. The first feature and the second feature represent different local information of the target image, and the first fusion result represents the low-dimensional global information of the target image. Therefore, the target model considers more comprehensive factors in the process of target detection, so the position information of the object finally output by the target model has sufficient accuracy to accurately complete target detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] Figure 1 is a schematic diagram of the structure of the artificial intelligence main framework;
[0061] FIG2a is a schematic diagram of the structure of an item recommendation system provided in an embodiment of the present application;
[0062] FIG2 b is another structural diagram of the item recommendation system provided in an embodiment of the present application;
[0063] FIG2c is a schematic diagram of a device related to item recommendation provided in an embodiment of the present application;
[0064] FIG3 is a schematic diagram of the architecture of the system 100 provided in an embodiment of the present application;
[0065] FIG4 is a schematic diagram of a structure of a target model provided in an embodiment of the present application;
[0066] FIG5 is a flow chart of an item recommendation method provided in an embodiment of the present application;
[0067] FIG6 is another schematic diagram of a target model provided in an embodiment of the present application;
[0068] FIG7 is a schematic structural diagram of a low-dimensional alignment module and a low-dimensional fusion module provided in an embodiment of the present application;
[0069] FIG8 is a schematic structural diagram of an injection module provided in an embodiment of the present application;
[0070] FIG9 is another structural diagram of the injection module provided in an embodiment of the present application;
[0071] FIG10 is another schematic diagram of the structure of the target model provided in an embodiment of the present application;
[0072] FIG11 is a schematic structural diagram of an enhanced injection module provided in an embodiment of the present application;
[0073] FIG12 is a schematic diagram of cross-layer information fusion processing provided in an embodiment of the present application;
[0074] FIG13 is another schematic structural diagram of an enhanced injection module provided in an embodiment of the present application;
[0075] FIG14 is another schematic diagram of cross-layer information fusion processing provided by an embodiment of the present application;
[0076] FIG15 is another schematic diagram of the structure of the target model provided in an embodiment of the present application;
[0077] FIG16 is a flow chart of an item recommendation method provided in an embodiment of the present application;
[0078] FIG17 is another schematic diagram of a target model provided in an embodiment of the present application;
[0079] FIG18 is a schematic diagram of the structures of a high-dimensional alignment module and a high-dimensional fusion module provided in an embodiment of the present application;
[0080] FIG19 is a schematic diagram of comparison results provided by an embodiment of the present application;
[0081] FIG20 is a flow chart of a model training method provided in an embodiment of the present application;
[0082] FIG21 is a schematic structural diagram of a target detection device provided in an embodiment of the present application;
[0083] FIG22 is a schematic structural diagram of a model training device provided in an embodiment of the present application;
[0084] FIG23 is a schematic diagram of the structure of an execution device provided in an embodiment of the present application;
[0085] FIG24 is a schematic structural diagram of a training device provided in an embodiment of the present application;
[0086] Figure 25 is a structural schematic diagram of the chip provided in an embodiment of the present application. DETAILED DESCRIPTION
[0087] The embodiments of the present application provide a target detection method and related equipment. During the target detection process, the factors considered are relatively comprehensive, so the position information of the object finally obtained has sufficient accuracy to accurately complete the target detection.
[0088] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, and this is merely a way of distinguishing the objects of the same attributes when describing them in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0089] As a fundamental computer vision task, object detection is increasingly required in a growing number of scenarios. To meet user needs for object detection in various application scenarios (such as autonomous driving, intelligent security, robotic navigation, and medical diagnosis), neural network models in the AI field are used to perform object detection tasks. These results are then presented to users for viewing and use, enhancing the user experience.
[0090] In related technologies, when it is necessary to locate an object in a scene, a target image used to present the scene can be obtained first, and the target image can be input into a neural network model. The neural network model can include a feature extraction module, a feature fusion module, and a detection module. Then, each layer of the feature extraction module can extract features from the target image and output the features obtained in each layer, that is, features at different levels. Next, the feature fusion module can fuse the features at different levels to obtain a feature fusion result. Then, the detection module can perform detection based on the feature fusion result, thereby obtaining and outputting the position information of the object in the target image, which is equivalent to obtaining the position information of the object in the scene.
[0091] In the above process, the neural network model directly obtains the location information of the object based on the feature fusion results, and the factors considered are relatively simple. This will result in the accuracy of the object location information finally output by the model being low, and the target detection cannot be completed accurately.
[0092] In order to solve the above problems, an embodiment of the present application provides a target detection method, which can be implemented in combination with artificial intelligence (AI) technology. AI technology is a technical discipline that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence. AI technology obtains the best results by perceiving the environment, acquiring knowledge and using knowledge. In other words, artificial intelligence technology is a branch of computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Using artificial intelligence for data processing is a common application of artificial intelligence.
[0093] First, we will describe the overall workflow of an AI system. See Figure 1, which illustrates a schematic diagram of the AI framework. This framework will be explained from two perspectives: the "intelligent information chain" (horizontal axis) and the "IT value chain" (vertical axis). The "intelligent information chain" reflects the entire process from data acquisition to processing. For example, it could be the general process of intelligent information perception, intelligent information representation and formation, intelligent reasoning, intelligent decision-making, and intelligent execution and output. Throughout this process, data undergoes a condensed journey from "data-information-knowledge-wisdom." The "IT value chain," spanning the underlying infrastructure of human intelligence, information (provided and processed by technology), and the system's industrial ecosystem, reflects the value that AI brings to the information technology industry.
[0094] (1) Infrastructure
[0095] Infrastructure provides computing power for AI systems, enabling communication with the outside world and supporting this through a foundational platform. External communication occurs through sensors; computing power is provided by intelligent chips (CPUs, NPUs, GPUs, ASICs, FPGAs, and other hardware accelerators). The foundational platform includes a distributed computing framework and network-related platform guarantees and support, including cloud storage and computing, and interconnected networks. For example, sensors communicate with the outside world to acquire data, which is then fed into the intelligent chips within the distributed computing system provided by the foundational platform for computation.
[0096] (2) Data
[0097] Data above the infrastructure layer represents data sources for AI. This data includes graphics, images, voice, and text, as well as IoT data from traditional devices. This includes business data from existing systems and sensor data such as force, displacement, liquid level, temperature, and humidity.
[0098] (3) Data processing
[0099] Data processing generally includes data training, machine learning, deep learning, search, reasoning, decision-making, etc.
[0100] Among them, machine learning and deep learning can symbolize and formalize data for intelligent information modeling, extraction, preprocessing, and training.
[0101] Reasoning refers to the process of simulating human intelligent reasoning in computers or intelligent systems, using formalized information to perform machine thinking and solve problems based on reasoning control strategies. Typical functions are search and matching.
[0102] Decision-making refers to the process of making decisions after intelligent information is reasoned, and usually provides functions such as classification, sorting, and prediction.
[0103] (4) General ability
[0104] After the data has undergone the data processing mentioned above, some general capabilities can be further formed based on the results of the data processing, such as algorithms or a general system, for example, translation, text analysis, computer vision processing, speech recognition, image recognition, etc.
[0105] (5) Smart products and industry applications
[0106] Smart products and industry applications refer to the products and applications of artificial intelligence systems in various fields. They are the encapsulation of the overall artificial intelligence solution, which productizes intelligent information decision-making and realizes practical application. Its application areas mainly include: smart terminals, smart transportation, smart medical care, autonomous driving, smart cities, etc.
[0107] Next, several application scenarios of this application are introduced.
[0108] Figure 2a is a schematic diagram of the structure of a target detection system provided in an embodiment of the present application. The target detection system includes a user device and a data processing device. The user device includes an intelligent terminal such as a mobile phone, a personal computer, or an information processing center. The user device is the initiator of target detection and is the initiator of the target detection request, typically initiated by a user through the user device.
[0109] The aforementioned data processing device can be a device or server with data processing capabilities, such as a cloud server, network server, application server, or management server. The data processing device receives text processing requests from smart terminals via an interactive interface and then performs text processing using memory for data storage and a data processing processor, including machine learning, deep learning, search, reasoning, and decision-making. The memory in the data processing device is a general term that includes local storage and a database for storing historical data. The database can be located on the data processing device or on other network servers.
[0110] In the target detection system shown in FIG2a, a user device can receive a user's instruction. For example, the user device can obtain an image input / selected by the user, and then initiate a request to a data processing device, causing the data processing device to execute an image processing application on the image obtained by the user device, thereby obtaining a corresponding processing result for the image. For example, the user device can obtain a target image input by the user (for presenting a scene containing an object to be detected), and then initiate a processing request for the target image to the data processing device, causing the data processing device to perform target detection-based processing on the target image, thereby obtaining the position information of the object in the target image, that is, the coordinates of the object in the image coordinate system (built based on the target image).
[0111] In FIG. 2 a , the data processing device may execute the target detection method according to the embodiment of the present application.
[0112] Figure 2b is another structural diagram of the target detection system provided in an embodiment of the present application. In Figure 2b, the user device directly serves as a data processing device. The user device can directly obtain input from the user and directly process it by the hardware of the user device itself. The specific process is similar to that of Figure 2a. Please refer to the above description and will not be repeated here.
[0113] In the target detection system shown in Figure 2b, the user device can obtain a target image input by the user (used to present a scene containing an object to be detected), and then perform target detection-based processing on the target image to obtain the position information of the object in the target image, that is, the coordinates of the object in the image coordinate system (built based on the target image).
[0114] In FIG2 b , the user equipment itself can execute the target detection method of the embodiment of the present application.
[0115] FIG2c is a schematic diagram of a target detection device according to an embodiment of the present application.
[0116] The user device in the above Figures 2a and 2b can specifically be the local device 301 or the local device 302 in Figure 2c, and the data processing device in Figure 2a can specifically be the execution device 210 in Figure 2c, wherein the data storage system 250 can store the data to be processed of the execution device 210, and the data storage system 250 can be integrated on the execution device 210, or it can be set on the cloud or other network servers.
[0117] The processors in Figures 2a and 2b can perform data training / machine learning / deep learning through a neural network model or other models (for example, a model based on a support vector machine), and use the model finally trained or learned from the data to perform image processing applications on the image, thereby obtaining corresponding processing results.
[0118] Figure 3 is a schematic diagram of the system 100 architecture provided in an embodiment of the present application. In Figure 3, the execution device 110 is configured with an input / output (I / O) interface 112 for data interaction with an external device. The user can input data to the I / O interface 112 through the client device 140. The input data can include: various tasks to be scheduled, callable resources and other parameters in the embodiment of the present application.
[0119] When the execution device 110 preprocesses the input data, or when the computing module 111 of the execution device 110 performs calculations and other related processing (such as implementing the functions of the neural network in this application), the execution device 110 can call the data, code, etc. in the data storage system 150 for the corresponding processing, and can also store the data, instructions, etc. obtained from the corresponding processing in the data storage system 150.
[0120] Finally, the I / O interface 112 returns the processing result to the client device 140 so as to provide it to the user.
[0121] It is worth noting that the training device 120 can generate corresponding target models / rules based on different training data for different goals or tasks. The corresponding target models / rules can be used to achieve the above goals or complete the above tasks, thereby providing the user with the desired results. The training data can be stored in the database 130 and come from training samples collected by the data collection device 160.
[0122] In the scenario shown in FIG3 , the user can manually input data, which can be performed through the interface provided by I / O interface 112. Alternatively, client device 140 can automatically send input data to I / O interface 112. If user authorization is required for client device 140 to automatically send input data, the user can set the corresponding permissions in client device 140. The user can view the output of execution device 110 on client device 140, which can be presented in a display, sound, action, or other specific form. Client device 140 can also serve as a data acquisition terminal, collecting input data and output results from I / O interface 112 as new sample data and storing them in database 130. Of course, collection can also be performed without client device 140, with I / O interface 112 directly storing the input data and output results from I / O interface 112 as new sample data in database 130.
[0123] It is worth noting that FIG3 is only a schematic diagram of a system architecture provided by an embodiment of the present application, and the positional relationship between the devices, components, modules, etc. shown in the figure does not constitute any limitation. For example, in FIG3, the data storage system 150 is an external memory relative to the execution device 110. In other cases, the data storage system 150 can also be placed in the execution device 110. As shown in FIG3, a neural network can be trained according to the training device 120.
[0124] The present application also provides a chip including a neural network processor (NPU). The chip can be provided in the execution device 110 shown in FIG3 to complete the computational work of the computation module 111. The chip can also be provided in the training device 120 shown in FIG3 to complete the training work of the training device 120 and output the target model / rule.
[0125] The neural network processor (NPU) is a coprocessor mounted on the host central processing unit (CPU), which assigns tasks to it. The core of the NPU is the arithmetic circuit, which is controlled by a controller to extract data from memory (weight memory or input memory) and perform calculations.
[0126] In some implementations, the arithmetic circuit includes multiple processing engines (PEs). In some implementations, the arithmetic circuit is a two-dimensional systolic array. The arithmetic circuit can also be a one-dimensional systolic array or other electronic circuit capable of performing mathematical operations such as multiplication and addition. In some implementations, the arithmetic circuit is a general-purpose matrix processor.
[0127] For example, consider an input matrix A, a weight matrix B, and an output matrix C. The computational circuit retrieves the corresponding data for matrix B from the weight memory and caches it on each PE within the computational circuit. The computational circuit then performs a matrix operation on the matrix A data from the input memory and matrix B, storing the partial or final matrix results in the accumulator.
[0128] The vector computation unit can further process the output of the arithmetic circuit, such as vector multiplication, vector addition, exponential operation, logarithmic operation, size comparison, etc. For example, the vector computation unit can be used for network calculations in non-convolutional / non-FC layers in neural networks, such as pooling, batch normalization, and local response normalization.
[0129] In some implementations, the vector computation unit can store the processed output vectors in a unified buffer. For example, the vector computation unit can apply a nonlinear function to the output of the computation circuit, such as a vector of accumulated values, to generate activation values. In some implementations, the vector computation unit generates normalized values, merged values, or both. In some implementations, the processed output vectors can be used as activation inputs to the computation circuit, such as for use in subsequent layers in a neural network.
[0130] The unified memory is used to store input data and output data.
[0131] The weight data is directly transferred from the external memory to the input memory and / or unified memory through the direct memory access controller (DMAC), the weight data in the external memory is stored in the weight memory, and the data in the unified memory is stored in the external memory.
[0132] The bus interface unit (BIU) is used to implement interaction between the main CPU, DMAC and instruction fetch memory through the bus.
[0133] An instruction fetch buffer connected to the controller, used to store instructions used by the controller;
[0134] The controller is used to call the instructions cached in the memory to control the working process of the computing accelerator.
[0135] Generally, unified memory, input memory, weight memory and instruction fetch memory are all on-chip memories, and external memory is memory outside the NPU, which can be double data rate synchronous dynamic random access memory (DDR SDRAM), high bandwidth memory (HBM) or other readable and writable memory.
[0136] Since the embodiments of the present application involve the application of a large number of neural networks, in order to facilitate understanding, the relevant terms and related concepts such as neural networks involved in the embodiments of the present application are first introduced below.
[0137] (1) Neural Network
[0138] A neural network can be composed of neural units. A neural unit can refer to an operation unit with xs and intercept 1 as input. The output of the operation unit can be:
[0139] Where s = 1, 2, ... n, n is a natural number greater than 1, Ws is the weight of xs, and b is the bias of the neural unit. f is the activation function of the neural unit, which is used to introduce nonlinear characteristics into the neural network to convert the input signal in the neural unit into the output signal. The output signal of the activation function can be used as the input of the next convolutional layer. The activation function can be a sigmoid function. A neural network is a network formed by connecting many of the above-mentioned single neural units together, that is, the output of one neural unit can be the input of another neural unit. The input of each neural unit can be connected to the local receptive field of the previous layer to extract the features of the local receptive field. The local receptive field can be an area composed of several neural units.
[0140] The operation of each layer in a neural network can be described by the mathematical expression y = a(Wx + b). From a physical perspective, the operation of each layer in a neural network can be understood as transforming the input space (a set of input vectors) into the output space (i.e., from the row space to the column space of a matrix) through five operations. These operations include: 1. Dimensionality increase / decrease; 2. Scaling / reduction; 3. Rotation; 4. Translation; and 5. "Bending." Operations 1, 2, and 3 are performed by Wx, 4 by +b, and 5 by a(). The word "space" is used here because the objects being classified are not individual things, but rather a class of things, and space refers to the collection of all individuals within that class. W is the weight vector, each value in which represents the weight of a neuron in that layer of the neural network. This vector W determines the spatial transformation from input space to output space described above. That is, the weights W of each layer control how the space is transformed. The goal of training a neural network is to ultimately obtain the weight matrix for all layers of the trained neural network (a weight matrix formed by the vectors W of many layers). Therefore, the training process of a neural network is essentially about learning how to control spatial transformations, and more specifically, about learning the weight matrix.
[0141] Because we want the output of the neural network to be as close as possible to the value we really want to predict, we can compare the current network's predicted value with the desired target value, and then update the weight vector of each layer of the neural network based on the difference between the two (of course, there is usually an initialization process before the first update, which is to pre-configure the parameters for each layer in the neural network). For example, if the network's predicted value is too high, the weight vector is adjusted to make it predict a lower value, and this adjustment is continued until the neural network can predict the desired target value. Therefore, it is necessary to pre-define "how to compare the difference between the predicted value and the target value." This is the loss function or objective function, which is an important equation used to measure the difference between the predicted value and the target value. Among them, taking the loss function as an example, the higher the output value (loss) of the loss function, the greater the difference, so the training of the neural network becomes a process of minimizing this loss as much as possible.
[0142] (2) Backpropagation algorithm
[0143] Neural networks can use the back propagation (BP) algorithm to correct the size of the parameters in the initial neural network model during training, reducing the reconstruction error loss of the neural network model. Specifically, the forward propagation of the input signal to the output generates error loss. This error loss information is then backpropagated to update the parameters in the initial neural network model, thereby converging the error loss. The BP algorithm is a backward propagation movement dominated by error loss, aiming to obtain the optimal parameters of the neural network model, such as the weight matrix.
[0144] The method provided in this application is described below from the training side of the neural network and the application side of the neural network.
[0145] The model training method provided in the embodiment of the present application involves the processing of data sequences, and can be specifically applied to methods such as data training, machine learning, and deep learning, and performs symbolic and formalized intelligent information modeling, extraction, preprocessing, and training on the training data (for example, the training images in this application), and finally obtains a trained neural network (such as the target model in this application); and the target detection method provided in the embodiment of the present application can use the above-mentioned trained neural network to input input data (for example, the target image in this application) into the trained neural network to obtain output data (such as the position information of the object in the target image in this application). It should be noted that the model training method and target detection method provided in the embodiment of the present application are inventions based on the same concept, and can also be understood as two parts in a system, or two stages of an overall process: such as the model training stage and the model application stage.
[0146] The target detection method provided by the embodiment of the present application is first introduced below. The target detection method provided by the embodiment of the present application can be implemented through a target model, and the target model can have a variety of structures. The first structure of the target model is first introduced below. Figure 4 is a structural diagram of the target model provided by the embodiment of the present application. As shown in Figure 4, the target model includes: a backbone network, a low-dimensional information aggregation-distribution branch, and a target detection head, wherein the input end of the backbone network serves as the input end of the entire target model, the output end of the backbone network is connected to the input end of the low-dimensional information aggregation-distribution branch, the output end of the low-dimensional information aggregation-distribution branch is connected to the input end of the target detection head, and the output end of the target detection head serves as the output end of the entire target model. In order to further understand the workflow of the target model, the workflow is further introduced below. Figure 5 is a flow chart of the item recommendation method provided by the embodiment of the present application. As shown in Figure 5, the method includes:
[0147] 501. Acquire a target image, where the target image contains an object to be detected.
[0148] In this embodiment, when it is necessary to locate an object in a scene, the scene may be photographed first to obtain a target image for presenting the scene. It can be seen that the scene presented by the target image contains the object to be detected (located).
[0149] 502. Perform feature extraction on the target image to obtain a first feature, and perform feature extraction on the first feature to obtain a second feature.
[0150] After obtaining the target image, the target image can be input into the target model, so the target model can first perform feature extraction on the target image to obtain the first feature, and then further perform feature extraction on the first feature to obtain the second feature.
[0151] Specifically, the target model can obtain the first feature and the second feature in the following way:
[0152] After obtaining the target image, the backbone network of the target model contains multiple feature extraction layers. Therefore, the first feature extraction layer of the backbone network extracts features from the target image, thereby obtaining features at the first level. The second feature extraction layer of the backbone network extracts features from the first level, thereby obtaining features at the second level. Finally, the last feature extraction layer of the backbone network extracts features from the second-to-last level, thereby obtaining features at the final level. Therefore, the backbone network can output features at multiple levels. Among these multiple levels of features, features at the earlier levels have larger sizes, while features at the later levels have smaller sizes.
[0153] Since the subsequent operations on the features of each level are similar, the following will take the features of two adjacent levels as an example to provide a schematic introduction from the features of multiple levels. The feature of the earlier level is called the first feature, and the feature of the later level is called the second feature. The size of the first feature is larger than the size of the second feature. For example, the first feature is the feature of the first level, and the second feature is the feature of the second level. For another example, the first feature is the feature of the fifth level, and the second feature is the feature of the sixth level. For another example, the first feature is the feature of the second-to-last level, and the second feature is the feature of the last level, and so on.
[0154] Then, after obtaining the first feature and the second feature, the backbone network can send the first feature and the second feature to the low-dimensional information aggregation-distribution branch.
[0155] For example, as shown in Figure 6 (Figure 6 is another schematic diagram of the target model provided by an embodiment of the present application), it is assumed that the target model includes a backbone network, a low-dimensional information aggregation-distribution branch, and a target detection head, and the backbone network includes three feature extraction layers. After the target image is input into the backbone network of the target model, the backbone network can output the first-level feature B3, the second-level feature B4, and the third-level feature B5, respectively, and send B3, B4, and B5 to the low-dimensional information aggregation-distribution branch. Among them, the size of B3 is larger than the size of B4, which is larger than the size of B5.
[0156] 503. Perform a first fusion on the first feature and the second feature to obtain a first fusion result.
[0157] After obtaining the first feature and the second feature, the target model can perform a first fusion (a certain feature fusion method) on the first feature and the second feature to obtain a first fusion result.
[0158] Specifically, the target model can obtain the first fusion result in the following ways:
[0159] After obtaining the first and second features, the low-dimensional information aggregation-distribution branch can first align the second feature to the first feature to obtain the third feature. It can be understood that the size of the first feature is the same as the size of the third feature. Then, the low-dimensional information aggregation-distribution branch can concatenate the first and third features to obtain the fourth feature. Then, the low-dimensional information aggregation-distribution branch can convolve the fourth feature (for example, based on a process of reparameterized convolution, etc.) to obtain the fifth feature, which is the first fusion result.
[0160] It should be understood that since the low-dimensional information aggregation-distribution branch is used to obtain the low-dimensional global information of the target image, that is, the texture features of the target image, the sizes of these features are generally large. Therefore, when performing feature alignment, this branch tends to use features with larger sizes as the alignment standard, that is, this branch usually uses the first feature as the alignment standard, so this branch usually aligns the second feature to the first feature. Of course, in some special cases (for example, the second feature is not the feature of the last level), this branch can also align the first feature to the second feature to obtain the third feature, and splice and convolve the second and third features to obtain the first fusion result.
[0161] Still as in the above example, the low-dimensional information aggregation-distribution branch includes a low-dimensional alignment module, a low-dimensional fusion module and an injection module. As shown in Figure 7 (Figure 7 is a structural diagram of the low-dimensional alignment module and the low-dimensional fusion module provided in an embodiment of the present application), the low-dimensional alignment module can use B4 as the alignment standard to pool B3 to reduce the size of B3 and obtain the feature B3' aligned to B4, and the size of B3' is the same as the size of B4. Similarly, the low-dimensional alignment module can perform linear interpolation on B5 to enlarge the size of B5 to obtain the feature B5' aligned to B4, and the size of B5' is the same as the size of B4. Then, the low-dimensional alignment module can splice B3', B4 and B5' to obtain the splicing result Fc, and send Fc to the low-dimensional fusion module. Then, the low-dimensional fusion module performs a process based on re-parameterized convolution on Fc to obtain a low-dimensional fusion result Ffuse, and sends Ffuse to the injection module.
[0162] 504. Based on the first fusion result, enhance the first feature and the second feature to obtain an enhanced first feature and an enhanced second feature.
[0163] After obtaining the first fusion result, the target model can use the first fusion result to enhance the first feature and the second feature, thereby obtaining the enhanced first feature and the enhanced second feature.
[0164] Specifically, the target model can obtain the enhanced first feature and the enhanced second feature in the following ways:
[0165] (1) Assume that the low-dimensional information aggregation-distribution branch only includes an injection module for the first feature. The injection module for the first feature can inject the first fusion result into the first feature to perform data enhancement on the first feature, thereby obtaining the enhanced first feature. Since the low-dimensional information aggregation-distribution branch does not include an injection module for the second feature, this branch does not process the second feature and directly determines the second feature as the enhanced second feature.
[0166] (2) Assume that the low-dimensional information aggregation-distribution branch includes an injection module for the first feature and an injection module for the second feature. The injection module for the first feature can inject the first fusion result into the first feature to perform data enhancement on the first feature, thereby obtaining the enhanced first feature. Similarly, the injection module for the second feature can inject the first fusion result into the second feature to perform data enhancement on the second feature, thereby obtaining the enhanced second feature.
[0167] (3) Assume that the low-dimensional information aggregation-distribution branch only includes an injection module for the second feature. Since the low-dimensional information aggregation-distribution branch does not include an injection module for the first feature, this branch may not process the first feature and directly determine the first feature as the enhanced first feature. The injection module for the second feature may inject the first fusion result into the second feature to perform data enhancement on the second feature, thereby obtaining the enhanced second feature.
[0168] Still taking the above example, assuming that the low-dimensional information aggregation-distribution branch includes an injection module for B4 and an injection module for B5, then this branch can directly determine B3 as the enhanced third-level feature P3, the injection module for B4 can inject Ffuse into B4, thereby obtaining the enhanced second-level feature P4, and the injection module for B5 can inject Ffuse into B5, thereby obtaining the enhanced first-level feature P5.
[0169] More specifically, the injection module can have multiple structures. The following first introduces the injection module of the first structure. The injection module of the first structure (the ordinary injection module) can obtain the enhanced first feature and the enhanced second feature in the following way:
[0170] (1) After obtaining the first fusion result, the injection module for the first feature can process the first fusion result and the first feature based on the cross-attention mechanism, thereby obtaining the enhanced first feature. It should be noted that since the first feature is used as the alignment standard in the process of obtaining the first fusion result, the size of the first fusion result is the same as the size of the first feature. Then, the injection module can perform point-by-point convolution on the first feature to obtain the sixth feature. At the same time, the injection module can also perform point-by-point convolution and activation function-based processing on the first fusion result to obtain the seventh feature. At the same time, the injection module can also perform point-by-point convolution only on the first fusion result to obtain the eighth feature (in this way, the size of the sixth feature, the size of the seventh feature and the size of the eighth feature are the same). Then, the injection module can multiply the sixth feature and the seventh feature to obtain the ninth feature, and add the eighth feature and the ninth feature to obtain the tenth feature. Finally, the injection module performs reparameterized convolution-based processing on the tenth feature to obtain the eleventh feature, which is the enhanced first feature.
[0171] (2) After obtaining the first fusion result, the injection module for the second feature can process the first fusion result and the second feature based on the cross-attention mechanism, thereby obtaining the enhanced second feature. It should be noted that since the first feature is used as the alignment standard in the process of obtaining the first fusion result, the size of the first fusion result is the same as the size of the first feature. Then, the injection module can perform point-by-point convolution on the second feature to obtain the twelfth feature. At the same time, the injection module can also perform point-by-point convolution, activation function-based processing and linear interpolation on the first fusion result to obtain the thirteenth feature. At the same time, the injection module can also perform point-by-point convolution and linear interpolation only on the first fusion result to obtain the fourteenth feature (in this way, the size of the twelfth feature, the size of the thirteenth feature and the size of the fourteenth feature are the same). Then, the injection module can multiply the twelfth feature and the thirteenth feature to obtain the fifteenth feature, and add the fourteenth feature and the fifteenth feature to obtain the sixteenth feature. Finally, the injection module performs reparameterized convolution on the sixteenth feature to obtain the seventeenth feature, which is the enhanced second feature.
[0172] Still taking the above example, as shown in Figures 8 and 9 (Figure 8 is a structural diagram of the injection module provided in an embodiment of the present application, and Figure 9 is another structural diagram of the injection module provided in an embodiment of the present application), after obtaining Ffuse, the injection module for B4 can first perform point-by-point convolution on B4 (also referred to as convolution 1×1) to obtain feature Q4. At the same time, the injection module for B4 can also perform point-by-point convolution and activation function-based processing (implemented by the sigmoid function) on Ffuse to obtain feature K4. At the same time, the injection module for B4 can also perform point-by-point convolution on Ffuse to obtain feature V4 (Q4, K4 and V4 have the same size). Then, the injection module for B4 can multiply Q4 and K4, and then add the multiplication result to V4 to obtain feature A4. Finally, the injection module for B4 can perform reparameterized convolution-based processing on A4 to obtain feature P4.
[0173] After obtaining Ffuse, the injection module for B5 can first perform point-by-point convolution on B5 to obtain feature Q5. At the same time, the injection module for B5 can also perform point-by-point convolution, activation function-based processing and linear interpolation on Ffuse to obtain feature K5. At the same time, the injection module for B5 can also perform point-by-point convolution and linear interpolation on Ffuse to obtain feature V5 (Q5, K5 and V5 have the same size). Then, the injection module for B5 can multiply Q5 and K5, and then add the multiplication result to V5 to obtain feature A5. Finally, the injection module for B5 can perform reparameterized convolution-based processing on A5 to obtain feature P5.
[0174] More specifically, the injection module of the second structure (enhanced injection module) can obtain the enhanced first feature and the enhanced second feature in the following manner:
[0175] (1) After obtaining the first fusion result, the injection module for the first feature can first preprocess the first feature based on the second feature (cross-layer information fusion) to obtain the preprocessed first feature. It should be noted that the injection module for the first feature can align the second feature to the first feature (i.e., perform linear interpolation on the second feature) to obtain the eighteenth feature, and perform point-by-point convolution on the first feature to obtain the nineteenth feature. Then, the injection module for the first feature can splice the eighteenth feature and the nineteenth feature to obtain the twentieth feature. Then, the injection module for the first feature can perform point-by-point convolution on the twentieth feature to obtain the twenty-first feature, which is the preprocessed first feature.
[0176] After obtaining the preprocessed first feature, the injection module for the first feature can perform a cross-attention mechanism-based process on the first fusion result and the preprocessed first feature to obtain the enhanced first feature. It should be noted that the injection module can perform point-by-point convolution on the preprocessed first feature to obtain the sixth feature. At the same time, the injection module can also perform point-by-point convolution and activation function-based processing on the first fusion result to obtain the seventh feature. At the same time, the injection module can also perform point-by-point convolution only on the first fusion result to obtain the eighth feature (in this way, the size of the sixth feature, the size of the seventh feature, and the size of the eighth feature are the same). Then, the injection module can multiply the sixth feature and the seventh feature to obtain the ninth feature, and add the eighth feature and the ninth feature to obtain the tenth feature. Finally, the injection module performs a reparameterized convolution-based process on the tenth feature to obtain the eleventh feature, which is the enhanced first feature.
[0177] (2) After obtaining the first fusion result, the injection module for the second feature can first preprocess the second feature based on the first feature (cross-layer information fusion) to obtain the preprocessed second feature. It should be noted that the injection module for the second feature can align the first feature to the second feature (i.e., pool the first feature) to obtain the twenty-second feature, and perform point-by-point convolution on the second feature to obtain the twenty-third feature. Then, the injection module for the second feature can splice the twenty-second feature and the twenty-third feature to obtain the twenty-fourth feature. Then, the injection module for the second feature can perform point-by-point convolution on the twenty-fourth feature to obtain the twenty-fifth feature, which is the preprocessed second feature.
[0178] After obtaining the preprocessed second feature, the injection module for the second feature can perform a cross-attention mechanism-based process on the first fusion result and the preprocessed second feature to obtain an enhanced second feature. It should be noted that the injection module can perform point-by-point convolution on the preprocessed second feature to obtain the twelfth feature. At the same time, the injection module can also perform point-by-point convolution, activation function-based processing and linear interpolation on the first fusion result to obtain the thirteenth feature. At the same time, the injection module can also perform point-by-point convolution and linear interpolation only on the first fusion result to obtain the fourteenth feature (in this way, the size of the twelfth feature, the size of the thirteenth feature and the size of the fourteenth feature are the same). Then, the injection module can multiply the twelfth feature and the thirteenth feature to obtain the fifteenth feature, and add the fourteenth feature and the fifteenth feature to obtain the sixteenth feature. Finally, the injection module performs a reparameterized convolution-based process on the sixteenth feature to obtain the seventeenth feature, which is the enhanced second feature.
[0179] Still taking the above example, as shown in FIG10 (FIG. 10 is another structural diagram of the target model provided by an embodiment of the present application), it is assumed that the low-dimensional information aggregation-distribution branch includes a low-dimensional alignment module, a low-dimensional fusion module, and an enhanced injection module. Then, the input of the injection module for B4 includes not only B4 and Ffuse, but also B5 and B3. The input of the injection module for B5 includes not only B5 and Ffuse, but also B4.
[0180] As shown in Figures 11 and 12 (Figure 11 is a structural diagram of the enhanced injection module provided in an embodiment of the present application, and Figure 12 is a schematic diagram of the cross-layer information fusion processing provided in an embodiment of the present application), after obtaining Ffuse, the injection module for B4 can first perform cross-layer information fusion processing on B3, B4, and B5. That is, the injection module for B4 first performs point-by-point convolution on B4 to obtain feature C4, and pools B3 to obtain feature C3, and performs linear interpolation on B5 to obtain feature C5. Then, the injection module for B4 can splice and point-by-point convolution on C3, C4, and C5 to obtain feature C4`.
[0181] After obtaining C4`, the injection module for B4 can perform point-by-point convolution on C4` to obtain feature Q4. At the same time, the injection module for B4 can also perform point-by-point convolution and activation function-based processing on Ffuse to obtain feature K4. At the same time, the injection module for B4 can also perform point-by-point convolution on Ffuse to obtain feature V4 (Q4, K4 and V4 have the same size). Next, the injection module for B4 can multiply Q4 and K4, and then add the multiplication result to V4 to obtain feature A4. Finally, the injection module for B4 can perform reparameterized convolution-based processing on A4 to obtain feature P4.
[0182] As shown in Figures 13 and 14 (Figure 13 is another structural diagram of the enhanced injection module provided in an embodiment of the present application, and Figure 14 is another schematic diagram of the cross-layer information fusion processing provided in an embodiment of the present application), after obtaining Ffuse, the injection module for B5 can first perform cross-layer information fusion processing on B4 and B5. That is, the injection module for B5 first performs point-by-point convolution on B5 to obtain feature D5, and then performs pooling on B4 to obtain feature D4. Next, the injection module for B5 can concatenate D5 and D4 and perform point-by-point convolution to obtain feature D5`.
[0183] After obtaining D5`, the injection module for B5 can first perform point-by-point convolution on D5` to obtain feature Q5. At the same time, the injection module for B5 can also perform point-by-point convolution, activation function-based processing and linear interpolation on Ffuse to obtain feature K5. At the same time, the injection module for B5 can also perform point-by-point convolution and linear interpolation on Ffuse to obtain feature V5 (Q5, K5 and V5 have the same size). Then, the injection module for B5 can multiply Q5 and K5, and then add the multiplication result to V5 to obtain feature A5. Finally, the injection module for B5 can perform reparameterized convolution-based processing on A5 to obtain feature P5.
[0184] 505. Based on the enhanced first feature and the enhanced second feature, obtain position information of the object in the target image.
[0185] After obtaining the enhanced first feature and the enhanced second feature, the target model can use the enhanced first feature and the enhanced second feature for detection, thereby obtaining and outputting the position information of these objects in the target image, that is, the coordinates of these objects in the image coordinate system (constructed based on the target image), which is equivalent to obtaining the position of these objects in the scene.
[0186] Specifically, the target model can obtain the position information of the object in the target image in the following ways:
[0187] After obtaining the enhanced first feature and the enhanced second feature, the target detection head can process the enhanced first feature and the enhanced second feature (for example, convolution and full connection, etc.) to obtain the position information of these objects in the target image.
[0188] The above is a detailed description of the target model of the first structure, and the target model of the second structure will be introduced below. Figure 15 is another structural schematic diagram of the target model provided by an embodiment of the present application. As shown in Figure 15, the target model includes: a backbone network, a low-dimensional information aggregation-distribution branch, a high-dimensional information aggregation-distribution branch, and a target detection head, wherein the input end of the backbone network serves as the input end of the entire target model, the output end of the backbone network is connected to the input end of the low-dimensional information aggregation-distribution branch, the output end of the low-dimensional information aggregation-distribution branch is connected to the input end of the high-dimensional information aggregation-distribution branch, the output end of the high-dimensional information aggregation-distribution branch is connected to the input end of the target detection head, and the output end of the target detection head serves as the output end of the entire target model. In order to further understand the workflow of the target model, the workflow is further introduced below. Figure 16 is a flow chart of the item recommendation method provided by an embodiment of the present application. As shown in Figure 16, the method includes:
[0189] 1601. Acquire a target image, where the target image contains an object to be detected.
[0190] 1602. Perform feature extraction on the target image to obtain a first feature, and perform feature extraction on the first feature to obtain a second feature.
[0191] 1603. Perform a first fusion on the first feature and the second feature to obtain a first fusion result.
[0192] 1604. Based on the first fusion result, enhance the first feature and the second feature to obtain an enhanced first feature and an enhanced second feature.
[0193] For the introduction of steps 1601 to 1604 , please refer to the relevant description of steps 501 to 504 in the embodiment shown in FIG5 , which will not be repeated here.
[0194] 1605. Perform a second fusion on the enhanced first feature and the enhanced second feature to obtain a second fusion result.
[0195] After obtaining the enhanced first feature and the enhanced second feature, the target model can perform a second fusion (another feature fusion method) on the enhanced first feature and the enhanced second feature to obtain a second fusion result.
[0196] Specifically, the target model can obtain the first fusion result in the following ways:
[0197] After obtaining the enhanced first feature and the enhanced second feature, the high-dimensional information aggregation-distribution branch can first align the first feature to the second feature to obtain the twenty-sixth feature. It can be understood that the size of the second feature is the same as the size of the twenty-sixth feature. Next, the high-dimensional information aggregation-distribution branch can concatenate the second feature and the twenty-sixth feature to obtain the twenty-seventh feature. Then, the high-dimensional information aggregation-distribution branch can perform self-attention-based processing, feedforward network-based processing, and addition on the twenty-seventh feature to obtain the twenty-eighth feature, which is the second fusion result.
[0198] It should be understood that since the high-dimensional information aggregation and distribution branch is used to obtain high-dimensional global information of the target image, that is, the structural features of the target image, these features are generally small in size. Therefore, when performing feature alignment, this branch tends to use the smaller features as the alignment standard. In other words, this branch usually uses the second feature as the alignment standard, and therefore usually aligns the first feature to the second feature.
[0199] For example, as shown in FIG17 (FIG17 is another schematic diagram of a target model provided by an embodiment of the present application), assuming that the target model includes a backbone network, a low-dimensional information aggregation-distribution branch, a high-dimensional information aggregation-distribution branch, and a target detection head, after the backbone network outputs B3, B4, and B5 to the low-dimensional information aggregation-distribution branch, the low-dimensional information aggregation-distribution branch can output P3, P4, and P5 to the high-dimensional information aggregation-distribution branch. Among them, the size of P3 is larger than the size of P4, which is larger than the size of P5.
[0200] The high-dimensional information aggregation-distribution branch includes a high-dimensional alignment module, a high-dimensional fusion module and an injection module. As shown in Figure 18 (Figure 18 is a structural diagram of the high-dimensional alignment module and the high-dimensional fusion module provided in an embodiment of the present application), the high-dimensional alignment module can use P5 as the alignment standard to pool P3 and P4 to reduce the size of P3 and P4 to obtain features P3' and P4' aligned to P5, and the size of P3' and the size of P4' are the same as the size of P5. Then, the high-dimensional alignment module can splice P3', P4' and P5 to obtain a splicing result Fu, and Fu will be sent to the high-dimensional fusion module. Then, the high-dimensional fusion module processes Fc based on the self-attention mechanism, based on the feedforward network and adds it, so as to obtain a high-dimensional fusion result F', and sends F' to the injection module.
[0201] 1606. Based on the second fusion result, enhance the enhanced first feature and the enhanced second feature to obtain a second-enhanced first feature and a second-enhanced second feature.
[0202] After obtaining the second fusion result, the target model can use the second fusion result to enhance the enhanced first feature and the enhanced second feature, thereby obtaining the second-enhanced first feature and the second-enhanced second feature.
[0203] Specifically, the target model can obtain the enhanced first feature and the enhanced second feature in the following ways:
[0204] (1) Assume that the high-dimensional information aggregation-distribution branch only includes an injection module for the first feature. The injection module for the first feature can inject the second fusion result into the enhanced first feature to perform data enhancement on the enhanced first feature, thereby obtaining the second-enhanced first feature. Since the high-dimensional information aggregation-distribution branch does not include an injection module for the second feature, this branch does not process the enhanced second feature and directly determines the enhanced second feature as the second-enhanced second feature.
[0205] (2) Assume that the high-dimensional information aggregation-distribution branch includes an injection module for the first feature and an injection module for the second feature. The injection module for the first feature can inject the second fusion result into the enhanced first feature to perform data enhancement on the enhanced first feature, thereby obtaining the second enhanced first feature. Similarly, the injection module for the second feature can inject the second fusion result into the enhanced second feature to perform data enhancement on the enhanced second feature, thereby obtaining the second enhanced second feature.
[0206] (3) Assume that the high-dimensional information aggregation-distribution branch only includes an injection module for the second feature. Since the high-dimensional information aggregation-distribution branch does not include an injection module for the first feature, this branch may not process the enhanced first feature and directly determine the enhanced first feature as the second-enhanced first feature. The injection module for the second feature may inject the second fusion result into the enhanced second feature to perform data enhancement on the enhanced second feature, thereby obtaining the second-enhanced second feature.
[0207] More specifically, the injection module can have multiple structures. The following first introduces the injection module of the first structure. The injection module of the first structure (the common injection module) can obtain the first feature after secondary enhancement and the second feature after secondary enhancement in the following way:
[0208] (1) After obtaining the second fusion result, the injection module for the first feature can process the second fusion result and the enhanced first feature based on the cross-attention mechanism, thereby obtaining the second enhanced first feature.
[0209] (2) After obtaining the second fusion result, the injection module for the second feature can process the second fusion result and the enhanced second feature based on the cross-attention mechanism, thereby obtaining the second feature after secondary enhancement.
[0210] More specifically, the injection module of the second structure (enhanced injection module) can obtain the second enhanced first feature and the second enhanced second feature in the following manner:
[0211] (1) After obtaining the second fusion result, the injection module for the first feature can first preprocess the enhanced first feature based on the enhanced second feature (cross-layer information fusion) to obtain the preprocessed and enhanced first feature. After obtaining the preprocessed and enhanced first feature, the injection module for the first feature can process the second fusion result and the preprocessed and enhanced first feature based on the cross-attention mechanism to obtain the second enhanced first feature.
[0212] (2) After obtaining the second fusion result, the injection module for the second feature can first preprocess the enhanced second feature based on the enhanced first feature (cross-layer information fusion) to obtain the preprocessed and enhanced second feature. After obtaining the preprocessed and enhanced second feature, the injection module for the second feature can process the second fusion result and the preprocessed and enhanced second feature based on the cross-attention mechanism to obtain the second enhanced second feature.
[0213] For an introduction to step 1606, please refer to the relevant description of step 1604, which will not be repeated here.
[0214] 1607. Based on the second enhanced first feature and the second enhanced second feature, obtain position information of the object in the image.
[0215] After obtaining the second enhanced first feature and the second enhanced second feature, the target model can use the second enhanced first feature and the second enhanced second feature for detection, thereby obtaining and outputting the position information of these objects in the target image, that is, the coordinates of these objects in the image coordinate system (constructed based on the target image), which is equivalent to obtaining the position of these objects in the scene.
[0216] Specifically, the target model can obtain the position information of the object in the target image in the following ways:
[0217] After obtaining the second enhanced first feature and the second enhanced second feature, the target detection head can process the second enhanced first feature and the second enhanced second feature (for example, convolution and full connection, etc.) to obtain the position information of these objects in the target image.
[0218] In addition, the target model provided in the embodiment of the present application (e.g., GD-YOLO in FIG19 ) and the model of the related art (e.g., YOLO in FIG19 ) can be compared, and the comparison result is shown in FIG19 ( FIG19 is a schematic diagram of the comparison result provided in the embodiment of the present application). Based on the table shown in FIG19 , it can be seen that the performance of the target model provided in the embodiment of the present application is better than that of the model of the related art.
[0219] In an embodiment of the present application, when target detection is required, a target image containing the object to be detected can be obtained, and the target image can be input into the target model. Then, the target model can perform feature extraction on the target image to obtain a first feature, and further perform feature extraction on the first feature to obtain a second feature. Then, the target model can perform a first fusion on the first feature and the second feature to obtain a first fusion result. Subsequently, the target model can enhance the first feature and the second feature based on the first fusion result to obtain an enhanced first feature and an enhanced second feature. Finally, the target model can use the enhanced first feature and the enhanced second feature for detection to obtain the position information of the object in the target image. At this point, the target detection is completed. In the above process, the target model obtains the position information of the object in the target image based on the enhanced first feature and the enhanced second feature, wherein the enhanced first feature is obtained based on the first feature and the first fusion result, and the enhanced second feature is obtained based on the second feature and the first fusion result. The first feature and the second feature represent different local information of the target image, and the first fusion result represents the low-dimensional global information of the target image. Therefore, the target model considers more comprehensive factors in the process of target detection, so the position information of the object finally output by the target model has sufficient accuracy to accurately complete target detection.
[0220] Furthermore, in an embodiment of the present application, the target model can also fuse the enhanced first feature and the enhanced second feature to obtain a second fusion result, and continue to enhance the enhanced first feature and the enhanced second feature based on the second fusion result to obtain a second enhanced second feature and a second enhanced second feature, and then obtain the position information of the object in the target image based on the second enhanced second feature and the second enhanced second feature. Since the first feature and the second feature represent different local information of the target image, the first fusion result represents the low-dimensional global information of the target image, and the second fusion result represents the high-dimensional global information of the target image, the target model considers more comprehensive factors during the target detection process, so the position information of the object finally output by the target model can have higher accuracy, and the target detection can be completed more correctly.
[0221] Furthermore, in an embodiment of the present application, the target model includes a low-dimensional information aggregation-distribution branch and a high-dimensional information aggregation-distribution branch. These two branches include injection modules for the first feature and / or the second feature. The number of injection modules is optional, which can ensure both the accuracy and speed of the target model when performing target detection. The flexible injection module selection method can maintain a balance between the accuracy and speed of target detection.
[0222] Furthermore, in the embodiments of the present application, the injection module has multiple structures. The conventional injection module can inject the feature fusion results into features at different levels, improving the model's utilization of global and local information, thereby improving the performance of the target model. The enhanced injection module can not only inject the feature fusion results into features at different levels, but also fuse features from adjacent layers with features from the current layer, enhancing the fluid fusion of cross-layer information and further improving the performance of the target model.
[0223] The above is a detailed description of the target detection method provided by the embodiment of the present application. The following is an introduction to the model training method provided by the embodiment of the present application. Figure 20 is a flow chart of the model training method provided by the embodiment of the present application. As shown in Figure 20, the method includes:
[0224] 2001. Obtain a training image, where the training image contains an object to be detected.
[0225] In this embodiment, when the training model needs to be trained, a batch of training data can be obtained first. The batch of training data includes training images, and the training images include objects to be detected. It should be noted that the actual position information of the objects to be detected in the training images is known.
[0226] 2002. The training image is processed by the model to be trained to obtain the position information of the object in the training image. The model to be trained is used to: perform feature extraction on the training image to obtain a first feature, and perform feature extraction on the first feature to obtain a second feature; perform a first fusion on the first feature and the second feature to obtain a first fusion result; based on the first fusion result, enhance the first feature and the second feature to obtain an enhanced first feature and an enhanced second feature; and obtain position information based on the enhanced first feature and the enhanced second feature.
[0227] After obtaining the training image, the training image can be input into the model to be trained. The model to be trained can then first perform feature extraction on the training image to obtain a first feature, and then perform feature extraction on the first feature to obtain a second feature. Next, the model to be trained can perform a first fusion on the first and second features to obtain a first fusion result. Then, based on the first fusion result, the model to be trained can enhance the first and second features to obtain an enhanced first feature and an enhanced second feature. Finally, based on the enhanced first and second features, the model to be trained can obtain (predicted) position information of the object in the training image.
[0228] In one possible implementation, the model to be trained is used to: inject the first fusion result into the first feature to obtain the enhanced first feature, and determine the second feature as the enhanced second feature; or, inject the first fusion result into the first feature to obtain the enhanced first feature, and inject the first fusion result into the second feature to obtain the enhanced second feature; or, determine the first feature as the enhanced first feature, and inject the first fusion result into the second feature to obtain the enhanced second feature.
[0229] In one possible implementation, the model to be trained is used to process the first fusion result and the first feature based on a cross-attention mechanism to obtain an enhanced first feature.
[0230] In one possible implementation, the model to be trained is used to process the first fusion result and the second feature based on a cross-attention mechanism to obtain an enhanced second feature.
[0231] In one possible implementation, the model to be trained is also used to preprocess the first feature based on the second feature to obtain the preprocessed first feature, where the preprocessing includes at least one of the following: alignment, splicing, or convolution; the model to be trained is used to process the first fusion result and the preprocessed first feature based on a cross-attention mechanism to obtain an enhanced first feature.
[0232] In one possible implementation, the model to be trained is also used to preprocess the second feature based on the first feature to obtain the preprocessed second feature, and the preprocessing includes at least one of the following: alignment, splicing or convolution; the model to be trained is used to process the first fusion result and the preprocessed second feature based on the cross-attention mechanism to obtain the enhanced second feature.
[0233] In a possible implementation, the first fusion includes at least one of the following: alignment, concatenation, or convolution.
[0234] In one possible implementation, the model to be trained is also used to perform a second fusion on the enhanced first feature and the enhanced second feature to obtain a second fusion result; the model to be trained is used to: based on the second fusion result, enhance the enhanced first feature and the enhanced second feature to obtain a second-enhanced first feature and a second-enhanced second feature; based on the second-enhanced first feature and the second-enhanced second feature, obtain the position information of the object in the training image.
[0235] In one possible implementation, the second fusion includes at least one of the following: alignment, splicing, processing based on a self-attention mechanism, processing based on a feedforward network, or addition.
[0236] For the introduction of step 2002, please refer to the relevant description of the embodiment shown in Figure 5 and the embodiment shown in Figure 16, which will not be repeated here.
[0237] 2003. Based on the position information and the real position information of the object in the training image, the training model is trained to obtain the target model.
[0238] After the (predicted) position information of the object in the training image is obtained, since the actual position information of the object in the training image is known, the position information of the object in the training image and the actual position information of the object in the training image can be calculated using a preset loss function to obtain a target loss. The target loss is used to indicate the difference between the position information of the object in the training image and the actual position information of the object in the training image. After obtaining the target loss, the parameters of the to-be-trained model can be updated based on the target loss to obtain the to-be-trained model with updated parameters. The to-be-trained model with updated parameters is then continuously trained using the next batch of training data until the model training conditions are met (e.g., the target loss converges, etc.), thereby obtaining the target model in the embodiments shown in FIG. 5 or FIG. 16 .
[0239] The target model obtained by training in the embodiment of the present application has a target detection function. When target detection is required, a target image containing the object to be detected can be obtained, and the target image can be input into the target model. Then, the target model can perform feature extraction on the target image to obtain a first feature, and further perform feature extraction on the first feature to obtain a second feature. Then, the target model can perform a first fusion on the first feature and the second feature to obtain a first fusion result. Subsequently, the target model can enhance the first feature and the second feature based on the first fusion result to obtain an enhanced first feature and an enhanced second feature. Finally, the target model can use the enhanced first feature and the enhanced second feature for detection to obtain the position information of the object in the target image. At this point, the target detection is completed. In the above process, the target model obtains the position information of the object in the target image based on the enhanced first feature and the enhanced second feature, wherein the enhanced first feature is obtained based on the first feature and the first fusion result, and the enhanced second feature is obtained based on the second feature and the first fusion result. The first feature and the second feature represent different local information of the target image, and the first fusion result represents the low-dimensional global information of the target image. Therefore, the target model considers more comprehensive factors in the process of target detection, so the position information of the object finally output by the target model has sufficient accuracy to accurately complete target detection.
[0240] The above is a detailed description of the target detection method and model training method provided by the embodiment of the present application. The target detection device and model training device provided by the embodiment of the present application will be introduced below. Figure 21 is a structural schematic diagram of the target detection device provided by the embodiment of the present application. As shown in Figure 21, the device includes:
[0241] An acquisition module 2101 is used to acquire a target image, where the target image contains an object to be detected;
[0242] Extraction module 2102, configured to perform feature extraction on the target image to obtain a first feature, and perform feature extraction on the first feature to obtain a second feature;
[0243] A fusion module 2103 is configured to perform a first fusion on the first feature and the second feature to obtain a first fusion result;
[0244] An enhancement module 2104 is configured to enhance the first feature and the second feature based on the first fusion result to obtain an enhanced first feature and an enhanced second feature;
[0245] The detection module 2105 is configured to obtain position information of the object in the target image based on the enhanced first feature and the enhanced second feature.
[0246] In an embodiment of the present application, when target detection is required, a target image containing the object to be detected can be obtained, and the target image can be input into the target model. Then, the target model can perform feature extraction on the target image to obtain a first feature, and further perform feature extraction on the first feature to obtain a second feature. Then, the target model can perform a first fusion on the first feature and the second feature to obtain a first fusion result. Subsequently, the target model can enhance the first feature and the second feature based on the first fusion result to obtain an enhanced first feature and an enhanced second feature. Finally, the target model can use the enhanced first feature and the enhanced second feature for detection to obtain the position information of the object in the target image. At this point, the target detection is completed. In the above process, the target model obtains the position information of the object in the target image based on the enhanced first feature and the enhanced second feature, wherein the enhanced first feature is obtained based on the first feature and the first fusion result, and the enhanced second feature is obtained based on the second feature and the first fusion result. The first feature and the second feature represent different local information of the target image, and the first fusion result represents the low-dimensional global information of the target image. Therefore, the target model considers more comprehensive factors in the process of target detection, so the position information of the object finally output by the target model has sufficient accuracy to accurately complete target detection.
[0247] In one possible implementation, the enhancement module 2104 is used to: inject the first fusion result into the first feature to obtain the enhanced first feature, and determine the second feature as the enhanced second feature; or, inject the first fusion result into the first feature to obtain the enhanced first feature, and inject the first fusion result into the second feature to obtain the enhanced second feature; or, determine the first feature as the enhanced first feature, and inject the first fusion result into the second feature to obtain the enhanced second feature.
[0248] In one possible implementation, the enhancement module 2104 is configured to process the first fusion result and the first feature based on a cross-attention mechanism to obtain an enhanced first feature.
[0249] In one possible implementation, the enhancement module 2104 is configured to process the first fusion result and the second feature based on a cross-attention mechanism to obtain an enhanced second feature.
[0250] In one possible implementation, the device also includes: a first preprocessing model, used to preprocess the first feature based on the second feature to obtain a preprocessed first feature, where the preprocessing includes at least one of the following: alignment, splicing, or convolution; an enhancement module 2104, used to process the first fusion result and the preprocessed first feature based on a cross-attention mechanism to obtain an enhanced first feature.
[0251] In one possible implementation, the device also includes: a second preprocessing module, used to preprocess the second feature based on the first feature to obtain a preprocessed second feature, where the preprocessing includes at least one of the following: alignment, splicing, or convolution; an enhancement module 2104, used to process the first fusion result and the preprocessed second feature based on a cross-attention mechanism to obtain an enhanced second feature.
[0252] In a possible implementation, the first fusion includes at least one of the following: alignment, concatenation, or convolution.
[0253] In one possible implementation, the device also includes: a second fusion module, used to perform a second fusion on the enhanced first feature and the enhanced second feature to obtain a second fusion result; a detection module 2105, used to: based on the second fusion result, enhance the enhanced first feature and the enhanced second feature to obtain a second-enhanced first feature and a second-enhanced second feature; based on the second-enhanced first feature and the second-enhanced second feature, obtain the position information of the object in the target image.
[0254] In one possible implementation, the second fusion includes at least one of the following: alignment, concatenation, processing based on a self-attention mechanism, processing based on a feedforward network, or addition.
[0255] FIG22 is a schematic diagram of the structure of a model training device provided in an embodiment of the present application. As shown in FIG22 , the device includes:
[0256] An acquisition module 2201 is used to acquire a training image, where the training image contains an object to be detected;
[0257] The processing module 2202 is configured to process the training image using the model to be trained to obtain position information of the object in the training image, wherein the model to be trained is configured to: perform feature extraction on the training image to obtain a first feature, perform feature extraction on the first feature to obtain a second feature; perform a first fusion on the first feature and the second feature to obtain a first fusion result; based on the first fusion result, enhance the first feature and the second feature to obtain an enhanced first feature and an enhanced second feature; and obtain position information based on the enhanced first feature and the enhanced second feature.
[0258] The training module 2203 is used to train the to-be-trained model based on the position information and the real position information of the object in the training image to obtain a target model.
[0259] The target model obtained by training in the embodiment of the present application has a target detection function. When target detection is required, a target image containing the object to be detected can be obtained and the target image can be input into the target model. Then, the target model can perform feature extraction on the target image to obtain a first feature, and further feature extraction on the first feature to obtain a second feature. Then, the target model can perform a first fusion on the first feature and the second feature to obtain a first fusion result. Subsequently, the target model can enhance the first feature and the second feature based on the first fusion result to obtain an enhanced first feature and an enhanced second feature. Finally, the target model can use the enhanced first feature and the enhanced second feature for detection to obtain the position information of the object in the target image. At this point, the target detection is completed. In the above process, the target model obtains the position information of the object in the target image based on the enhanced first feature and the enhanced second feature, wherein the enhanced first feature is obtained based on the first feature and the first fusion result, and the enhanced second feature is obtained based on the second feature and the first fusion result. The first feature and the second feature represent different local information of the target image, and the first fusion result represents the low-dimensional global information of the target image. Therefore, the target model considers more comprehensive factors in the process of target detection, so the position information of the object finally output by the target model has sufficient accuracy to accurately complete target detection.
[0260] In one possible implementation, the model to be trained is used to: inject the first fusion result into the first feature to obtain the enhanced first feature, and determine the second feature as the enhanced second feature; or, inject the first fusion result into the first feature to obtain the enhanced first feature, and inject the first fusion result into the second feature to obtain the enhanced second feature; or, determine the first feature as the enhanced first feature, and inject the first fusion result into the second feature to obtain the enhanced second feature.
[0261] In one possible implementation, the model to be trained is used to process the first fusion result and the first feature based on a cross-attention mechanism to obtain an enhanced first feature.
[0262] In one possible implementation, the model to be trained is used to process the first fusion result and the second feature based on a cross-attention mechanism to obtain an enhanced second feature.
[0263] In one possible implementation, the model to be trained is also used to preprocess the first feature based on the second feature to obtain the preprocessed first feature, where the preprocessing includes at least one of the following: alignment, splicing, or convolution; the model to be trained is used to process the first fusion result and the preprocessed first feature based on a cross-attention mechanism to obtain an enhanced first feature.
[0264] In one possible implementation, the model to be trained is also used to preprocess the second feature based on the first feature to obtain the preprocessed second feature, and the preprocessing includes at least one of the following: alignment, splicing or convolution; the model to be trained is used to process the first fusion result and the preprocessed second feature based on the cross-attention mechanism to obtain the enhanced second feature.
[0265] In a possible implementation, the first fusion includes at least one of the following: alignment, concatenation, or convolution.
[0266] In one possible implementation, the model to be trained is also used to perform a second fusion on the enhanced first feature and the enhanced second feature to obtain a second fusion result; the model to be trained is used to: based on the second fusion result, enhance the enhanced first feature and the enhanced second feature to obtain a second-enhanced first feature and a second-enhanced second feature; based on the second-enhanced first feature and the second-enhanced second feature, obtain the position information of the object in the training image.
[0267] In one possible implementation, the second fusion includes at least one of the following: alignment, splicing, processing based on a self-attention mechanism, processing based on a feedforward network, or addition.
[0268] It should be noted that the information interaction, execution process, etc. between the modules / units of the above-mentioned device are based on the same concept as the method embodiment of the present application, and the technical effects they bring are the same as those of the method embodiment of the present application. For specific contents, please refer to the description in the method embodiment shown above in the embodiment of the present application, and no further details will be given here.
[0269] The embodiment of the present application also relates to an execution device, and Figure 23 is a structural diagram of the execution device provided by the embodiment of the present application. As shown in Figure 23, the execution device 2300 can be specifically manifested as a mobile phone, a tablet, a laptop computer, an intelligent wearable device, a server, etc., which are not limited here. Among them, the target detection device described in the corresponding embodiment of Figure 21 can be deployed on the execution device 2300 to implement the function of target detection in the corresponding embodiment of Figure 5 or Figure 16. Specifically, the execution device 2300 includes: a receiver 2301, a transmitter 2302, a processor 2303 and a memory 2304 (wherein the number of processors 2303 in the execution device 2300 can be one or more, and Figure 23 takes one processor as an example), wherein the processor 2303 may include an application processor 23031 and a communication processor 23032. In some embodiments of the present application, the receiver 2301, the transmitter 2302, the processor 2303 and the memory 2304 can be connected via a bus or other means.
[0270] Memory 2304 may include read-only memory and random access memory, and provides instructions and data to processor 2303. A portion of memory 2304 may also include non-volatile random access memory (NVRAM). Memory 2304 stores processor and operation instructions, executable modules, or data structures, or subsets or extended sets thereof. The operation instructions may include various operation instructions for implementing various operations.
[0271] Processor 2303 controls the operation of the execution device. In specific applications, the various components of the execution device are coupled together via a bus system. In addition to a data bus, the bus system may also include a power bus, a control bus, and a status signal bus. However, for clarity, all of these buses are referred to as a bus system in the figure.
[0272] The methods disclosed in the above embodiments of the present application can be applied to or implemented by processor 2303. Processor 2303 can be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by hardware integrated logic circuits or software instructions in processor 2303. The above processor 2303 can be a general-purpose processor, a digital signal processor (DSP), a microprocessor, or a microcontroller, and can further include an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The processor 2303 can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in conjunction with the embodiments of the present application can be directly implemented as being executed by a hardware decoding processor, or can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium well-known in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, etc. The storage medium is located in memory 2304, and processor 2303 reads the information in memory 2304 and, in conjunction with its hardware, completes the steps of the above method.
[0273] Receiver 2301 can be used to receive input digital or character information and generate signal input related to executing device-related settings and function control. Transmitter 2302 can be used to output digital or character information through the first interface. Transmitter 2302 can also be used to send instructions to the disk pack through the first interface to modify data in the disk pack. Transmitter 2302 can also include a display device such as a display screen.
[0274] In an embodiment of the present application, in one case, the processor 2303 is used to complete target detection through the target model in the embodiment corresponding to Figure 5 or Figure 16.
[0275] The present application also relates to a training device. FIG24 is a schematic diagram of the structure of the training device provided by the present application. As shown in FIG24 , the training device 2400 is implemented by one or more servers. The training device 2400 may vary significantly due to different configurations or performance. It may include one or more central processing units (CPUs) 2424 (e.g., one or more processors) and memory 2432, and one or more storage media 2430 (e.g., one or more mass storage devices) storing application programs 2442 or data 2444. The memory 2432 and storage medium 2430 may be temporary storage or permanent storage. The program stored in the storage medium 2430 may include one or more modules (not shown), each module may include a series of instruction operations in the training device. Furthermore, the CPU 2424 may be configured to communicate with the storage medium 2430 to execute the series of instruction operations in the storage medium 2430 on the training device 2400.
[0276] The training device 2400 may also include one or more power supplies 2426, one or more wired or wireless network interfaces 2450, one or more input and output interfaces 2458; or, one or more operating systems 2441, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.
[0277] Specifically, the training device can execute the model training method in the embodiment corresponding to Figure 20 to obtain the target model.
[0278] An embodiment of the present application also relates to a computer storage medium, which stores a program for signal processing. When the computer storage medium is run on a computer, it enables the computer to execute the steps executed by the aforementioned execution device, or enables the computer to execute the steps executed by the aforementioned training device.
[0279] An embodiment of the present application also relates to a computer program product, which stores instructions that, when executed by a computer, enable the computer to execute the steps executed by the aforementioned execution device, or enable the computer to execute the steps executed by the aforementioned training device.
[0280] The execution device, training device or terminal device provided in the embodiments of the present application can specifically be a chip, and the chip includes: a processing unit and a communication unit, the processing unit can be, for example, a processor, and the communication unit can be, for example, an input / output interface, a pin or a circuit, etc. The processing unit can execute the computer execution instructions stored in the storage unit, so that the chip in the execution device executes the data processing method described in the above embodiment, or so that the chip in the training device executes the data processing method described in the above embodiment. Optionally, the storage unit is a storage unit in the chip, such as a register, a cache, etc. The storage unit can also be a storage unit located outside the chip in the wireless access device, such as a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM), etc.
[0281] Specifically, see Figure 25 , which is a schematic diagram of the structure of a chip provided in an embodiment of the present application. The chip can be represented as a neural network processor NPU 2500. NPU 2500 is mounted on the host CPU (host CPU) as a coprocessor and is assigned tasks by the host CPU. The core of the NPU is arithmetic circuit 2503, which is controlled by controller 2504 to extract matrix data from memory and perform multiplication operations.
[0282] In some implementations, the arithmetic circuit 2503 includes multiple processing units (PEs). In some implementations, the arithmetic circuit 2503 is a two-dimensional systolic array. The arithmetic circuit 2503 can also be a one-dimensional systolic array or other electronic circuit capable of performing mathematical operations such as multiplication and addition. In some implementations, the arithmetic circuit 2503 is a general-purpose matrix processor.
[0283] For example, assume there are input matrix A, weight matrix B, and output matrix C. The arithmetic circuit retrieves the corresponding data of matrix B from weight memory 2502 and caches it on each PE in the arithmetic circuit. The arithmetic circuit retrieves the data of matrix A from input memory 2501 and performs a matrix operation on matrix B. The partial or final matrix result is stored in accumulator 2508.
[0284] Unified memory 2506 is used to store input and output data. Weight data is directly transferred to weight memory 2502 through the Direct Memory Access Controller (DMAC) 2505. Input data is also transferred to unified memory 2506 through the DMAC.
[0285] BIU stands for Bus Interface Unit, i.e., bus interface unit 2513 , which is used for interaction between the AXI bus, DMAC, and instruction fetch buffer (IFB) 2509 .
[0286] The bus interface unit 2513 (BIU) is used for the instruction fetch memory 2509 to obtain instructions from the external memory, and is also used for the storage unit access controller 2505 to obtain the original data of the input matrix A or the weight matrix B from the external memory.
[0287] DMAC is mainly used to transfer input data in the external memory DDR to the unified memory 2506 or to transfer weight data to the weight memory 2502 or to transfer input data to the input memory 2501.
[0288] The vector calculation unit 2507 includes multiple operation processing units. When necessary, it further processes the output of the operation circuit 2503, such as vector multiplication, vector addition, exponential operation, logarithmic operation, size comparison, etc. It is mainly used for non-convolutional / fully connected layer network calculations in neural networks, such as batch normalization, pixel-level summation, and upsampling of the predicted label plane.
[0289] In some implementations, the vector calculation unit 2507 can store the processed output vector to the unified memory 2506. For example, the vector calculation unit 2507 can apply a linear function or a nonlinear function to the output of the operation circuit 2503, such as linear interpolation of the predicted label plane extracted by the convolution layer, or another example is a vector of accumulated values to generate an activation value. In some implementations, the vector calculation unit 2507 generates a normalized value, a pixel-level summed value, or both. In some implementations, the processed output vector can be used as an activation input to the operation circuit 2503, for example, for use in subsequent layers in a neural network.
[0290] An instruction fetch buffer 2509 connected to the controller 2504 is used to store instructions used by the controller 2504;
[0291] Unified memory 2506, input memory 2501, weight memory 2502, and instruction fetch memory 2509 are all on-chip memories. External memories are private to the NPU hardware architecture.
[0292] The processor mentioned in any of the above places can be a general-purpose central processing unit, a microprocessor, an ASIC, or one or more integrated circuits for controlling the execution of the above program.
[0293] It should also be noted that the device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed across multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment. In addition, in the drawings of the device embodiments provided in this application, the connection relationship between the modules indicates that there is a communication connection between them, which can be specifically implemented as one or more communication buses or signal lines.
[0294] Through the description of the above embodiments, those skilled in the art can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course can also be implemented by special hardware including application-specific integrated circuits, special CPUs, special memories, special components, etc. In general, all functions performed by computer programs can be easily implemented with corresponding hardware, and the specific hardware structures used to implement the same function can also be diverse, such as analog circuits, digital circuits or special circuits, etc. However, for the present application, software program implementation is a better implementation method in most cases. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer's floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk or optical disk, etc., and includes a number of instructions to enable a computer device (which can be a personal computer, training equipment, or network equipment, etc.) to execute the methods described in each embodiment of the present application.
[0295] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware, or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.
[0296] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website, a computer, a training device or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website, computer, training device or data center. The computer-readable storage medium can be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations. The available medium can be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)).
Claims
1. A target detection method, characterized in that: The method is implemented by a target model, and the method comprises: Acquire a target image, wherein the target image includes an object to be detected; Performing feature extraction on the target image to obtain a first feature, and performing feature extraction on the first feature to obtain a second feature; Performing a first fusion on the first feature and the second feature to obtain a first fusion result; Based on the first fusion result, the first feature and the second feature are enhanced to obtain an enhanced first feature and an enhanced second feature; Based on the enhanced first feature and the enhanced second feature, position information of the object in the target image is acquired.
2. The method according to claim 1, characterized in that The step of enhancing the first feature and the second feature based on the first fusion result to obtain the enhanced first feature and the enhanced second feature includes: injecting the first fusion result into the first feature to obtain an enhanced first feature, and determining the second feature as an enhanced second feature; or, injecting the first fusion result into the first feature to obtain an enhanced first feature, and injecting the first fusion result into the second feature to obtain an enhanced second feature; or, The first feature is determined as an enhanced first feature, and the first fusion result is injected into the second feature to obtain an enhanced second feature.
3. The method according to claim 2, characterized in that The injecting the first fusion result into the first feature to obtain the enhanced first feature includes: The first fusion result and the first feature are processed based on a cross-attention mechanism to obtain an enhanced first feature.
4. The method according to claim 2 or 3, characterized in that: The injecting the first fusion result into the second feature to obtain the enhanced second feature includes: The first fusion result and the second feature are processed based on the cross-attention mechanism to obtain an enhanced second feature.
5. The method according to claim 3, characterized in that: The method further comprises: Based on the second feature, preprocessing the first feature to obtain a preprocessed first feature, wherein the preprocessing includes at least one of the following: alignment, concatenation or convolution; The first fusion result and the first feature are processed based on the cross attention mechanism to obtain an enhanced first feature including: The first fusion result and the preprocessed first feature are processed based on a cross-attention mechanism to obtain an enhanced first feature.
6. The method according to claim 4, characterized in that The method further comprises: Based on the first feature, preprocessing the second feature to obtain a preprocessed second feature, wherein the preprocessing includes at least one of the following: alignment, concatenation or convolution; The first fusion result and the second feature are processed based on the cross attention mechanism to obtain an enhanced second feature including: The first fusion result and the preprocessed second feature are processed based on a cross-attention mechanism to obtain an enhanced second feature.
7. The method according to any one of claims 1 to 6, characterized in that: The first fusion includes at least one of the following: alignment, concatenation or convolution.
8. The method according to any one of claims 1 to 7, characterized in that: The method further comprises: Performing a second fusion on the enhanced first feature and the enhanced second feature to obtain a second fusion result; The acquiring the position information of the object in the target image based on the enhanced first feature and the enhanced second feature includes: Based on the second fusion result, the enhanced first feature and the enhanced second feature are enhanced to obtain a second enhanced first feature and a second enhanced second feature; Based on the second enhanced first feature and the second enhanced second feature, position information of the object in the target image is obtained.
9. The method according to claim 8, characterized in that The second fusion includes at least one of the following: alignment, concatenation, processing based on a self-attention mechanism, processing based on a feedforward network, or addition.
10. A model training method, characterized in that: The method comprises: Acquire a training image, wherein the training image contains an object to be detected; The training image is processed by a model to be trained to obtain the position information of the object in the training image, and the model to be trained is used to: extract features from the training image to obtain a first feature, and extract features from the first feature to obtain a second feature; perform a first fusion on the first feature and the second feature to obtain a first fusion result; based on the first fusion result, enhance the first feature and the second feature to obtain an enhanced first feature and an enhanced second feature; and obtain the position information based on the enhanced first feature and the enhanced second feature; Based on the position information and the real position information of the object in the training image, the model to be trained is trained to obtain a target model.
11. The method according to claim 10, characterized in that The model to be trained is used for: Injecting the first fusion result into the first feature to obtain an enhanced first feature, and determining the second feature as an enhanced second feature; or, Injecting the first fusion result into the first feature to obtain an enhanced first feature, and injecting the first fusion result into the second feature to obtain an enhanced second feature; or, The first feature is determined as an enhanced first feature, and the first fusion result is injected into the second feature to obtain an enhanced second feature.
12. The method according to claim 11, characterized in that The model to be trained is used to process the first fusion result and the first feature based on the cross-attention mechanism to obtain an enhanced first feature.
13. The method according to claim 11 or 12, characterized in that: The model to be trained is used to process the first fusion result and the second feature based on the cross-attention mechanism to obtain an enhanced second feature.
14. The method according to claim 12, characterized in that The model to be trained is further used to preprocess the first feature based on the second feature to obtain a preprocessed first feature, wherein the preprocessing includes at least one of the following: alignment, concatenation or convolution; The model to be trained is used to process the first fusion result and the preprocessed first feature based on the cross-attention mechanism to obtain an enhanced first feature.
15. The method according to claim 13, characterized in that The model to be trained is further used to preprocess the second feature based on the first feature to obtain a preprocessed second feature, wherein the preprocessing includes at least one of the following: alignment, concatenation or convolution; The model to be trained is used to process the first fusion result and the preprocessed second feature based on the cross-attention mechanism to obtain an enhanced second feature.
16. The method according to any one of claims 10 to 15, characterized in that: The first fusion includes at least one of the following: alignment, concatenation or convolution.
17. The method according to any one of claims 10 to 16, characterized in that: The model to be trained is further used to perform a second fusion on the enhanced first feature and the enhanced second feature to obtain a second fusion result; The model to be trained is used for: Based on the second fusion result, the enhanced first feature and the enhanced second feature are enhanced to obtain a second enhanced first feature and a second enhanced second feature; Based on the second enhanced first feature and the second enhanced second feature, position information of the object in the training image is obtained.
18. The method according to claim 17, characterized in that The second fusion includes at least one of the following: alignment, concatenation, processing based on a self-attention mechanism, processing based on a feedforward network, or addition.
19. A target detection device, characterized in that: The device comprises a target model, and the device comprises: An acquisition module, used for acquiring a target image, wherein the target image includes an object to be detected; an extraction module, configured to perform feature extraction on the target image to obtain a first feature, and perform feature extraction on the first feature, Get the second feature; A fusion module, used for performing a first fusion on the first feature and the second feature to obtain a first fusion result; an enhancement module, configured to enhance the first feature and the second feature based on the first fusion result to obtain an enhanced first feature and an enhanced second feature; A detection module is used to obtain the position information of the object in the target image based on the enhanced first feature and the enhanced second feature.
20. A model training device, characterized in that: The device comprises: An acquisition module, used for acquiring a training image, wherein the training image contains an object to be detected; a processing module, configured to process the training image through a model to be trained to obtain the position information of the object in the training image, wherein the model to be trained is configured to: perform feature extraction on the training image to obtain a first feature, and perform feature extraction on the first feature to obtain a second feature; perform a first fusion on the first feature and the second feature to obtain a first fusion result; based on the first fusion result, enhance the first feature and the second feature to obtain an enhanced first feature and an enhanced second feature; and obtain the position information based on the enhanced first feature and the enhanced second feature; A training module is used to train the model to be trained based on the position information and the real position information of the object in the training image to obtain a target model.
21. A target detection device, characterized in that: The target detection device includes a memory and a processor; the memory stores codes, and the processor is configured to execute the codes. When the codes are executed, the target detection device executes the method according to any one of claims 1 to 18.
22. A computer storage medium, characterized in that The computer storage medium stores one or more instructions, which, when executed by one or more computers, enable the one or more computers to implement the method of any one of claims 1 to 18.
23. A computer program product, characterized in that The computer program product stores instructions, which, when executed by a computer, cause the computer to implement the method according to any one of claims 1 to 18.
Citation Information
Patent Citations
A target detection method and related device
CN117173626B
Target detection method and electronic equipment
CN114387496A
Target detection method and system based on attention mechanism and feature cross fusion
CN115035361A
Target detection method, target detection model training method and related device
CN115797706A
Target detection method and device, model training method and device, equipment and medium
CN115880555A
Cited By
Belt foreign matter visual identification system based on image processing
CN120495993A
SAR image target detection method and device based on data augmentation
CN120563796A