Small target detection method, device, equipment and medium
By performing adaptive segmentation and sub-image detection on high-resolution and large-size images, the problem of low accuracy and speed of small target detection in images is solved, and more efficient target detection is achieved.
Patent Information
- Application Number
- CN202110605010.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-31
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2041-05-31
AI Technical Summary
It is difficult for existing technology to efficiently detect small targets in high-resolution and large-size images, resulting in low detection accuracy and speed.
By adaptively dividing the image to be detected into multiple sub-images, and performing small target detection on each sub-image respectively, the detection results of the sub-images are finally integrated to determine the target detection result of the image.
It improves the accuracy and speed of small target detection in high-resolution and large-size images, and avoids the problem of small targets being missed when large images are directly detected.
Smart Images

Figure CN113221895B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the field of image processing technology, and in particular to a small target detection method, device, equipment and medium. Background Art
[0002] Object detection technology is applied in many fields of life and production, but small object detection in high-resolution and large-size images has always been a difficult problem in object detection technology.
[0003] How to detect small targets in high-resolution and large-size images and improve detection accuracy and speed is an urgent problem to be solved. Summary of the invention
[0004] Embodiments of the present invention provide a small target detection method, device, equipment and medium to solve the technical problem of small target detection for high-resolution large-size images and improve detection accuracy and detection speed.
[0005] In a first aspect, an embodiment of the present invention provides a small target detection method, comprising:
[0006] Acquire an image to be detected, and determine at least one sub-image to be detected corresponding to the image to be detected;
[0007] Performing small target detection on each of the sub-images to be detected;
[0008] The target detection result of the image to be detected is determined according to the target detection result of the sub-image to be detected.
[0009] In a second aspect, an embodiment of the present invention further provides a small target detection device, comprising:
[0010] A to-be-detected sub-image determining module, used to obtain an to-be-detected image and determine at least one to-be-detected sub-image corresponding to the to-be-detected image;
[0011] A sub-image to be detected target detection module, used to perform small target detection on each of the sub-images to be detected;
[0012] The target detection result determination module is used to determine the target detection result of the image to be detected according to the target detection result of the sub-image to be detected.
[0013] In a third aspect, an embodiment of the present invention further provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the small target detection method described in any embodiment of the present invention is implemented.
[0014] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the small target detection method described in any embodiment of the present invention.
[0015] The technical solution of the embodiment of the present invention, when performing small target detection on the image to be detected, first obtains each sub-image to be detected corresponding to the image to be detected, and then performs small target detection on each sub-image to be detected respectively, and then obtains the small target detection result of the image to be detected based on the target detection results of each sub-image to be detected. When the image to be detected is a high-resolution large-size image, the technical problem of performing small target detection on the high-resolution large-size image can be solved, and small target detection is performed on each sub-image to be detected corresponding to the image to be detected to determine the small target detection result of the image to be detected, and the detection accuracy and detection speed when performing small target detection on the high-resolution large-size image can also be improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 is a flow chart of a small target detection method in Embodiment 1 of the present invention;
[0017] Figure 2 is a flow chart of a small target detection method in Embodiment 2 of the present invention;
[0018] Figure 3 This is an example diagram of the process of detecting small targets in high-resolution large-size images in the second embodiment of the present invention;
[0019] Figure 4 This is an example diagram of data rearrangement of a target detection image in Embodiment 3 of the present invention;
[0020] Figure 5 This is an example diagram of extracting feature maps of data rearrangement images using different feature extraction methods in Embodiment 3 of the present invention;
[0021] Figure 6 is an example diagram of the overall network structure of the target detection network in the third embodiment of the present invention;
[0022] Figure 7 is a flowchart of a small target detection method in Embodiment 4 of the present invention;
[0023] Figure 8 is a structural schematic diagram of a small target detection device in Embodiment 5 of the present invention;
[0024] Fig. 9 It is a schematic diagram of the hardware structure of an electronic device in Embodiment 6 of the present invention. DETAILED DESCRIPTION
[0025] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.
[0026] It should be mentioned before discussing the exemplary embodiments in more detail that some exemplary embodiments are described as processes or methods depicted as flow charts. Although the flow charts describe the operations (or steps) as sequential processes, many of the operations therein can be implemented in parallel, concurrently or simultaneously. In addition, the order of the operations can be rearranged. The process can be terminated when its operation is completed, but can also have additional steps not included in the accompanying drawings. The process can correspond to a method, function, procedure, subroutine, subprogram, etc.
[0027] As mentioned above, when the image size resolution is high and the target is small, the target detection is more difficult.
[0028] Taking satellite images as an example, many targets in high-resolution images are much smaller than 32×32 pixels (MS COCO, a well-known target detection dataset in the academic community, divides targets of different sizes into three levels: pixel size less than 32×32, pixel size between 32×32 and 96×96, and pixel size greater than 96×96). The smaller the target, the more difficult it is to detect. At the same time, high-resolution images are very large, generally larger than 4460×9561 pixels, or even 16000×16000 pixels. Direct detection will result in many small targets not being detected.
[0029] The small target detection method of the disclosed embodiment can improve the detection accuracy and detection speed when performing small target detection on high-resolution large-size images.
[0030] Embodiment 1
[0031] Figure 1 This is a flow chart of a small target detection method provided in Example 1 of the present invention. This embodiment is applicable to the case of performing small target detection on high-resolution large-size images. The method can be executed by the small target detection device provided in the embodiment of the present invention. The device can be implemented in software and / or hardware and can generally be integrated in an electronic device.
[0032] like Figure 1 As shown, the small target detection method provided in this embodiment specifically includes:
[0033] S110: Acquire an image to be detected, and determine at least one sub-image to be detected corresponding to the image to be detected.
[0034] The image to be detected refers to an image that needs to be detected as a small target. This embodiment does not specifically limit the image size and resolution of the image to be detected. Optionally, the image to be detected is a high-resolution large-size image that needs to be detected as a small target, and its image size is greater than 4460×9561 pixels, or greater than 16000×16000 pixels, etc.
[0035] The sub-image to be detected refers to an image that needs to be detected as a small target after adaptive segmentation of the image to be detected. The number of sub-images to be detected corresponding to the image to be detected may be one or more. The image content included in at least one sub-image to be detected corresponding to the image to be detected is consistent with the image content included in the image to be detected. The number of sub-images to be detected corresponding to the image to be detected can be determined based on the size of the image to be detected and the size of the standard input template image of the target detection network. Among them, the standard input template image of the target detection network refers to a template image that meets the network input size of the target detection network, and the target detection network can be any detection network for small target detection.
[0036] As an optional implementation manner, determining at least one sub-image to be detected corresponding to the image to be detected may be specifically as follows:
[0037] Calculate the size ratio coefficient of the image to be detected and the standard input template image of the target detection network; when the size ratio coefficient meets the segmentation condition, segment the image to be detected and determine at least two sub-images to be detected corresponding to the image to be detected; when the size ratio coefficient does not meet the segmentation condition, process the image to be detected and determine a sub-image to be detected corresponding to the image to be detected; wherein the size of the sub-image to be detected is the same as the size of the standard input template image of the target detection network.
[0038] The size ratio coefficient is calculated according to the size of the image to be detected and the size of the standard input template image of the target detection network. For example, if the size of the image to be detected is A1×A2 (pixels) and the size of the standard input template image of the target detection network is B1×B2 (pixels), the ratio of A1×A2 (pixels) to B1×B2 (pixels) can be used as the size ratio coefficient. The obtained size ratio coefficient is analyzed to determine whether the size ratio coefficient meets the segmentation condition, and the image to be detected is adaptively segmented according to the judgment result to obtain at least one sub-image to be detected corresponding to the image to be detected.
[0039] For example, the segmentation condition may be that the size ratio coefficient is not less than or greater than a preset ratio coefficient threshold. Taking the segmentation condition that the size ratio coefficient is not less than 2 as an example, when the size ratio coefficient meets the segmentation condition, that is, when the obtained size ratio coefficient is greater than or equal to 2, the image to be detected is segmented according to the size of the target detection network standard input template image, and multiple sub-images to be detected with the same size as the target detection network standard input template image are obtained; when the obtained size ratio coefficient does not meet the segmentation condition, that is, when the obtained size ratio coefficient is less than 2, the image to be detected is reduced according to the size of the target detection network standard input template image, and a sub-image to be detected with the same size as the target detection network standard input template image is obtained.
[0040] Further, as an optional implementation, the size ratio coefficient of the image to be detected and the standard input template image of the target detection network is calculated, which can be specifically:
[0041] Calculate the image width ratio coefficient and image height ratio coefficient of the image to be detected and the standard input template image of the target detection network, and round up the image width ratio coefficient and the image height ratio coefficient to integers to obtain the image width correction ratio coefficient and the image height correction ratio coefficient respectively; use the larger one of the image width correction ratio coefficient and the image height correction ratio coefficient as the size ratio coefficient; accordingly, the size ratio coefficient satisfies the segmentation condition, which can be specifically as follows: if the size ratio coefficient is greater than a preset ratio coefficient threshold, then it is determined that the size ratio coefficient satisfies the segmentation condition; the size ratio coefficient does not meet the segmentation condition, which can be specifically as follows: if the size ratio coefficient is less than or equal to the preset ratio coefficient threshold, then it is determined that the size ratio coefficient does not meet the segmentation condition.
[0042] Assume that the image size of the image to be detected is img_w×img_h (pixels), and the image size of the standard input template image of the target detection network is net_w×net_h (pixels), where img_w is the image width of the image to be detected, img_h is the image height of the image to be detected, net_w is the image width of the standard input template image of the target detection network, and net_h is the image height of the standard input template image of the target detection network.
[0043] The image width ratio coefficient refers to the ratio of the image width of the image to be detected to the image width of the standard input template image of the target detection network, that is, the image width ratio coefficient w = img_w / net_w; the image height ratio coefficient refers to the ratio of the image height of the image to be detected to the image height of the standard input template image of the target detection network, that is, the image height ratio coefficient h = img_h / net_h.
[0044] The image width ratio coefficient w and the image height ratio coefficient h are rounded up to obtain the image width correction ratio coefficient w' and the image height correction ratio coefficient h', respectively, and the larger ratio coefficient a' (w' or h') of the image width correction ratio coefficient w' and the image height correction ratio coefficient h' is used as the size ratio coefficient. Furthermore, the size ratio coefficient a' can be used as a judgment condition for whether subsequent image segmentation is required.
[0045] Whether it is necessary to segment the image to be detected is determined according to the size ratio coefficient a'. Taking the preset ratio coefficient threshold of 2 as an example, when the size ratio coefficient a' is greater than 2, the image to be detected needs to be segmented, that is, when the ratio of a corresponding edge of the image to be detected and the standard input template image of the target detection network is greater than 2, the image to be detected needs to be segmented to determine multiple sub-images to be detected corresponding to the image to be detected; when the size ratio coefficient a' is less than or equal to 2, the image to be detected does not need to be segmented, and a sub-image to be detected corresponding to the image to be detected is determined after the image to be detected is processed.
[0046] Further, as an optional implementation, when the size ratio coefficient meets the segmentation condition, the image to be detected is segmented to determine at least two sub-images to be detected corresponding to the image to be detected, which can be specifically as follows:
[0047] According to the image width correction ratio coefficient and the image height correction ratio coefficient, the image unit size of the image to be detected is determined, and each segmentation center alignment point in the image to be detected is determined according to the image unit size; with each segmentation center alignment point as the center, the image to be detected is segmented according to the size of the target detection network standard input template image to obtain at least two sub-images to be confirmed; the at least two sub-images to be confirmed are respectively aligned with the center of the target detection network standard input template image to generate at least two sub-images to be detected corresponding to the image to be detected.
[0048] The width of the image unit size refers to the quotient of the image width of the image to be detected and the image width correction ratio coefficient, and the height of the image unit size refers to the quotient of the image height of the image to be detected and the image height correction ratio coefficient. The segmentation center alignment point refers to the center point of each segmented image area obtained when the image to be detected is segmented according to the image unit size.
[0049] Taking each segmentation center alignment point as the center, the image to be detected is segmented according to the size of the standard input template image of the target detection network to obtain multiple sub-images to be confirmed. Among them, there may be overlapping areas between two sub-images to be confirmed that are adjacent to each other up and down or left and right. Since each segmentation center alignment point is determined according to the image unit size, the sub-image to be confirmed obtained by segmentation with each segmentation center alignment point as the center is segmented according to the size of the standard input template image of the target detection network, and the size of the standard input template image of the target detection network is greater than or equal to the image unit size, so the size of the sub-image to be confirmed is less than or equal to the size of the standard input template image of the target detection network. Among them, when the sub-image to be confirmed is located in the first row, last row, first column or last column of the segmented image to be detected, the size of the sub-image to be confirmed may be smaller than the size of the standard input template image of the target detection network. At this time, the segmentation center alignment point is not the center of the sub-image to be confirmed.
[0050] For each sub-image to be confirmed, it is aligned with the target detection network standard input template image to generate the corresponding sub-image to be detected. Specifically, for each sub-image to be confirmed, it can be aligned with the target detection network standard input template image, and the position coordinates of the sub-image to be confirmed relative to the target detection network standard input template image are calculated according to the size of the sub-image to be confirmed and the target detection network standard input template image, wherein the position coordinates include the upper left alignment point and the lower right alignment point, or include the lower left alignment point and the upper right alignment point, and the sub-image to be confirmed is filled into the target detection network standard input template image in the area between the upper left alignment point and the lower right alignment point, or in the area between the lower left alignment point and the upper right alignment point. If there are blank areas around the target detection network standard input template image (either the upper, lower, left, or right side) after the sub-image to be confirmed is filled into the target detection network standard input template image, it is necessary to fill pixels in the corresponding blank areas, such as filling pixels with a pixel value of "0" in the blank areas to generate a sub-image to be detected corresponding to the sub-image to be confirmed.
[0051] Further, as an optional implementation, taking each segmentation center alignment point as the center, the size of the template image is input according to the target detection network standard, and segmentation is performed in the image to be detected to obtain at least two sub-images to be confirmed, which can be specifically as follows:
[0052] Taking each segmentation center alignment point as the center and inputting the size of the template image according to the target detection network standard, the coordinate range of each sub-image to be confirmed in the image to be detected is calculated respectively; according to the coordinate range of each sub-image to be confirmed in the image to be detected, the image to be detected is segmented to obtain at least two sub-images to be confirmed.
[0053] For each segmentation center alignment point, the segmentation center alignment point is taken as the center, and the size of the template image and the coordinates of the segmentation center alignment point are input according to the target detection network standard to calculate the coordinate range of the corresponding sub-image to be confirmed. If the calculated coordinate range exceeds the coordinate range in the image to be detected, for example, the calculated coordinate value is a negative value, or the calculated coordinate value is greater than the maximum coordinate value in the corresponding direction of the image to be detected, the calculated coordinate range is adjusted, and the exceeded coordinate range is limited to the corresponding boundary of the image to be detected, and the adjusted coordinate range is used as the coordinate range of the sub-image to be confirmed in the image to be detected, and then the image to be detected can be segmented according to the coordinate range of the sub-image to be confirmed in the image to be detected, and the corresponding sub-image to be confirmed is obtained.
[0054] Optionally, when the size ratio coefficient meets the segmentation condition, the image to be detected is adaptively segmented, and the adaptive segmentation is performed in the width direction first and then the height direction, or in the height direction first and then the width direction. Taking the adaptive segmentation in the width direction and then the height direction as an example, the adaptive segmentation can be achieved through two layers of loops, the inner loop is performed in the width direction of the image to be detected, and the outer loop is performed in the height direction of the image to be detected. The sub-image to be confirmed obtained after each inner loop segmentation is aligned with the standard input template image of the target detection network to generate the sub-image to be detected. Optionally, the generated multiple sub-images to be detected are stored in the sub-image list to be detected for batch processing of small target detection.
[0055] As a specific implementation, when the size ratio coefficient meets the segmentation condition, the process of adaptively segmenting the image to be detected to obtain multiple sub-images to be detected may include:
[0056] a. Set the segmentation counters. The width direction (i.e., x-coordinate direction) counter is represented by i, and the height direction (i.e., y-coordinate direction) counter is represented by j. The counters start from 0 and the maximum values are w'-1 and h'-1 respectively. According to the image width and height correction ratio coefficient (w', h'), the width and height (c_w, c_h) of the image unit size for adaptive segmentation of the image to be detected are calculated, that is, the segmentation center alignment point of the subsequent segmentation is determined in turn by the width and height of the image unit size.
[0057] b. The outer loop controls the height direction. When the y-direction counter j is less than the height coefficient h', the inner loop continues. When j is greater than or equal to h', the outer loop ends and the sub-image to be confirmed is output.
[0058] c. The outer loop counter j controls the selection of different y-direction offset calculations. Different positions correspond to different up and down offsets for centering and alignment in the image height direction. When y is equal to 0, the image to be detected is segmented at the top row; when y is greater than 0 and less than h'-1, the image to be detected is segmented in the middle; when y is equal to h'-1, the image to be detected is segmented at the bottom row.
[0059] d. The inner loop controls the width direction. When the x-direction counter i is less than w', the current inner loop is performed. When i is greater than or equal to w', the current inner loop is exited. When the width counter i of the inner loop is set to 0, the height counter j of the outer loop is increased by 1, and the next round of outer loop control is performed.
[0060] e. The inner loop counter i controls the selection of different x-direction offset calculations. Different positions correspond to different left and right offsets for centering and alignment in the width direction of the image. When x is equal to 0, the image to be detected is segmented in the leftmost column; when x is greater than 0 and less than w'-1, the image to be detected is segmented in the middle part; when x is equal to w'-1, the image to be detected is segmented in the rightmost column.
[0061] f. The offset in the y direction is controlled by the outer loop counter j, and the offset in the x direction is controlled by the inner loop counter i. The alignment coordinate points when the image to be detected is segmented are calculated, such as the upper left alignment coordinate point and the lower right alignment coordinate point (i.e., the upper left point and lower right point of the sub-image to be confirmed), or the lower left alignment coordinate point and the upper right alignment coordinate point (i.e., the lower left point and upper right point of the sub-image to be confirmed), and then the sub-image to be confirmed can be output according to the alignment coordinate points.
[0062] g. According to the alignment coordinate points of the sub-image to be confirmed and the alignment coordinate points of the standard input template image of the target detection network, the sub-image to be confirmed is filled into the standard input template image of the target detection network, and after filling the blank area around the standard input template image of the target detection network with pixels, a sub-image to be detected corresponding to the sub-image to be confirmed is generated.
[0063] Optionally, the sub-images to be detected that have completed segmentation and alignment conversion are stored in a list of sub-images to be detected as a batch for subsequent small object detection.
[0064] Furthermore, as an optional implementation, when the size ratio coefficient does not meet the segmentation condition, the image to be detected is processed to determine a sub-image to be detected corresponding to the image to be detected. Specifically, the image to be detected is reduced according to the size ratio coefficient to obtain a reduced image to be detected; the reduced image to be detected is centered with the standard input template image of the target detection network to generate a sub-image to be detected corresponding to the image to be detected.
[0065] First, the image to be detected is reduced according to the size ratio coefficient a' to obtain a reduced image to be detected; then the reduced image to be detected is aligned with the target detection network standard input template image in the center to generate a sub-image to be detected corresponding to the image to be detected. Specifically, the position coordinates of the reduced image to be detected relative to the target detection network standard input template image are calculated according to the size of the reduced image to be detected and the target detection network standard input template image, wherein the position coordinates include the upper left alignment point and the lower right alignment point, or include the lower left alignment point and the upper right alignment point, and the reduced image to be detected is filled into the area between the upper left alignment point and the lower right alignment point in the target detection network standard input template image, or the area between the lower left alignment point and the upper right alignment point. If there are blank areas around the target detection network standard input template image (either the upper, lower, left, or right sides) after the reduced image to be detected is filled into the target detection network standard input template image, it is necessary to fill pixels in the corresponding blank areas, such as filling pixels with a pixel value of "0" in the blank areas to generate a sub-image to be detected corresponding to the reduced image to be detected, that is, a sub-image to be detected corresponding to the image to be detected.
[0066] S120 , performing small target detection on each sub-image to be detected.
[0067] Small target detection is performed for each generated sub-image to be detected, and a target detection result corresponding to each sub-image to be detected is obtained. Among them, small target detection can be performed on each sub-image to be detected by any target detection network that matches the size of the sub-image to be detected. Optionally, the target detection algorithm used by the target detection network can be a two-stage algorithm or a single-stage algorithm, wherein the two-stage algorithm has higher detection accuracy but slightly worse real-time performance, and the single-stage algorithm has slightly insufficient detection accuracy but better real-time performance.
[0068] When there are multiple sub-images to be detected, in order to improve the efficiency of small target detection, parallel processing can be performed in the form of batch processing to achieve small target detection on multiple sub-images to be detected at the same time.
[0069] S130 , determining the target detection result of the image to be detected according to the target detection result of the sub-image to be detected.
[0070] When there are multiple sub-images to be detected, the target detection result corresponding to the image to be detected can be obtained by combining the target detection results of the multiple sub-images to be detected. For example, the target detection frames of the multiple sub-images to be detected can be restored to the image to be detected, and the target detection result of the image to be detected can be obtained by ranking the confidences of these target detection frames and removing duplicates.
[0071] The technical solution of the embodiment of the present invention, when performing small target detection on the image to be detected, first obtains each sub-image to be detected corresponding to the image to be detected, and then performs small target detection on each sub-image to be detected respectively, and then obtains the small target detection result of the image to be detected based on the target detection results of each sub-image to be detected. When the image to be detected is a high-resolution large-size image, the technical problem of performing small target detection on the high-resolution large-size image can be solved, and small target detection is performed on each sub-image to be detected corresponding to the image to be detected to determine the small target detection result of the image to be detected, and the detection accuracy and detection speed when performing small target detection on the high-resolution large-size image can also be improved.
[0072] In the above technical solution, when the image to be detected is a high-resolution large-size image, the image to be detected is adaptively segmented to generate multiple sub-images to be detected corresponding to the image to be detected, and small target detection is performed on each sub-image to be detected respectively through a target detection network that matches the size of the sub-image to be detected. Compared with using an ultra-large network input for detection, the detection accuracy is high, the detection speed is fast, and high-performance hardware support is not required.
[0073] Embodiment 2
[0074] Figure 2 A flow chart of a small target detection method provided for Embodiment 2 of the present invention, wherein this embodiment is concretized on the basis of the aforementioned embodiment, wherein, in the case where multiple sub-images to be detected corresponding to the image to be detected can be determined, the small target detection method provided by this embodiment also includes: determining a secondary detection sub-image based on every two adjacent sub-images to be detected, and performing small target detection on the secondary detection sub-image; correspondingly, determining the target detection result of the image to be detected based on the target detection result of the sub-image to be detected, which can be specifically as follows: determining the target detection result of the image to be detected based on the target detection results of the sub-image to be detected and the secondary detection sub-image.
[0075] like Figure 2 As shown, the small target detection method provided in this embodiment includes:
[0076] S210: Acquire an image to be detected, and determine at least two sub-images to be detected corresponding to the image to be detected.
[0077] S220 , performing small target detection on each sub-image to be detected.
[0078] S230 , determining a secondary detection sub-image according to every two adjacent sub-images to be detected, and performing small target detection on the secondary detection sub-image.
[0079] No matter how the image to be detected is segmented, the problem that the target at the adjacent or overlapping part of two adjacent sub-images to be detected is segmented into two parts cannot be avoided. In order to solve the problem that the target at the adjacent or overlapping part of the sub-images to be detected is segmented into multiple parts, this embodiment performs a secondary detection on the basis of performing small target detection on each sub-image to be detected, so as to improve the target detection performance.
[0080] For two adjacent sub-images to be detected, which may be two adjacent sub-images to be detected in the width direction of the image to be detected, or two adjacent sub-images to be detected in the height direction of the image to be detected, a secondary detection sub-image corresponding to the two images to be detected is determined. The secondary detection sub-image is determined based on the adjacent or overlapping areas of the two adjacent sub-images to be detected, and the overlapping area corresponding to the two adjacent sub-images to be detected does not exist repeatedly in the secondary detection sub-image. Optionally, the size of the secondary detection sub-image is the same as the size of the sub-image to be detected.
[0081] After determining the secondary detection sub-image for each two adjacent sub-images to be detected, small target detection is continued on the corresponding secondary detection sub-image to obtain a target detection result corresponding to the secondary detection sub-image.
[0082] As an optional implementation, a secondary detection sub-image is determined based on every two adjacent sub-images to be detected. Specifically, if two adjacent sub-images to be detected meet the repeated detection condition, a secondary detection sub-image is determined based on the two adjacent sub-images to be detected.
[0083] In order to avoid unnecessary waste of computing resources, two adjacent sub-images to be detected can be screened, and a secondary detection sub-image is generated only when necessary, and small target detection is performed on the generated secondary detection sub-image.
[0084] The repeated detection condition refers to the condition that requires secondary detection, for example, the existence of a target detection frame at the adjacent or overlapping position of two adjacent sub-images to be detected. For each two adjacent sub-images to be detected, when the two adjacent sub-images to be detected meet the repeated detection condition, for example, the existence of a target detection frame at the adjacent or overlapping position of the two adjacent sub-images to be detected, the corresponding secondary detection sub-image is generated according to the two adjacent sub-images to be detected.
[0085] As an optional implementation, two adjacent sub-graphs to be detected satisfy the repeated detection condition, which may be specifically:
[0086] If there are two target detection frames in two adjacent sub-images to be detected whose overlap is greater than a preset overlap threshold, it is determined that the two adjacent sub-images to be detected meet the repeated detection condition.
[0087] After performing small target detection on each sub-image to be detected, a target detection frame corresponding to each sub-image to be detected can be obtained. For two adjacent sub-images to be detected, the target detection frames corresponding to the two sub-images to be detected are judged to overlap, and if there are two target detection frames whose overlap is greater than a preset overlap threshold (for example, 50% or 25%), it can be determined that the two adjacent sub-images to be detected meet the repeated detection condition.
[0088] As an optional implementation, determining a secondary detection sub-image based on the two adjacent sub-images to be detected can be specifically as follows: determining a target area image corresponding to the two adjacent sub-images to be detected in the image to be detected; taking the center point of the target area image as the center, inputting the size of the template image according to the target detection network standard, and cutting out the secondary detection sub-image in the target area image.
[0089] When analyzing two adjacent sub-images to be detected, if the two adjacent sub-images to be detected meet the repeated detection condition, the target area image corresponding to the two adjacent sub-images to be detected can be determined in the image to be detected, that is, the joint area image of the two adjacent sub-images to be detected. After determining the target area image corresponding to the two adjacent sub-images to be detected, the secondary detection sub-image corresponding to the two adjacent sub-images to be detected can be cut out in the target area image with the center point of the target area image as the center and the size of the template image input according to the target detection network standard.
[0090] S240 , determining the target detection result of the image to be detected according to the target detection results of the sub-image to be detected and the secondary detection sub-image.
[0091] In this embodiment, small target detection is performed not only on multiple sub-images to be detected obtained by adaptively segmenting the image to be detected, but also on each secondary detection sub-image determined by two adjacent sub-images to be detected. Furthermore, after obtaining the target detection results of each sub-image to be detected and the target detection results of each secondary detection sub-image, that is, after obtaining the target detection frames corresponding to each sub-image to be detected and the target detection frames corresponding to each secondary detection sub-image, the target detection results of the image to be detected can be determined by combining the target detection results of the sub-image to be detected and the secondary detection sub-image.
[0092] As an optional implementation manner, determining the target detection result of the image to be detected according to the target detection results of the sub-image to be detected and the secondary detection sub-image may be specifically as follows:
[0093] The target detection frame in the sub-image to be detected and the target detection frame in the secondary detection sub-image are restored to the image to be detected; the target detection frame in the image to be detected is screened to obtain the target detection result of the image to be detected.
[0094] The target detection frames in each sub-image to be detected and the target detection frames in each secondary detection sub-image are restored to the image to be detected, and the target detection frames restored to the image to be detected are screened to obtain the target detection result of the image to be detected. When the target detection frames restored to the image to be detected are screened, the category confidence of each target detection frame can be sorted, and each target detection frame can be deduplicated to obtain each target detection frame that matches the image to be detected as the final detection result of small target detection of the image to be detected.
[0095] Optionally, when screening the target detection frames restored to the image to be detected, NMS (Non-Maximum Suppression) processing can be performed on all target detection frames regressed to the image to be detected to avoid the problem of multiple target detection frames for the same target in the image to be detected.
[0096] When the small target detection method provided by this embodiment is used to detect small targets in a high-resolution large-size image, the processing flow can be as follows: Figure 3 As shown, the input high-resolution large-size image is adaptively segmented to obtain multiple sub-images to be detected corresponding to the high-resolution large-size image. After small target detection is performed on the multiple sub-images to be detected, the secondary detection sub-image is determined according to the adjacent or overlapping parts of two adjacent sub-images to be detected, and small target detection is performed on each secondary detection sub-image. Finally, the target detection results of the sub-image to be detected and the secondary detection sub-image are regressed to the high-resolution large-size image, and all target detection frames regressed to the high-resolution large-size image are subjected to NMS de-duplication and merging processing to obtain the small target detection result of the high-resolution large-size image.
[0097] For details not explained in this embodiment, please refer to the aforementioned embodiments and will not be repeated here.
[0098] The above technical scheme, after performing small target detection on multiple sub-images to be detected by adaptively dividing the image to be detected and obtaining them, continues to analyze two adjacent sub-images to be detected to determine whether secondary detection is needed, and if necessary, generates a secondary detection sub-image based on the two adjacent sub-images to be detected, and continues to perform small target detection on the generated secondary detection sub-image, thereby realizing secondary detection at adjacent parts of sub-images to be detected, solving the problem of affecting target detection results due to the fact that targets at adjacent or overlapping parts of adjacent sub-images to be detected are divided into multiple parts when adaptively dividing the sub-images to be detected, thereby improving the overall detection performance.
[0099] Embodiment 3
[0100] Based on the above-mentioned embodiments, this embodiment concretizes the small target detection on the sub-image to be detected and the secondary detection sub-image. In this embodiment, when the image to be detected includes the sub-image to be detected and the secondary detection sub-image, the small target detection on the image to be detected can be specifically as follows: adjusting the image size and the number of channels of the image to be detected to obtain a data rearrangement image; performing feature extraction on the data rearrangement image to determine a target feature map; and determining the target detection result corresponding to the image to be detected according to the target feature map.
[0101] The image size of the target detection image refers to the size of the target detection image in the width and height directions; the number of channels of the target detection image refers to the size of the target detection image in the depth direction. Taking the target detection image as a 512*512 (pixel) three-channel image as an example, the image size of the target detection image is 512*512 (pixel), and the number of channels of the target detection image is 3.
[0102] The image size and the number of channels of the target detection image are adjusted so that the target detection image including pixel data is rearranged in the width and height directions and the depth direction to obtain a data rearranged image.
[0103] Optionally, adjusting the image size and the number of channels of the image to be detected to obtain the data rearranged image may specifically include: reducing the image size of the image to be detected, increasing the number of channels of the image to be detected to obtain the data rearranged image.
[0104] By reducing the image size of the target detection image and increasing the number of channels of the target detection image, the pixel data of the target detection image can be rearranged, which can not only retain the spatial structure information of the original image but also improve the fine-grained feature representation capability, thereby enhancing the image's feature extraction capability and spatial positioning capability.
[0105] Optionally, a data rearrangement operation of the target detection image is implemented by a DFR (Depth Feature Rearrangement Module) module that converts the width and height information of the target detection image into depth information, so as to enhance the feature extraction capability and spatial positioning capability.
[0106] Before and after the pixel data is rearranged, the product of the image size of the target detection image and the number of channels is equal. For example, taking the target detection image as a 3-channel image of 512*512 (pixels), the image size of the target detection image can be reduced from 512*512 to 256*256, and the number of channels of the target detection image can be expanded from 3 channels to 12 channels.
[0107] Further, as an optional implementation manner, the image size of the target detection image includes width information and height information, and adjusting the image size and the number of channels of the target detection image to obtain the data rearrangement image may include:
[0108] Divide the pixel data of the target detection image to determine Z target detection sub-images, wherein the target detection sub-images have the same number of channels as the target detection image, and the ratio of the product of the width information and the height information of the target detection image to the product of the width information and the height information of the target detection sub-image is Z, where Z is an integer greater than 1;
[0109] The Z sub-images to be detected as targets are combined in the channel direction to obtain a data rearrangement image.
[0110] The pixel data of the target detection image may be divided by dividing the target detection image by region, and determining the pixel data of each region as a target detection sub-image, or multiple pixel data that meet the preset data screening method may be determined as the pixel data of a target detection sub-image, and Z target detection sub-images are determined respectively. The pixel data of different target detection sub-images are different. The present disclosure does not limit the way of dividing pixel data.
[0111] Among them, the preset data screening method may refer to a method of screening pixel data in the image to be detected according to preset rules while keeping the number of channels of the image to be detected unchanged. For example, the preset data screening method may be to extract pixel data according to equal interval sizes, or to extract pixel data according to unequal interval sizes, wherein, when multiple extraction directions are included (for example, width information direction and height information direction), the equal interval sizes in different extraction directions may be different, for example, pixel data is extracted at intervals of 1 pixel along the width information direction (row direction), and pixel data is extracted at intervals of 0 pixels along the height information direction (column direction). The equal interval sizes in different extraction directions may also be the same. For example, pixel data is extracted at intervals of 1 pixel to generate a sub-image to be detected by the target, and the present disclosure does not limit the data screening method.
[0112] According to a preset data screening method, the target detection image is cut into a plurality of target detection sub-images; and the plurality of target detection sub-images are superimposed in a channel combination manner to obtain a data rearrangement image.
[0113] The preset data screening method refers to a method of screening pixel data in the target detection image according to preset rules while keeping the number of channels unchanged.
[0114] According to a preset data screening method, the target detection image is cut to obtain a plurality of target detection sub-images, wherein the number of channels of the target detection sub-image is equal to that of the target detection image, and the image size of the target detection sub-image is smaller than that of the target detection image. The plurality of target detection sub-images are superimposed in a channel combination manner to obtain a data rearrangement image, wherein the image size of the data rearrangement image is equal to that of the target detection sub-image, and the number of channels of the data rearrangement image is the sum of the number of channels of the plurality of target detection sub-images.
[0115] Among them, in the sub-image to be detected by the target generated according to the preset data screening method, two adjacent pixel data may not be adjacent in the image to be detected by the target. For example, the data screening method may include extracting the pixel data of the image to be detected by the target according to a preset interval size, and the two adjacent pixel data in the sub-image to be detected by the target are two pixel data with the preset interval size in the image to be detected by the target.
[0116] Wherein, when determining the sub-image to be detected, the first pixel data extracted is the pixel data not included in the determined sub-image to be detected, so that the pixel data of different sub-images to be detected are different. Extracting pixel data according to a preset interval size can be extracting pixel data according to a preset interval size along the width information direction and along the length information direction.
[0117] Furthermore, according to a preset data screening method, the image to be detected is cut into a plurality of sub-images to be detected, which can be specifically: pixel data is extracted from the image to be detected according to a preset interval size to generate a plurality of sub-images to be detected.
[0118] When filtering pixel data in the target detection image to generate the target detection sub-image, pixel data may be extracted from the target detection image according to a preset interval size to generate the target detection sub-image.
[0119] like Figure 4As shown, when rearranging the data of the 4*4 (pixel) 3-channel image to be detected, a sub-image to be detected can be generated by extracting one pixel data at every pixel interval, and multiple sub-images to be detected can be obtained, and superimposed in the form of channel combination to obtain a 2*2 (pixel) 12-channel data rearranged image. Specifically, the data rearrangement of the image to be detected can be achieved through the DFR module. Overall, the image data is first screened in the width and height directions and then superimposed in the depth direction to achieve pixel depth rearrangement of the multi-channel image. Figure 4 In the example shown, the image data in width and height is reduced by half, and the data in depth is increased fourfold, which not only retains the spatial structure information of the original image but also improves the fine-grained feature representation.
[0120] As an optional implementation, feature extraction is performed on the data rearrangement image to determine the target feature map, which can be specifically as follows: different feature extraction methods are used to extract feature maps of the data rearrangement image respectively; wherein different feature extraction methods have different image receptive fields; and each extracted feature map is fused to obtain a target feature map corresponding to the image to be detected.
[0121] Different feature extraction methods are used in parallel to extract feature maps of the data rearrangement image respectively, so as to obtain multiple feature maps. Since the image receptive fields of different feature extraction methods are different, the multiple feature maps obtained are of different sizes. The feature maps of different sizes are fused to obtain a target feature map corresponding to the target detection image.
[0122] Optionally, the feature extraction method may include only a convolution feature extraction method, or only a pooling feature extraction method, or both a convolution feature extraction method and a pooling feature extraction method.
[0123] When the convolution kernel size of the convolution feature extraction method is different (such as 3*3, 5*5, 7*7, 9*9 respectively), the image receptive field is different; when the pooling kernel size of the pooling feature extraction method is different (such as 3*3, 5*5, 7*7, 9*9 respectively, the image receptive field is different. When both the convolution feature extraction method and the pooling feature extraction method are used, different kernel sizes can be used for different feature extraction methods.
[0124] like Figure 5As shown, taking the input image of the target to be detected as 512*512*3 (indicates that the image size is 512*512 and the number of channels is 3) as an example, after the data rearrangement processing of the DFR module (network layer), a 256*256*12 data rearrangement image is obtained, and then different feature extraction methods are used to extract feature maps of the data rearrangement image respectively. Taking the use of different convolution feature extraction methods in parallel to extract feature maps of the data rearrangement image as an example, such as group convolution of four different convolution kernels 3*3, 5*5, 7*7, and 9*9, the receptive field is expanded to extract feature information of different scales. Then, the feature map of 48 channels is obtained by splicing in the depth direction through the routing layer to realize the fusion of multi-scale feature information. Among them, the group convolution of convolution kernels of different scales not only reduces the amount of calculation but also can fuse feature information of different scales, thereby enhancing the spatial feature extraction capability of the network.
[0125] For example, taking the target detection algorithm as a single-stage algorithm, when performing target detection on the target detection image, the overall network structure of the target detection network can be as follows: Figure 6 As shown in the figure (the downward arrow in the figure indicates upsampling, and the upward arrow indicates downsampling), the input image to be detected is processed by data rearrangement, feature map extraction and feature map fusion to achieve downsampling while extracting more feature information between different channels in the adjacent area, and then multi-level downsampling and upsampling are performed to perform multi-scale feature fusion to achieve target detection.
[0126] In the above technical solution, the operation of re-arranging data for the target detection image can appear as an operation of the network layer (that is, it can be processed by the core in the many-core system), or as a pre-processing operation before the network layer (that is, it can be processed by the CPU (Central Processing Unit)). When it appears as an operation of the network layer, a feature fusion layer is subsequently added for fusion and parallel computing is performed through the GPU, that is, the pixel data of the target detection image is rearranged and the feature map is extracted through the core in the many-core system, and the processing speed is faster. When it is a pre-processing operation before the network layer, the pixel data is rearranged by the CPU and then sent to the core for feature extraction. The processing speed will be relatively slow, but it can also enhance the expression ability of the image.
[0127] Embodiment 4
[0128] Figure 7 This is a flowchart of a small target detection method provided in Embodiment 4 of the present invention. This embodiment provides a specific implementation method based on the above embodiments.
[0129] Reference Figure 7, the input high-resolution large-size image is adaptively segmented to obtain sub-images to be detected 0_0, sub-images to be detected 0_1, sub-images to be detected 0_2, sub-images to be detected 0_3, and sub-images to be detected Figure 1 _0、Sub-items to be tested Figure 1 _1. The subunit to be tested Figure 1 _2 and the molecules to be detected Figure 1 _3, and perform small target detection on these sub-images to be detected. Figure 7 The left and right adjacent particles to be detected are shown in the example Figure 1 _0 and the subunit to be detected Figure 1 The adaptive segmentation method of the sub-image to be detected can be found in the above embodiment and will not be described in detail here.
[0130] Assume that the detected particle Figure 1 _0 and the subunit to be detected Figure 1 The small target detection results of _1 are divided into two groups, BBox_0 and BBox_1. Each group of BBox may contain multiple target detection frames. Suppose the representation format of the target detection frame is [center_x, center_y, b_w, b_h], where center_x represents the x-coordinate of the center point of the target detection frame, center_y represents the y-coordinate of the center point of the target detection frame, b_w represents the width of the target detection frame, and b_h represents the height of the target detection frame.
[0131] The following is a detailed explanation of the steps of generating a secondary detection image based on adjacent sub-images to be detected:
[0132] (1) Target detection frame coordinate conversion. The target detection frames of two adjacent sub-images to be detected are converted from the representation format [center_x, center_y, b_w, b_h] to [xmin, ymin, xmax, ymax], where xmin represents the minimum value of the target detection frame x coordinate, ymin represents the minimum value of the target detection frame y coordinate, xmax represents the maximum value of the target detection frame x coordinate, and ymax represents the maximum value of the target detection frame y coordinate.
[0133] (2) Sort the target detection frames according to the coordinates. Among them, the left sub-images of the two adjacent sub-images to be detected are sorted by the xmax column to find the rightmost target detection frame bbox_r (that is, one or more target detection frames closest to the adjacent sub-images to be detected), and the right sub-images of the two adjacent sub-images to be detected are sorted by the xmin column to find the leftmost target detection frame bbox_l (that is, one or more target detection frames closest to the adjacent sub-images to be detected).
[0134] If two adjacent sub-images to be detected are two sub-images to be detected that are adjacent to each other up and down, the upper sub-images of the two adjacent sub-images to be detected can be sorted by the ymin column to find the lowermost target detection box bbox_d (that is, one or more target detection boxes closest to the adjacent sub-image to be detected), and the lower sub-images of the two adjacent sub-images to be detected can be sorted by the ymax column to find the uppermost target detection box bbox_u (that is, one or more target detection boxes closest to the adjacent sub-image to be detected).
[0135] (3) Calculate the IOU (Intersection over Union) of the target detection boxes bbox_r and bbox_l. If the calculated IOU is greater than a preset overlap threshold (for example, 0.25), they can be considered to be two repeated target detection boxes of the same object. If it is less than the preset overlap threshold, they are considered to belong to two different objects and no secondary detection is required.
[0136] Perform IOU calculation on the target detection boxes bbox_u and bbox_d. If the calculated overlap IOU is greater than the preset overlap threshold, they can be considered as two repeated target detection boxes of the same object. If it is less than the preset overlap threshold, they are considered to belong to two different objects and no secondary detection is required.
[0137] (4) Generate a secondary detection sub-image based on two adjacent sub-images to be detected. If the IOU of the target detection boxes bbox_r and bbox_l is greater than the preset overlap threshold, or the IOU of the target detection boxes bbox_u and bbox_d is greater than the preset overlap threshold, then generate a secondary detection sub-image based on the two adjacent sub-images to be detected, and perform small target detection on the secondary detection sub-image. The secondary detection sub-image can be an image block obtained by dividing the image with the center point of the joint area of the two adjacent sub-images to be detected as the center and the width and height (net_w, net_h) of the standard input template image of the target detection network as the boundary.
[0138] After obtaining the small target detection results of each sub-image to be detected and each secondary detection sub-image, the target detection frames corresponding to each sub-image to be detected and each secondary detection sub-image are regressed to the high-resolution large-size image, and all target detection frames regressed to the high-resolution large-size image are subjected to NMS deduplication processing, so that the small target detection results of the high-resolution large-size image can be obtained.
[0139] A high-resolution large-size image img (img_w, img_h) is divided into multiple sub-images to be confirmed img_c (c_w, c_h) (where c_w is the image width of the sub-image to be confirmed, and c_h is the image height of the sub-image to be confirmed). All sub-images to be confirmed are filled into the target detection network standard input template image IMG (net_w, net_h) in a way that the center coordinates are aligned to generate multiple sub-images to be detected. Multiple sub-images to be detected can be used as a batch for small target detection to obtain the target detection box information corresponding to each sub-image to be detected, that is, [center_x, center_y, b_w, b_h, score, class_id], where score identifies the confidence of the target detection box, and class_id indicates the category of the target detection box. At this time, the information of the target detection box obtained is relative to the target detection network standard input template image IMG (net_w, net_h). When regressing the target detection frame information to a high-resolution large-size image (original image), only two reference coordinate transformations are required for the center point coordinates (center_x, center_y), and there is no need to process the target detection frame width and height (b_w, b_h), confidence, and category included in the target detection frame information.
[0140] Specifically, the steps of regressing the target detection frames of the sub-image to be detected and the secondary detection sub-image to the high-resolution large-size image (original image) may include:
[0141] (1) Convert the reference coordinate origin of the target detection box information from IMG (0, 0) to the IMG center point (net_w / 2, net_h), that is, convert the target detection box information from [center_x, center_y, b_w, b_h, score, class_id] to [center_x-net_w / 2, center_y-net_h / 2, b_w, b_h, score, class_id].
[0142] (2) Calculate the relative relationship (relation_x, relation_y) between the center point of the sub-image img_c (c_w, c_h) to be confirmed and the origin of the original image img (0,0).
[0143] (3) The center-aligned target detection box information is added with the distance of the center point of the sub-image to be confirmed relative to the origin of the original image coordinates, that is, the target detection box information is converted from [center_x-net_w / 2, center_y-net_h / 2, b_w, b_h, score, class_id] to [center_x-net_w / 2+relation_x, center_y-net_h / 2+relation
[0144] _y,b_w,b_h,score,class_id].
[0145] (4) Perform NMS processing on all regressed target detection frames on the high-resolution large-size image (original image) to avoid multiple detection frames for the same object in the high-resolution large-size image.
[0146] For details not explained in this embodiment, please refer to the aforementioned embodiments and will not be repeated here.
[0147] The above technical solution proposes a method for adaptive segmentation of high-resolution large-size images, which divides the large image into sub-images, reduces the size of the input image of the target detection network, improves the target detection speed and accuracy, and reduces the pressure on hardware equipment. The above technical solution also proposes a method for efficient small target detection for high-resolution large-size images. Combining the adaptive segmentation method of high-resolution large-size images and the improved network structure, the multiple sub-images to be detected obtained by segmentation are detected as a batch, and secondary detection is performed for the case where the target detection frames in adjacent sub-images to be detected have a high degree of overlap, thereby achieving fast and accurate small target detection.
[0148] Embodiment 5
[0149] Figure 8 This is a schematic diagram of the structure of a small target detection device provided in Embodiment 5 of the present invention. This embodiment is applicable to the case of detecting small targets in high-resolution large-size images. The device can be implemented in software and / or hardware and can generally be integrated in electronic devices. Figure 8 As shown, the device includes: a sub-image to be detected determining module 510, a sub-image to be detected target detecting module 520 and a target detection result determining module 530. Among them,
[0150] A to-be-detected sub-image determining module 510 is used to obtain an image to be detected and determine at least one to-be-detected sub-image corresponding to the image to be detected;
[0151] A sub-image to be detected target detection module 520, used to perform small target detection on each of the sub-images to be detected;
[0152] The target detection result determination module 530 is used to determine the target detection result of the image to be detected according to the target detection result of the sub-image to be detected.
[0153] The technical solution of the embodiment of the present invention, when performing small target detection on the image to be detected, first obtains each sub-image to be detected corresponding to the image to be detected, and then performs small target detection on each sub-image to be detected respectively, and then obtains the small target detection result of the image to be detected based on the target detection results of each sub-image to be detected. When the image to be detected is a high-resolution large-size image, the technical problem of performing small target detection on the high-resolution large-size image can be solved, and small target detection is performed on each sub-image to be detected corresponding to the image to be detected to determine the small target detection result of the image to be detected, and the detection accuracy and detection speed when performing small target detection on the high-resolution large-size image can also be improved.
[0154] Furthermore, the above device also includes: a secondary detection module, used to determine a secondary detection sub-image according to every two adjacent sub-images to be detected, and perform small target detection on the secondary detection sub-image;
[0155] Correspondingly, the target detection result determination module 530 is specifically configured to determine the target detection result of the image to be detected according to the target detection results of the sub-image to be detected and the secondary detection sub-image.
[0156] Optionally, the module 510 for determining the sub-image to be detected is used to calculate the size ratio coefficient between the image to be detected and the standard input template image of the target detection network; when the size ratio coefficient meets the segmentation condition, the image to be detected is segmented to determine at least two sub-images to be detected corresponding to the image to be detected; when the size ratio coefficient does not meet the segmentation condition, the image to be detected is processed to determine a sub-image to be detected corresponding to the image to be detected; wherein the size of the sub-image to be detected is the same as the size of the standard input template image of the target detection network.
[0157] Optionally, the module 510 for determining the sub-image to be detected is specifically used to calculate the image width ratio coefficient and the image height ratio coefficient of the image to be detected and the standard input template image of the target detection network, and round up the image width ratio coefficient and the image height ratio coefficient to obtain an image width correction ratio coefficient and an image height correction ratio coefficient, respectively; the larger one of the image width correction ratio coefficient and the image height correction ratio coefficient is used as the size ratio coefficient; if the size ratio coefficient is greater than a preset ratio coefficient threshold, it is determined that the size ratio coefficient meets the segmentation condition; if the size ratio coefficient is less than or equal to the preset ratio coefficient threshold, it is determined that the size ratio coefficient does not meet the segmentation condition.
[0158] Optionally, the module 510 for determining the sub-image to be detected is specifically used to determine the image unit size of the image to be detected according to the image width correction ratio coefficient and the image height correction ratio coefficient, and determine each segmentation center alignment point in the image to be detected according to the image unit size; with each of the segmentation center alignment points as the center, the image to be detected is segmented according to the size of the target detection network standard input template image to obtain at least two sub-images to be confirmed; the at least two sub-images to be confirmed are respectively centered with the target detection network standard input template image to generate at least two sub-images to be detected corresponding to the image to be detected.
[0159] Optionally, the module 510 for determining the sub-image to be detected is specifically used to calculate the coordinate range of each sub-image to be confirmed in the image to be detected based on the size of the template image input according to the target detection network standard and with each of the segmentation center alignment points as the center, to obtain at least two sub-images to be confirmed; and to segment the image to be detected based on the coordinate range of each sub-image to be confirmed in the image to be detected to obtain the at least two sub-images to be confirmed.
[0160] Optionally, the module 510 for determining the sub-image to be detected, when processing the image to be detected and determining a sub-image to be detected corresponding to the image to be detected, is specifically used to reduce the image to be detected according to the size ratio coefficient to obtain a reduced image to be detected; and to center align the reduced image to be detected with the standard input template image of the target detection network to generate a sub-image to be detected corresponding to the image to be detected.
[0161] Optionally, the secondary detection module is specifically configured to determine a secondary detection sub-image according to two adjacent sub-images to be detected if the two adjacent sub-images to be detected meet a repeated detection condition.
[0162] Optionally, the secondary detection module is specifically used to determine that two adjacent sub-images to be detected meet the repeated detection condition if there are two target detection frames whose overlap is greater than a preset overlap threshold in two adjacent sub-images to be detected.
[0163] Optionally, the secondary detection module is specifically used to determine the target area image corresponding to the two adjacent sub-images to be detected in the image to be detected; taking the center point of the target area image as the center, inputting the size of the template image according to the target detection network standard, and cutting out the secondary detection sub-image in the target area image.
[0164] Furthermore, the target detection result determination module 530 is specifically used to restore the target detection frame in the sub-image to be detected and the target detection frame in the secondary detection sub-image to the image to be detected; and to filter the target detection frame in the image to be detected to obtain the target detection result of the image to be detected.
[0165] Optionally, the image to be detected includes the sub-image to be detected and the secondary detection sub-image;
[0166] Correspondingly, the sub-image target detection module 520 to be detected and the secondary detection module are specifically used to adjust the image size and the number of channels of the image to be detected to obtain a data rearrangement image when performing small target detection on the image to be detected; perform feature extraction on the data rearrangement image to determine a target feature map; and determine a target detection result corresponding to the image to be detected based on the target feature map.
[0167] Optionally, the sub-image target detection module 520 to be detected and the secondary detection module are specifically used to extract feature maps of the data rearranged image using different feature extraction methods when performing feature extraction on the data rearranged image to determine the target feature map; wherein different feature extraction methods have different image receptive fields; and the extracted feature maps are fused to obtain a target feature map corresponding to the image to be detected.
[0168] The above-mentioned small target detection device can execute the small target detection method provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the executed small target detection method.
[0169] Embodiment 6
[0170] Fig. 9 This is a hardware structure diagram of an electronic device provided in Embodiment 6 of the present invention. Fig. 9 As shown, the electronic device includes:
[0171] one or more processors 610, Fig. 9 A processor 610 is taken as an example;
[0172] Memory 620.
[0173] The processor 610 and the memory 620 in the electronic device can be connected via a bus or other means. Fig. 9 The example of connecting through bus is taken in the following.
[0174] The memory 620, as a non-transitory computer-readable storage medium, can be used to store software programs and computer executable programs, such as program instructions corresponding to a small target detection method in an embodiment of the present invention, including:
[0175] Acquire an image to be detected, and determine at least one sub-image to be detected corresponding to the image to be detected;
[0176] Performing small target detection on each of the sub-images to be detected;
[0177] The target detection result of the image to be detected is determined according to the target detection result of the sub-image to be detected.
[0178] The processor 610 executes various functional applications and data processing of the chip by running the software program instructions stored in the memory 620, that is, implements a small target detection method in any embodiment of the above method.
[0179] The memory 620 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required by at least one function; the data storage area may store data created according to the use of the chip, etc. In addition, the memory 620 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage devices.
[0180] Embodiment 7
[0181] Embodiment 7 of the present invention further provides a storage medium including computer executable instructions, wherein the computer executable instructions are used to implement a small target detection method when executed by a processor, the method comprising:
[0182] Acquire an image to be detected, and determine at least one sub-image to be detected corresponding to the image to be detected;
[0183] Performing small target detection on each of the sub-images to be detected;
[0184] The target detection result of the image to be detected is determined according to the target detection result of the sub-image to be detected.
[0185] Optionally, when executed by a processor, the computer executable instruction may also be used to implement a technical solution of a small target detection method provided by any embodiment of the present invention.
[0186] Through the above description of the implementation methods, the technicians in the relevant field can clearly understand that the present invention can be implemented by means of software and necessary general hardware, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory (FLASH), hard disk or optical disk, etc., including a number of instructions for the chip to execute the methods described in each embodiment of the present invention.
[0187] It is worth noting that in the above-mentioned embodiment of the small target detection device, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.
[0188] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
Claims
1. A small target detection method, characterized in that: include: Acquire an image to be detected, and determine at least one sub-image to be detected corresponding to the image to be detected; Performing small target detection on each of the sub-images to be detected; Determining the target detection result of the image to be detected according to the target detection result of the sub-image to be detected; Determining at least one sub-image to be detected corresponding to the image to be detected includes: Calculate the size ratio coefficient of the image to be detected and the standard input template image of the target detection network; When the size ratio coefficient meets the segmentation condition, segmenting the image to be detected to determine at least two sub-images to be detected corresponding to the image to be detected; When the size ratio coefficient does not meet the segmentation condition, processing the image to be detected to determine a sub-image to be detected corresponding to the image to be detected; Wherein, the size of the sub-image to be detected is the same as the size of the standard input template image of the target detection network; When the size ratio coefficient does not meet the segmentation condition, the image to be detected is processed to determine a sub-image to be detected corresponding to the image to be detected, including: When the size ratio coefficient does not meet the segmentation condition, the image to be detected is reduced to obtain a sub-image to be detected corresponding to the image to be detected; The size ratio coefficient satisfies the segmentation conditions, including: If the size ratio coefficient is greater than a preset ratio coefficient threshold, determining that the size ratio coefficient meets the segmentation condition; The size ratio coefficient does not meet the segmentation conditions, including: If the size ratio coefficient is less than or equal to the preset ratio coefficient threshold, it is determined that the size ratio coefficient does not meet the segmentation condition.
2. The method according to claim 1, characterized in that Also includes: Determine a secondary detection sub-image according to each two adjacent to-be-detected sub-images, and perform small target detection on the secondary detection sub-image; Wherein, determining the target detection result of the image to be detected according to the target detection result of the sub-image to be detected includes: The object detection result of the image to be detected is determined according to the object detection results of the sub-image to be detected and the secondary detection sub-image.
3. The method according to claim 1, characterized in that Calculating the size ratio coefficient of the image to be detected and the standard input template image of the target detection network includes: Calculating the image width ratio coefficient and the image height ratio coefficient of the image to be detected and the standard input template image of the target detection network, and rounding up the image width ratio coefficient and the image height ratio coefficient to obtain the image width correction ratio coefficient and the image height correction ratio coefficient respectively; The larger one of the image width correction ratio coefficient and the image height correction ratio coefficient is used as the size ratio coefficient.
4. The method according to claim 3, characterized in that Segmenting the image to be detected to determine at least two sub-images to be detected corresponding to the image to be detected, including: Determine the image unit size of the image to be detected according to the image width correction ratio coefficient and the image height correction ratio coefficient, and determine each segmentation center alignment point in the image to be detected according to the image unit size; The width of the image unit size refers to the quotient of the image width of the image to be detected and the image width correction ratio coefficient, and the height of the image unit size refers to the quotient of the image height of the image to be detected and the image height correction ratio coefficient; the segmentation center alignment point refers to the center point of each segmented image area obtained when the image to be detected is segmented according to the image unit size; Taking each of the segmentation center alignment points as the center, inputting the size of the template image according to the target detection network standard, segmenting the image to be detected to obtain at least two sub-images to be confirmed; The at least two sub-images to be confirmed are respectively aligned with the center of the target detection network standard input template image to generate at least two sub-images to be detected corresponding to the image to be detected.
5. The method according to claim 4, characterized in that Taking each of the segmentation center alignment points as the center, inputting the size of the template image according to the target detection network standard, segmenting the image to be detected to obtain at least two sub-images to be confirmed, including: Taking each of the segmentation center alignment points as the center and inputting the size of the template image according to the target detection network standard, respectively calculating the coordinate range of each of the sub-images to be confirmed in the image to be detected; The image to be detected is segmented according to the coordinate range of each of the sub-images to be confirmed in the image to be detected to obtain the at least two sub-images to be confirmed.
6. The method according to claim 3, characterized in that Processing the image to be detected to determine a sub-image to be detected corresponding to the image to be detected, including: Performing a reduction process on the image to be detected according to the size ratio coefficient to obtain a reduced image to be detected; The reduced image to be detected is aligned with the standard input template image of the target detection network to generate a sub-image to be detected corresponding to the image to be detected.
7. The method according to claim 2, characterized in that Determining a secondary detection sub-graph according to each two adjacent sub-graphs to be detected includes: If two adjacent sub-images to be detected satisfy the repeated detection condition, a secondary detection sub-image is determined according to the two adjacent sub-images to be detected.
8. The method according to claim 7, characterized in that Two adjacent sub-graphs to be detected meet the repeated detection conditions, including: If there are two target detection frames in two adjacent sub-images to be detected whose overlap is greater than a preset overlap threshold, it is determined that the two adjacent sub-images to be detected meet the repeated detection condition.
9. The method according to claim 7, characterized in that: Determining a secondary detection sub-image according to the two adjacent sub-images to be detected includes: Determining, in the image to be detected, a target area image corresponding to the two adjacent sub-images to be detected; Taking the center point of the target area image as the center and inputting the size of the template image according to the target detection network standard, the secondary detection sub-image is cut out in the target area image.
10. The method according to claim 2, characterized in that Determining the target detection result of the image to be detected according to the target detection results of the sub-image to be detected and the secondary detection sub-image includes: Restoring the target detection frame in the sub-image to be detected and the target detection frame in the secondary detection sub-image to the image to be detected; The target detection frame in the image to be detected is screened to obtain a target detection result of the image to be detected.
11. The method according to any one of claims 2 to 10, characterized in that: The target detection image includes the sub-image to be detected and the secondary detection sub-image; Performing small target detection on the target detection image includes: Adjusting the image size and the number of channels of the target detection image to obtain a data rearrangement image; Performing feature extraction on the data rearrangement image to determine a target feature map; According to the target feature map, a target detection result corresponding to the image to be detected is determined.
12. The method according to claim 11, characterized in that Extracting features from the data rearrangement image to determine a target feature map includes: Using different feature extraction methods to extract feature maps of the data rearrangement image respectively; wherein the image receptive fields of different feature extraction methods are different; The extracted feature maps are fused to obtain a target feature map corresponding to the target detection image.
13. A small target detection device, characterized in that: include: A to-be-detected sub-image determining module, used to obtain an to-be-detected image and determine at least one to-be-detected sub-image corresponding to the to-be-detected image; A sub-image to be detected target detection module, used to perform small target detection on each of the sub-images to be detected; An object detection result determination module is used to determine the object detection result of the image to be detected according to the object detection result of the sub-image to be detected; The to-be-detected sub-image determination module is specifically used to calculate the size ratio coefficient between the to-be-detected image and the target detection network standard input template image; When the size ratio coefficient meets the segmentation condition, the image to be detected is segmented to determine at least two sub-images to be detected corresponding to the image to be detected; when the size ratio coefficient does not meet the segmentation condition, the image to be detected is reduced to obtain a sub-image to be detected corresponding to the image to be detected; wherein the size of the sub-image to be detected is the same as the size of the standard input template image of the target detection network; The size ratio coefficient satisfies the segmentation conditions, including: If the size ratio coefficient is greater than a preset ratio coefficient threshold, determining that the size ratio coefficient meets the segmentation condition; The size ratio coefficient does not meet the segmentation conditions, including: If the size ratio coefficient is less than or equal to the preset ratio coefficient threshold, it is determined that the size ratio coefficient does not meet the segmentation condition.
14. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 12 is implemented.
15. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 12 is implemented.
