Small target detection method and device, equipment, storage medium and product

By dividing the initial image into multiple grid images and combining it, small target images to be tested are generated, and the problem of low accuracy of small target detection in the prior art is solved, and efficient and accurate small target detection is achieved.

CN119850932AInactive Publication Date: 2025-04-18E SURFING VISION TECHNOLOGY CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202510316893.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-18
Publication Date
2025-04-18
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The accuracy of small and medium-sized target detection in the prior art is low, and it is impossible to effectively distinguish small targets from backgrounds, resulting in poor detection results.

Method used

By dividing the initial image into multiple grid images and batch recognition, the target grid image containing the small target to be tested is determined, and the target image to be tested is generated based on the relative distance between the grid images, and finally input it into the trained small target detection model for detection.

Benefits of technology

The accuracy of small object detection is improved, missed detection of small objects to be tested is avoided, and the comprehensive detection ability of small objects in the initial image is enhanced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119850932A_ABST
    Figure CN119850932A_ABST
Patent Text Reader

Abstract

The invention relates to a small target detection method and device, equipment, a storage medium and a product. The method comprises the following steps: acquiring an initial image, dividing the initial image into a plurality of grid images, carrying out batch identification on the grid images, and determining that the grid images comprise a target grid image of a preset small target to be detected; based on the relative distance between the different target grid images in the image coordinate system, combining the different target grid images to obtain a to-be-measured small target image; and inputting the to-be-detected small target image into the completely trained small target detection model to obtain a detection result of the to-be-detected small target. According to the invention, the precision of small target detection can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image recognition technology, and in particular to a small target detection method, device, equipment, storage medium and product. Background Art

[0002] In video surveillance scenarios such as transportation, kitchens, and schools, target detection algorithms are widely used, such as work clothes detection, regional intrusion detection, etc. However, in practical applications, the pixels of the target to be detected often account for a small proportion, which is the problem of small target detection. Since the pixels of small targets account for a small proportion, the features that can be used for detection are limited, and they cannot be effectively distinguished from the background.

[0003] Small target detection methods in the prior art usually reduce the input image to a fixed size and then input it into the model for small target detection. Since the small target itself accounts for a very small proportion of the entire image, the small target object will be reduced proportionally after the overall image is reduced. It has fewer effective features, which ultimately leads to poor small target detection effect.

[0004] At present, no effective solution has been proposed to address the problem of low accuracy in small target detection in existing technologies. Summary of the invention

[0005] Based on this, it is necessary to provide a small target detection method, device, equipment, storage medium and product to address the above technical problems.

[0006] In a first aspect, the present application provides a small target detection method. The method comprises: Acquire an initial image, divide the initial image into a plurality of grid images, perform batch recognition on the grid images, and determine a target grid image including a preset small target to be detected in the grid images; Based on the relative distances between different target grid images in the image coordinate system, different target grid images are combined to obtain a small target image to be tested; The image of the small target to be tested is input into the well-trained small target detection model to obtain the detection result of the small target to be tested.

[0007] In one embodiment, based on the relative distances between different target grid images in the image coordinate system, different target grid images are combined to obtain a small target image to be tested, including: Taking each target grid image as an initial first grid image in turn; Determine whether a grid within a preset neighborhood of the first grid image contains a small target to be detected; if so, merge the grid containing the small target to be detected with the first grid image, and use the merged grid image as a new first grid image; The above steps of determining whether the grid contains the small target to be detected and updating the first grid image are executed repeatedly until the grid within the preset area of ​​the latest first grid image does not contain the small target to be detected; Determine an initial small target image to be detected corresponding to the small target to be detected based on the latest first grid image; When it is detected that the shape of the initial small target image to be tested does not fall within the preset shape range, the initial small target image to be tested is expanded based on the grid image adjacent to the initial small target image to be tested until the shape of the expanded initial small target image to be tested falls within the shape range, and the expanded initial small target image to be tested is determined as the small target image to be tested.

[0008] In one embodiment, after the initial small object image to be tested is expanded until the shape of the expanded initial small object image to be tested falls within the shape range, the method further includes: Combining the grid image within the preset second range of the expanded initial small target image to be tested with the expanded initial small target image to obtain an expanded small target image; Based on the preset default pixel specification, the expanded small target image is filled with constants to obtain the small target image to be tested.

[0009] In one embodiment, after obtaining the detection result for the small target to be detected, the method further includes: Determine the anchor point coordinates corresponding to the small target image to be tested, and calculate the coordinate offset between the anchor point coordinates of the small target image to be tested and the anchor point coordinates of the initial image; The coordinate offset is combined with the relative coordinates corresponding to the image of the small target to be measured to determine the actual coordinates of the small target to be measured.

[0010] In one embodiment, batch recognition is performed on the grid images to determine the target grid images including the preset small targets to be detected in the grid images, including: The grid images are input one by one into a fully trained classification model for classification processing to obtain classification results corresponding to the grid images; wherein, the classification model is trained based on a preset grid image training set with grid image annotations, and the grid image annotations represent whether there is a small target to be tested in each training grid image in the grid image training set.

[0011] In one embodiment, the method further comprises: Obtain a preset target detection training set, wherein the target detection training set carries a small target recognition label; The target detection training set is input into the initial small target detection model for training to obtain the training small target detection prediction result. The loss function result is calculated based on the training small target detection prediction result and the small target recognition label. The gradient of the loss function result is reversely transferred to the initial small target detection model for iterative training to generate a fully trained small target detection model.

[0012] In a second aspect, the present application also provides a small target detection device. The device comprises: An acquisition module is used to acquire an initial image, divide the initial image into a plurality of grid images, and perform batch recognition on the grid images to determine a target grid image including a preset small target to be detected in the grid image; A calculation module, used for combining different target grid images based on relative distances between different target grid images in an image coordinate system to obtain a small target image to be tested; The generation module is used to input the image of the small target to be tested into the well-trained small target detection model to obtain the detection result of the small target to be tested.

[0013] In a third aspect, the present application further provides a computer device. The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program: Acquire an initial image, divide the initial image into a plurality of grid images, perform batch recognition on the grid images, and determine a target grid image including a preset small target to be detected in the grid images; Based on the relative distances between different target grid images in the image coordinate system, different target grid images are combined to obtain a small target image to be tested; The image of the small target to be tested is input into the well-trained small target detection model to obtain the detection result of the small target to be tested.

[0014] In a fourth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented: Acquire an initial image, divide the initial image into a plurality of grid images, perform batch recognition on the grid images, and determine a target grid image including a preset small target to be detected in the grid images; Based on the relative distances between different target grid images in the image coordinate system, different target grid images are combined to obtain a small target image to be tested; The image of the small target to be tested is input into the well-trained small target detection model to obtain the detection result of the small target to be tested.

[0015] In a fifth aspect, the present application further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the following steps are implemented: Acquire an initial image, divide the initial image into a plurality of grid images, perform batch recognition on the grid images, and determine a target grid image including a preset small target to be detected in the grid images; Based on the relative distances between different target grid images in the image coordinate system, different target grid images are combined to obtain a small target image to be tested; The image of the small target to be tested is input into the well-trained small target detection model to obtain the detection result of the small target to be tested.

[0016] The above-mentioned small target detection method, device, equipment, storage medium and product first batch recognize the grid images obtained by dividing the initial image, determine the target grid images including the small target to be detected in the grid image, and then combine different target grid images based on the relative distance between different target grid images in the image coordinate system to obtain the small target image to be detected, and finally input the small target image to be detected into a well-trained small target detection model to obtain the detection result of the small target to be detected. Through this application, the small target image to be detected containing the small target part to be detected can be efficiently and accurately cut out from the initial image without reducing the original image, thereby improving the accuracy of the small target detection to be detected. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 Schematic diagram of a small target detection method in one embodiment; Figure 2 is a schematic diagram of a process of segmenting an initial image in one embodiment; Figure 3 A schematic diagram of a flow chart of a small target detection method in a preferred embodiment; Figure 4 A schematic diagram of a process for determining a small target image to be tested in one embodiment; Figure 5 is a structural block diagram of a small target detection device in an embodiment; Figure 6 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0018] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0019] In one embodiment, Figure 1As shown, a small target detection method is provided, comprising the following steps: Step S110, acquiring an initial image, dividing the initial image into a plurality of grid images, and performing batch recognition on the grid images to determine a target grid image including a preset small target to be detected in the grid images.

[0020] Specifically, the above-mentioned initial image is an acquired image that needs to be detected as a small target. In practical applications, it can be an image captured by a monitoring device, etc. The above-mentioned small target to be detected is a target that occupies a relatively small area in the image. After acquiring the initial image, the initial image is first divided according to a preset pixel specification to obtain a plurality of grid images. In some preferred embodiments, the pixel specification may be 225×225. In some embodiments, when it is measured that the size of the initial image does not meet the requirements of the pixel specification, that is, it is not an integer multiple of the pixel specification size, the size of the initial image can be first made to meet the requirements of the pixel specification by a constant filling method, and then divided according to the pixel specification to obtain a plurality of grid images. Figure 2 It is a schematic diagram of the process of segmenting the initial image in an embodiment. As can be seen from the figure, since it is detected that the initial image a does not meet the pixel specification requirement (the width of the initial image a is not an integer multiple of 225), the initial image a is first filled with a constant to obtain image b, and then image b is segmented according to the preset pixel specification. Image c is a schematic diagram of segmentation, and image d is obtained after segmentation, that is, multiple grid images are obtained after segmentation.

[0021] The grid images are then processed in batches to determine whether the grid images contain the small target to be tested. Among them, the method of batch processing the grid images includes, but is not limited to, determining at least one preset small target object, such as a mouse, a mobile phone, etc., and then independently detecting each grid image to determine whether there is a preset small target object in the grid image, or to determine whether there is a part of the small target object in each grid image. In some preferred embodiments, the grid image can be input into a well-trained classification model to classify whether each grid image contains a preset small target object. In this embodiment, multiple grid images can be batch detected at the same time, or each grid image can be traversed in turn to complete the detection of whether the grid image contains the small target to be tested. This application does not impose too many restrictions on this, and the method of determining whether all grid images contain the small target to be tested should fall within the protection scope of this application. The grid image containing the small target object is determined as the target grid image.

[0022] Step S120 , combining different target grid images based on relative distances between different target grid images in the image coordinate system to obtain a small target image to be tested.

[0023] Specifically, it is determined that among all target grid images, there are target grid images that contain small targets to be tested. In practical applications, it usually happens that an initial image obtained includes multiple small targets to be tested of different types, or multiple small targets to be tested of the same type, such as multiple mobile phones included in an initial image, or multiple types of small targets to be tested such as mobile phones, mice, wallets, etc. in an initial image, and in practical applications, the area where a small target to be tested is located is often divided into multiple target grid images. At this time, if the target grid image containing some small targets to be tested is directly sent to the small target detection model for detection, it will result in the inability to fully detect every small target to be tested in the initial image. In addition, due to the fact that the area where a small target to be tested is located is divided into multiple target grid images, the same target will be divided into multiple detection objects and multiple detections will be performed, which will correspondingly reduce the detection accuracy of the small targets to be tested.

[0024] Therefore, in the present application, the target grid images are first combined according to the relative distances between different grid images in the image coordinate system to obtain a small target image to be tested, wherein the above relative distance is the relative physical distance between multiple target grid images. In practical applications, the image coordinate system can be introduced to assist in calculating the relative distances between each grid image. In the present application, target grid images with a relatively close relative distance can be combined to obtain a small target image to be tested. Preferably, two or more target grid images with a relative distance less than 225 pixels can be combined into a small target image to be tested.

[0025] Step S130, inputting the small target image to be tested into a well-trained small target detection model to obtain a detection result for the small target to be tested.

[0026] Input the image of the small target to be tested into the small target detection model to obtain the detection result of the small target to be tested, wherein the detection result includes but is not limited to the specific category of the small target to be tested (such as mobile phone, wallet, mouse, etc.) and the relative coordinate information of the position of the small target to be tested, wherein the relative coordinate information is the coordinate information of the small target to be tested in the small target image to which it belongs. In practical applications, the above small target detection model can select the yoloV11 (You Only Look Once) model.

[0027] Through steps S110 to S130, after the initial image is divided into multiple grid images, a target grid image containing the same small target to be tested is determined in the grid image, and a small target image to be tested is generated according to the target grid image, and finally the small target image to be tested is input into the small target detection model to obtain a detection result of the small target to be tested. Through the present application, the small target image to be tested containing the small target to be tested can be accurately divided, and all the small targets to be tested contained in the initial image can be comprehensively searched, which improves the detection accuracy and avoids the problem of missed detection.

[0028] In one embodiment, based on the relative distances between different target grid images in the image coordinate system, different target grid images are combined to obtain a small target image to be detected, including: Taking each target grid image as an initial first grid image in turn; Determine whether a grid within a preset neighborhood of the first grid image contains a small target to be detected; if so, merge the grid containing the small target to be detected with the first grid image, and use the merged grid image as a new first grid image; The above steps of determining whether the grid contains the small target to be detected and updating the first grid image are executed repeatedly until the grid within the preset area of ​​the latest first grid image does not contain the small target to be detected; Determine an initial small target image to be detected corresponding to the small target to be detected based on the latest first grid image; When it is detected that the shape of the initial small target image to be tested does not fall within the preset shape range, the initial small target image to be tested is expanded based on the grid image adjacent to the initial small target image to be tested until the shape of the expanded initial small target image to be tested falls within the shape range, and the expanded initial small target image to be tested is determined as the small target image to be tested.

[0029] Specifically, in this embodiment, it is necessary to divide the target grid images with relatively close distances to obtain the initial small target image to be tested, and then expand the shape of the initial small target image to be tested to meet the requirements of subsequent small target detection, wherein each target grid image is first used as the initial first grid image in turn, and it is determined whether the grid in the preset neighborhood around the first grid image contains the small target to be tested. If so, the grid containing the small target to be tested is merged with the first grid image, and the merged grid image is used as the new first grid image, wherein the range of the preset neighborhood can be set to a range of one grid around the first grid image. Then, based on the new first grid image, the above steps of detecting whether the small target to be tested is contained and updating the first grid image are cyclically executed until the grid in the preset neighborhood of the latest first grid image does not contain the small target to be tested. In this embodiment, the three adjacent grids a, b, and c from top to bottom all include the small target to be measured. At this time, A can be used as the first grid image. At this time, within the preset neighborhood of the first grid image, there is B including the small target to be measured, so B and A are merged, and the merged {A, B} is the new first grid image. Furthermore, within the preset neighborhood of the new first grid image {A, B}, there is C including the small target to be measured, so C is added at this time, and finally the latest first grid image {A, B, C} is obtained. It should be noted that in this embodiment, each target grid image can be used as the first grid image in turn, and when it is queried that the current target grid image is already included in the initial small target image to be measured corresponding to the small target to be measured, the current target grid image can be skipped and the next target grid image can be processed to improve the efficiency of image processing.

[0030] Furthermore, the shape of the initial small target image to be tested is detected. In practical applications, in order to improve the efficiency of subsequent image detection, the shape of the initial small target image to be tested needs to be unified in this embodiment. In some preferred embodiments, the shape of the initial small target image to be tested should be a rectangle, that is, the above-mentioned shape range should include a rectangle. In summary, if it is detected that the shape of the initial small target image to be tested is not a rectangle, the initial small target image to be tested needs to be expanded based on the grid image adjacent to the initial small target image to be tested, until the shape of the expanded initial small target image to be tested is a rectangle, and the expanded initial small target image to be tested is determined as the small target image to be tested.

[0031] The present application can efficiently determine the target grid images belonging to the same small target to be measured through the position information between each target grid image, and also ensure the integrity of the small target to be measured in the small target image to be measured. Moreover, because each target grid image containing the small target to be measured is used as a unit, the problem of missing the small target to be measured is effectively avoided.

[0032] In some embodiments, after expanding the initial small object image to be tested until the shape of the expanded initial small object image to be tested falls within the shape range, the method further includes: Combining the grid image within the preset second range of the expanded initial small target image to be tested with the expanded initial small target image to obtain an expanded small target image; Based on the preset default pixel specification, the expanded small target image is filled with constants to obtain the small target image to be tested.

[0033] Specifically, with the expanded initial small target image to be tested as the center, the grid image within the second range around the expanded initial small target image to be tested is combined with the expanded initial small target image to obtain the expanded small target image, wherein the second range can be set by relevant technical personnel according to actual needs, preferably set to a one-grid range, that is, the grid image within a one-grid range around the expanded initial small target image to be tested is combined with the expanded initial small target image to be tested.

[0034] Furthermore, after the expansion is completed, constant padding is performed on the expanded small target image based on a preset default pixel specification to obtain a small target image to be tested.

[0035] Through this embodiment, on the one hand, it can be ensured that the image of the small target to be detected is only a partial image containing the small target to be detected, rather than the entire initial image. On the other hand, through the expansion based on the second range grid image, it can be ensured that a part of the background image is added to the image of the small target to be detected, so as to improve the detection accuracy.

[0036] In some embodiments, after obtaining the detection result for the small target to be detected, the method further includes: Determine the anchor point coordinates corresponding to the small target image to be tested, and calculate the coordinate offset between the anchor point coordinates of the small target image to be tested and the anchor point coordinates of the initial image; The coordinate offset is combined with the relative coordinates corresponding to the image of the small target to be measured to determine the actual coordinates of the small target to be measured.

[0037] Specifically, the anchor point coordinates corresponding to the small target image to be tested are determined, wherein the anchor point coordinates are the coordinates of a point on the small target image to be tested, and the anchor point coordinates can be selected by relevant technical personnel, such as the upper left corner coordinates of the small target image to be tested. Further, the anchor point coordinates of the initial image are determined. Similarly, the anchor point coordinates of the initial image can also be determined by relevant technical personnel, but in actual applications, for the convenience of calculation, the anchor point coordinates of the initial image and the anchor point coordinates of the small target image to be tested should correspond to each other, that is, when the anchor point coordinates of the small target image to be tested are the upper left corner coordinates, the anchor point coordinates of the initial image can also be set to the upper left corner coordinates.

[0038] Based on the anchor point coordinates of the small target image to be tested and the initial image, the relative coordinate offset between the small target image to be tested and the initial image is calculated. The calculation method can preferably be to calculate the difference between the anchor point coordinates of the small target image to be tested and the anchor point coordinates of the initial image, so as to obtain the above-mentioned coordinate offset. For example, in practical applications, the anchor point coordinates of the initial image are generally set as the upper left corner coordinates, and the anchor point coordinates of the initial image are set as (0,0), and the length and width of each grid image are pre-set, such as x×y, so the anchor point coordinates of the grid image in the nth column and the mth row (generally also set as the upper left corner coordinates of the grid image) are (x(n-1), y(m-1)), which is the above-mentioned coordinate offset.

[0039] Finally, the coordinate offset is added to the relative coordinates of the small target to be measured to obtain the actual coordinates of the small target to be measured. The relative coordinates of the small target to be measured can be output by the small target detection model, so that the actual coordinates of the small target to be measured can be obtained based on the relative coordinates of the small target to be measured and the above-mentioned coordinate offset.

[0040] In some embodiments, batch recognition is performed on the grid images to determine the target grid images including the preset small targets to be detected in the grid images, including: The grid images are input one by one into a fully trained classification model for classification processing to obtain classification results corresponding to the grid images; wherein, the classification model is trained based on a preset grid image training set with grid image annotations, and the grid image annotations represent whether there is a small target to be tested in each training grid image in the grid image training set.

[0041] Specifically, the above classification model can be selected by relevant technical personnel according to actual needs, such as using the resnet101 network. All grid images are input one by one into the fully trained classification model, and each grid image is classified and processed by the classification model to obtain a classification result corresponding to the grid image, which characterizes whether the grid image includes a small target to be measured, or whether it includes a part of the small target to be measured. Further, the training method of the classification model includes but is not limited to obtaining a grid image training set for training, the grid image training set includes a large number of grid images that have been segmented and carry grid image annotations, wherein the grid image training set includes a large number of grid images, each grid image carries a grid image annotation, and the grid image annotation characterizes whether the grid image includes a small target to be measured, or whether it contains a part of the small target to be measured, and the initial classification model is trained based on the grid image training set to obtain the above classification model.

[0042] In some embodiments, the method further comprises: Obtain a preset target detection training set, wherein the target detection training set carries a small target recognition label; The target detection training set is input into the initial small target detection model for training to obtain the training small target detection prediction result. The loss function result is calculated based on the training small target detection prediction result and the small target recognition label. The gradient of the loss function result is reversely transferred to the initial small target detection model for iterative training to generate a fully trained small target detection model.

[0043] Specifically, a preset target detection training set is obtained, wherein the acquisition of the target detection training set includes, but is not limited to, obtaining an initial training image containing a small target to be tested, and segmenting the initial training image to obtain a grid training image, screening the grid training image containing the small target to be tested or a part of the small target to be tested, and combining and expanding the grid training images containing the same small target to be tested to obtain a training small target image to be tested, wherein the training small target image to be tested contains a complete small target to be tested, and the training small target image to be tested is used as a positive sample, and then a different number of grid images are randomly selected from the grid training image, such as 3×5, that is, 3 grids in width and 5 grids in height, and then the grid image is filled with constants based on the fixed pixel specifications input by the detection module, so as to obtain a grid image for enriching the training set. Further, the target detection training set carries a small target identification label, that is, the small target identification label represents the specific category of the small target to be tested in the image, such as mobile phones, wallets, etc.

[0044] Finally, the target detection training set is input into the initial small target detection model for training to obtain the training small target detection prediction result, the loss function result is calculated according to the training small target detection prediction result and the small target recognition label, and the gradient of the loss function result is reversely transmitted to the initial small target detection model for iterative training to generate a fully trained small target detection model. Among them, the choice of small target detection model can be determined by relevant technical personnel according to actual needs, such as the yoloV11 model can be selected.

[0045] The present application also provides a preferred embodiment of a small target detection method, Figure 3 Schematic diagram of the flow of a small target detection method in a preferred embodiment.

[0046] For the training process, firstly, an initial training image containing a small target to be tested is obtained, and then the initial training image is segmented to obtain a grid training image, and a grid image annotation is added to the grid training image. The grid image annotation is used to characterize whether the grid image includes a small target to be tested or a part of the small target to be tested, thereby obtaining a grid image training set; at the same time, the grid training image is combined and expanded to obtain a training small target image to be tested, and the training small target image to be tested contains a complete small target to be tested, and the training small target image to be tested is annotated, and a small target recognition label is added to the training small target image to be tested, and the small target recognition label reflects the category of the small target to be tested, and different grid images are randomly selected from the grid training image, and the randomly selected grid images and the training small target images to be tested carrying small target recognition labels are combined to obtain a target detection training set. In summary, the initial classification model is trained based on the grid image training set to obtain a fully trained classification model, and the initial small target detection model is trained based on the target detection training set to obtain a fully trained small target detection model.

[0047] For the reasoning process, first, an initial image is obtained, which is the image to be inferred, and then the initial image is segmented to obtain multiple grid images, and each grid image is input into the above-mentioned fully trained classification model. The classification model is used to confirm that the grid image contains a target grid image of a preset small target to be tested, and then the target grid image is combined and expanded to determine that the small target image to be tested contains a complete small target to be tested, and the small target image to be tested is input into the small target detection model, and the detection result corresponding to the small target to be tested and the relative coordinate information of the small target to be tested are output. The actual coordinate information of the small target to be tested is calculated through the coordinate offset between the small target image to be tested and the initial image, wherein, Figure 4The figure is a flow chart of determining the image of the small target to be tested in one embodiment. As can be seen from the figure, image a is the above-mentioned grid image that has been segmented, and then the target grid image containing the small target to be tested in the grid image is determined. Taking the small target to be tested as a mouse as an example, the red boxes in the figure are two target grid images containing the small target to be tested, and the sum of the two red boxes is the above-mentioned basic small target image. Then, the target grid image containing the small target to be tested within a first range around the basic small target image is determined and divided into the initial small target image to be tested to obtain image b. Furthermore, when it is detected that the shape of the initial small target image to be tested is not a rectangle, the initial small target image to be tested is segmented based on the grid images adjacent to the initial small target image to be tested. The target image is expanded to obtain the expanded initial small target image to be tested, as shown in image c. Since the shape of the initial small target image to be tested in this embodiment is already a rectangle, image c is the same as image b. Further, the grid image within the second range around the expanded initial small target image to be tested is combined with the expanded initial small target image to obtain an expanded small target image, as shown in image d. The green box in image d represents the grid image within the second range of the initial small target image to be tested. In this embodiment, the second range is a one-grid range. Finally, based on the preset default pixel specification, the expanded small target image is filled with constants to obtain the small target image to be tested, that is, image e.

[0048] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0049] Based on the same inventive concept, the embodiment of the present application also provides a small target detection device for implementing the small target detection method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more small target detection device embodiments provided below can refer to the limitations of the small target detection method above, and will not be repeated here.

[0050] In one embodiment, Figure 5 As shown, a small target detection device is provided, including: an acquisition module 51, a calculation module 52 and a generation module 53, wherein: An acquisition module 51 is used to acquire an initial image, divide the initial image into a plurality of grid images, and perform batch recognition on the grid images to determine a target grid image including a preset small target to be detected in the grid images; A calculation module 52, configured to combine different target grid images based on relative distances between different target grid images in an image coordinate system to obtain a small target image to be measured; The generation module 53 is used to input the image of the small target to be detected into the well-trained small target detection model to obtain the detection result of the small target to be detected.

[0051] Specifically, the acquisition module 51 acquires the initial image, divides the initial image into multiple grid images, and performs batch recognition on the grid images to determine that the grid image includes a target grid image of a small target to be tested, and sends the target grid image to the calculation module 52. The calculation module 52 determines the target grid image corresponding to the same small target to be tested, and generates a small target image to be tested based on the target grid image corresponding to the same small target to be tested, and sends the small target image to be tested to the generation module 53. The generation module 53 inputs the small target image to be tested into the small target detection model to obtain a detection result corresponding to the small target to be tested.

[0052] Each module in the above-mentioned small target detection device can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above-mentioned modules can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.

[0053] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 6 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data related to small target detection. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a small target detection method is implemented.

[0054] Those skilled in the art will understand that Figure 6The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0055] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented: Acquire an initial image, divide the initial image into a plurality of grid images, perform batch recognition on the grid images, and determine a target grid image including a preset small target to be detected in the grid images; Based on the relative distances between the different target grid images in the image coordinate system, the different target grid images are combined to obtain a small target image to be tested; The image of the small target to be tested is input into the well-trained small target detection model to obtain the detection result of the small target to be tested.

[0056] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented: Acquire an initial image, divide the initial image into a plurality of grid images, perform batch recognition on the grid images, and determine a target grid image including a preset small target to be detected in the grid images; Based on the relative distances between the different target grid images in the image coordinate system, the different target grid images are combined to obtain a small target image to be tested; The image of the small target to be tested is input into the well-trained small target detection model to obtain the detection result of the small target to be tested.

[0057] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps: Acquire an initial image, divide the initial image into a plurality of grid images, perform batch recognition on the grid images, and determine a target grid image including a preset small target to be detected in the grid images; Based on the relative distances between the different target grid images in the image coordinate system, the different target grid images are combined to obtain a small target image to be tested; The image of the small target to be tested is input into the well-trained small target detection model to obtain the detection result of the small target to be tested.

[0058] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.

[0059] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0060] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0061] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A small target detection method, characterized in that: The method comprises: Acquire an initial image, divide the initial image into a plurality of grid images, perform batch recognition on the grid images, and determine a target grid image including a preset small target to be detected in the grid images; Based on the relative distances between the different target grid images in the image coordinate system, the different target grid images are combined to obtain a small target image to be tested; The small target image to be tested is input into a well-trained small target detection model to obtain a detection result for the small target to be tested.

2. The method according to claim 1, characterized in that The combining of different target grid images based on the relative distances between different target grid images in the image coordinate system to obtain the small target image to be measured comprises: Taking each of the target grid images in turn as an initial first grid image; Determine whether the grid within the preset neighborhood of the first grid image contains the small target to be detected; if so, merge the grid containing the small target to be detected with the first grid image, and use the merged grid image as a new first grid image; The above steps of determining whether the grid contains the small target to be detected and updating the first grid image are executed repeatedly until the grid within the preset area of ​​the latest first grid image does not contain the small target to be detected; Determine an initial small target image to be detected corresponding to the small target to be detected based on the latest first grid image; When it is detected that the shape of the initial small target image to be tested does not fall within a preset shape range, the initial small target image to be tested is expanded based on the grid image adjacent to the initial small target image to be tested until the shape of the expanded initial small target image to be tested falls within the shape range, and the expanded initial small target image to be tested is determined as the small target image to be tested.

3. The method according to claim 2, characterized in that After the initial small target image to be tested is expanded until the shape of the expanded initial small target image to be tested belongs to the shape range, the method further includes: Combining the grid image within the preset second range of the expanded initial small target image to be tested with the expanded initial small target image to obtain an expanded small target image; Based on a preset default pixel specification, the expanded small object image is filled with constants to obtain the small object image to be tested.

4. The method according to claim 1, characterized in that: After obtaining the detection result for the small target to be detected, the method further includes: Determine the anchor point coordinates corresponding to the small target image to be tested, and calculate the coordinate offset between the anchor point coordinates of the small target image to be tested and the anchor point coordinates of the initial image; The coordinate offset is combined with the relative coordinates corresponding to the image of the small target to be measured to determine the actual coordinates of the small target to be measured.

5. The method according to claim 1, characterized in that The step of batch-recognizing the grid images to determine a target grid image including a preset small target to be detected in the grid images includes: The grid images are input one by one into a fully trained classification model for classification processing to obtain classification results corresponding to the grid images; wherein the classification model is trained based on a preset grid image training set carrying grid image annotations, and the grid image annotations represent whether the small target to be tested exists in each training grid image in the grid image training set.

6. The method according to claim 1, characterized in that The method further comprises: Obtaining a preset target detection training set, wherein the target detection training set carries a small target recognition label; The target detection training set is input into the initial small target detection model for training to obtain the training small target detection prediction result, the loss function result is calculated based on the training small target detection prediction result and the small target identification label, and the gradient of the loss function result is reversely transmitted to the initial small target detection model for iterative training to generate the fully trained small target detection model.

7. A small target detection device, characterized in that: The device comprises: An acquisition module, used for acquiring an initial image, dividing the initial image into a plurality of grid images, and performing batch recognition on the grid images to determine a target grid image including a preset small target to be detected in the grid images; A calculation module, used for combining different target grid images based on relative distances between different target grid images in an image coordinate system to obtain a small target image to be measured; The generation module is used to input the small target image to be tested into a well-trained small target detection model to obtain a detection result for the small target to be tested.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Image recognition method and device

    CN111191570A

  • Remote sensing image detection method and device, electronic equipment and storage medium

    CN115115947A

  • Two-stage YOLO-based oversized image target detection method and device

    CN116612294A

  • Target detection model training method and device, electronic equipment and storage medium

    CN119180997A