Image cutting method, image cutting device and storage medium based on target detection

By obtaining the position and size information of the target box, selecting the map cutting strategy based on the pixel jump situation, and combining with the deep learning model to evaluate the effect, the problems of information retention and redundancy reduction in image cutting processing are solved, and efficient image cutting and Model performance improves.

CN112927247BActive Publication Date: 2024-12-03CHANGZHOU MICROINTELLIGENCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110248957.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-03-08
Publication Date
2024-12-03
Estimated Expiration
2041-03-08

AI Technical Summary

Technical Problem

In deep algorithm learning based on object detection, image cutting processing requires reasonable cutting to meet the needs of various algorithms, and it is necessary to retain effective information to the greatest extent and reduce redundancy, which is difficult to effectively implement in the prior art.

Method used

By obtaining the position information and size of the target box, judging its distribution rules, and selecting a map cutting strategy based on the pixel jump situation, such as sliding window method, special position cutting, cluster cutting or edge cutting, and evaluation with deep learning model Graph cutting effect, select negative samples for area extraction and graph cutting.

Benefits of technology

Automatic graph cutting is realized, effective information is retained to the greatest extent, redundancy is reduced, the learning effect of the model and algorithm performance are improved, and a solid foundation is provided for subsequent operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112927247B_ABST
    Figure CN112927247B_ABST
Patent Text Reader

Abstract

The present invention provides a cutting method, cutting device and storage medium based on target detection, the method comprising: obtaining the position information and size of the target frame in the detection image to determine the distribution law of the target frame; determining the distribution of the target in the detection image; selecting a cutting strategy according to the distribution law of the target frame and the distribution of the target in the detection image, and cutting the image according to the cutting strategy; inputting the cut image into a deep learning model for training to determine the cutting effect; selecting the Negative chips cutting image containing difficult negative samples according to the cutting effect, extracting the negative samples in the region, and cutting the image according to the extracted region. The method can select a suitable cutting strategy for automatic cutting of the image by analyzing the target and the position, size and distribution, and further evaluates the cutting effect in combination with the subsequent deep learning model performance, thereby ensuring the cutting effect and laying a foundation for subsequent practical operations.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular to a method for cutting a picture based on target detection, a device for cutting a picture based on target detection, and a non-temporary computer-readable storage medium. Background Art

[0002] In the learning and detection of deep algorithms based on target detection, it is generally necessary to cut the image data to meet the requirements of various algorithms or machine memory requirements, such as 32 multiples in yolo, such as cutting into 512*512, 256*256 and other image sizes. Reasonable cutting of images to ensure accurate learning of all targets without adding additional offset information, making model learning more effective, is of great significance to the performance of the algorithm.

[0003] Therefore, how to effectively slice images, retain and enhance effective information to the greatest extent, and reduce unnecessary redundancy needs has become a technical problem that needs to be urgently solved by technical personnel in this field. Summary of the invention

[0004] In order to solve the above technical problems, the present invention proposes a cutting method based on target detection. This method can select a suitable cutting strategy for automatic cutting by analyzing the target and its position, size, and distribution. At the same time, it further evaluates the cutting effect in combination with the subsequent deep learning model performance, thereby ensuring the cutting effect and laying the foundation for subsequent practical operations.

[0005] The present invention also proposes a picture cutting device based on target detection.

[0006] The present invention also provides a non-transitory computer-readable storage medium.

[0007] The technical solution adopted by the present invention is as follows:

[0008] The first aspect of the present invention proposes a method for cutting images based on target detection, comprising the following steps: obtaining position information and size of a target box in a detection image, and judging the distribution law of the target box according to the position information and size of the target box; counting non-black and non-white areas and pixel jumps in the detection image, and judging the distribution of the target in the detection image according to the non-black and non-white areas and pixel jumps; selecting a cutting strategy according to the distribution law of the target box and the distribution of the target in the detection image, and cutting the image according to the cutting strategy, wherein the cutting strategy includes: a sliding window cutting strategy, a special position cutting strategy, a clustering cutting strategy, and an edge-based cutting strategy; inputting the cut image into a deep learning model for training to judge the cutting effect; selecting Negative chips cutting images containing difficult negative samples according to the cutting effect, performing region extraction on the negative samples, and cutting the image according to the extracted region.

[0009] According to an embodiment of the present invention, the method further includes: obtaining changes in the distribution pattern of the target frame of the cut image and changes in the size of the target frame; inputting the cut image into a single-stage target detection model or a two-stage target detection model to obtain an algorithm performance of the cut image, wherein the algorithm performance includes: an overkill rate of a target, a missed detection rate of a target, an accuracy rate of a target, a confusion matrix of a target, a category AP (average precision) value, and an overall mAP (meanAverage Precision) value; and correcting the cut image strategy according to changes in the distribution pattern of the target frame, changes in the size of the target frame, and the algorithm performance.

[0010] According to one embodiment of the present invention, the single-stage target detection model includes: YOLOv5 model, SSD (Single Shot MultiBox Detector) model, and the two-stage target detection model includes: Faster R-CNN (Region Convolutional Neural Networks, based on convolutional neural network), Cascade R-CNN, HTC (Hybrid Task Cascade).

[0011] According to an embodiment of the present invention, according to the image cutting effect, the Negative chips image cutting containing difficult negative samples is selected based on the SNIPER algorithm.

[0012] According to one embodiment of the present invention, a cutting strategy is selected according to the distribution law of the target frame and the distribution of the target in the detection image, including: if the target frame distribution is balanced and the detection image contains all the information of the target, a window cutting strategy is adopted for cutting; if the target frame distribution is balanced and the detection image contains partial information of the target, a special position cutting strategy is adopted; if the target frame distribution is uneven and the detection image contains all the information of the target, an edge-based cutting strategy is adopted; if the target frame distribution is uneven and the detection image contains partial information of the target, a clustering cutting strategy is adopted.

[0013] The second aspect of the present invention proposes a target detection-based image cutting device, including: an acquisition module, the acquisition module is used to obtain the position information and size of the target box in the detection image, and judge the distribution law of the target box according to the position information and size of the target box; a statistical module, the statistical module is used to count the non-black and non-white areas and pixel jumps in the detection image, and judge the distribution of the target in the detection image according to the non-black and non-white areas and pixel jumps; a first image cutting module, the first image cutting module is used to select the image cutting strategy according to the distribution law of the target box and the distribution of the target in the detection image, and cut the image according to the image cutting strategy, wherein the image cutting strategy includes: a sliding window image cutting strategy, a special position image cutting strategy, a clustering image cutting strategy and an edge-based image cutting strategy; a learning module, the learning module is used to input the image after cutting into a deep learning model for training to determine the image cutting effect; a second image cutting module, the second image cutting module is used to select the Negative chips image cutting containing difficult negative samples according to the image cutting effect, extract the region of the negative sample, and cut the image according to the extracted region.

[0014] According to one embodiment of the present invention, the above-mentioned image cutting device also includes a correction module, which is used to: obtain the changes in the distribution law of the target box of the image after cutting and the changes in the size of the target box; input the image after cutting into a single-stage target detection model or a two-stage target detection model to obtain the algorithm performance of the image after cutting, and the algorithm performance includes: the over-kill rate of the target, the missed detection rate of the target, the accuracy of the target, the confusion matrix of the target, the category AP value and the overall mAP value; correct the image cutting strategy according to the changes in the distribution law of the target box, the changes in the size of the target box and the algorithm performance.

[0015] According to an embodiment of the present invention, the second image cutting module is specifically used to: select Negative chips image cutting containing difficult negative samples based on the SNIPER algorithm according to the image cutting effect.

[0016] According to one embodiment of the present invention, the first cutting module is specifically used for: if the target frame distribution is balanced and the detection image contains all the information of the target, then adopting the window cutting strategy for cutting; if the target frame distribution is balanced and the detection image contains partial information of the target, then adopting the special position cutting strategy; if the target frame distribution is uneven and the detection image contains all the information of the target, then adopting the edge-based cutting strategy; if the target frame distribution is uneven and the detection image contains partial information of the target, then adopting the clustering cutting strategy.

[0017] The third aspect of the present invention provides a non-temporary computer-readable storage medium having a computer program stored thereon. When the program is executed by a processor, the image cutting method based on target detection described in the first aspect of the present invention is implemented.

[0018] Beneficial effects of the present invention:

[0019] The present invention can select a suitable cutting strategy for automatic cutting by analyzing the target and its position, size, and distribution. It can also further evaluate the cutting effect in combination with the subsequent deep learning model performance, thereby ensuring the cutting effect and laying the foundation for subsequent practical operations. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 is a flow chart of a method for cutting a picture based on target detection according to an embodiment of the present invention;

[0021] Figure 2 is a flowchart of a method for cutting images based on target detection according to another embodiment of the present invention;

[0022] Figure 3 4 is a block diagram of a device for cutting images based on target detection according to an embodiment of the present invention. DETAILED DESCRIPTION

[0023] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0024] Figure 1 is a flow chart of a method for cutting a picture based on target detection according to an embodiment of the present invention, the method comprising the following steps:

[0025] S1, obtain the position information and size of the target frame in the detection image, and determine the distribution pattern of the target frame according to the position information and size of the target frame.

[0026] Specifically, the target detection image has a target box to mark the target. For example, defects in industrial quality inspection images are marked in the form of target boxes. The distribution pattern of the target box can be determined based on the location information and size of the target box. For example, if the target box is distributed in every area of ​​the whole image, and the size and number of the targets distributed in each area are similar, it can be determined that the target box is evenly distributed in the whole image, or if the target box is only distributed in some areas, it can be determined that the target is unevenly distributed in the whole image.

[0027] S2, counting the non-black and non-white areas and pixel jumps in the detection image, and judging the distribution of the target in the detection image according to the non-black and non-white areas and pixel jumps.

[0028] Specifically, the edge of the workpiece can be determined based on the non-black and non-white areas and pixel jumps in the image, and the distribution of the target in the detection image can be determined based on the edge, including whether the workpiece occupies the entire image.

[0029] S3, selecting a cutting strategy according to the distribution law of the target box and the distribution of the target in the detection image, and cutting the image according to the cutting strategy, wherein the cutting strategy includes: sliding window cutting strategy, special position cutting strategy, clustering cutting strategy and edge-based cutting strategy.

[0030] Further, according to an embodiment of the present invention, a cutting strategy is selected according to the distribution law of the target box and the distribution of the target in the detection image, including: if the target box distribution is balanced and the detection image contains all the information of the target, a window cutting strategy is adopted for cutting; if the target box distribution is balanced and the detection image contains partial information of the target, a special position cutting strategy is adopted; if the target box distribution is uneven and the detection image contains all the information of the target, an edge-based cutting strategy is adopted; if the target box distribution is uneven and the detection image contains partial information of the target, a clustering cutting strategy is adopted.

[0031] S4, inputting the sliced ​​image into the deep learning model for training to determine the sliced ​​image effect.

[0032] The deep learning model can be a neural network model, and the deep learning module can be trained in advance according to actual needs.

[0033] S5: Select the Negative chips containing difficult negative samples according to the cutting effect, extract the region of the negative samples, and cut the image according to the extracted region.

[0034] Among them, in one embodiment of the present invention, according to the image cutting effect, the negative chips (negative fragments) containing difficult negative samples are selected based on the SNIPER (ScaleNormalization for Image Pyramids with Efficient Resampling, a multi-scale training algorithm) algorithm. The SNIPER algorithm selects the negative chips containing difficult negative samples, which is a prior art and will not be described in detail in the present invention.

[0035] Specifically, the distribution law of the target frame is first determined according to the position information and size of the target frame, then the non-black and non-white areas and pixel jumps in the detection image are counted, and the distribution of the target in the detection image is determined according to the non-black and non-white areas and pixel jumps, and then the cutting strategy is selected according to the distribution law of the target frame and the distribution of the target in the detection image, and the image is cut according to the cutting strategy, wherein, if the target frame distribution is balanced and the detection image contains all the information of the target, the window cutting strategy is adopted for cutting; if the target frame distribution is balanced and the detection image contains partial information of the target, the special position cutting strategy is adopted; if the target frame distribution is uneven and the detection image contains all the information of the target, the edge-based cutting strategy is adopted; if the target frame distribution is uneven and the detection image contains partial information of the target, the clustering cutting strategy is adopted.

[0036] The image is sliced ​​according to the selected slice strategy, and the sliced ​​image is input into the deep learning model for training, and the slice effect is judged. Then, according to the slice effect, the Negative chips containing difficult negative samples are selected for slice, and the difficult negative samples are screened. Through fine slice, the original image is extracted and replaced, which further improves the model performance and optimization efficiency. Therefore, this method can select a suitable slice strategy for automatic slice by considering the target and its position, size, and distribution, and further evaluate the slice effect in combination with the subsequent deep learning model performance, which ensures the slice effect and lays the foundation for subsequent practical operations.

[0037] In the present invention, for the sliding window image cutting strategy, firstly, the image is cut from left to right and from top to bottom according to the preset image cutting size and filling position. Here, we also implement the judgment of the edge to ensure the size consistency; in addition, the image can be filled according to the needs, and the filling methods include mean and edge filling.

[0038] The special position cutting strategy is applicable to the situation where the main target is unevenly distributed. Specific scenarios include: in the center or bottom of the picture, or horizontal distribution, the rest is all black or all white, which does not provide effective information for model learning, so there is no need for cutting. Therefore, the special position cutting strategy realizes targeted cutting of target objects in special positions.

[0039] For the clustering cutting strategy, this strategy first counts the position, size, and aspect ratio of the target box, and clusters the target box, i.e., the defects, based on the characteristic distribution of the data using the K-Means (clustering algorithm based on Euclidean distance) and spectral clustering methods in machine learning.

[0040] For edge-based image cutting strategy, this strategy is designed for irregularly distributed images or images with variable shooting angles to enhance the effectiveness of image cutting. First, the corresponding edge is identified based on pixel transformation and edge judgment, and then the corresponding image cutting is implemented based on the edge. You can also choose whether to keep the target in the middle as needed.

[0041] According to one embodiment of the present invention, Figure 2 As shown, the above-mentioned image cutting method based on target detection also includes:

[0042] S31, obtaining a distribution pattern change and a size change of a target frame of the image after the image is cut.

[0043] S32, input the sliced ​​image into a single-stage target detection model or a two-stage target detection model to obtain the algorithm performance of the sliced ​​image, the algorithm performance including: target overkill rate, target missed detection rate, target accuracy, target confusion matrix, category AP value and overall mAP value, etc.

[0044] The single-stage target detection models include: YOLOv5 model, SSD model, and the two-stage target detection models include: Faster R-CNN, Cascade R-CNN, and HTC.

[0045] S33, modifying the image cutting strategy according to the change of the distribution pattern of the target box, the change of the size of the target box and the algorithm performance.

[0046] Specifically, before inputting the sliced ​​images into the deep learning model for training, the sliced ​​images can be input into a simple target detection model (for example, a single-stage model that runs fast and can guarantee a certain accuracy) for pre-screening, and unnecessary samples can be filtered out to improve the effect of subsequent deep learning.

[0047] To this end, in the present invention, after selecting a cutting strategy according to the distribution law of the target frame and the distribution of the target in the detection image, and cutting the image according to the cutting strategy, the distribution law change of the target frame of the image after cutting and the size change of the target frame are obtained, and the cutting strategy is corrected according to the distribution law change of the target frame and the size change of the target frame. For example, for the case where the image is too large and the target is too small, such as images of 5000*5000 pixels or more and targets of 50*50 pixels, if the background is not complicated, it can be considered to use clustering cutting after window cutting, aggregate and screenshot the adjacent targets to enhance the model performance. In addition, the cut image is input into the machine learning model to obtain the overkill rate, missed detection rate, accuracy rate, and confusion matrix of the target, and the cutting strategy is corrected according to the overkill rate, missed detection rate, accuracy rate, and confusion matrix. For example, if the overkill rate is high, the missed detection rate is high, the accuracy rate is low, or the accuracy rate of the confusion matrix is ​​low, the cutting strategy is corrected. At the same time, the image can also be processed according to the algorithm performance of the image after cutting, such as background filling.

[0048] As a result, innovative image cutting strategies are implemented for different situations, unnecessary samples are filtered, and situations where there is no target frame after cutting are judged and screened out. At the same time, the image situation can be filled and processed.

[0049] According to the target detection-based image cutting method of the embodiment of the present invention, the position information and size of the target frame in the detection image are obtained, and the distribution law of the target frame is judged according to the position information and size of the target frame, the non-black and non-white areas and pixel jumps in the detection image are statistically detected, and the distribution of the target in the detection image is judged according to the non-black and non-white areas and pixel jumps, and the image cutting strategy is selected according to the distribution law of the target frame and the distribution of the target in the detection image, and the image is cut according to the image cutting strategy, wherein the image cutting strategy includes: sliding window image cutting strategy, special position image cutting strategy, clustering image cutting strategy and edge-based image cutting strategy, the image after image cutting is input into the deep learning model for training to judge the image cutting effect, and the negative chips image cutting containing difficult negative samples is selected according to the image cutting effect, and the negative samples are extracted from the region, and the image is cut according to the extracted region. Therefore, the method can select a suitable image cutting strategy for automatic image cutting by the target and the position, size, and distribution, and further evaluate the image cutting effect in combination with the subsequent deep learning model performance, thereby ensuring the image cutting effect and laying a foundation for subsequent practical operations.

[0050] Corresponding to the above-mentioned image cutting method based on target detection, the present invention also proposes an image cutting device based on target detection. Since the device embodiment of the present invention corresponds to the above-mentioned method embodiment, the details not disclosed in the device embodiment can be referred to the above-mentioned method embodiment, and will not be repeated in the present invention.

[0051] Figure 3 FIG. 1 is a block diagram of a device for cutting a picture based on target detection according to an embodiment of the present invention. Figure 3 As shown, the device includes: an acquisition module 1, a statistical module 2, a first image cutting module 3, a learning module 4, and a second image cutting module 5.

[0052] Among them, the acquisition module 1 is used to obtain the position information and size of the target frame in the detection image, and judge the distribution law of the target frame according to the position information and size of the target frame; the statistical module 2 is used to count the non-black and non-white areas and pixel jumps in the detection image, and judge the distribution of the target in the detection image according to the non-black and non-white areas and pixel jumps; the first cutting module 3 is used to select the cutting strategy according to the distribution law of the target frame and the distribution of the target in the detection image, and cut the image according to the cutting strategy, wherein the cutting strategy includes: sliding window cutting strategy, special position cutting strategy, clustering cutting strategy and edge-based cutting strategy; the learning module 4 is used to input the cut image into the deep learning model for training to judge the cutting effect; the second cutting module 5 is used to select the Negative chips cutting containing difficult negative samples according to the cutting effect, extract the negative samples, and cut the image according to the extracted area.

[0053] According to one embodiment of the present invention, the above-mentioned target detection-based image cutting device also includes a correction module, which is used to: obtain changes in the distribution pattern of the target box and the size of the target box of the image after cutting; input the image after cutting into a single-stage target detection model or a two-stage target detection model to obtain the algorithm performance of the image after cutting, and the algorithm performance includes: the over-kill rate of the target, the missed detection rate of the target, the accuracy of the target, the confusion matrix of the target, the category AP value and the overall mAP value, etc.; correct the image cutting strategy according to the changes in the distribution pattern of the target box, the size change of the target box and the algorithm performance.

[0054] The single-stage target detection models include: YOLOv5 model, SSD model, and the two-stage target detection models include: Faster R-CNN, Cascade R-CNN, and HTC.

[0055] According to an embodiment of the present invention, the second image cutting module 5 is specifically used to: select Negative chips image cutting containing difficult negative samples based on the SNIPER algorithm according to the image cutting effect.

[0056] According to one embodiment of the present invention, the first cutting module 3 is specifically used for: if the target frame distribution is balanced and the detection image contains all the information of the target, a window cutting strategy is adopted for cutting; if the target frame distribution is balanced and the detection image contains partial information of the target, a special position cutting strategy is adopted; if the target frame distribution is uneven and the detection image contains all the information of the target, an edge-based cutting strategy is adopted; if the target frame distribution is uneven and the detection image contains partial information of the target, a clustering cutting strategy is adopted.

[0057] According to the target detection-based image cutting device of an embodiment of the present invention, the acquisition module acquires the position information and size of the target frame in the detection image, and determines the distribution law of the target frame according to the position information and size of the target frame. The statistical module counts the non-black and non-white areas and pixel jumps in the detection image, and determines the distribution of the target in the detection image according to the non-black and non-white areas and pixel jumps. The first image cutting module selects an image cutting strategy according to the distribution law of the target frame and the distribution of the target in the detection image, and performs image cutting according to the image cutting strategy, wherein the image cutting strategy includes: a sliding window image cutting strategy, a special position image cutting strategy, a clustering image cutting strategy, and an edge-based image cutting strategy. The learning module inputs the image after image cutting into a deep learning model for training to determine the image cutting effect. The second image cutting module selects Negative chips that contain difficult negative samples according to the image cutting effect, extracts regions for the negative samples, and performs image cutting according to the extracted regions. Therefore, the device can select the appropriate cutting strategy for automatic cutting by analyzing the target and its position, size, and distribution. At the same time, it can further evaluate the cutting effect in combination with the subsequent deep learning model performance, thereby ensuring the cutting effect and laying the foundation for subsequent practical operations.

[0058] In addition, the present invention also proposes a non-temporary computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the above-mentioned image cutting method based on target detection is implemented.

[0059] According to the non-temporary computer-readable storage medium of the embodiment of the present invention, when the computer program stored in the processor is executed, the position information and size of the target frame in the detection image are obtained, and the distribution law of the target frame is determined according to the position information and size of the target frame, the non-black and non-white areas and pixel jumps in the detection image are counted, and the distribution of the target in the detection image is determined according to the non-black and non-white areas and pixel jumps, and the image cutting strategy is selected according to the distribution law of the target frame and the distribution of the target in the detection image, and the image is cut according to the image cutting strategy, wherein the image cutting strategy includes: sliding window image cutting strategy, special position image cutting strategy, clustering image cutting strategy and edge-based image cutting strategy, the image after image cutting is input into the deep learning model for training to determine the image cutting effect, and the negative chips containing difficult negative samples are selected according to the image cutting effect, and the negative samples are extracted from the region, and the image is cut according to the extracted region. Therefore, by determining the target and the position, size, and distribution, a suitable image cutting strategy can be selected for automatic image cutting, and the image cutting effect can be further evaluated in combination with the subsequent deep learning model performance, so as to ensure the image cutting effect and lay a foundation for subsequent actual operation.

[0060] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.

[0061] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of the present invention, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.

[0062] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code comprising one or more executable instructions for implementing the steps of a custom logical function or process, and the scope of the preferred embodiments of the present invention includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of the present invention belong.

[0063] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purpose of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or processing in other suitable ways if necessary, and then stored in a computer memory.

[0064] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, a plurality of steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0065] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.

[0066] In addition, each functional unit in each embodiment of the present invention may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.

[0067] The storage medium mentioned above may be a read-only memory, a magnetic disk or an optical disk, etc. Although the embodiments of the present invention have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limiting the present invention. A person of ordinary skill in the art may change, modify, replace and modify the above embodiments within the scope of the present invention.

Claims

