Method and device for detecting hazardous materials
By preprocessing the perspective images of security inspection targets and performing feature pyramid analysis, combined with nonmaximum suppression algorithms, the problems of low detection accuracy and efficiency in existing technologies are solved, achieving accurate and efficient identification of dangerous goods.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-23
- Publication Date
- 2026-03-27
AI Technical Summary
Existing methods for detecting hazardous materials suffer from poor accuracy and low efficiency because the complex stacking and arrangement of different types of items result in discrepancies between the image outline of concealed contraband and the actual outline features.
By acquiring perspective images of objects to be inspected, preprocessing them, and then inputting them into a pre-trained hazardous materials identification model, the region of interest is determined using feature pyramids and non-maximum suppression algorithms to identify whether hazardous materials are present.
It improves the accuracy and efficiency of hazardous materials detection, quickly identifies regions of interest in images, and enhances the feature recognition capabilities of the detection.
Smart Images

Figure CN114596485B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of image detection, and in particular to a dangerous goods detection method and device. BACKGROUND
[0002] With the development of society, tourism and transportation industry become more and more common. Usually when transporting goods or passengers, the goods or the packages carried by the passengers need to be detected. However, there will be some criminals who will take the opportunity to hide some prohibited items in the to-be-detected objects. When the passenger flow is large, it undoubtedly consumes too much time to detect one by one, so generally the goods and packages are imaged by the method of radiation imaging, and then detected by a preset dangerous goods identification model.
[0003] In the traditional detection technology, due to the stacking of goods and the complex placement of different categories of goods in the package, the mutual shielding between the goods is caused, which causes the imaging profile of the hidden prohibited items to be inconsistent with the actual profile characteristics of the prohibited items. The existing dangerous goods identification model does not have the function of feature recognition, which leads to the existing detection method with poor accuracy and low efficiency. SUMMARY
[0004] The purpose of the present application is to provide a dangerous goods detection method and device to improve the accuracy and efficiency of dangerous goods detection.
[0005] In a first aspect, an embodiment of the present application provides a dangerous goods detection method, including: obtaining a perspective image of a security check object; preprocessing the perspective image to obtain a preprocessed image of the security check object; inputting the preprocessed image into a pre-trained dangerous goods identification model to output an interest region in the preprocessed image; the interest region is a region that meets a preset feature requirement; determining whether the security check object contains dangerous goods based on the interest region to obtain a detection result.
[0006] In combination with the first aspect, an embodiment of the present application provides a first possible implementation manner of the first aspect, wherein the step of inputting the preprocessed image into the pre-trained dangerous goods identification model to output the interest region in the preprocessed image that meets the preset feature requirement includes: inputting the preprocessed image into the pre-trained dangerous goods identification model to output a feature pyramid of the preprocessed image; and determining the interest region in the preprocessed image according to the feature pyramid.
[0007] With reference to the first possible implementation manner of the first aspect, in a second possible implementation manner of the first aspect, the determining, based on the region of interest, whether the security check object contains dangerous goods to obtain a detection result includes: performing screening on the detection box in the region of interest and preset label information corresponding to the detection box based on a non-maximum suppression algorithm, to determine whether the security check object contains dangerous goods, and to obtain a detection result; and the preset label information includes a dangerous goods category and a position.
[0008] With reference to the second possible implementation manner of the first aspect, in a third possible implementation manner of the first aspect, the dangerous goods identification model is obtained by training in the following manner: obtaining preset training set data; the training set data includes: an original image with the preset label information and a synthetic image; the synthetic image is used to indicate a combined image of a perspective image of a sample and a background of the perspective image; and training a preset initial neural network according to the training set data until a preset training end condition is met, to obtain the trained dangerous goods identification model.
[0009] With reference to the third possible implementation manner of the first aspect, in a fourth possible implementation manner of the first aspect, the training of the preset initial neural network according to the training set data until the preset training end condition is met, to obtain the trained dangerous goods identification model includes: setting a parameter of a region of interest of the initial neural network based on a size of the sample; performing feature extraction on the original image and the synthetic image based on the initial neural network, to obtain a training set feature pyramid; generating a training set region of interest corresponding to the training set feature pyramid according to the training set feature pyramid; performing classification on the training set region of interest based on a preset classifier, to obtain a predicted value of the training set data; the predicted value includes: a position coordinate of the training set region of interest and an object category probability vector of the preset label information corresponding to the training set region of interest; calculating a loss value of the dangerous goods identification model according to the predicted value and a true value of the training set region of interest; adjusting the parameter of the initial neural network according to the loss value, and continuing to train the network after the parameter adjustment until the preset training end condition is met, to obtain the trained dangerous goods identification model.
[0010] With reference to the fourth possible implementation manner of the first aspect, in a fifth possible implementation manner of the first aspect, after the performing of classification on the training set region of interest based on the preset classifier to obtain the predicted value of the training set data, the method further includes: performing screening on the predicted value based on a non-maximum suppression algorithm, to obtain a preset number of the predicted values.
[0011] With the fifth possible implementation manner of the first aspect, the sixth possible implementation manner of the first aspect is provided, and the method further comprises: obtaining preset test set data; the test set data comprises: original images with the preset annotation information and synthetic images; the synthetic images are used to indicate combined images of perspective images of the sample and backgrounds of the perspective images; testing the dangerous goods identification model according to the test set data until a preset training end condition is met, and obtaining the tested dangerous goods identification model.
[0012] With the sixth possible implementation manner of the first aspect, the seventh possible implementation manner of the first aspect is provided, and after the step of testing the dangerous goods identification model according to the test set data until a preset training end condition is met, and obtaining the tested dangerous goods identification model, the method further comprises: collecting error data in the test set data based on the dangerous goods identification model; the error data is used to indicate data that does not meet a preset training result after the test set data is tested by the dangerous goods identification model; training the dangerous goods identification model according to the error data until a preset training end condition is met, and obtaining the adjusted dangerous goods identification model.
[0013] With the first aspect, the eighth possible implementation manner of the first aspect is provided, and the step of pre-processing the perspective image to obtain the pre-processed image of the security check object comprises: cropping a blank area of the perspective image to obtain an intermediate to-be-detected image; and scaling the intermediate to-be-detected image to obtain the pre-processed image.
[0014] With the first aspect, the eighth possible implementation manner of the first aspect is provided, and the step of pre-processing the perspective image to obtain the pre-processed image comprises: cropping a blank area of the perspective image to obtain an intermediate to-be-detected image; and scaling the intermediate to-be-detected image to obtain the pre-processed image.
[0015] The embodiments of the present application have the following beneficial effects:
[0016] The application provides a dangerous goods detection method and device, which comprises the following steps: obtaining a perspective image of a security check object; performing preprocessing on the perspective image to obtain a preprocessed image of the security check object; inputting the preprocessed image into a pre-trained dangerous goods identification model to output a region of interest in the preprocessed image; the region of interest is a region meeting preset feature requirements; determining whether the security check object contains dangerous goods based on the region of interest to obtain a detection result. The method quickly determines the region of interest of the image through the preset model, and the region of interest is a region meeting preset feature requirements, so that the features of the image are determined, and the accuracy and efficiency of dangerous goods detection are improved.
[0017] Other features and advantages of the embodiments disclosed in the present embodiment will be described in the subsequent description, or some features and advantages can be inferred or determined without doubt from the description, or can be known by implementing the above-mentioned technologies of the present disclosure.
[0018] In order to make the above-mentioned purposes, features and advantages of the present disclosure more obvious and easy to understand, the following preferred embodiments are specifically described below, and the accompanying drawings are described in detail as follows. BRIEF DESCRIPTION OF DRAWINGS
[0019] In order to more clearly illustrate the specific embodiments of the present application or the technical solutions in the prior art, the following will briefly introduce the drawings needed to be used in the specific embodiments or the prior art description. Obviously, the drawings in the following description are some embodiments of the present application, and those skilled in the art can also obtain other drawings according to these drawings without creative labor.
[0020] Figure 1 A flowchart of a dangerous goods detection method provided by an embodiment of the present application is shown in the figure;
[0021] Figure 2 A flowchart of another dangerous goods detection method provided by an embodiment of the present application is shown in the figure;
[0022] Figure 3 A structural diagram of a dangerous goods detection device provided by an embodiment of the present application is shown in the figure;
[0023] Figure 4 A structural diagram of an electronic device provided by an embodiment of the present application is shown in the figure.
[0024] Icon: 31-image acquisition module; 32-image preprocessing module; 33-region of interest determination module; 34-detection result determination module; 41-memory; 42-processor; 43-bus; 44-communication interface. DETAILED DESCRIPTION
[0025] In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions of the present application will be described clearly and completely below with reference to the drawings. Obviously, the described embodiments are only some of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the scope of protection of the present application.
[0026] In the prior art, due to the stacking of the articles and the complex arrangement of different types of articles in the package, the articles are mutually blocked, so that the imaging profile of the hidden prohibited articles is inconsistent with the actual profile characteristics of the prohibited articles, and the existing dangerous article identification model does not have the function of feature recognition, resulting in poor accuracy and low efficiency of the existing detection method.
[0027] Therefore, the embodiments of the present application provide a dangerous article detection method and device, which can alleviate the above technical problems and improve the accuracy and efficiency of dangerous article detection. In order to facilitate the understanding of the embodiments of the present application, first, a dangerous article detection method disclosed by the embodiments of the present application will be described in detail.
[0028] Embodiment 1
[0029] As shown in the flowchart of the dangerous article detection method provided by the embodiments of the present application. Figure 1
[0030] As shown in the flowchart of the dangerous article detection method provided by the embodiments of the present application. Figure 1
[0031] Step S101: Obtain a perspective image of a security check object.
[0032] In this embodiment, the X-ray imaging device is used to image the security check object, thereby obtaining an X-ray perspective image of the security check object.
[0033] Step S102: Preprocess the perspective image to obtain a preprocessed image of the security check object.
[0034] In this embodiment, the step of preprocessing the perspective image to obtain a preprocessed image of the security check object includes: first, cropping the blank area of the perspective image to obtain an intermediate detection image. Then, the intermediate detection image is scaled according to a preset scaling factor, so that the pixel size of the same type of articles in the detection perspective image obtained by different models remains unchanged. Here, the above preprocessing process removes the blank area of the perspective image while scaling the size of the perspective image to a certain extent, so that the size of the articles in the perspective image remains within a reasonable range.
[0035] Step S103: inputting the preprocessed image into a pre-trained dangerous article recognition model to output a region of interest in the preprocessed image; the region of interest is a region meeting preset feature requirements.
[0036] In this embodiment, the preprocessed image is input into a pre-trained dangerous article recognition model, the dangerous article recognition model determines a feature pyramid of the preprocessed image, and thus obtains the region of interest in the preprocessed image based on the feature pyramid.
[0037] Step S104: determining whether the security check object contains dangerous articles based on the region of interest to obtain a detection result.
[0038] Here, since the region of interest contains a detection frame and a preset label corresponding to the detection frame, it is determined whether the detection frame and the preset label corresponding to the detection frame contain dangerous articles based on a maximum value suppression algorithm to obtain a detection result.
[0039] The dangerous article detection method provided in the embodiment of the application comprises the following steps: obtaining a perspective image of a security check object; preprocessing the perspective image to obtain a preprocessed image of the security check object; inputting the preprocessed image into a pre-trained dangerous article recognition model to output a region of interest in the preprocessed image; the region of interest is a region meeting preset feature requirements; and determining whether the security check object contains dangerous articles based on the region of interest to obtain a detection result. The method quickly determines the region of interest of the image through a preset model, and the region of interest is a region meeting preset feature requirements, so that the features of the image are determined, and the accuracy and efficiency of dangerous article detection are improved.
[0040] Embodiment 2
[0041] Based on the method shown in FIG. 1, the application further provides another dangerous article detection method. Figure 1 As shown in FIG. 2, the method comprises the following steps: Figure 2 As shown in FIG. 2, the method comprises the following steps: Figure 2 Step S201: obtaining a perspective image of a security check object.
[0042] Step S201: obtaining a perspective image of a security check object.
[0043] Step S202: preprocessing the perspective image to obtain a preprocessed image of the security check object.
[0044] The format of the preprocessed image is a JPEG format.
[0045] Here, random spatial transformation and noise addition are performed on each picture in the preprocessed image of the security check object to form new pictures and add the new pictures to a picture data set, so that the quantity and diversity of the data are improved.
[0046] Step S203: inputting the preprocessed image into the pre-trained dangerous goods identification model to output a feature pyramid of the preprocessed image.
[0047] Wherein, the picture features are extracted using a CNN network: the preprocessed image is input into the trained neural network, the neural network performs forward calculation, and the last convolutional layer and the pooling layer output a feature matrix F i of the picture, i represents the feature matrix obtained by the i-th layer of the convolutional neural network, then starting from the feature matrix F i of the uppermost layer, up-sampling is performed downwardly to obtain a feature matrix The feature F of the i-th layer and the feature F i-1 of the i-1-th layer are fused to obtain The feature matrix is taken as the feature of the i-1-th layer of the convolutional neural network, and the feature simultaneously contains information of a lower layer and abstract information of a higher layer. The feature F i-1 is down-sampled, and the feature F i-2 is fused to obtain Similarly, the feature F is obtained by starting from the feature matrix F i of the uppermost layer, down-sampling is performed upwardly to obtain a feature matrix F i+1 , and F i+2 Through the above up-sampling and down-sampling, a feature pyramid of the preprocessed image is obtained
[0048] In the embodiment, the dangerous goods identification model is obtained through steps A1-A2 as follows:
[0049] Step A1: obtaining preset training set data; the training set data includes: original images and synthetic images with preset annotation information; the synthetic images are used to indicate a perspective image of a sample and a combined image of the perspective image and the background.
[0050] Here, a large number of security check objects are scanned using an X-ray security check machine to obtain a certain number of image sample data, the sample data including sample data containing dangerous goods and sample data not containing dangerous goods. The objects in the security check objects are individually scanned and imaged to obtain individual images of each object, and a picture synthesis algorithm is used to combine the individual pictures of the objects and a large number of background pictures to generate rich synthetic data.
[0051] Step A2: training a preset initial neural network according to the training set data until a preset training end condition is met to obtain a trained dangerous goods identification model.
[0052] In the embodiment, the above step A2 is specifically implemented through steps B1-B6 as follows:
[0053] Step B1: Set the parameters of the region of interest of the initial neural network based on the size of the sample.
[0054] Step B2: Perform feature extraction on the original image and the synthetic image based on the initial neural network to obtain a training set feature pyramid.
[0055] Step B3: Generate a training set region of interest corresponding to the training set feature pyramid according to the training set feature pyramid.
[0056] Step B4: Classify the training set region of interest based on a preset classifier to obtain a predicted value of the training set data; the predicted value includes: the position coordinates of the training set region of interest and the item category probability vector of the preset annotation information corresponding to the training set region of interest.
[0057] In one possible implementation, after step B4, the method further includes: filtering the predicted values based on a non-maximum suppression algorithm to obtain a preset number of predicted values.
[0058] Step B5: Calculate the loss value of the dangerous goods recognition model according to the predicted value and the true value of the training set region of interest.
[0059] Here, the preset loss function value is used for back propagation on the dangerous goods recognition model. The batch gradient descent algorithm is used to update the parameters of the model until all training set data are cycled once.
[0060] Step B6: Adjust the parameters of the initial neural network according to the loss value, and continue to train the network after the parameter adjustment until a preset training end condition is met to obtain a trained dangerous goods recognition model.
[0061] Here, the training set data is divided into a preset number of batches of data, and steps B1-B6 are performed on each batch of data, i.e., the feature pyramid of the training set data is obtained, the predicted value and the loss value are obtained, and the model parameter adjustment is performed once.
[0062] In one possible implementation, after step B6, the method further includes steps B7-B8:
[0063] Step B7: Obtain a preset test set data; the test set data includes: an original image with the preset annotation information and a synthetic image; the synthetic image is used to indicate a perspective image of a sample and a combined image of the perspective image background.
[0064] Step B8: Test the dangerous goods recognition model according to the test set data until a preset training end condition is met to obtain a tested dangerous goods recognition model.
[0065] In another possible implementation, after step B8, the method further includes the following steps B9-B10:
[0066] Step B9: collecting error data in the test set data based on the dangerous goods identification model; the error data is used to indicate that the test set data does not meet the preset training result after testing the dangerous goods identification model.
[0067] Step B10: training the dangerous goods identification model according to the error data until a preset training end condition is met, to obtain an adjusted dangerous goods identification model.
[0068] Step S204: determining a region of interest in the preprocessed image according to the feature pyramid.
[0069] Step S205: determining whether the security check object contains dangerous goods based on the region of interest, to obtain a detection result.
[0070] In one implementation, the step of determining whether the security check object contains dangerous goods based on the region of interest, to obtain a detection result, includes: performing filtering on a detection box in the region of interest and preset annotation information corresponding to the detection box based on a non-maximum suppression algorithm, to determine whether the security check object contains dangerous goods, to obtain a detection result; the preset annotation information includes a dangerous goods category and a position.
[0071] Here, a bounding box prediction network and a classification network are used to predict the bounding box and category of an object on a feature map: since the feature pyramid of the preprocessed image contains features of different levels and different sizes, the features of the bottom layer have a small receptive field and contain more specific and small information of the original picture, such as the edges of lines and corner points, which is beneficial to detecting small objects; the features of the high layer have a large receptive field and represent more abstract semantic features, which is beneficial to detecting large objects; meanwhile, the abstract features of the high layer are fused into the features of the low layer through up-sampling, to further improve the detection performance of small objects. The bounding box prediction network and the classification network are used to respectively perform bounding box detection and classification on each layer of features of the feature pyramid, to obtain a large number of candidate box sets.
[0072] The embodiment of the present application provides a dangerous goods detection method, which comprises the following steps: obtaining a perspective image of a security check object; performing preprocessing on the perspective image to obtain a preprocessed image of the security check object; inputting the preprocessed image into a pre-trained dangerous goods identification model to output a feature pyramid of the preprocessed image; determining an interest region in the preprocessed image according to the feature pyramid; and determining whether the security check object contains dangerous goods based on the interest region to obtain a detection result. The method quickly determines the feature pyramid of the image through a preset model, and determines the interest region of the preprocessed image according to the feature pyramid, thereby further improving the accuracy and efficiency of dangerous goods detection.
[0073] Embodiment 3
[0074] The embodiment of the present application also provides a dangerous goods detection device, as shown in the figure, which is a structural schematic diagram of a dangerous goods detection device provided by the embodiment of the present application, comprising: Figure 3
[0075] The image acquisition module 31 is used for acquiring a perspective image of a security check object.
[0076] The image preprocessing module 32 is used for performing preprocessing on the perspective image to obtain a preprocessed image of the security check object.
[0077] The interest region determination module 33 is used for inputting the preprocessed image into a pre-trained dangerous goods identification model to output an interest region in the preprocessed image; the interest region is a region meeting a preset feature requirement.
[0078] The detection result determination module 34 is used for determining whether the security check object contains dangerous goods based on the interest region to obtain a detection result.
[0079] The image acquisition module 31, the image preprocessing module 32, the interest region determination module 33 and the detection result determination module 34 are sequentially connected.
[0080] In one of the implementation manners, the interest region determination module 33 is further used for inputting the preprocessed image into a pre-trained dangerous goods identification model to output a feature pyramid of the preprocessed image; and the interest region in the preprocessed image is determined according to the feature pyramid.
[0081] In one of the implementation manners, the detection result determination module 34 is further used for performing screening on a detection frame in the interest region and preset annotation information corresponding to the detection frame based on a non-maximum suppression algorithm to determine whether the security check object contains dangerous goods and obtain a detection result; the preset annotation information comprises a dangerous goods category and a position.
[0082] In one of the embodiments, the device further comprises a dangerous object recognition model generation module; the dangerous object recognition model generation module is configured to obtain preset training set data; the training set data comprises original images and synthetic images with preset annotation information; the synthetic images are used to indicate combined images of perspective images of samples and backgrounds of the perspective images; and an initial neural network is trained according to the training set data until a preset training end condition is met, so as to obtain a trained dangerous object recognition model.
[0083] In one of the embodiments, the dangerous object recognition model generation module is further configured to set parameters of a region of interest of the initial neural network based on the size of the sample; perform feature extraction on the original images and the synthetic images based on the initial neural network, so as to obtain a training set feature pyramid; generate training set regions of interest corresponding to the training set feature pyramid according to the training set feature pyramid; classify the training set regions of interest based on a preset classifier, so as to obtain predicted values of the training set data; the predicted values comprise position coordinates of the training set regions of interest and an item category probability vector of the preset annotation information corresponding to the training set regions of interest; calculate a loss value of the dangerous object recognition model according to the predicted values and true values of the training set regions of interest; adjust parameters of the initial neural network according to the loss value, and continue to train the network after the parameters are adjusted until a preset training end condition is met, so as to obtain the trained dangerous object recognition model.
[0084] In one of the embodiments, the dangerous object recognition model generation module is further configured to screen the predicted values based on a non-maximum suppression algorithm, so as to obtain a preset number of the predicted values.
[0085] In one of the embodiments, the dangerous object recognition model generation module is further configured to obtain preset test set data; the test set data comprises original images and synthetic images with preset annotation information; the synthetic images are used to indicate combined images of perspective images of samples and backgrounds of the perspective images; and the dangerous object recognition model is tested according to the test set data until a preset training end condition is met, so as to obtain a tested dangerous object recognition model.
[0086] In one of the embodiments, the dangerous object recognition model generation module is further configured to collect error data in the test set data based on the dangerous object recognition model; the error data are used to indicate data that do not meet a preset training result after the test set data are tested by the dangerous object recognition model; and the dangerous object recognition model is trained according to the error data until a preset training end condition is met, so as to obtain an adjusted dangerous object recognition model.
[0087] In one embodiment, the image preprocessing module 32 is further configured to crop the blank area of the perspective image to obtain an intermediate image to be detected, and scale the intermediate image to be detected to obtain the preprocessed image.
[0088] The dangerous goods detection device provided by the embodiments has the same technical features as the dangerous goods detection method provided by the above embodiments, and can solve the same technical problems and achieve the same technical effects. Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the device described above can refer to the corresponding process in the foregoing method embodiments, which will not be described here.
[0089] Embodiment 4
[0090] The embodiment provides an electronic device, including a processor and a memory, the memory stores computer executable instructions capable of being executed by the processor, and the processor executes the computer executable instructions to implement the steps of the dangerous goods detection method.
[0091] The embodiment provides a computer readable storage medium, wherein the computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement the steps of the dangerous goods detection method.
[0092] Referring to Figure 4 The electronic device includes a memory 41 and a processor 42, the memory 41 stores a computer program capable of running on the processor 42, and the processor executes the computer program to implement the steps provided by the dangerous goods detection method.
[0093] As Figure 4 The device further includes a bus 43 and a communication interface 44, the processor 42, the communication interface 44 and the memory 41 are connected through the bus 43, and the processor 42 is configured to execute executable modules stored in the memory 41, such as a computer program.
[0094] The memory 41 can include a high-speed random access memory (RAM) and can also include a non-volatile memory, such as at least one disk memory. The communication between the system network element and at least one other network element is realized through at least one communication interface 44 (which can be wired or wireless), and the Internet, a wide area network, a local area network, a metropolitan area network, etc. can be used.
[0095] The bus 43 can be an ISA bus, a PCI bus or an EISA bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For the convenience of representation, Figure 4 Figure 4Only one bidirectional arrow is used to represent both directions, but does not indicate that there is only one bus or only one type of bus.
[0096] The memory 41 is configured to store a program, and the processor 42 is configured to execute the program after receiving an execution instruction. The method performed by the dangerous goods detection device according to any one of the embodiments of the present application can be applied to the processor 42 or implemented by the processor 42. The processor 42 can be an integrated circuit chip with a signal processing capability. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor 42 or an instruction in the form of software. The processor 42 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; or a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. Each method, step and logic block diagram disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in combination with the embodiments of the present application can be directly embodied as a hardware code processor for execution, or a combination of hardware and software modules in the code processor for execution. The software module can be located in a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register or other mature storage medium in the art. The storage medium is located in the memory 41, and the processor 42 reads information in the memory 41 and combines the hardware to complete the steps of the above method.
[0097] Further, the embodiment of the present application further provides a machine readable storage medium, the machine readable storage medium stores machine executable instructions, when the machine executable instructions are called and executed by the processor 42, the machine executable instructions cause the processor 42 to implement the above dangerous goods detection method.
[0098] The electronic device and the computer readable storage medium provided by the embodiments of the present application have the same technical features, so they can also solve the same technical problems and achieve the same technical effects.
[0099] In addition, in the description of the embodiments of the present application, unless specifically defined and limited, the terms "mounting", "connection", "connecting" should be understood in a broad sense, for example, can be fixedly connected, can also be detachably connected, or integrally connected; can be mechanically connected, can also be electrically connected; can be directly connected, can also be indirectly connected through an intermediate medium, can be internal communication of two elements. For those skilled in the art, the specific meaning of the above terms in the present application can be understood according to the specific circumstances.
[0100] In the description of the present application, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer" and the like indicate the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present application and simplifying the description, and do not indicate or imply that the devices or elements referred to must have a particular orientation, be constructed and operated in a particular orientation, and therefore cannot be understood as a limitation on the present application. In addition, the terms "first", "second", "third" are only for the purpose of description, and cannot be understood as indicating or implying relative importance.
Claims
1. A hazardous material detection method characterized by, The method comprises: obtaining a perspective image of a security check object; preprocessing the perspective image to obtain a preprocessed image of the security check object; inputting the preprocessed image into a pre-trained dangerous goods identification model to output a region of interest in the preprocessed image; the region of interest is a region that meets a preset feature requirement; based on the region of interest, determining whether the security check object contains dangerous goods to obtain a detection result; wherein the step of inputting the preprocessed image into the pre-trained dangerous goods identification model to output the region of interest in the preprocessed image, wherein the region of interest is a region that meets a preset feature requirement, comprises: inputting the preprocessed image into the pre-trained dangerous goods identification model to output a feature pyramid of the preprocessed image; determining the region of interest in the preprocessed image according to the feature pyramid; and the step of determining whether the security check object contains dangerous goods based on the region of interest to obtain a detection result comprises: based on a non-maximum suppression algorithm, filtering the detection frame in the region of interest and the preset annotation information corresponding to the detection frame to determine whether the security check object contains dangerous goods to obtain a detection result; the preset annotation information includes the category and position of the dangerous goods; wherein the dangerous goods identification model is obtained by the following method: obtaining a preset training set data; the training set data includes: original images and synthetic images with the preset annotation information; the synthetic image is used to indicate the combination of the perspective image of the sample and the background of the perspective image; training a preset initial neural network according to the training set data until a preset training end condition is met to obtain the trained dangerous goods identification model; the step of training a preset initial neural network according to the training set data until a preset training end condition is met to obtain the trained dangerous goods identification model comprises: setting the parameters of the region of interest of the initial neural network based on the size of the sample; extracting features from the original image and the synthetic image based on the initial neural network to obtain a training set feature pyramid; generating a training set region of interest corresponding to the training set feature pyramid according to the training set feature pyramid; classifying the training set region of interest based on a preset classifier to obtain a predicted value of the training set data; the predicted value includes: the position coordinates of the training set region of interest and the item category probability vector of the preset annotation information corresponding to the training set region of interest; calculating the loss value of the dangerous goods identification model according to the predicted value and the true value of the training set region of interest; adjusting the parameters of the initial neural network according to the loss value, and continuing to train the network after the parameter adjustment until a preset training end condition is met to obtain the trained dangerous goods identification model; after classifying the training set region of interest based on a preset classifier to obtain a predicted value of the training set data, the method further comprises: filtering the predicted value based on a non-maximum suppression algorithm to obtain a preset number of predicted values.
2. The hazardous substance detection method according to claim 1, characterized by, The method further comprises: acquire preset test set data; the test set data includes: original images with preset annotation information and synthetic images; the synthetic images are used to indicate perspective images of samples and combined images of backgrounds of the perspective images; test the dangerous goods identification model according to the test set data until a preset training end condition is met, to obtain the tested dangerous goods identification model.
3. The hazardous substance detection method according to claim 2, characterized by, After the step of testing the dangerous goods identification model according to the test set data until a preset training end condition is met, to obtain the tested dangerous goods identification model, the method further includes: collect error data in the test set data based on the dangerous goods identification model; the error data are used to indicate data that do not meet a preset training result after the test set data is tested by the dangerous goods identification model; train the dangerous goods identification model according to the error data until a preset training end condition is met, to obtain an adjusted dangerous goods identification model.
4. The hazardous object detection method according to claim 1, wherein The step of preprocessing the perspective image to obtain a preprocessed image of the security check object includes: cropping a blank area of the perspective image to obtain an intermediate to-be-detected image; scaling the intermediate to-be-detected image to obtain the preprocessed image.
5. A hazardous substance detection apparatus characterized by comprising: A device for implementing the method of claim 1, comprising: an image acquisition module configured to acquire a perspective image of a security check object; an image preprocessing module configured to preprocess the perspective image to obtain a preprocessed image of the security check object; an area of interest determination module configured to input the preprocessed image into a pre-trained dangerous goods identification model and output an area of interest in the preprocessed image; the area of interest is an area that meets a preset feature requirement; a detection result determination module configured to determine whether the security check object contains dangerous goods based on the area of interest to obtain a detection result; a dangerous goods model generation module configured to acquire preset training set data; the training set data includes: original images with preset annotation information and synthetic images; the synthetic images are used to indicate perspective images of samples and combined images of backgrounds of the perspective images; train a preset initial neural network according to the training set data until a preset training end condition is met, to obtain a trained dangerous goods identification model; The dangerous identification model generation module is configured to set parameters of a region of interest of the initial neural network based on a size of the sample, perform feature extraction on the original image and the synthetic image based on the initial neural network, and obtain a training set feature pyramid; generate a training set region of interest corresponding to the training set feature pyramid according to the training set feature pyramid; classify the training set region of interest based on a preset classifier, and obtain a predicted value of the training set data; the predicted value includes position coordinates of the training set region of interest and an item category probability vector of the preset annotation information corresponding to the training set region of interest; calculate a loss value of the dangerous identification model according to the predicted value and a true value of the training set region of interest; adjust parameters of the initial neural network according to the loss value, and continue to train the network after the parameters are adjusted, until a preset training end condition is met, and a trained dangerous identification model is obtained; The dangerous identification model generation module is further configured to screen the predicted value based on a non-maximum suppression algorithm, and obtain a preset number of predicted values.
Citation Information
Patent Citations
Deformable convolution hybrid task cascade semantic segmentation method based on embedded balance
CN111210443A
Dangerous material detection method and device, computer equipment and storage medium
CN113723462A