Small target detection method, system, electronic device and computer-readable storage medium
By building an improved small object detection model, and automatically adjusting the detection area using density estimation and image cropping modules, the problem of low efficiency of small object detection in high-speed scenarios is solved, and efficient small object detection is achieved.
Patent Information
- Application Number
- CN202410958164.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-17
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2044-07-17
AI Technical Summary
In high-speed scenarios, it is difficult for the prior art to effectively detect small-scale targets, resulting in computational redundancy and inefficient detection.
By constructing an improved small object detection model, the model includes a feature extraction module, a density estimation module, an image cropping module, a small object detection module and a loss calculation module. This model can automatically estimate target dense areas for amplification, reducing computational redundancy.
On the basis of not significantly increasing the calculation amount, the efficiency of small object detection is improved and the accuracy of small object detection is maintained.
Smart Images

Figure CN118941789B_ABST
Abstract
Description
Background Art
[0002] In the application of traffic incident analysis system based on computer vision, since reliable detection distance is a very important indicator for evaluating traffic incident analysis system, and the detection ability of target detection algorithm for small targets directly determines the reliable detection distance of traffic incident analysis system, the detection ability of target detection algorithm for small targets is very important in the entire traffic incident detection system.
[0003] In order to detect small-scale targets in high-speed scenes, the solution usually adopted is to enlarge the resolution of the model input. This solution will enlarge the target-free area in the image, introducing a large amount of computational redundancy. The method proposed in this paper can automatically estimate the target dense area for enlargement, and can effectively control the increase in computational complexity while maintaining the detection effect.
[0004] Therefore, it is urgent to provide a technical solution to solve the above problems. Summary of the invention
[0005] To solve the above technical problems, the present invention provides a small target detection method, system, electronic device and computer-readable storage medium.
[0006] In a first aspect, the present invention provides a small target detection method, the technical solution of the method is as follows:
[0007] Construct an improved small target detection model and train it; wherein the small target detection model includes: a feature extraction module, a density estimation module, an image cropping module, a small target detection module and a loss calculation module; the feature extraction module is used to: perform feature extraction on the original sample image to obtain an original feature map; the density estimation module is used to: perform density estimation on the original feature map to obtain a target density feature map and determine the predicted density of each target grid; the image cropping module is used to: in the original sample image, extract the area where the first M grids with the highest predicted density and the adjacent areas are located to obtain a cropped sample image; the feature extraction module is also used to: perform feature extraction on the cropped sample image to obtain a target feature map; the small target detection module is used to: perform small target detection on the target feature map and perform detection frame regression processing to obtain a small target prediction frame; the loss calculation module is used to: calculate the loss corresponding to the original sample image according to the predicted density of each target grid in the target density feature map, the small target prediction frame and the small target annotation frame of the original sample image;
[0008] The image to be detected is input into the trained improved small target detection model for detection to obtain the small target detection result of the image to be detected.
[0009] The beneficial effects of a small target detection method of the present invention are as follows:
[0010] The method of the present invention can improve the efficiency of small target detection and maintain the accuracy of small target detection without significantly increasing the amount of calculation.
[0011] Based on the above solution, a small target detection method of the present invention can also be improved as follows.
[0012] In an optional manner, the density estimation module is specifically used to: perform size conversion on the original feature map to obtain a converted feature map and determine each target grid of the converted feature map, perform density estimation on the converted feature map using a yolov5 model to obtain the target density feature map and determine the predicted density of each target grid.
[0013] In an optional manner, the loss corresponding to the original sample image includes: density estimation loss and target box regression loss; the loss calculation module is specifically used for:
[0014] Determine the annotation density of each target grid according to the small target annotation box of the original sample image, and calculate the density estimation loss of the original sample image according to the annotation density and predicted density of each target grid;
[0015] The target frame regression loss of the original sample image is calculated according to the small target prediction frame and the small target annotation frame of the original sample image.
[0016] In an optional manner, the training process of the improved small target detection model is:
[0017] Based on the density estimation loss and target box regression loss of multiple original sample images, the improved small target detection model is trained to obtain an optimized small target detection model. The optimized small target detection model is used as the improved small target detection model and returned for iterative training until the preset iterative training conditions are met, and the improved small target detection model is determined as the trained improved small target detection model.
[0018] In an optional manner, the step of determining the labeling density of any target grid according to the small target labeling box of the original sample image in the loss calculation module includes:
[0019] The annotation density of any target grid is calculated according to a first preset formula; wherein the first preset formula is: Target n is the annotation density of the nth target grid, C is the preset density upper limit, T is the number of small target annotation boxes, Area_intersection niArea_all is the area of the i-th small target label box falling within the M-th target grid. i The total area of the box labeled for the i-th small object.
[0020] In a second aspect, the present invention provides a small target detection system, the technical solution of which is as follows:
[0021] Includes: training unit and detection unit;
[0022] The training unit is used to construct and train an improved small target detection model; wherein the small target detection model includes a feature extraction module, a density estimation module, an image cropping module, a small target detection module and a loss calculation module; the feature extraction module is used to perform feature extraction on the original sample image to obtain an original feature map; the density estimation module is used to perform density estimation on the original feature map to obtain a target density feature map and determine the predicted density of each target grid; the image cropping module is used to extract the area where the first M grids with the highest predicted density and the adjacent areas are located in the original sample image to obtain a cropped sample image; the feature extraction module is also used to perform feature extraction on the cropped sample image to obtain a target feature map; the small target detection module is used to perform small target detection on the target feature map and perform detection frame regression processing to obtain a small target prediction frame; the loss calculation module is used to calculate the loss corresponding to the original sample image according to the predicted density of each target grid in the target density feature map, the small target prediction frame and the small target annotation frame of the original sample image;
[0023] The detection unit is used to: input the image to be detected into the trained improved small target detection model for detection, and obtain the small target detection result of the image to be detected.
[0024] The beneficial effects of a small target detection system of the present invention are as follows:
[0025] The system of the present invention can improve the efficiency of small target detection and maintain the accuracy of small target detection without significantly increasing the amount of calculation.
[0026] Based on the above solution, the small target detection system of the present invention can also be improved as follows.
[0027] In an optional manner, the density estimation module is specifically used to: perform size conversion on the original feature map to obtain a converted feature map and determine each target grid of the converted feature map, perform density estimation on the converted feature map using a yolov5 model to obtain the target density feature map and determine the predicted density of each target grid.
[0028] In an optional manner, the loss corresponding to the original sample image includes: density estimation loss and target box regression loss; the loss calculation module is specifically used for:
[0029] Determine the annotation density of each target grid according to the small target annotation box of the original sample image, and calculate the density estimation loss of the original sample image according to the annotation density and predicted density of each target grid;
[0030] The target frame regression loss of the original sample image is calculated according to the small target prediction frame and the small target annotation frame of the original sample image.
[0031] In a third aspect, a technical solution of an electronic device of the present invention is as follows:
[0032] The invention comprises a memory, a processor and a program stored in the memory and running on the processor. When the processor executes the program, the steps of the small target detection method of the present invention are implemented.
[0033] In a fourth aspect, the present invention provides a computer-readable storage medium having the following technical solution:
[0034] Instructions are stored in the computer-readable storage medium. When the computer-readable storage medium reads the instructions, the computer-readable storage medium executes the steps of the small target detection method of the present invention.
[0035] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] The accompanying drawings are only used to illustrate the embodiments and are not to be considered as limiting the present invention. In addition, the same reference symbols are used to represent the same components throughout the accompanying drawings. In the accompanying drawings:
[0037] Figure 1 A schematic diagram of a flow chart of an embodiment of a small target detection method of the present invention;
[0038] Figure 2 This is a schematic diagram of the structure of the small target detection model;
[0039] Figure 3 This is a schematic diagram of the calculation of the annotation density;
[0040] Figure 4 A schematic diagram of the structure of an embodiment of a small target detection system of the present invention;
[0041] Figure 5The figure is a schematic structural diagram of an embodiment of an electronic device of the present invention. DETAILED DESCRIPTION
[0042] Exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present invention are shown in the drawings, it should be understood that the present invention can be implemented in various forms and should not be limited to the embodiments set forth herein.
[0043] Figure 1 A flow chart of an embodiment of a small target detection method provided by the present invention is shown, and the small target detection method can be executed by an electronic device such as a terminal device or a server. The terminal device can be any fixed or mobile terminal such as a user equipment (UE), a mobile device, a user terminal, a terminal, a cellular phone, a cordless phone, a personal digital assistant (PDA), a handheld device, a computing device, a vehicle-mounted device, a wearable device, etc. The server can be a single server or a server cluster composed of multiple servers. Any electronic device can implement the small target detection method by calling computer-readable instructions stored in a memory through a processor. Figure 1 As shown, the following steps are included:
[0044] S1. Build and train an improved small target detection model.
[0045] Among them, Figure 2 As shown, the small target detection model includes: a feature extraction module, a density estimation module, an image cropping module, a small target detection module and a loss calculation module. The feature extraction module is used to: extract features from the original sample image to obtain the original feature map; the density estimation module is used to: perform density estimation on the original feature map to obtain the target density feature map and determine the predicted density of each target grid; the image cropping module is used to: extract the area where the first M grids with the highest predicted density and the adjacent area are located in the original sample image to obtain the cropped sample image; the feature extraction module is also used to: extract features from the cropped sample image to obtain the target feature map; the small target detection module is used to: perform small target detection on the target feature map and perform detection frame regression processing to obtain the small target prediction frame; the loss calculation module is used to: calculate the loss corresponding to the original sample image according to the predicted density of each target grid in the target density feature map, the small target prediction frame and the small target annotation frame of the original sample image.
[0046] Among them, the application scenario of this embodiment defaults to a high-speed scenario, and the original sample image will be uniformly sized as a 640*640 image before input, and can also be adjusted according to actual conditions, without limitation. The image size of the target density feature map is 32*32, that is, the target density feature map contains 32*32 target grids. The value of M is a positive integer, and the adjacent area of the target grid is 8 adjacent grids around the target grid (if it is a target grid on the boundary, the adjacent grids of the target grid are determined according to the actual number), and the purpose of selecting the adjacent grids is to maintain the integrity of the target in the image.
[0047] It should be noted that the improved small target detection model does not include a loss calculation module in the inference stage.
[0048] S2. Input the image to be detected into the trained improved small target detection model for detection, and obtain the small target detection result of the image to be detected.
[0049] The image to be detected is an image that needs to be detected as a small target, and the small target detection result includes the category of the small target and the small target prediction box.
[0050] In an optional manner, the density estimation module is specifically used to: perform size conversion on the original feature map to obtain a converted feature map and determine each target grid of the converted feature map, perform density estimation on the converted feature map using the yolov5 model to obtain a target density feature map and determine the predicted density of each target grid.
[0051] The default size of the original feature map is 640*640, and the default size of the converted feature map is 32*32. The prediction density refers to the density of the predicted target boxes containing all categories that fall into the target grid.
[0052] In an optional manner, the loss corresponding to the original sample image includes: density estimation loss and target box regression loss; the loss calculation module is specifically used for:
[0053] According to the small target annotation box of the original sample image, the annotation density of each target grid is determined, and according to the annotation density and predicted density of each target grid, the density estimation loss of the original sample image is calculated.
[0054] Among them, the cross entropy loss is used to evaluate the correctness of the density estimation. The density estimation loss of any target grid is calculated as follows: L d,n is the density estimation loss of the nth target grid; x n is the predicted density of the nth target grid, x n is a C-dimensional vector; x n,c represents the logits output at the cth position of the nth target grid, Represents the logits output by the annotation density of the nth target grid under the target category.
[0055] According to the small target prediction box and the small target annotation box of the original sample image, the target box regression loss of the original sample image is calculated.
[0056] Among them, since small targets are very sensitive to position deviations, the iou-based metric is not suitable as a regression loss for small targets. Therefore, in this embodiment, the Gaussian Wasserstein distance is used to measure the error between the prediction result and the target distribution. For each small target prediction box bbox = [x, y, w, h], where x and y represent the horizontal and vertical coordinates of the center point of the small target prediction box, and w and h represent the width and height of the small target prediction box, the bounding box can be modeled by a two-dimensional Gaussian distribution. The mean in the two-dimensional Gaussian distribution corresponds to the center point of the bounding box, and the standard deviation is related to the width and height of the bounding box. The modeled two-dimensional Gaussian distribution is as follows: μ is the mean vector of the two-dimensional Gaussian distribution, and δ is the covariance matrix of the two-dimensional Gaussian distribution. Specifically: For the Gaussian distribution N modeled from the small target prediction box A = (cxa, cya, wa, ha) and the small target annotation box B = (cxb, cyb, wb, hb) a and N b , the normalized wasserstein distance (NWD) between them can be expressed as follows: Represents a two-dimensional Gaussian distribution N a and N b The normalized Wasserstein distance between them is the wasserstein distance, where the constant S is a constant related to the data set. The normalized wasserstein distance can better measure the similarity between the two distributions, that is, the target box regression loss.
[0057] In an optional manner, the training process of the improved small target detection model is:
[0058] Based on the density estimation loss and target box regression loss of multiple original sample images, the improved small target detection model is trained to obtain an optimized small target detection model. The optimized small target detection model is used as the improved small target detection model and returned for iterative training until the preset iterative training conditions are met, and the improved small target detection model is determined as the trained improved small target detection model.
[0059] Among them, the preset iterative training conditions are: reaching the maximum number of iterations or loss convergence.
[0060] In an optional manner, the step of determining the labeling density of any target grid according to the small target labeling box of the original sample image in the loss calculation module includes:
[0061] The annotation density of any target grid is calculated according to the first preset formula.
[0062] Among them, the first preset formula is: Target n is the annotation density of the nth target grid, C is the preset density upper limit, T is the number of small target annotation boxes, Area_intersection ni Area_all is the area of the i-th small target label box falling within the M-th target grid. i The total area of the box labeled for the i-th small object.
[0063] It should be noted that if Figure 3 As shown in , the area of the i-th small target annotation box falling into the M-th target grid is calculated, which is divided into three cases: 1) The small target annotation box completely falls into the grid, and the intersection area of the small target annotation box and the grid is the annotation box area, and the ratio of the area of the small target annotation box to the area of the small target annotation box is 1. 2) The small target annotation box partially intersects with the grid, and the ratio of the area of the small target annotation box and the grid to the area of the annotation box is between 0 and 1. 3) The small target annotation box does not intersect with the grid, and the ratio of the area of the small target annotation box and the grid to the area of the small target annotation box is 0.
[0064] The technical solution of this embodiment can improve the efficiency of small target detection and maintain the accuracy of small target detection without significantly increasing the amount of calculation.
[0065] Figure 4 FIG. 2 is a schematic diagram showing a structure of an embodiment of a small target detection system 200 provided by the present invention. Figure 4 As shown, the system 200 includes: a training unit 210 and a detection unit 220;
[0066] The training unit 210 is used to: construct and train an improved small target detection model; wherein the small target detection model includes: a feature extraction module, a density estimation module, an image cropping module, a small target detection module and a loss calculation module; the feature extraction module is used to: perform feature extraction on the original sample image to obtain an original feature map; the density estimation module is used to: perform density estimation on the original feature map to obtain a target density feature map and determine the predicted density of each target grid; the image cropping module is used to: in the original sample image, extract the area where the first M grids with the highest predicted density and the adjacent area are located to obtain a cropped sample image; the feature extraction module is also used to: perform feature extraction on the cropped sample image to obtain a target feature map; the small target detection module is used to: perform small target detection on the target feature map and perform detection frame regression processing to obtain a small target prediction frame; the loss calculation module is used to: calculate the loss corresponding to the original sample image according to the predicted density of each target grid in the target density feature map, the small target prediction frame and the small target annotation frame of the original sample image;
[0067] The detection unit 220 is used to input the image to be detected into the trained improved small target detection model for detection, and obtain the small target detection result of the image to be detected.
[0068] In an optional manner, the density estimation module is specifically used to: perform size conversion on the original feature map to obtain a converted feature map and determine each target grid of the converted feature map, perform density estimation on the converted feature map using the yolov5 model to obtain a target density feature map and determine the predicted density of each target grid.
[0069] In an optional manner, the loss corresponding to the original sample image includes: density estimation loss and target box regression loss; the loss calculation module is specifically used for:
[0070] According to the small target annotation box of the original sample image, determine the annotation density of each target grid, and calculate the density estimation loss of the original sample image according to the annotation density and predicted density of each target grid;
[0071] According to the small target prediction box and the small target annotation box of the original sample image, the target box regression loss of the original sample image is calculated.
[0072] In an optional manner, the training process of the improved small target detection model is:
[0073] Based on the density estimation loss and target box regression loss of multiple original sample images, the improved small target detection model is trained to obtain an optimized small target detection model. The optimized small target detection model is used as the improved small target detection model and returned for iterative training until the preset iterative training conditions are met, and the improved small target detection model is determined as the trained improved small target detection model.
[0074] In an optional manner, the step of determining the labeling density of any target grid according to the small target labeling box of the original sample image in the loss calculation module includes:
[0075] The annotation density of any target grid is calculated according to the first preset formula; wherein the first preset formula is: Target n is the annotation density of the nth target grid, C is the preset density upper limit, T is the number of small target annotation boxes, Area_intersection ni Area_all is the area of the i-th small target label box falling within the M-th target grid. i The total area of the box labeled for the i-th small object.
[0076] The technical solution of this embodiment can improve the efficiency of small target detection and maintain the accuracy of small target detection without significantly increasing the amount of calculation.
[0077] The above parameters and steps for each module to implement corresponding functions in the small target detection system 200 of this embodiment can refer to the parameters and steps in the embodiment of the small target detection method above, and will not be repeated here.
[0078] like Figure 5 As shown, an electronic device 300 according to an embodiment of the present invention includes a processor 320, the processor 320 is coupled to a memory 310, and the memory 310 stores at least one computer program 330, and the at least one computer program 330 is loaded and executed by the processor 320, so that the electronic device 300 implements any of the above-mentioned small target detection methods, specifically:
[0079] The electronic device 300 may have relatively large differences due to different configurations or performances, and may include one or more processors 320 (Central Processing Units, CPU) and one or more memories 310, wherein the one or more memories 310 store at least one computer program 330, and the at least one computer program 330 is loaded and executed by the one or more processors 320, so that the electronic device 300 implements any small target detection method provided in the above embodiments. Of course, the electronic device 300 may also have components such as a wired or wireless network interface, a keyboard, and an input and output interface for input and output, and the electronic device 300 may also include other components for implementing device functions, which will not be described in detail here.
[0080] A computer-readable storage medium according to an embodiment of the present invention stores at least one computer program, and the at least one computer program is loaded and executed by a processor so that a computer implements any of the above-mentioned small target detection methods.
[0081] Optionally, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, and the like.
[0082] In an exemplary embodiment, a computer program product or a computer program is also provided, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the electronic device performs any of the above-mentioned small target detection methods.
[0083] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects and represent the definition of a specific order or sequence. The order of use of similar objects can be interchanged where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than the order shown or described.
[0084] Those skilled in the art know that the present invention can be implemented as a system, method or computer program product. Therefore, the present disclosure can be specifically implemented in the following forms, namely: it can be complete hardware, it can be complete software (including firmware, resident software, microcode, etc.), or it can be a combination of hardware and software, which is generally referred to as "circuit", "module" or "system" herein. In addition, in some embodiments, the present invention can also be implemented in the form of a computer program product in one or more computer-readable media, and the computer-readable medium contains computer-readable program code.
[0085] Any combination of one or more computer-readable media can be used. Computer-readable media can be computer-readable signal media or computer-readable storage media. Computer-readable storage media can be, for example, but not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or devices, or any combination of the above. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it.
[0086] Although the embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present invention. A person skilled in the art may change, modify, replace and vary the above embodiments within the scope of the present invention.
Claims
1. A small target detection method, characterized in that: include: Construct an improved small target detection model and train it; wherein the small target detection model includes: a feature extraction module, a density estimation module, an image cropping module, a small target detection module and a loss calculation module; the feature extraction module is used to: perform feature extraction on the original sample image to obtain an original feature map; the density estimation module is used to: perform density estimation on the original feature map to obtain a target density feature map and determine the predicted density of each target grid; the image cropping module is used to: in the original sample image, extract the area where the first M grids with the highest predicted density and the adjacent areas are located to obtain a cropped sample image; the feature extraction module is also used to: perform feature extraction on the cropped sample image to obtain a target feature map; the small target detection module is used to: perform small target detection on the target feature map and perform detection frame regression processing to obtain a small target prediction frame; the loss calculation module is used to: calculate the loss corresponding to the original sample image according to the predicted density of each target grid in the target density feature map, the small target prediction frame and the small target annotation frame of the original sample image; Inputting the image to be detected into the trained improved small target detection model for detection, and obtaining the small target detection result of the image to be detected; The density estimation module is specifically used to: perform size conversion on the original feature map to obtain a conversion feature map and determine each target grid of the conversion feature map, perform density estimation on the conversion feature map using the yolov5 model to obtain the target density feature map and determine the predicted density of each target grid; The loss corresponding to the original sample image includes: density estimation loss and target frame regression loss; the loss calculation module is specifically used for: Determine the annotation density of each target grid according to the small target annotation box of the original sample image, and calculate the density estimation loss of the original sample image according to the annotation density and predicted density of each target grid; Calculating a target frame regression loss of the original sample image according to the small target prediction frame and the small target annotation frame of the original sample image; The step of determining the labeling density of any target grid according to the small target labeling frame of the original sample image in the loss calculation module includes: The annotation density of any target grid is calculated according to a first preset formula; wherein the first preset formula is: Target n is the annotation density of the nth target grid, C is the preset density upper limit, T is the number of small target annotation boxes, Area_intersection ni Area_all is the area of the i-th small target label box falling within the M-th target grid. i The total area of the box labeled for the i-th small object.
2. The small target detection method according to claim 1, characterized in that: The training process of the improved small target detection model is: Based on the density estimation loss and target box regression loss of multiple original sample images, the improved small target detection model is trained to obtain an optimized small target detection model. The optimized small target detection model is used as the improved small target detection model and returned for iterative training until the preset iterative training conditions are met, and the improved small target detection model is determined as the trained improved small target detection model.
3. A small target detection system, characterized in that: include: Training unit and testing unit; The training unit is used to construct and train an improved small target detection model; wherein the small target detection model includes a feature extraction module, a density estimation module, an image cropping module, a small target detection module and a loss calculation module; the feature extraction module is used to perform feature extraction on the original sample image to obtain an original feature map; the density estimation module is used to perform density estimation on the original feature map to obtain a target density feature map and determine the predicted density of each target grid; the image cropping module is used to extract the area where the first M grids with the highest predicted density and the adjacent areas are located in the original sample image to obtain a cropped sample image; the feature extraction module is also used to perform feature extraction on the cropped sample image to obtain a target feature map; the small target detection module is used to perform small target detection on the target feature map and perform detection frame regression processing to obtain a small target prediction frame; the loss calculation module is used to calculate the loss corresponding to the original sample image according to the predicted density of each target grid in the target density feature map, the small target prediction frame and the small target annotation frame of the original sample image; The detection unit is used to: input the image to be detected into the trained improved small target detection model for detection, and obtain the small target detection result of the image to be detected; The density estimation module is specifically used to: perform size conversion on the original feature map to obtain a conversion feature map and determine each target grid of the conversion feature map, perform density estimation on the conversion feature map using the yolov5 model to obtain the target density feature map and determine the predicted density of each target grid; The loss corresponding to the original sample image includes: density estimation loss and target frame regression loss; the loss calculation module is specifically used for: Determine the annotation density of each target grid according to the small target annotation box of the original sample image, and calculate the density estimation loss of the original sample image according to the annotation density and predicted density of each target grid; Calculating a target frame regression loss of the original sample image according to the small target prediction frame and the small target annotation frame of the original sample image; The step of determining the labeling density of any target grid according to the small target labeling box of the original sample image in the loss calculation module includes: The annotation density of any target grid is calculated according to the first preset formula; wherein the first preset formula is: Target n is the annotation density of the nth target grid, C is the preset density upper limit, T is the number of small target annotation boxes, Area_intersection ni Area_all is the area of the i-th small target label box falling within the M-th target grid. i The total area of the box labeled for the i-th small object.
4. An electronic device, characterized in that: The electronic device includes a processor, the processor is coupled to a memory, at least one computer program is stored in the memory, and the at least one computer program is loaded and executed by the processor so that the electronic device implements the small target detection method as described in claim 1 or 2.
5. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one computer program, and the at least one computer program is loaded and executed by the processor so that the computer-readable storage medium implements the small target detection method as claimed in claim 1 or 2.
Citation Information
Patent Citations
Aerial photography target counting and detecting method based on lightweight density estimation network
CN116486288A