Target detection model processing method and apparatus, and electronic device
By combining a feature extraction model and a reversible neural network in the target detection model, and calculating statistical data on feature map differences to adjust parameters, the robustness problem under the influence of light and shadow is solved, and high-accuracy target detection is achieved under different light and shadow conditions.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHANGHAI DIANZE INTELLIGENT TECH CO LTD
- Filing Date
- 2023-02-23
- Publication Date
- 2026-04-24
AI Technical Summary
In existing technologies, target detection models based on flow models are not robust during training because sample images are easily affected by different lighting effects, leading to problems such as misjudgment and missed judgment.
By acquiring multiple sample images of a preset background that do not contain a foreground target, feature maps are extracted using a feature extraction model, and the statistical difference between the feature maps is calculated as the loss value. The network parameters of the feature extraction model are adjusted, and the model is trained in conjunction with a reversible neural network model to make the feature maps conform to the preset target distribution, thereby improving robustness.
Under different lighting conditions, the robustness of the feature extraction model is improved, false positives and false negatives are reduced, and the accuracy of target detection is enhanced.
Smart Images

Figure CN116109838B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and more specifically, to a target detection model processing method, apparatus, and electronic device. Background Technology
[0002] With the continuous development of image processing technology, machine learning-based target detection or anomaly detection techniques under fixed backgrounds are being applied across various industries. When performing target detection, it is typically necessary to first determine the region or location of foreground targets (e.g., foreign objects, cracks, or other defects) from a relatively fixed background image (e.g., an image of an object surface without anomalies). Some schemes employ a flow-based reversible neural network model to map image features of the image to be processed, thereby determining the foreground targets in the image. In such schemes, the sample images used during training usually only include positive samples, i.e., images without foreground targets. However, during training, the sample images are easily affected by different lighting effects, resulting in low robustness and leading to problems such as misjudgment and missed detection in the subsequent target detection process. Summary of the Invention
[0003] To overcome the aforementioned shortcomings in the prior art, the purpose of this application is to provide a target detection model processing method, the method comprising:
[0004] Acquire multiple sample images with preset backgrounds that do not contain foreground objects;
[0005] The feature extraction model to be trained is used to extract features from the multiple sample images to obtain multiple first feature maps;
[0006] Difference statistics are obtained based on the differences between multiple first feature maps;
[0007] The model parameters of the feature extraction model are updated by taking the derivative with the aim of minimizing the difference statistics, so as to obtain the trained feature extraction model;
[0008] The feature map extracted by the feature extraction model is input into the reversible neural network model to be trained. The reversible neural network model is trained to map the first feature map to a first data matrix, and the first data matrix conforms to the target distribution of a preset target function, thereby obtaining the trained reversible neural network model.
[0009] In one possible implementation, the method further includes:
[0010] Get the image to be processed on a preset background;
[0011] The feature extraction model is used to extract features from the image to be processed, thereby obtaining a second feature map of the image to be processed.
[0012] The second feature map is mapped using the reversible neural network model to obtain the second data matrix corresponding to the second feature map.
[0013] Based on the difference between the distribution obtained by processing the second data matrix by inputting it into a preset objective function and the target distribution, the position and range information of the foreground target in the preset background are determined.
[0014] In one possible implementation, the step of obtaining difference statistics based on the differences between the plurality of first feature maps includes:
[0015] Calculate the variance of pixel values at the same position in multiple first feature maps, and obtain a variance map composed of the variances of each pixel value as the difference statistics.
[0016] In one possible implementation, the step of obtaining the difference statistics of the plurality of first feature maps includes:
[0017] The first feature map is divided into multiple patches, and the variance of pixel values of each pixel in the same patch of the multiple first feature maps is calculated to obtain a variance map composed of the variances of each pixel value as the difference statistics.
[0018] In one possible implementation, the step of updating the model parameters of the feature extraction model by taking the derivative with the aim of minimizing the difference statistics includes:
[0019] Obtain a preset number of the largest variances of the pixel values in the variance map;
[0020] Calculate the sum of squares of the variances of the preset number of largest pixel values;
[0021] The model parameters of the feature extraction model are updated by taking derivatives with the aim of minimizing the sum of squares.
[0022] In one possible implementation, the step of acquiring multiple sample images of a preset background that do not contain a foreground target includes:
[0023] Acquire multiple sample images of the preset background without foreground targets under different lighting conditions.
[0024] In one possible implementation, the step of acquiring multiple sample images of a preset background that do not contain a foreground target includes:
[0025] Obtain a sample image of the preset background that does not contain a foreground target;
[0026] Data augmentation algorithms are used to add various light and shadow transformations to the sample images to obtain multiple processed sample images.
[0027] Another objective of this application is to provide a target detection model processing device, the target detection model processing device comprising:
[0028] The image acquisition module is used to acquire multiple sample images of a preset background that do not contain a foreground target;
[0029] The feature extraction module is used to extract features from multiple sample images using a feature extraction model to be trained, thereby obtaining multiple first feature maps.
[0030] The difference calculation module is used to obtain difference statistics based on the differences between multiple first feature maps;
[0031] The first training module is used to perform derivative updates on the model parameters of the feature extraction model with the aim of minimizing the difference statistics, so as to obtain the trained feature extraction model.
[0032] The second training module is used to input the feature map extracted by the feature extraction model into the reversible neural network model to be trained, and to train the reversible neural network model to map the first feature map to a first data matrix, and to make the first data matrix conform to the target distribution of a preset target function, so as to obtain the trained reversible neural network model.
[0033] Another objective of this application is to provide an electronic device, including a processor and a machine-readable storage medium, wherein the machine-readable storage medium stores machine-executable instructions, and the machine-executable instructions, when executed by the processor, implement the target detection model processing method provided in this application.
[0034] Another objective of this application is to provide a machine-readable storage medium storing machine-executable instructions that, when executed by one or more processors, implement the target detection model processing method provided in this application.
[0035] Compared with the prior art, this application has the following beneficial effects:
[0036] The target detection model processing method, apparatus, and electronic device provided in this application adjust the network parameters of the feature extraction model by using the statistical difference data between multiple first feature maps extracted by the feature extraction model as the loss value. This allows the feature maps extracted by the feature extraction model to have better robustness under different lighting conditions when they are subsequently processed by a reversible neural network for target detection. Attached Figure Description
[0037] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0038] Figure 1 This is one of the flowcharts illustrating the steps of the target detection model processing method provided in this embodiment;
[0039] Figure 2 This is the second schematic diagram of the steps of the target detection model processing method provided in this embodiment;
[0040] Figure 3 This is one of the schematic diagrams illustrating the image processing process of the target detection model processing method provided in this embodiment;
[0041] Figure 4 This is the second schematic diagram of the image processing process of the target detection model processing method provided in this embodiment;
[0042] Figure 5 This is the third schematic diagram of the image processing process of the target detection model processing method provided in this embodiment;
[0043] Figure 6 This is a schematic diagram of the electronic device provided in this embodiment;
[0044] Figure 7 This is a schematic diagram of the functional modules of the target detection model processing device provided in this embodiment. Detailed Implementation
[0045] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. The components of the embodiments of this application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0046] Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0047] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.
[0048] In the description of this application, it should be noted that the terms "first," "second," "third," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0049] In the description of this application, it should also be noted that, unless otherwise expressly specified and limited, the terms "set up," "install," "connect," and "link" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in this application based on the specific circumstances.
[0050] Please see Figure 1 , Figure 1 This is a flowchart illustrating the steps of a target detection model processing method provided in this embodiment. The steps of this method are described in detail below. The target detection model may include a feature extraction model and a reversible neural network model.
[0051] Step S110: Obtain multiple sample images with a preset background that do not contain a foreground target.
[0052] In this embodiment, the sample image can be obtained from video captured by a camera at a fixed position and angle. The sample image is a predetermined image that includes only the preset background and has no foreground target. In one example, the sample image is an image of an object in its normal state without any abnormal areas in an object anomaly detection scenario. In another example, the sample image can be a background image from a video surveillance scene.
[0053] Optionally, in one possible implementation, in step S110, multiple sample images of the preset background without foreground targets under different lighting conditions can be acquired. This reduces the impact of different lighting conditions on the feature extraction results during subsequent training.
[0054] In another possible implementation, in step S110, sample images without foreground targets on the preset background can be acquired. Then, a data augmentation algorithm is used to add various lighting and shadow transformations to the sample images, resulting in multiple processed sample images. This allows for the addition of different lighting effects to sample images without requiring a large number of sample images, thereby reducing the impact of different lighting conditions on the feature extraction results during subsequent training.
[0055] Step S120: The feature extraction model to be trained is used to extract features from the multiple sample images to obtain multiple first feature maps.
[0056] In this embodiment, the feature extraction model can be a general neural network model used for image feature extraction, such as ResNet18, ResNet50, ViT, etc. During the training phase, multiple sample images can be input into the feature extraction model in batches for feature extraction to obtain multiple first feature maps.
[0057] Step S130: Obtain difference statistics based on the differences between the multiple first feature maps.
[0058] Step S140: The model parameters of the feature extraction model are updated by taking the derivative with the aim of minimizing the difference statistics, so as to obtain the trained feature extraction model.
[0059] In this embodiment, to minimize the impact of different lighting effects on the feature extraction model, the statistical difference between multiple first feature maps can be used as the loss value. The model parameters of the feature extraction model are then updated by taking the derivative of the statistical difference data. This allows the feature extraction model to extract similar or identical features from each sample image under different lighting conditions, thereby improving the robustness of the features extracted by the feature extraction model to different lighting conditions.
[0060] Step S150: Input the feature map extracted by the feature extraction model into the reversible neural network model to be trained, train the reversible neural network model to map the first feature map to a first data matrix, and make the first data matrix conform to the target distribution of the preset target function, and obtain the trained reversible neural network model.
[0061] In this embodiment, the reversible neural network model is a flow-based neural network model. In this embodiment, since the first data matrix corresponding to the sample images of the preset background that do not contain foreground targets conforms to the target distribution after processing by the objective function, the target distribution can be used as a reference to represent the characteristic that the preset background does not contain foreground targets.
[0062] Furthermore, in one possible implementation, please refer to... Figure 2 The method provided in this embodiment may further include the following steps of processing the image to be processed using a target detection model.
[0063] Step S210: Obtain the image to be processed on a preset background.
[0064] In this embodiment, unlike step S110, the image to be processed may include an image under the preset background that requires detection of the presence of a foreground target or the presence of anomalies. The image to be processed includes at least a background image region that is partially the same as the sample image.
[0065] For example, please refer to Figure 3 and Figure 4 The sample image can be an image of a normally functioning object that has been determined to be without anomalies in an anomaly detection scenario, such as... Figure 3 As shown; the image to be processed can be an image of an object that needs to be determined to have defects such as foreign objects, cracks, or damage, such as... Figure 4 As shown.
[0066] Step S220: Extract features from the image to be processed using the feature extraction model to obtain a second feature map of the image to be processed.
[0067] Step S230: Perform feature mapping on the second feature map using the reversible neural network model to obtain the second data matrix corresponding to the second feature map.
[0068] Step S240: Based on the difference between the distribution obtained by processing the second data matrix by inputting it into a preset objective function and the target distribution, determine the position and range information of the foreground target in the preset background.
[0069] In this embodiment, after processing the second feature map of the image to be processed using the reversible neural network, the distribution obtained by processing the second data matrix using a preset target function, locations with small differences from the target distribution can be considered as regions close to the preset background, while locations with large differences from the target distribution can be considered as regions where the foreground target is located. Figure 3 and Figure 4 Taking the anomaly detection scenario shown as an example, the foreground target can be a foreign object, crack, damage or other defect on the preset background.
[0070] For example, in this embodiment, the target distribution corresponding to the objective function is a Gaussian distribution with a mean of 0 and a variance of 1. Therefore, in step S150, the parameter G of the mapping function of the invertible neural network model can be determined according to the following formula.
[0071] ζ(z i )=f(x i )(|det(J G )|) -1
[0072] x i =G -1 (z i )
[0073] Among them, z i For each feature value in the second overall image feature, ζ(z) i ) for z i probability density function, x i For z i The values J in the second data matrix obtained after processing by the mapping function of the invertible neural network model G G is the Jacobian determinant of the mapping function of the invertible neural network model. -1 The inverse mapping of the mapping function of the invertible neural network model.
[0074] Then, by solving for the maximum value condition parameter of the following formula, the parameter G of the mapping function of the invertible neural network model is obtained:
[0075]
[0076] Thus, the first data matrix obtained by the reversible neural network after training, after mapping the first feature map, conforms to a Gaussian distribution with a mean of 0 and a variance of 1.
[0077] Based on this, in step S240, when processing the image to be processed, the target distribution can be a Gaussian distribution with a mean of 0 and a variance of 1, and the values x in the second data matrix can be... i Substituting the values into the formula of the objective function described below, we obtain the distribution value k of the second data matrix after processing by the objective function. i :
[0078] k i =exp(-0.5x i 2 )
[0079] Wherein, the distribution value k corresponding to the preset background in the image to be processed iThe distribution value k corresponding to the foreground target in the image to be processed is relatively closer to 1. i It is relatively closer to 0;
[0080] Then, the distribution values k can be obtained. i The heat map is generated by multiplying by 255. Then, the areas in the heat map with pixel values less than a set threshold are identified as the areas where the foreground target is located. The position and range information of the foreground target on the preset background are determined based on the area where the foreground target is sitting.
[0081] For example, please refer to Figure 5 After binarizing the heatmap according to the set threshold, since the value of the region where the foreground target is located is closer to 255, while the value of the region corresponding to the preset background is closer to 0, the position and range information of the foreground target on the preset background can be determined.
[0082] Based on the above design, in the target detection model processing method provided in this embodiment, the network parameters of the feature extraction model are adjusted by using the statistical data of the differences between multiple first feature maps extracted by the feature extraction model as the loss value. This allows the feature maps extracted by the feature extraction model to have better robustness under different lighting conditions when they are subsequently processed by the reversible neural network for target detection.
[0083] In one possible implementation, in step S130, the pixel value variance of pixels at the same position in multiple first feature maps can be calculated to obtain a variance map composed of the variances of each pixel value as the difference statistics.
[0084] For example, suppose the dimensions of the first feature map of multiple sample images in a certain round are [b, c, h, w], where b is the number of sample images in the batch, c is the number of channels in each first feature map, h is the height of the first feature map, and w is the width of the first feature map. Since the feature map size of each channel in each first feature map is h*w, for pixels at the same position in the feature maps of each channel in multiple first feature maps, the variance of the pixel values at that position can be calculated, thus obtaining a variance map of size h*w. In the variance map, areas with larger pixel values indicate lower stationarity at the corresponding positions.
[0085] Further, in step S140, a preset number of the largest pixel value variances can be obtained from the variance map. For example, the pixel variance values in the variance map are sorted in descending order, and then the n largest pixel variance values are obtained, where n <= h*w.
[0086] Then, the sum of squares of the largest variances of the pixel values is calculated, and this sum of squares can be used as the loss value. The model parameters of the feature extraction model are then updated by taking the derivative with the aim of minimizing the sum of squares.
[0087] In another possible implementation, in step S130, the first feature map can be divided into multiple blocks, and then the variance of the pixel values of each pixel in the same block of the multiple first feature maps can be calculated to obtain a variance map composed of the variances of each pixel value as the difference statistics.
[0088] This embodiment also provides an electronic device that can be used to run or implement the target detection model processing method provided in this embodiment. The electronic device may include a device with image processing capabilities, such as a server, a personal computer, a laptop computer, etc.
[0089] Please refer to Figure 6 A schematic diagram of the electronic device 100, which includes a target detection model processing device 110, a machine-readable storage medium 120, and a processor 130.
[0090] The machine-readable storage medium 120, processor 130, and communication unit 140 are electrically connected directly or indirectly to each other to achieve data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses or signal lines. The target detection model processing device 110 includes at least one software function module that can be stored in the machine-readable storage medium 120 in the form of software or firmware or embedded in the operating system (OS) of the electronic device 100. The processor 130 is used to execute the executable modules stored in the machine-readable storage medium 120, such as the software function modules and computer programs included in the target detection model processing device 110.
[0091] The machine-readable storage medium 120 may be, but is not limited to, random access memory (RAM), read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), etc. The machine-readable storage medium 120 is used to store programs, and the processor 130 executes these programs / executable target detection model processing methods provided in this embodiment after receiving execution instructions.
[0092] The processor 130 may be an integrated circuit chip with signal processing capabilities. The aforementioned processor can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be a Digital Signal Processor (DSP), 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. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor.
[0093] Please refer to Figure 7 This embodiment also provides a target detection model processing device 110, which includes at least one functional module that can be stored in machine-readable storage medium 120 in software form. Functionally, the target detection model processing device 110 may include an image acquisition module 111, a feature extraction module 112, a difference calculation module 113, a first training module 114, and a second training module 115.
[0094] The image acquisition module 111 is used to acquire multiple sample images of a preset background that do not contain foreground targets.
[0095] In this embodiment, the image acquisition module 111 can be used to perform... Figure 1 For a detailed description of the image acquisition module 111 shown in step S110, please refer to the description of step S110.
[0096] The feature extraction module 112 is used to extract features from multiple sample images using a feature extraction model to be trained, thereby obtaining multiple first feature maps.
[0097] In this embodiment, the feature extraction module 112 can be used to perform... Figure 1 For a detailed description of the feature extraction module 112 shown in step S120, please refer to the description of step S120.
[0098] The difference calculation module 113 is used to obtain difference statistics based on the differences between multiple first feature maps.
[0099] In this embodiment, the difference calculation module 113 can be used to perform... Figure 1 For a detailed description of the difference calculation module 113 shown in step S130, please refer to the description of step S130.
[0100] The first training module 114 is used to perform derivative updates on the model parameters of the feature extraction model with the aim of minimizing the difference statistics, so as to obtain the trained feature extraction model.
[0101] In this embodiment, the first training module 114 can be used to execute Figure 1 For a detailed description of the first training module 114, see the description of step S140 shown.
[0102] The second training module 115 is used to input the feature map extracted by the feature extraction model into the reversible neural network model to be trained, and to train the reversible neural network model to map the first feature map to a first data matrix, and to make the first data matrix conform to the target distribution of a preset target function, so as to obtain the trained reversible neural network model.
[0103] In this embodiment, the second training module 115 can be used to execute Figure 1 For a detailed description of step S150 shown, please refer to the description of step S150 for details regarding the second training module 115.
[0104] In summary, the target detection model processing method, apparatus, and electronic device provided in this application adjust the network parameters of the feature extraction model by using the statistical data of the differences between multiple first feature maps extracted by the feature extraction model as the loss value. This allows the feature maps extracted by the feature extraction model to have better robustness under different lighting conditions when they are subsequently processed by a reversible neural network for target detection.
[0105] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0106] In addition, the functional modules in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0107] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0108] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0109] The above descriptions are merely various embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A target detection model processing method, characterized in that, The method includes: Acquire multiple sample images with preset backgrounds that do not contain foreground objects; The feature extraction model to be trained is used to extract features from the multiple sample images to obtain multiple first feature maps; Difference statistics are obtained based on the differences between multiple first feature maps; The model parameters of the feature extraction model are updated by taking the derivative with the aim of minimizing the difference statistics, so as to obtain the trained feature extraction model; The feature map extracted by the feature extraction model is input into the reversible neural network model to be trained. The reversible neural network model is trained to map the first feature map to a first data matrix, and the first data matrix conforms to the target distribution of a preset target function, thereby obtaining the trained reversible neural network model. The method further includes: Get the image to be processed on a preset background; The feature extraction model is used to extract features from the image to be processed, thereby obtaining a second feature map of the image to be processed. The second feature map is mapped using the reversible neural network model to obtain the second data matrix corresponding to the second feature map. Based on the difference between the distribution obtained by processing the second data matrix by inputting it into a preset objective function and the target distribution, the position and range information of the foreground target in the preset background are determined.
2. The method according to claim 1, characterized in that, The step of obtaining difference statistics based on the differences between multiple first feature maps includes: Calculate the variance of pixel values at the same position in multiple first feature maps, and obtain a variance map composed of the variances of each pixel value as the difference statistics.
3. The method according to claim 1, characterized in that, The step of obtaining the difference statistics of the plurality of first feature maps includes: The first feature map is divided into multiple patches, and the variance of pixel values of each pixel in the same patch of the multiple first feature maps is calculated to obtain a variance map composed of the variances of each pixel value as the difference statistics.
4. The method according to claim 2 or 3, characterized in that, The step of updating the model parameters of the feature extraction model by taking the derivative with the aim of minimizing the difference statistics includes: Obtain a preset number of the largest variances of the pixel values in the variance map; Calculate the sum of squares of the variances of the preset number of largest pixel values; The model parameters of the feature extraction model are updated by taking derivatives with the aim of minimizing the sum of squares.
5. The method according to claim 1, characterized in that, The step of acquiring multiple sample images of a preset background that do not contain a foreground target includes: Acquire multiple sample images of the preset background without foreground targets under different lighting conditions.
6. The method according to claim 1, characterized in that, The step of acquiring multiple sample images of a preset background that do not contain a foreground target includes: Obtain a sample image of the preset background that does not contain a foreground target; Data augmentation algorithms are used to add various light and shadow transformations to the sample images to obtain multiple processed sample images.
7. A target detection model processing device, characterized in that, The target detection model processing device includes: The image acquisition module is used to acquire multiple sample images of a preset background that do not contain a foreground target; The feature extraction module is used to extract features from multiple sample images using a feature extraction model to be trained, thereby obtaining multiple first feature maps. The difference calculation module is used to obtain difference statistics based on the differences between multiple first feature maps; The first training module is used to perform derivative updates on the model parameters of the feature extraction model with the aim of minimizing the difference statistics, so as to obtain the trained feature extraction model. The second training module is used to input the feature map extracted by the feature extraction model into the reversible neural network model to be trained, train the reversible neural network model to map the first feature map to a first data matrix, and make the first data matrix conform to the target distribution of a preset target function, so as to obtain the trained reversible neural network model. The target detection model processing device is also used for: Get the image to be processed on a preset background; The feature extraction model is used to extract features from the image to be processed, thereby obtaining a second feature map of the image to be processed. The second feature map is mapped using the reversible neural network model to obtain the second data matrix corresponding to the second feature map. Based on the difference between the distribution obtained by processing the second data matrix by inputting it into a preset objective function and the target distribution, the position and range information of the foreground target in the preset background are determined.
8. An electronic device, characterized in that, The method includes a processor and a machine-readable storage medium, wherein the machine-readable storage medium stores machine-executable instructions, which, when executed by the processor, implement the method according to any one of claims 1-6.
9. A machine-readable storage medium, characterized in that, The machine-readable storage medium stores machine-executable instructions that, when executed by one or more processors, implement the method of any one of claims 1-6.
Citation Information
Patent Citations
Target detection method and device and electronic equipment
CN116071563A