1. A method for cutting images based on target detection, characterized in that: The following steps are involved: Obtaining the position information and size of the target frame in the detection image, and determining the distribution pattern of the target frame according to the position information and size of the target frame; Counting the non-black and non-white areas and pixel jumps in the detection image, and judging the distribution of the target in the detection image according to the non-black and non-white areas and pixel jumps; Selecting a cutting strategy according to the distribution law of the target frame and the distribution of the target in the detection image, and performing cutting according to the cutting strategy, wherein the cutting strategy includes: a sliding window cutting strategy, a special position cutting strategy, a clustering cutting strategy and an edge-based cutting strategy; Inputting the cut image into a deep learning model for training to determine the effect of the cut image; Selecting a Negative chips slice containing a difficult negative sample according to the slice effect, performing region extraction on the negative sample, and performing slice according to the extracted region; Selecting a cutting strategy according to the distribution law of the target frame and the distribution of the target in the detection image includes: If the target frames are evenly distributed and the detected image contains all the information of the target, a window cutting strategy is used for cutting the image; If the target frames are evenly distributed and the detected image contains partial information of the target, a special position cutting strategy is adopted; If the target frame is unevenly distributed and the detection image contains all the information of the target, an edge-based cutting strategy is adopted; If the target frame distribution is uneven and the detection image contains partial information of the target, a clustering and cutting strategy is adopted.

2. The target detection-based image cutting method according to claim 1, characterized in that: Also includes: Obtaining a change in distribution pattern of a target frame of the cut picture and a change in size of the target frame; Input the sliced ​​image into a single-stage target detection model or a two-stage target detection model to obtain algorithm performance of the sliced ​​image, wherein the algorithm performance includes: target overkill rate, target missed detection rate, target accuracy, target confusion matrix, category AP value and overall mAP value; The image cutting strategy is modified according to the change of the distribution pattern of the target frame, the change of the size of the target frame and the performance of the algorithm.

3. The target detection-based image cutting method according to claim 2, characterized in that: The single-stage target detection model includes: YOLOv5 model, SSD model, and the two-stage target detection model includes: Faster R-CNN, CascadeR-CNN, HTC.

4. The target detection-based image cutting method according to claim 1, characterized in that: According to the image cutting effect, the Negative chips image cutting containing difficult negative samples is selected based on the SNIPER algorithm.

5. A picture cutting device based on target detection, characterized in that: include: An acquisition module, the acquisition module is used to acquire the position information and size of the target frame in the detection image, and determine the distribution law of the target frame according to the position information and size of the target frame; A statistical module, the statistical module is used to count the non-black and non-white areas and pixel jumps in the detection image, and determine the distribution of the target in the detection image according to the non-black and non-white areas and pixel jumps; A first cutting module, wherein the first cutting module is used to select a cutting strategy according to the distribution law of the target frame and the distribution of the target in the detection image, and cut the image according to the cutting strategy, wherein the cutting strategy includes: a sliding window cutting strategy, a special position cutting strategy, a clustering cutting strategy and an edge-based cutting strategy; A learning module, wherein the learning module is used to input the cut picture into a deep learning model for training to determine the cut effect; A second image cutting module, the second image cutting module is used to select a Negative chips image cutting containing a difficult negative sample according to the image cutting effect, perform region extraction on the negative sample, and perform image cutting according to the extracted region; The first image cutting module is specifically used for: If the target frames are evenly distributed and the detected image contains all the information of the target, a window cutting strategy is used for cutting the image; If the target frames are evenly distributed and the detected image contains partial information of the target, a special position cutting strategy is adopted; If the target frame is unevenly distributed and the detection image contains all the information of the target, an edge-based cutting strategy is adopted; If the target frame distribution is uneven and the detection image contains partial information of the target, a clustering and cutting strategy is adopted.

6. The target detection-based image cutting device according to claim 5, characterized in that: It also includes a correction module, the correction module is used to: Obtaining a change in distribution pattern of a target frame of the cut picture and a change in size of the target frame; Input the sliced ​​image into a single-stage target detection model or a two-stage target detection model to obtain algorithm performance of the sliced ​​image, wherein the algorithm performance includes: target overkill rate, target missed detection rate, target accuracy, target confusion matrix, category AP value and overall mAP value; The image cutting strategy is modified according to the change of the distribution pattern of the target frame, the change of the size of the target frame and the performance of the algorithm.

7. The target detection-based image cutting device according to claim 5, characterized in that: The second image cutting module is specifically used for: According to the image cutting effect, the Negative chips image cutting containing difficult negative samples is selected based on the SNIPER algorithm.

8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the image cutting method based on target detection according to any one of claims 1 to 4 is implemented.