CN118351490B - Image detection method, device and storage medium - Google Patents
Image detection method, device and storage medium Download PDFInfo
- Publication number
- CN118351490B CN118351490B CN202410772882.7A CN202410772882A CN118351490B CN 118351490 B CN118351490 B CN 118351490B CN 202410772882 A CN202410772882 A CN 202410772882A CN 118351490 B CN118351490 B CN 118351490B
- Authority
- CN
- China
- Prior art keywords
- image
- target
- network
- detected
- foreground
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000001514 detection method Methods 0.000 title claims abstract description 89
- 238000000354 decomposition reaction Methods 0.000 claims abstract description 85
- 238000012549 training Methods 0.000 claims description 134
- 238000007689 inspection Methods 0.000 claims description 57
- 238000000605 extraction Methods 0.000 claims description 17
- 238000010586 diagram Methods 0.000 claims description 12
- 238000004590 computer program Methods 0.000 claims description 11
- 238000000034 method Methods 0.000 abstract description 13
- 230000006870 function Effects 0.000 description 10
- 230000005540 biological transmission Effects 0.000 description 6
- 238000013135 deep learning Methods 0.000 description 6
- 230000008901 benefit Effects 0.000 description 4
- 238000004364 calculation method Methods 0.000 description 4
- 238000012545 processing Methods 0.000 description 4
- 238000004458 analytical method Methods 0.000 description 2
- 238000004891 communication Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 238000004519 manufacturing process Methods 0.000 description 2
- 238000007781 pre-processing Methods 0.000 description 2
- 239000000243 solution Substances 0.000 description 2
- 108010001267 Protein Subunits Proteins 0.000 description 1
- 238000004422 calculation algorithm Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000004927 fusion Effects 0.000 description 1
- 238000002347 injection Methods 0.000 description 1
- 239000007924 injection Substances 0.000 description 1
- 238000002372 labelling Methods 0.000 description 1
- 238000010295 mobile communication Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Landscapes
- Image Analysis (AREA)
Abstract
The application relates to an image detection method, an image detection device and a storage medium, wherein the image detection method comprises the following steps: the method comprises the steps of obtaining an image to be detected, inputting the image to be detected into a target decomposition network to obtain a layered target image output by the target decomposition network, wherein the layered target image comprises a foreground image and a background image decomposed by the image to be detected, inputting the layered target image into a target number prediction network to obtain a target number prediction graph output by the target number prediction network, determining the number of overlapped foreground targets in the layered target image according to the target number prediction graph, and determining the layered target image as a detection result image under the condition that the number of the overlapped foreground targets is less than or equal to 1.
Description
Technical Field
The present application relates to the field of image processing, and in particular, to an image detection method, apparatus, and storage medium.
Background
With the increasing travel demands in modern life, security inspection of various places, articles, and the like is often required in more and more scenes. For example, in airports, railway stations, subway stations, large-scale venues, etc., it is often necessary to secure baggage packages for carrying. The security inspection of these sites is very labor intensive and requires high efficiency and accuracy, which can produce a large number of X-ray security inspection images to be processed. Target detection for an X-ray security inspection image is an important research technology in the current security inspection field, and various potential threat object targets in the X-ray security inspection image are accurately identified through analysis of the X-ray security inspection image. However, multiple article objects in a baggage package tend to overlap to a high degree, thereby shielding each other, and easily causing problems of false detection and missed detection of the objects. Therefore, there is a need for an image detection method for accurately detecting and distinguishing overlapping targets in an X-ray security inspection image.
At present, no effective solution has been proposed for the problem of how to detect and distinguish overlapping objects in images in the related art.
Disclosure of Invention
The embodiment of the application provides an image detection method, an image detection device and a storage medium, which at least solve the problem of how to accurately detect and distinguish overlapping targets in images in the related art.
In a first aspect, an embodiment of the present application provides an image detection method.
In some of these embodiments, the image detection method includes:
executing an image to be detected, wherein the image to be detected is obtained by the steps of obtaining the image to be detected;
inputting the image to be detected into a target decomposition network to obtain a layered target image output by the target decomposition network, wherein the layered target image comprises a foreground image and a background image decomposed by the image to be detected;
Inputting the layered target images into a target number prediction network to obtain a target number prediction graph output by the target number prediction network, and determining the number of overlapped foreground targets in the layered target images according to the target number prediction graph;
And determining the layered object image as a detection result image in the case that the number of overlapping foreground objects is less than or equal to 1.
In some of these embodiments, the method further comprises:
and under the condition that the number of the overlapped foreground targets is larger than 1, determining the layered target image as a current image to be detected, and transferring to an image to be detected obtaining step.
In some of these embodiments, the target decomposition network comprises a decomposition convolutional layer and a decomposition-dense network block;
The inputting the image to be detected into the target decomposition network to obtain a layered target image output by the target decomposition network comprises the following steps:
and inputting the image to be detected into the decomposition convolution layer and the decomposition dense network block in sequence to acquire the output layered target image.
In some of these embodiments, the target number prediction network includes a feature extraction module and an attention module;
The step of inputting the layered target image into a target number prediction network to obtain a target number prediction graph output by the target number prediction network, and the step of determining the number of overlapping foreground targets in the layered target image according to the target number prediction graph comprises the following steps:
Sequentially inputting the layered target images into a feature extraction module and an attention module to obtain the output target number prediction graph;
and determining the number of overlapped foreground targets in the layered target image according to the pixel value of each pixel in the target number prediction graph.
In some embodiments, before the inputting the image to be detected into the target decomposition network to obtain the layered target image output by the target decomposition network, the method further includes:
Acquiring a training target image and a training background image;
Determining a training overlapping image according to the training target image and the training background image;
And training according to the training target image, the training background image and the training overlapping image to obtain the target decomposition network.
In some embodiments, before the step of inputting the layered target image into the target number prediction network to obtain a target number prediction graph output by the target number prediction network, and determining the number of overlapping foreground targets in the layered target image according to the target number prediction graph, the method further includes:
Calculating the number of overlapping targets at each pixel point in the training overlapping image;
Determining the number of overlapping targets as pixel values of corresponding pixel points in the training overlapping images so as to determine the target number training diagram;
And training according to the training overlapping image and the target number training image to obtain the target number prediction network.
In a second aspect, an embodiment of the present application provides an X-ray security inspection image detection method.
In some embodiments, the X-ray security inspection image detection method includes:
acquiring an X-ray security inspection image to be detected; the X-ray security inspection image to be detected comprises a target object to be subjected to security inspection;
Inputting the X-ray security inspection image to be detected into a target decomposition network to obtain an X-ray foreground image and an X-ray background image decomposed by the X-ray security inspection image to be detected; wherein the X-ray foreground image includes a first target object of the target objects, and the X-ray background image does not include the first target object;
Inputting the X-ray foreground images into a target number prediction network to obtain a first target number prediction graph output by the target number prediction network, and determining the first overlapped foreground target number in the X-ray foreground images according to the first target number prediction graph;
Inputting the X-ray background image into the target number prediction network to obtain a second target number prediction graph output by the target number prediction network, and determining the second overlapping foreground target number in the X-ray background image according to the second target number prediction graph;
under the condition that the number of the first overlapped foreground objects is smaller than or equal to 1, determining the corresponding X-ray foreground images as first detection result images;
and under the condition that the number of the second overlapping foreground objects is less than or equal to 1, determining the corresponding X-ray background image as a second detection result image.
In some embodiments, the X-ray security inspection image to be detected is a color image with a size of 700 pixels or more and 1200 pixels or less;
the X-ray foreground image, the X-ray background image and the X-ray security inspection image to be detected have the same size.
In a third aspect, an embodiment of the present application provides an image detection apparatus.
In some embodiments, the image detection device includes a to-be-detected image acquisition module, a layered target image acquisition module, an overlapping foreground target number determination module, and a detection result image determination module:
the image acquisition module to be detected is used for executing an image acquisition step to be detected, and the image acquisition step to be detected comprises the step of acquiring an image to be detected;
The layered target image acquisition module is used for inputting the image to be detected into a target decomposition network so as to acquire a layered target image output by the target decomposition network, wherein the layered target image comprises a foreground image and a background image decomposed by the image to be detected;
the overlapping foreground target number determining module is used for inputting the layered target image into a target number predicting network to obtain a target number predicting image output by the target number predicting network, and determining the number of overlapping foreground targets in the layered target image according to the target number predicting image;
The detection result image determining module is used for determining the layered target image as a detection result image under the condition that the number of the overlapped foreground targets is less than or equal to 1.
In a fourth aspect, an embodiment of the present application provides a storage medium having stored thereon a computer program which, when executed by a processor, implements the image detection method according to the first aspect and the X-ray security inspection image detection method according to the second aspect.
Compared with the related art, the image detection method, the device and the storage medium provided by the embodiment of the application are used for acquiring the image to be detected and inputting the image to be detected into the target decomposition network so as to acquire the layered target image output by the target decomposition network, wherein the layered target image comprises a foreground image and a background image decomposed by the image to be detected; further, inputting the layered target images into a target number prediction network to obtain a target number prediction graph output by the target number prediction network, and determining the number of overlapped foreground targets in the layered target images according to the target number prediction graph; when the number of the overlapped foreground targets is smaller than or equal to 1, the layered target images are determined to be the detection result images, so that the problem of how to detect and distinguish the overlapped targets in the images in the related technology is solved, and the accuracy of target detection in the images to be detected is improved.
The details of one or more embodiments of the application are set forth in the accompanying drawings and the description below to provide a more thorough understanding of the other features, objects, and advantages of the application.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this specification, illustrate embodiments of the application and together with the description serve to explain the application and do not constitute a limitation on the application. In the drawings:
fig. 1 is a block diagram of a hardware configuration of a terminal of an image detection method according to an embodiment of the present application;
fig. 2 is a flowchart of an image detection method according to an embodiment of the present application;
FIG. 3 is a flow chart of yet another image detection method according to an embodiment of the present application;
fig. 4 is a flowchart of an image detection method according to a preferred embodiment of the present application;
FIG. 5 is a flow chart of an X-ray security inspection image detection method according to an embodiment of the present application;
Fig. 6 is a block diagram of the structure of an image detection apparatus according to an embodiment of the present application.
Detailed Description
The present application will be described and illustrated with reference to the accompanying drawings and examples in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application. All other embodiments, which can be made by a person of ordinary skill in the art based on the embodiments provided by the present application without making any inventive effort, are intended to fall within the scope of the present application. Moreover, it should be appreciated that while such a development effort might be complex and lengthy, it would nevertheless be a routine undertaking of design, fabrication, or manufacture for those of ordinary skill having the benefit of this disclosure, and thus should not be construed as having the benefit of this disclosure.
Reference in the specification to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the application. The appearances of such phrases in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is to be expressly and implicitly understood by those of ordinary skill in the art that the described embodiments of the application can be combined with other embodiments without conflict.
Unless defined otherwise, technical or scientific terms used herein should be given the ordinary meaning as understood by one of ordinary skill in the art to which this application belongs. The terms "a," "an," "the," and similar referents in the context of the application are not to be construed as limiting the quantity, but rather as singular or plural. The terms "comprising," "including," "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, article, or apparatus that comprises a list of steps or modules (elements) is not limited to only those steps or elements but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus. The terms "connected," "coupled," and the like in connection with the present application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The term "plurality" as used herein means greater than or equal to two. "and/or" describes an association relationship of an association object, meaning that there may be three relationships, e.g., "a and/or B" may mean: a exists alone, A and B exist together, and B exists alone. The terms "first," "second," "third," and the like, as used herein, are merely distinguishing between similar objects and not representing a particular ordering of objects.
The method embodiment provided in this embodiment may be executed in a terminal, a computer or a similar computing device. Taking the operation on the terminal as an example, fig. 1 is a block diagram of the hardware structure of the terminal of the image detection method according to the embodiment of the present invention. As shown in fig. 1, the terminal may include one or more processors 102 (only one is shown in fig. 1) (the processor 102 may include, but is not limited to, a microprocessor MCU or a processing device such as a programmable logic device FPGA) and a memory 104 for storing data, and optionally, a transmission device 106 for communication functions and an input-output device 108. It will be appreciated by those skilled in the art that the structure shown in fig. 1 is merely illustrative and not limiting on the structure of the terminal described above. For example, the terminal may also include more or fewer components than shown in fig. 1, or have a different configuration than shown in fig. 1.
The memory 104 may be used to store a computer program, for example, a software program of application software and a module, such as a computer program corresponding to an image detection method in an embodiment of the present invention, and the processor 102 executes the computer program stored in the memory 104 to perform various functional applications and data processing, that is, implement the above-mentioned method. Memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include memory remotely located relative to the processor 102, which may be connected to the terminal via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device 106 is used to receive or transmit data via a network. The specific example of the network described above may include a wireless network provided by a communication provider of the terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, simply referred to as a NIC) that can connect to other network devices through a base station to communicate with the internet. In one example, the transmission device 106 may be a Radio Frequency (RF) module for communicating with the internet wirelessly.
The present embodiment provides an image detection method, fig. 2 is a flowchart of the image detection method according to an embodiment of the present application, and as shown in fig. 2, the flowchart includes the following steps:
Step S201, an image to be detected is acquired.
When the image to be detected can be a security inspection, the X-ray security inspection image acquired by the X-ray security inspection machine can further comprise a plurality of mutually shielded overlapped targets. For ease of understanding, in the following embodiments, the image to be detected may also be expressed as an X-ray overlapping image, and the two images are in a unified relationship.
Step S202, inputting the image to be detected into a target decomposition network to obtain a layered target image output by the target decomposition network, wherein the layered target image comprises a foreground image and a background image decomposed by the image to be detected.
Further, the obtained X-ray overlapped image is input into a target decomposition network to obtain a layered target image output by the target decomposition network. In the embodiment of the application, the target decomposition network is a deep learning network obtained through training and can be used for decomposing an image input into two layered target images comprising a foreground image and a background image. The foreground image may be an image formed by a first object extracted from the X-ray overlapping image, the background image may be an image formed by removing the first object from the X-ray overlapping image, and the first object may include one or more objects.
Step S203, inputting the layered target image into a target number prediction network to obtain a target number prediction graph output by the target number prediction network, and determining the number of overlapping foreground targets in the layered target image according to the target number prediction graph.
And respectively inputting the obtained layered target images into a target number prediction network to obtain a target number prediction graph output by the target number prediction network. In the embodiment of the application, the target number prediction network is a deep learning network obtained through training and can be used for judging the overlapping number of targets in an input image. Specifically, the target number prediction network comprises a feature extraction module and an attention module, the layered target image acquires features through the feature extraction module, the attention module enhances the feature information acquisition capability, and finally the target number prediction graph with the same width and height as the input layered target image is output. The pixel value of each pixel in the target number prediction graph represents the corresponding target number at the pixel coordinate, so that according to the target number prediction graph, the embodiment of the application can determine the number of overlapped foreground targets in the layered target image.
Step S204 of determining the layered object image as the detection result image in the case where the number of overlapping foreground objects is less than or equal to 1.
When the number of overlapping foreground objects is less than or equal to 1, it is indicated that there are no overlapping objects in the corresponding layered object image, that is, all overlapping objects in the X-ray overlapping image are decomposed, so that the layered object image is determined as a detection result image, which indicates that all objects in the X-ray overlapping image have been accurately detected.
Through the steps, the embodiment of the application acquires the image to be detected, inputs the image to be detected into the target decomposition network, and the target decomposition network decomposes the image to be detected to output the layered target image, wherein the layered target image comprises a foreground image and a background image decomposed by the image to be detected; respectively inputting the decomposed foreground images and background images into a target number prediction network to obtain a target number prediction graph output by the target number prediction network, wherein the target number prediction graph is used for determining the number of overlapped foreground targets in layered target images; when the number of the overlapped foreground objects is less than or equal to 1, the fact that no object or only 1 object exists in the corresponding layered object image is indicated, and therefore the distinction of the overlapped objects in the images is completed, and therefore the layered object image is determined to be a detection result image. The embodiment of the application solves the problem of accurately detecting and distinguishing the overlapped targets in the images, and improves the accuracy of target detection in the X-ray security inspection images.
The embodiment also provides an image detection method. Fig. 3 is a flowchart of still another image detection method according to an embodiment of the present application, as shown in fig. 3, on the basis of steps S201, S202, S203 and S204, the flowchart further includes the steps of:
Step S301, in the case where the number of overlapping foreground objects is greater than 1, the layered object image is determined as the current image to be detected, and the process proceeds to step S201.
And under the condition that the number of the overlapped foreground targets is larger than 1, the fact that the overlapped targets exist in the corresponding layered target images is indicated, so that the layered target images are required to be determined to be the current images to be detected, the images are continuously input into a target decomposition network for decomposition until the number of the overlapped foreground targets obtained through judgment of the target number prediction network is smaller than or equal to 1 in the images obtained through decomposition.
Through the steps, when the number of the overlapped foreground targets output by the target number prediction network is larger than 1, the embodiment of the application judges that a plurality of targets exist in the corresponding layered target images, then the layered target images are determined to be the current images to be detected, the images are circularly input into the target decomposition network, the overlapped targets in the images are further decomposed, and the accuracy and the efficiency of detecting and distinguishing the overlapped targets are improved.
In some of these embodiments, the target decomposition network includes a decomposition convolutional layer and a decomposition-dense network block; step S202 includes:
step S2021, inputting the image to be detected into the deconvolution layer and the deconvolution dense network block in order to obtain the output layered target image.
And the X-ray overlapped image is subjected to processing of a decomposition convolution layer and a decomposition dense network block in sequence to obtain a first preprocessing image and a second preprocessing image. Inputting the first preprocessed image into a first reconstruction branch network to obtain a foreground image output by the first reconstruction branch network, wherein the first reconstruction branch network comprises a first convolution layer and a first dense network block; and inputting the second preprocessed image into a second reconstruction branch network to acquire a background image output by the second reconstruction branch network, wherein the second reconstruction branch network comprises a second convolution layer and a second dense network block.
Through the steps, the image to be detected is sequentially input into the decomposition convolution layer and the decomposition dense network block to obtain the output layered target image, and the overlapping target is accurately and efficiently decomposed, wherein the layered target image comprises a foreground image and a background image.
In some of these embodiments, the target number prediction network includes a feature extraction module and an attention module;
step S203 includes:
Step S2031, sequentially inputting the layered target images into a feature extraction module and an attention module to obtain an output target number prediction graph;
in the embodiment of the application, the target number prediction network is a deep learning network obtained through training and can be used for judging the overlapping number of targets in an input image. Specifically, the target number prediction network comprises a feature extraction module and an attention module, wherein the layered target image acquires features through the feature extraction module, and then the attention module enhances the feature information acquisition capability and finally outputs a target number prediction graph.
Step S2032, determining the number of overlapping foreground objects in the layered object image according to the pixel values of the pixels in the object number prediction graph.
The pixel value of each pixel in the target number prediction graph represents the corresponding target number at the pixel coordinate, so that according to the target number prediction graph, the embodiment of the application can determine the number of overlapped foreground targets in the layered target image. It should be noted that the target number prediction graph output by the target number prediction network is the same as the input layered target image in width and height, i.e. in size.
Through the steps, the embodiment of the application predicts the feature extraction module and the attention module contained in the network based on the number of the targets, so that the layered target images acquire the features through the feature extraction module, then the attention module enhances the feature information acquisition capability, and finally the number of the overlapped foreground targets in the layered target images is accurately and efficiently determined.
In some of these embodiments, before step S202, further includes:
step S212, a training target image and a training background image are acquired.
The training target image may be a contraband target image in a known database, and the training background image may be a parcel background image in the known database.
Step S222, determining a training overlapping image according to the training target image and the training background image.
Specifically, the training target image f and the training background image b can be fused by using the following X-ray image fusion algorithm formula based on the X-ray image dangerous goods image injection (THREAT IMAGE project, TIP) principle, so as to obtain a training overlapping image fb.
(1)
(2)
From equations (1) and (2)
(3)
Wherein I 0 is an initial image value before the incidence of X-ray, h f、μb and h b are attenuation coefficients and thicknesses of the training target image f and the training background image b, and w 1 and w 2 are preset parameters, which are set to 0.5 in the embodiment of the present application.
Step S232, training to obtain a target decomposition network according to the training target image, the training background image and the training overlapping image.
According to the training target image, the training background image and the training overlapping image, the target decomposition network is obtained through training.
Through the steps, the training target image and the training background image are fused to obtain the training overlapping image, and the target decomposition network is obtained through training according to the training target image, the training background image and the training overlapping image, so that the feasibility is high.
In some of these embodiments, step 232 includes:
Step S2321, determining a first reconstruction loss corresponding to the training target image and a second reconstruction loss corresponding to the training background image.
Step S2322, determining a target decomposition training loss function of the target decomposition network according to the first reconstruction loss and the second reconstruction loss.
The target decomposition training loss function of the target decomposition network is the sum of the first reconstruction loss and the second reconstruction loss, and the target decomposition training loss function has the following formula:
in the training loss function formula, the method comprises the following steps of, For the foreground image output by the first reconstructed branch network,And reconstructing the background image output by the branch network for the second.
Step S2323, training to obtain a target decomposition network according to the target decomposition training loss function, the training target image, the training background image and the training overlapping image.
Through the steps, the embodiment of the application determines the target decomposition training loss function when the target decomposition network is trained, so that the target decomposition network obtained by training outputs more accurate target layered images during reasoning prediction.
In some of these embodiments, before step S203, further includes:
step S213, calculating the number of overlapping targets at each pixel point in the training overlapping image.
And determining coordinates corresponding to each pixel point in the training overlapping image, and calculating the number of overlapping targets at each coordinate.
In step S223, the number of overlapping targets is determined as the pixel value of the corresponding pixel point in the training overlapping image, so as to determine the training map of the number of targets.
And determining the number of the overlapped targets as the pixel value of the corresponding pixel point in the training overlapped image, thereby obtaining a target number training image.
Step S233, training to obtain a target number prediction network according to the training overlapping images and the target number training image.
And training the target number prediction network by taking the target number training image as a training object and taking the training overlapping image as a training object. It is worth mentioning that the training loss function of the target number prediction network may be a commonly used cross entropy loss function:
Wherein, For the number of tags to be used,For the network output prediction value, C is a preset target number, and in the embodiment of the present application, is preset to 10.
Through the steps, the embodiment of the application carries out pixel labeling on the training overlapping images to determine the target number training images, and further trains to obtain the target number prediction network, so that the feasibility is high.
The embodiments of the present application will be described and illustrated below by means of preferred embodiments.
Fig. 4 is a flowchart of an image detection method according to a preferred embodiment of the present application. As shown in fig. 4, the image detection method includes the steps of:
step S401, a training target image and a training background image are obtained, and a training overlapping image is determined according to the training target image and the training background image;
step S402, training to obtain a target decomposition network according to a training target image, a training background image and a training overlapping image;
step S403, obtaining an image to be detected, and inputting the image to be detected into a target decomposition network to obtain a layered target image output by the target decomposition network, wherein the layered target image comprises a foreground image and a background image decomposed by the image to be detected;
step S404, determining a target number training image according to the training overlapping image, and training to obtain a target number prediction network according to the training overlapping image and the target number training image;
Step S405, inputting the layered target images into a target number prediction network to obtain a target number prediction graph output by the target number prediction network, and determining the number of overlapped foreground targets in the layered target images according to the target number prediction graph;
Step S406, in the case where the number of overlapping foreground objects is less than or equal to 1, determining the layered object image as the detection result image.
It should be noted that the steps illustrated in the above-described flow or flow diagrams of the figures may be performed in a computer system, such as a set of computer-executable instructions, and that, although a logical order is illustrated in the flow diagrams, in some cases, the steps illustrated or described may be performed in an order other than that illustrated herein.
The embodiment also provides an X-ray security inspection image detection method. Fig. 5 is a flowchart of an X-ray security inspection image detection method according to an embodiment of the present application, as shown in fig. 5, the flowchart includes the following steps:
Step S501, an X-ray security inspection image to be detected is obtained; the X-ray security inspection image to be detected comprises a target object to be subjected to security inspection.
In the embodiment of the application, the X-ray security inspection image to be detected can be obtained by detecting and collecting the baggage package through an X-ray security inspection machine under security inspection scenes such as airports, railway stations and the like. The X-ray security inspection image to be detected comprises a target object to be subjected to security inspection, and the target object can be a plurality of forbidden objects overlapped with each other.
Step S502, inputting the X-ray security inspection image to be detected into a target decomposition network to obtain an X-ray foreground image and an X-ray background image decomposed by the X-ray security inspection image to be detected; wherein the X-ray foreground image includes a first target object of the target objects, and the X-ray background image does not include the first target object.
In the embodiment of the application, the obtained X-ray security inspection image to be detected is further input into a target decomposition network to obtain an X-ray foreground image and an X-ray background image output by the target decomposition network. The target decomposition network is a deep learning network obtained through training and can be used for decomposing an image input into the deep learning network into two layered target images comprising a foreground image and a background image. The X-ray foreground image may be an image formed by a first target object extracted from an X-ray security image to be detected, and the X-ray background image may be an image formed by removing the first target object from the X-ray security image to be detected. The first target object may comprise one or more target objects. A second target object may be included in the X-ray background image.
Step S503, inputting the X-ray foreground images into a target number prediction network to obtain a first target number prediction graph output by the target number prediction network, and determining the first overlapped foreground target number in the X-ray foreground images according to the first target number prediction graph.
In the embodiment of the application, the obtained X-ray foreground images are input into a target number prediction network so as to obtain a first target number prediction image corresponding to the X-ray foreground images, which is output by the target number prediction network. The target number prediction network is a deep learning network obtained through training and can be used for judging the overlapping number of target objects in an input image. Specifically, the target number prediction network comprises a feature extraction module and an attention module, the X-ray foreground image acquires features through the feature extraction module, the attention module enhances the feature information acquisition capability, and finally the target number prediction network outputs a first target number prediction graph with the same width and height as the input X-ray foreground image. The pixel value of each pixel in the first target number prediction graph represents the number of the first target objects corresponding to the pixel coordinate, so that according to the first target number prediction graph, the embodiment of the application can determine the first overlapped foreground target number in the X-ray foreground image.
Step S504, inputting the X-ray background image into the target number prediction network to obtain a second target number prediction graph output by the target number prediction network, and determining the second overlapping foreground target number in the X-ray background image according to the second target number prediction graph.
Similarly, in the embodiment of the application, the obtained X-ray background image is input into the target number prediction network to obtain a second target number prediction graph corresponding to the X-ray background image output by the target number prediction network. Thus, the embodiment of the application predicts the target number of all the images output by the target decomposition network for subsequent application. Specifically, the X-ray background image acquires features through the feature extraction module, then the attention module enhances the feature information acquisition capability, and finally a second target number prediction graph with the same width and height as the input X-ray background image is output. The pixel value of each pixel in the second target number prediction graph represents the corresponding second target object number at the pixel coordinate, so that according to the second target number prediction graph, the embodiment of the application can determine the second overlapping foreground target number in the X-ray background image.
In step S505, in the case where the first overlapping foreground object number is less than or equal to 1, the corresponding X-ray foreground image is determined as the first detection result image.
When the number of the first overlapped foreground objects is smaller than or equal to 1, the fact that no overlapped objects exist in the corresponding X-ray foreground images is indicated, namely all overlapped objects in the X-ray foreground images are decomposed, and therefore the X-ray foreground images are determined to be first detection result images, and the fact that all the objects in the X-ray foreground images are accurately detected is indicated. That is, the first detection result image is an image obtained by decomposing all the superimposed objects in the initial X-ray foreground image. The initial X-ray foreground image is the X-ray foreground image output after the X-ray security inspection image to be detected is input to the target decomposition network for the first time. Only a single foreground object (first object) or no foreground object (first object) exists in the first detection result image.
In step S506, in the case where the second overlapping foreground object number is less than or equal to 1, the corresponding X-ray background image is determined as the second detection result image.
Similarly, when the number of second overlapping foreground objects is less than or equal to 1, it is indicated that there are no overlapping objects in the corresponding X-ray background image, that is, all overlapping objects in the X-ray background image are decomposed, so that the X-ray background image is determined as a second detection result image, which indicates that all objects in the X-ray background image have been accurately detected. That is, the second detection result image is an image obtained by decomposing all the superimposed objects in the initial X-ray background image. The initial X-ray background image is an output X-ray background image after the X-ray security inspection image to be detected is input to the target decomposition network for the first time. Only a single foreground object (second object) or no foreground object (second object) exists in the second detection result image.
It should be noted that, in the case that the number of the first overlapping foreground objects is greater than 1, determining the corresponding X-ray foreground image as the current X-ray security image to be detected, and performing steps S501 to S506 in a circulating manner; similarly, in the case where the number of second overlapping foreground objects is greater than 1, the corresponding X-ray background image is determined as the current X-ray security inspection image to be detected, and steps S501 to S506 are cyclically executed.
Through the steps, the embodiment of the application acquires the X-ray security inspection image to be detected, inputs the X-ray security inspection image to be detected into the target decomposition network, and the target decomposition network decomposes the X-ray security inspection image to be detected and outputs an X-ray foreground image and an X-ray background image decomposed by the X-ray security inspection image to be detected; respectively inputting the decomposed X-ray foreground image and X-ray background image into a target number prediction network to respectively obtain a first target number prediction image and a second target number prediction image which are output by the target number prediction network; the first target number prediction graph is used for determining the first overlapping foreground target number in the X-ray foreground image, and the second target number prediction graph is used for determining the second overlapping foreground target number in the X-ray background image; when the number of the first overlapped foreground objects is smaller than or equal to 1, indicating that no object or only 1 object exists in the corresponding X-ray foreground image, thereby completing the distinction of the overlapped objects in the X-ray foreground image; when the number of the second overlapping foreground objects is smaller than or equal to 1, indicating that no object or only 1 object exists in the corresponding X-ray background image, thereby completing the distinction of the overlapping objects in the X-ray background image; accordingly, the corresponding X-ray foreground image and X-ray background image are determined as detection result images. The embodiment of the application solves the problem of accurately detecting and distinguishing the overlapped targets in the images, and improves the accuracy of target detection in the X-ray security inspection images.
In some embodiments, the X-ray security inspection image detection method further includes:
the X-ray security inspection image to be detected is a color image with the size being more than or equal to 700 pixels and less than or equal to 1200 pixels; the X-ray foreground image, the X-ray background image and the X-ray security inspection image to be detected have the same size.
In the embodiment of the application, the X-ray foreground image, the X-ray background image and the X-ray security inspection image to be detected are all color images with the size being more than or equal to 700 pixels and less than or equal to 1200 pixels, and in the same embodiment, the sizes of the X-ray foreground image, the X-ray background image and the X-ray security inspection image to be detected are the same. Therefore, the embodiment of the application can improve the visual effect of image detection and has high feasibility.
The embodiment also provides an image detection device, which is used for implementing the above embodiments and preferred embodiments, and is not described in detail. As used below, the terms "module," "unit," "sub-unit," and the like may be a combination of software and/or hardware that implements a predetermined function. While the means described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware, is also possible and contemplated.
Fig. 6 is a block diagram of an image detection apparatus according to an embodiment of the present application, as shown in fig. 6, including: the image acquisition module to be detected 10, the layered object image acquisition module 20, the overlapping foreground object number determination module 30 and the detection result image determination module 40.
The image to be detected acquisition module 10 is configured to perform an image to be detected acquisition step, where the image to be detected acquisition step includes acquiring an image to be detected;
A layered target image acquisition module 20, configured to input an image to be detected into a target decomposition network, so as to acquire a layered target image output by the target decomposition network, where the layered target image includes a foreground image and a background image decomposed from the image to be detected;
The overlapping foreground object number determining module 30 is configured to input the layered object image into the object number prediction network, obtain an object number prediction graph output by the object number prediction network, and determine the number of overlapping foreground objects in the layered object image according to the object number prediction graph;
the detection result image determining module 40 is configured to determine the layered object image as a detection result image in a case where the number of overlapping foreground objects is less than or equal to 1.
In some of these embodiments, the image detection apparatus further includes: and the image to be detected is reset.
The image to be detected resetting module is configured to determine the layered object image as the current image to be detected in the case that the number of overlapping foreground objects is greater than 1, and go to step S201.
In some of these embodiments, the target decomposition network includes a decomposition convolutional layer and a decomposition-dense network block;
The layered target image acquisition module is used for sequentially inputting the image to be detected into a decomposition convolution layer and a decomposition dense network block so as to acquire an output layered target image.
In some of these embodiments, the target number prediction network includes a feature extraction module and an attention module; the overlapping foreground object number determining module comprises: a target number prediction graph determining module and a foreground target number prediction module;
The target number prediction graph determining module is used for sequentially inputting the layered target images into the feature extraction module and the attention module so as to obtain an output target number prediction graph;
The foreground target number prediction module is used for determining the number of overlapped foreground targets in the layered target image according to the pixel values of all pixels in the target number prediction graph.
In some of these embodiments, the image detection apparatus further includes: the system comprises a training image acquisition module, a training overlapping image determining module and a target decomposition network training module;
the training image acquisition module is used for acquiring a training target image and a training background image;
The training overlapping image determining module is used for determining a training overlapping image according to the training target image and the training background image;
The target decomposition network training module is used for training to obtain a target decomposition network according to the training target image, the training background image and the training overlapping image.
In some of these embodiments, the image detection apparatus further includes: a target number training diagram determining module and a target number predicting network determining module;
The target number training diagram determining module is used for determining a target number training diagram according to the training overlapping images;
the target number prediction network determining module is used for obtaining a target number prediction network through training according to the training overlapping image and the target number training image.
In some of these embodiments, the target number training graph determination module includes: a pixel point target number calculation module and a training target number calculation module;
The pixel point target number calculation module is used for calculating the number of overlapping targets at each pixel point in the training overlapping image;
The training target number calculation module is used for determining the number of the overlapped targets as the pixel value of the corresponding pixel point in the training overlapped image so as to determine a target number training diagram.
The above-described respective modules may be functional modules or program modules, and may be implemented by software or hardware. For modules implemented in hardware, the various modules described above may be located in the same processor; or the above modules may be located in different processors in any combination.
The present embodiment also provides an electronic device comprising a memory having stored therein a computer program and a processor arranged to run the computer program to perform the steps of any of the method embodiments described above.
Optionally, the electronic apparatus may further include a transmission device and an input/output device, where the transmission device is connected to the processor, and the input/output device is connected to the processor.
Alternatively, in the present embodiment, the above-described processor may be configured to execute the following steps by a computer program:
Executing an image to be detected, wherein the image to be detected is obtained by the steps of obtaining the image to be detected;
Inputting the image to be detected into a target decomposition network to obtain a layered target image output by the target decomposition network, wherein the layered target image comprises a foreground image and a background image decomposed by the image to be detected;
inputting the layered target images into a target number prediction network to obtain a target number prediction graph output by the target number prediction network, and determining the number of overlapped foreground targets in the layered target images according to the target number prediction graph;
In the case where the number of overlapping foreground objects is less than or equal to 1, the layered object image is determined as the detection result image.
It should be noted that, specific examples in this embodiment may refer to examples described in the foregoing embodiments and alternative implementations, and this embodiment is not repeated herein.
In addition, in combination with the image detection method in the above embodiment, the embodiment of the present application may be implemented by providing a storage medium. The storage medium has a computer program stored thereon; the computer program, when executed by a processor, implements any of the image detection methods of the above embodiments.
It should be understood by those skilled in the art that the technical features of the above-described embodiments may be combined in any manner, and for brevity, all of the possible combinations of the technical features of the above-described embodiments are not described, however, they should be considered as being within the scope of the description provided herein, as long as there is no contradiction between the combinations of the technical features.
The user information (including but not limited to user equipment information, user personal information, etc.) and the data (including but not limited to data for analysis, stored data, presented data, etc.) related to the present application are information and data authorized by the user or sufficiently authorized by each party.
The above examples illustrate only a few embodiments of the application, which are described in detail and are not to be construed as limiting the scope of the application. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the application, which are all within the scope of the application. Accordingly, the scope of protection of the present application is to be determined by the appended claims.
Claims (9)
1. An image detection method, characterized by comprising the steps of:
executing an image to be detected, wherein the image to be detected is obtained by the steps of obtaining the image to be detected;
inputting the image to be detected into a target decomposition network to obtain a layered target image output by the target decomposition network, wherein the layered target image comprises a foreground image and a background image decomposed by the image to be detected;
Inputting the layered target images into a target number prediction network to obtain a target number prediction graph output by the target number prediction network, and determining the number of overlapped foreground targets in the layered target images according to the target number prediction graph;
Determining the layered object image as a detection result image in the case that the number of overlapping foreground objects is less than or equal to 1;
and under the condition that the number of the overlapped foreground targets is larger than 1, determining the layered target image as a current image to be detected, and transferring to an image to be detected obtaining step.
2. The image detection method of claim 1, wherein the target decomposition network comprises a decomposition convolutional layer and a decomposition-dense network block;
The inputting the image to be detected into the target decomposition network to obtain a layered target image output by the target decomposition network comprises the following steps:
and inputting the image to be detected into the decomposition convolution layer and the decomposition dense network block in sequence to acquire the output layered target image.
3. The image detection method according to claim 2, wherein the target number prediction network includes a feature extraction module and an attention module;
The step of inputting the layered target image into a target number prediction network to obtain a target number prediction graph output by the target number prediction network, and the step of determining the number of overlapping foreground targets in the layered target image according to the target number prediction graph comprises the following steps:
Sequentially inputting the layered target images into a feature extraction module and an attention module to obtain the output target number prediction graph;
and determining the number of overlapped foreground targets in the layered target image according to the pixel value of each pixel in the target number prediction graph.
4. The image detection method according to any one of claims 1 to 3, further comprising, before said inputting the image to be detected into a target decomposition network to acquire a layered target image output by the target decomposition network:
Acquiring a training target image and a training background image;
Determining a training overlapping image according to the training target image and the training background image;
And training according to the training target image, the training background image and the training overlapping image to obtain the target decomposition network.
5. The image detection method according to claim 4, further comprising, before said inputting the layered target image into a target number prediction network to obtain a target number prediction map output by the target number prediction network, and determining the number of overlapping foreground targets in the layered target image from the target number prediction map:
Calculating the number of overlapping targets at each pixel point in the training overlapping image;
Determining the number of overlapping targets as pixel values of corresponding pixel points in the training overlapping images so as to determine the target number training diagram;
And training according to the training overlapping image and the target number training image to obtain the target number prediction network.
6. The X-ray security inspection image detection method is characterized by comprising the following steps of:
acquiring an X-ray security inspection image to be detected; the X-ray security inspection image to be detected comprises a target object to be subjected to security inspection;
Inputting the X-ray security inspection image to be detected into a target decomposition network to obtain an X-ray foreground image and an X-ray background image decomposed by the X-ray security inspection image to be detected; wherein the X-ray foreground image includes a first target object of the target objects, and the X-ray background image does not include the first target object;
Inputting the X-ray foreground images into a target number prediction network to obtain a first target number prediction graph output by the target number prediction network, and determining the first overlapped foreground target number in the X-ray foreground images according to the first target number prediction graph;
Inputting the X-ray background image into the target number prediction network to obtain a second target number prediction graph output by the target number prediction network, and determining the second overlapping foreground target number in the X-ray background image according to the second target number prediction graph;
under the condition that the number of the first overlapped foreground objects is smaller than or equal to 1, determining the corresponding X-ray foreground images as first detection result images;
and under the condition that the number of the second overlapping foreground objects is less than or equal to 1, determining the corresponding X-ray background image as a second detection result image.
7. The image detection method according to claim 6, wherein,
The X-ray security inspection image to be detected is a color image with the size being more than or equal to 700 pixels and less than or equal to 1200 pixels;
the X-ray foreground image, the X-ray background image and the X-ray security inspection image to be detected have the same size.
8. An image detection device is characterized by comprising an image acquisition module to be detected, a layered target image acquisition module, an overlapping foreground target quantity determination module and a detection result image determination module:
the image acquisition module to be detected is used for executing an image acquisition step to be detected, and the image acquisition step to be detected comprises the step of acquiring an image to be detected;
The layered target image acquisition module is used for inputting the image to be detected into a target decomposition network so as to acquire a layered target image output by the target decomposition network, wherein the layered target image comprises a foreground image and a background image decomposed by the image to be detected;
the overlapping foreground target number determining module is used for inputting the layered target image into a target number predicting network to obtain a target number predicting image output by the target number predicting network, and determining the number of overlapping foreground targets in the layered target image according to the target number predicting image;
The detection result image determining module is used for determining the layered target image as a detection result image under the condition that the number of the overlapped foreground targets is less than or equal to 1.
9. A storage medium having a computer program stored therein, wherein the computer program is arranged to perform the image detection method of any one of claims 1 to 6 when run.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410772882.7A CN118351490B (en) | 2024-06-17 | 2024-06-17 | Image detection method, device and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410772882.7A CN118351490B (en) | 2024-06-17 | 2024-06-17 | Image detection method, device and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN118351490A CN118351490A (en) | 2024-07-16 |
CN118351490B true CN118351490B (en) | 2024-09-17 |
Family
ID=91815768
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202410772882.7A Active CN118351490B (en) | 2024-06-17 | 2024-06-17 | Image detection method, device and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN118351490B (en) |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108288279A (en) * | 2018-01-25 | 2018-07-17 | 盛视科技股份有限公司 | Article discrimination method based on X-ray image foreground target extraction |
Family Cites Families (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP7106894B2 (en) * | 2018-03-08 | 2022-07-27 | セイコーエプソン株式会社 | Image reading device, program and image generation method |
KR101914281B1 (en) * | 2018-05-23 | 2018-11-01 | 엘아이지넥스원 주식회사 | Apparatus and method for targeting target |
JP7239507B2 (en) * | 2020-01-30 | 2023-03-14 | 株式会社日立製作所 | ALERT OUTPUT TIMING CONTROL DEVICE, ALERT OUTPUT TIMING CONTROL METHOD, ALERT OUTPUT TIMING CONTROL PROGRAM |
US11257231B2 (en) * | 2020-06-17 | 2022-02-22 | Toyota Research Institute, Inc. | Camera agnostic depth network |
CN113326753B (en) * | 2021-05-20 | 2022-04-19 | 同济大学 | X-ray security inspection contraband detection method aiming at overlapping problem |
CN113537209A (en) * | 2021-06-02 | 2021-10-22 | 浙江吉利控股集团有限公司 | Image processing method, device, equipment and computer readable storage medium |
CN114626443B (en) * | 2022-02-25 | 2024-05-03 | 华南理工大学 | Object rapid detection method based on conditional branching and expert system |
CN117911380A (en) * | 2024-01-24 | 2024-04-19 | 华南理工大学 | X-ray security inspection detection method based on improved FCOS network |
-
2024
- 2024-06-17 CN CN202410772882.7A patent/CN118351490B/en active Active
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108288279A (en) * | 2018-01-25 | 2018-07-17 | 盛视科技股份有限公司 | Article discrimination method based on X-ray image foreground target extraction |
Also Published As
Publication number | Publication date |
---|---|
CN118351490A (en) | 2024-07-16 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US12056892B2 (en) | Image processing method and apparatus, electronic device and computer readable storage medium | |
CN108875540B (en) | Image processing method, device and system and storage medium | |
Chen et al. | Building extraction from remote sensing images with deep learning in a supervised manner | |
Wang et al. | Semantic segmentation of remote sensing ship image via a convolutional neural networks model | |
CN115272182B (en) | Lane line detection method, lane line detection device, electronic equipment and computer readable medium | |
CN116152611A (en) | Multistage multi-scale point cloud completion method, system, equipment and storage medium | |
CN109325539A (en) | Insulator falls crosstalk detecting method and device | |
CN117292120B (en) | Light-weight visible light insulator target detection method and system | |
CN112819889B (en) | Method and device for determining position information, storage medium and electronic device | |
CN118351490B (en) | Image detection method, device and storage medium | |
CN111047598A (en) | Deep learning-based ultraviolet discharge light spot segmentation method and device for power transmission and transformation equipment | |
CN112686314B (en) | Target detection method and device based on long-distance shooting scene and storage medium | |
Wei et al. | DRCNet: Road Extraction From Remote Sensing Images Using DenseNet With Recurrent Criss-Cross Attention and Convolutional Block Attention Module | |
CN110992306B (en) | Method and device for segmenting deteriorated insulator in infrared image based on deep learning | |
CN113808134B (en) | Oil tank layout information generation method, oil tank layout information generation device, electronic apparatus, and medium | |
CN110852242A (en) | Watermark identification method, device, equipment and storage medium based on multi-scale network | |
CN112862953B (en) | Point cloud data processing method and device, electronic equipment and storage medium | |
Gong et al. | Fine feature sensitive marching squares | |
CN114036971A (en) | Oil tank information generation method, oil tank information generation device, electronic device, and computer-readable medium | |
CN113591862A (en) | Text recognition method and device | |
CN118152762B (en) | Neutral hydrogen source identification and segmentation method, device and medium based on deep learning | |
Zhu et al. | A few-shot segmentation method for prohibited item inspection | |
CN118447261A (en) | Target detection method, device, equipment and medium | |
CN111881912B (en) | Data processing method and device and electronic equipment | |
CN113408502B (en) | Gesture recognition method and device, storage medium and electronic equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |