A method, system, device and storage medium for detecting concealed contraband

By acquiring and processing the standard deviation of the segmented images, and combining it with thresholding and integral functions, the real-time response problem of deep learning algorithms when the package portion is displayed is solved, achieving efficient and accurate detection of contraband.

CN120876480BActive Publication Date: 2025-12-05HUNAN SUKE INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511384851.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-09-26
Publication Date
2025-12-05
Estimated Expiration
2045-09-26

AI Technical Summary

Technical Problem

In existing technologies, target detection algorithms driven by deep learning require a complete package image as a prerequisite for processing. When the package is partially displayed during transmission, it is difficult to respond in real time, resulting in a time difference between the detection process and the transmission process, which restricts the overall security inspection efficiency.

Method used

By obtaining the standard deviation of the current image segment and combining it with the standard deviation of several historical images segment, a first image is generated. Based on the threshold and the standard deviation of the image, images of contraband are cropped, and the detection results are calculated using a preset integral function, thereby improving detection efficiency and accuracy.

Benefits of technology

This technology enables the prohibited items identification process to be initiated before the package has fully passed through the security scanner, shortening the average time from the start of entry into the security scanner to the completion of the inspection, and improving the efficiency and accuracy of prohibited items detection in packages.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120876480B_ABST
    Figure CN120876480B_ABST
Patent Text Reader

Abstract

The application discloses a parcel contraband detection method, system, device and storage medium. The parcel contraband detection method comprises the following steps: calculating a first image standard deviation of a current slice image; in the case that there are a plurality of historical slice images of the current slice image and the first image standard deviation is less than a first threshold value, obtaining second image standard deviations of the plurality of historical slice images, and in the case that all the plurality of second historical slice images are less than the first threshold value, generating a first image according to the current slice image and the plurality of second historical slice images; calculating a third image standard deviation of each slice image in the first image; based on a second threshold value and the third image standard deviation, intercepting a contraband image in the first image; determining a first detection result of the contraband image, and calculating a detection result of all contrabands in the contraband image based on the first detection result and a preset integral function, thereby improving the efficiency and accuracy of parcel contraband detection.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of parcel contraband detection, and in particular to a parcel contraband detection method, system, device and storage medium. BACKGROUND

[0002] At present, the detection of contraband is mainly carried out through a target detection algorithm driven by deep learning, and auxiliary image judgment is achieved through automatic analysis of scanned images, which reduces the artificial pressure to a certain extent. However, the target detection algorithm driven by deep learning needs a complete parcel image as a prerequisite for processing. When the parcel is partially displayed during transmission, the target detection algorithm driven by deep learning is difficult to respond in real time, resulting in a time difference between the detection link and the transmission process, and restricting the overall security efficiency. SUMMARY

[0003] The present application aims to at least solve the technical problems existing in the prior art. To this end, the present application provides a parcel contraband detection method, system, device and storage medium, which can improve the efficiency and accuracy of parcel contraband detection.

[0004] In a first aspect of the present application, a parcel contraband detection method is provided, comprising the following steps:

[0005] obtaining a current slice image; wherein the current slice image is an image frame of a parcel passing collected by a security inspection machine at a current time;

[0006] calculating a first image standard deviation of the current slice image;

[0007] in the case that there are a plurality of historical slice images of the current slice image and the first image standard deviation is less than a first threshold, obtaining a second image standard deviation of the plurality of historical slice images, wherein the plurality of historical slice images are all image frames of a parcel passing collected before the current time;

[0008] in the case that the plurality of second historical slice images are all less than the first threshold, generating a first image according to the current slice image and the plurality of second historical slice images; wherein the plurality of second historical slice images are consecutive adjacent image frames, and there is a historical slice image adjacent to the current slice image in the plurality of second historical slice images, and the adjacent historical slice image collected before the earliest second historical slice image in the plurality of second historical slice images is a first historical slice image, the first historical slice image is a historical slice image with an image standard deviation greater than or equal to the first threshold, and the second historical slice image is a historical slice image with an image standard deviation less than the first threshold;

[0009] calculating a third image standard deviation of each of the slice images in the first image;

[0010] based on the second threshold value and the third image standard deviation, intercepting the contraband image in the first image;

[0011] determining a first detection result of the contraband image, wherein the first detection result comprises a contraband category, a contraband minimum circumscribed rectangle, a contraband confidence value, and a package detection number of a package in which the contraband is located;

[0012] based on the first detection result and a preset integral function, calculating a detection result of all contrabands in the contraband image.

[0013] The package contraband detection method according to the embodiments of the present application has at least the following beneficial effects:

[0014] The method comprises the following steps: acquiring a current slice image; calculating a first image standard deviation of the current slice image; in the case that there are a plurality of historical slice images of the current slice image and the first image standard deviation is less than a first threshold value, acquiring a second image standard deviation of the plurality of historical slice images, wherein the plurality of historical slice images are all image frames of a package passing through collected before the current time; in the case that the plurality of second historical slice images are all less than the first threshold value, generating a first image according to the current slice image and the plurality of second historical slice images; calculating a third image standard deviation of each of the slice images in the first image; based on the second threshold value and the third image standard deviation, intercepting the contraband image in the first image; determining a first detection result of the contraband image, and based on the first detection result and a preset integral function, calculating a detection result of all contrabands in the contraband image. The first image standard deviation, the second image standard deviation, and the first threshold value are used to screen out a to-be-detected image with a package, and then the second threshold value and the third image standard deviation are used to intercept a contraband image of the to-be-detected image in the to-be-detected image with a package, and based on the first detection result of the contraband image and the preset integral function, a detection result of all contrabands in the contraband image is calculated, thereby improving the efficiency and accuracy of package contraband detection.

[0015] According to some embodiments of the present application, before the current slice image is acquired, the method further comprises:

[0016] acquiring a first initial image, a second initial image, and a third initial image, wherein the first initial image is an image collected in the case that the x-ray is turned off and no package passes through the security inspection machine, the second initial image is an image collected in the case that the x-ray is turned on and no package passes through the security inspection machine, and the third initial image is an initial image collected in the case that the x-ray is turned on and a package passes through the security inspection machine at the current time, and the image width of the third initial image is equal to a preset width;

[0017] calculating a pixel average value of each row in the first initial image; and calculating a pixel average value of each row in the second initial image;

[0018] The obtaining the current slice image comprises:

[0019] The third initial image is normalized based on the pixel average value of each row in the first initial image and the pixel average value of each row in the second initial image, to obtain the current slice image.

[0020] According to some embodiments of the present application, the intercepting the contraband image in the first image based on the second threshold value and the third image standard deviation comprises:

[0021] Obtaining a moving direction of the package;

[0022] Determining all package images in the first image and a point coordinate set of each package image by a contour extraction algorithm;

[0023] Connecting adjacent points in the point coordinate set of each package image by a straight line to obtain a closed-loop image region of each package image;

[0024] Vertically slicing each closed-loop image region according to a preset width to obtain a second image and a coordinate of each second image;

[0025] Sorting the second image based on the moving direction of the package and the coordinate of the second image to obtain a sorted package image;

[0026] Iterating through each sorted package image to filter out all sorted package images whose third image standard deviation is less than the second threshold value as third images;

[0027] Iterating through each sorted package image to filter out all sorted package images whose third image standard deviation is greater than or equal to the second threshold value as fourth images;

[0028] Intercepting the contraband image based on the third images and the fourth images.

[0029] According to some embodiments of the present application, the intercepting the contraband image based on the third images and the fourth images comprises:

[0030] Numbering the sorted package image according to a preset rule to obtain a number of the sorted package image, wherein the number is a constant value;

[0031] A first mark symbol is added to each of the third images, and a second mark symbol is added to each of the fourth images, wherein the first mark symbol is different from the second mark symbol;

[0032] Each of the sorted package images is traversed, and a first number of a first sorted package image with the first mark symbol is obtained as a first number based on a first preset direction;

[0033] Each of the sorted package images is traversed, and a second number of a first sorted package image with the second mark symbol is obtained as a second number based on a second preset direction, wherein the first preset direction and the second preset direction are opposite directions;

[0034] In a case where the first preset direction is the same as the package moving direction and the first number is greater than or equal to the second number, the sorted package images are screened by a preset screening rule based on the first number and the second number, and a fifth image is obtained;

[0035] A minimum circumscribed rectangle containing all the fifth images is calculated;

[0036] An image in which the minimum circumscribed rectangle of the fifth image is located is intercepted as the contraband image.

[0037] According to some embodiments of the present application, the first image is generated according to the current slice image and the plurality of second historical slice images, including:

[0038] In a case where the first preset direction is the same as the package moving direction, the current slice image and the plurality of second historical slice images are sequentially spliced in ascending order of time to obtain the first image;

[0039] In a case where the second preset direction is the same as the package moving direction, the current slice image and the plurality of second historical slice images are sequentially spliced in descending order of time to obtain the first image.

[0040] According to some embodiments of the present application, the first detection result of the contraband image is determined, including:

[0041] The contraband image is input into a trained neural network detection model to obtain the first detection result output by the trained neural network detection model;

[0042] The number of package detections of a package in which a contraband corresponding to each of the minimum circumscribed rectangles of the contraband in the first detection result is obtained.

[0043] According to some embodiments of the present application, the calculation of the detection result of each contraband in the contraband image based on the first detection result and a preset integral function comprises:

[0044] obtaining the horizontal coordinate of the first preset vertex of each minimum bounding rectangle of the contraband, the vertical coordinate of the first preset vertex of the minimum bounding rectangle of the contraband, the rectangular width of the minimum bounding rectangle of the contraband, and the rectangular length of the minimum bounding rectangle of the contraband;

[0045] in the case where the number of package detections is one, taking the horizontal coordinate of the first preset vertex of each minimum bounding rectangle of the contraband, the vertical coordinate of the first preset vertex, the rectangular width, the rectangular length, and the contraband confidence value as the detection result of the corresponding contraband in the contraband image;

[0046] in the case where the number of package detections is greater than one, obtaining the historical detection result of each contraband at the previous moment;

[0047] calculating a package weight factor at the current moment based on a preset integral function and the number of package detections;

[0048] calculating the detection result of the corresponding contraband in the contraband image based on the horizontal coordinate of the first preset vertex of each minimum bounding rectangle of the contraband, the vertical coordinate of the first preset vertex, the rectangular width, the rectangular length, and the contraband confidence value, the historical detection result, and the package weight factor.

[0049] In a second aspect of the present application, a package contraband detection system is provided, which comprises:

[0050] a data acquisition module configured to acquire a current slice image; wherein the current slice image is an image frame of a package passing acquired by a security inspection machine at a current moment;

[0051] a first image standard deviation calculation module configured to calculate a first image standard deviation of the current slice image;

[0052] a second image standard deviation acquisition module configured to, in the case where the current slice image has a plurality of historical slice images and the first image standard deviation is less than a first threshold value, acquire a second image standard deviation of the plurality of historical slice images, wherein the plurality of historical slice images are all image frames of a package passing acquired before the current moment;

[0053] The first image generation module is configured to generate a first image according to the current slice image and a plurality of second historical slice images when the plurality of second historical slice images are all less than the first threshold value; wherein the plurality of second historical slice images are consecutive adjacent image frames, and there is a historical slice image in the plurality of second historical slice images that is an adjacent image frame of the current slice image, and a second historical slice image that is the earliest in the plurality of second historical slice images is adjacent to a first historical slice image that is collected before the second historical slice image, the first historical slice image is a historical slice image with an image standard deviation greater than or equal to the first threshold value, and the second historical slice image is a historical slice image with an image standard deviation less than the first threshold value;

[0054] The third image standard deviation calculation module is configured to calculate a third image standard deviation of each slice image in the first image.

[0055] The image intercepting module is configured to intercept a contraband image in the first image based on a second threshold value and the third image standard deviation.

[0056] The first detection result determination module is configured to determine a first detection result of the contraband image, wherein the first detection result includes a contraband category, a minimum circumscribed rectangle of the contraband, a contraband confidence value, and a package detection number of a package in which the contraband is located.

[0057] The contraband detection result calculation module is configured to calculate a detection result of all contrabands in the contraband image based on the first detection result and a preset integral function.

[0058] The system obtains a current split image, calculates a first image standard deviation of the current split image, obtains second image standard deviations of a plurality of historical split images in a case that the first image standard deviation is less than a first threshold and that the current split image has the plurality of historical split images, the plurality of historical split images being all image frames collected before the current time and through which a package passes, generates a first image according to the current split image and the plurality of second historical split images in a case that the plurality of second historical split images are all less than the first threshold, calculates third image standard deviations of each split image in the first image, intercepts a contraband image in the first image based on a second threshold and the third image standard deviations, determines a first detection result of the contraband image, and calculates detection results of all contrabands in the contraband image based on the first detection result and a preset integral function. The first image standard deviation, the second image standard deviation and the first threshold are used to screen a to-be-detected image with a package, and then the second threshold and the third image standard deviations are used to intercept a contraband image of the to-be-detected image in the to-be-detected image with the package, and the detection results of all contrabands in the contraband image are calculated according to the first detection result of the contraband image and the preset integral function, thereby improving the efficiency and accuracy of package contraband detection.

[0059] In a third aspect, the present application provides a package contraband detection electronic device, comprising at least one control processor and a memory connected in communication with the at least one control processor; the memory stores instructions executable by the at least one control processor, and the instructions are executed by the at least one control processor to enable the at least one control processor to perform the package contraband detection method described above.

[0060] In a fourth aspect, the present application provides a computer-readable storage medium, which stores computer-executable instructions for causing a computer to perform the package contraband detection method described above.

[0061] It should be noted that the beneficial effects of the second aspect to the fourth aspect of the present application and the prior art are the same as those of the above-mentioned package contraband detection system and the prior art, which will not be described here.

[0062] Additional aspects and advantages of the present application will be in part apparent and in part pointed out hereinafter. BRIEF DESCRIPTION OF DRAWINGS

[0063] The above and / or additional aspects and advantages of the present application will become apparent and be readily appreciated from the following description, including the appended drawings.

[0064] Figure 1 is a flowchart of an embodiment of the package contraband detection method provided by the present application;

[0065] Figure 2 is a structural schematic diagram of an embodiment of a parcel contraband detection system provided by the present application;

[0066] Figure 3 is a structural schematic diagram of an embodiment of an electronic device provided by the present application. DETAILED DESCRIPTION

[0067] The embodiments of the present application will be described in detail below, examples of the embodiments are shown in the drawings, wherein the same or similar reference signs represent the same or similar elements or elements having the same or similar functions throughout. The embodiments described below by referring to the drawings are exemplary and are only used to explain the present application, and cannot be understood as a limitation of the present application.

[0068] In the description of the present application, if the first, second, etc. are described, it is only for the purpose of distinguishing technical features, and cannot be understood as indicating or implying the relative importance of the indicated technical features or implicitly indicating the number of the indicated technical features or the sequence of the indicated technical features.

[0069] In the description of the present application, it should be understood that the orientation description, such as the orientation or position relationship indicated by up, down, etc. is based on the orientation or position relationship shown in the drawings, and is only for the convenience of describing the present application and simplifying the description, and therefore cannot be understood as indicating or implying that the indicated device or element must have a particular orientation, be constructed and operated in a particular orientation, and therefore cannot be understood as a limitation of the present application.

[0070] In the description of the present application, it should be noted that, unless otherwise explicitly limited, the words such as setting, installing, connecting, etc. should be broadly understood, and the person skilled in the art can reasonably determine the specific meaning of the above words in the present application in combination with the specific content of the technical solution.

[0071] At present, contraband detection is mainly performed through a target detection algorithm driven by deep learning, auxiliary image judgment is achieved through automatic analysis of scanned images, and the artificial pressure is reduced to a certain extent, but the target detection algorithm driven by deep learning needs to take a complete parcel image as a processing premise, and when the parcel is partially displayed during transmission, the target detection algorithm driven by deep learning is difficult to respond in real time, thereby causing a time difference between the detection link and the transmission process, and restricting the overall security efficiency.

[0072] In order to solve the above technical defects, the embodiments of the present application provide a parcel contraband detection method, system, device and storage medium.

[0073] Please refer to Figure 1 is a flowchart of a parcel contraband detection method provided by the embodiments of the present application, the method is applied to an electronic device, which can be a server or the like. As shown inFigure 1 The package contraband detection method includes:

[0074] Step S101, acquiring a current slice image; wherein the current slice image is an image frame of a package passing collected by the security inspection machine at a current time;

[0075] Step S102, calculating a first image standard deviation of the current slice image;

[0076] Step S103, in the case that the current slice image has a plurality of historical slice images and the first image standard deviation is less than a first threshold value, acquiring a second image standard deviation of the plurality of historical slice images, wherein the plurality of historical slice images are all image frames of the package passing collected before the current time;

[0077] Step S104, in the case that the plurality of second historical slice images are all less than the first threshold value, generating a first image according to the current slice image and the plurality of second historical slice images; wherein the plurality of second historical slice images are consecutive adjacent image frames, and there is a historical slice image adjacent to the current slice image in the plurality of second historical slice images, and the adjacent historical slice image collected before the earliest second historical slice image in the plurality of second historical slice images is the first historical slice image, the first historical slice image is a historical slice image with an image standard deviation greater than or equal to the first threshold value, and the second historical slice image is a historical slice image with an image standard deviation less than the first threshold value;

[0078] Step S105, calculating a third image standard deviation of each slice image in the first image;

[0079] Step S106, based on a second threshold value and the third image standard deviation, intercepting a contraband image in the first image;

[0080] Step S107, determining a first detection result of the contraband image, wherein the first detection result includes a contraband category, a minimum circumscribed rectangle of the contraband, a confidence value of the contraband, and a package detection number of a package where the contraband is located;

[0081] Step S108, calculating a detection result of all contrabands in the contraband image based on the first detection result and a preset integral function.

[0082] The first threshold value can be a value set in advance according to actual needs, which can be 1 pixel.

[0083] The second threshold value can be a value set in advance according to actual needs, which can be 1.5 pixels.

[0084] The preset integral function can be an integral function set in advance according to actual needs.

[0085] The image standard deviation can be calculated by a meanStdDev function of OpenCV (Open Source Computer Vision Library).

[0086] Specifically, the method further comprises:

[0087] In a case where the first image standard deviation is greater than or equal to the first threshold value, ending the parcel contraband detection on the current slice image.

[0088] Specifically, the method further comprises:

[0089] In a case where the current slice image does not exist the several historical slice images and the first image standard deviation is less than the first threshold value, taking the current slice image as the first image.

[0090] Specifically, the method further comprises:

[0091] In a case where the several second historical slice images are all less than the first threshold value, generating the first image according to the current slice image and the several second historical slice images; wherein the several second historical slice images are continuous adjacent image frames, and there is a historical slice image adjacent to the current slice image in the several second historical slice images, and the earliest one of the several second historical slice images in the collection time is the earliest one of the historical slice images in the collection time, the first historical slice image is a historical slice image with an image standard deviation greater than or equal to the first threshold value, and the second historical slice image is a historical slice image with an image standard deviation less than the first threshold value.

[0092] The method comprises the following steps: acquiring a current slice image; calculating a first image standard deviation of the current slice image; in the case that there are a plurality of historical slice images of the current slice image and the first image standard deviation is less than a first threshold value, acquiring a second image standard deviation of the plurality of historical slice images, wherein the plurality of historical slice images are all image frames of a package passing through collected before the current time; in the case that the plurality of second historical slice images are all less than the first threshold value, generating a first image according to the current slice image and the plurality of second historical slice images; calculating a third image standard deviation of each slice image in the first image; based on the second threshold value and the third image standard deviation, intercepting a contraband image in the first image; determining a first detection result of the contraband image, and calculating a detection result of all contrabands in the contraband image based on the first detection result and a preset integral function. The first image standard deviation, the second image standard deviation and the first threshold value are used to screen out a to-be-detected image with a package, and then the second threshold value and the third image standard deviation are used to intercept a contraband image of the to-be-detected image in the to-be-detected image with the package, and the first detection result of the contraband image and the preset integral function are used to calculate the detection result of all contrabands in the contraband image, thereby improving the efficiency and accuracy of package contraband detection.

[0093] In some embodiments, before the current slice image is acquired, the method further comprises:

[0094] Step S201, acquiring a first initial image, a second initial image and a third initial image, wherein the first initial image is an image collected in the case that the x-ray is turned off and no package passes through the security inspection machine, the second initial image is an image collected in the case that the x-ray is turned on and no package passes through the security inspection machine, and the third initial image is an initial image collected in the case that the x-ray is turned on and a package passes through the security inspection machine at the current time, and the image width of the third initial image is equal to a preset width;

[0095] Step S202, calculating the pixel average value of each row in the first initial image; and calculating the pixel average value of each row in the second initial image;

[0096] The current slice image is acquired, comprising:

[0097] Step S203, based on the pixel average value of each row in the first initial image and the pixel average value of each row in the second initial image, performing normalization processing on the third initial image to obtain the current slice image.

[0098] The above-mentioned preset width can be a value set in advance according to actual needs, and can be 50 pixels.

[0099] In step S203, the third initial image is normalized based on the first pixel average value and the second pixel average value to obtain the current slice image. The current slice image can be obtained by normalizing the third initial image based on the first pixel average value and the second pixel average value according to the following formula:

[0100] ;

[0101] wherein, is a pixel value of a first row and a first column of the current slice image, is a pixel value of a first row and a first column of the third initial image, is a pixel average value of the first row in the first initial image, is a pixel average value of the first row in the second initial image. The application improves the accuracy of the current slice image by normalizing the third initial image based on the pixel average value of each row in the first initial image and the pixel average value of each row in the second initial image to obtain the current slice image.

[0102] In some embodiments, step S106 can include but is not limited to steps S301-S308:

[0103] In some embodiments, step S106 can include but is not limited to steps S301-S308:

[0104] Step S301, obtaining a moving direction of the package;

[0105] Step S302, determining all package images in the first image and a point coordinate set of each package image by a contour extraction algorithm;

[0106] Step S303, connecting adjacent points in the point coordinate set of each package image to obtain a closed loop image region of each package image;

[0107] Step S304, vertically slicing each closed loop image region according to a preset width to obtain a second image and a coordinate of each second image;

[0108] Step S305, sorting the second image based on the moving direction of the package and the coordinate of the second image to obtain a sorted package image;

[0109] Step S306, traversing each sorted package image to filter out all sorted package images with a third image standard deviation less than a second threshold value as the third image;

[0110] ​​​​​Step S307, traversing each sorted parcel image, screening all sorted parcel images with a third image standard deviation greater than or equal to a second threshold value as a fourth image;

[0111] Step S308, based on the third image and the fourth image, intercepting the contraband image.

[0112] The above-mentioned preset width can be a value set in advance according to actual needs, which can be 5 pixels.

[0113] In the above step S302, the determination of all parcel images in the first image and the point coordinate set of each parcel image through the contour extraction algorithm can be the determination of all parcel images in the first image and the point coordinate set of each parcel image through the findContours function of OpenCV.

[0114] In the above step S305, the sorting of the second image based on the parcel moving direction and the coordinates of the second image to obtain the sorted parcel image can be ascending sorting of the second image in the opposite direction of the parcel moving direction according to the coordinates of the second image to obtain the sorted parcel image.

[0115] The present application provides data basis for subsequent parcel contraband detection by intercepting the contraband image, and improves the efficiency of parcel contraband detection.

[0116] In some embodiments, step S308 can include but is not limited to steps S401 to S407:

[0117] Step S401, numbering the sorted parcel image according to a preset rule to obtain the number of the sorted parcel image, wherein the number is a constant value;

[0118] Step S402, adding a first mark symbol to each third image; adding a second mark symbol to each fourth image, wherein the first mark symbol and the second mark symbol are different;

[0119] Step S403, traversing each sorted parcel image, based on a first preset direction, obtaining the number of the sorted parcel image with the first mark symbol as a first mark symbol as a first number;

[0120] Step S404, traversing each sorted parcel image, based on a second preset direction, obtaining the number of the sorted parcel image with the first mark symbol as a second mark symbol as a second number, wherein the first preset direction and the second preset direction are opposite directions;

[0121] Step S405: In a case where the first preset direction is the same as the moving direction of the package and the first number is greater than or equal to the second number, the sorted package images are screened by a preset screening rule based on the first number and the second number to obtain fifth images.

[0122] Step S406: A minimum bounding rectangle containing all the fifth images is calculated.

[0123] Step S407: An image in which the minimum bounding rectangle of the fifth image is located is intercepted as a contraband image.

[0124] The first mark symbol can be a value set in advance according to actual needs, and can be 0.

[0125] The first mark symbol can be a value set in advance according to actual needs, and can be 1.

[0126] The first preset direction can be a direction set in advance according to actual needs.

[0127] The second preset direction can be a direction set in advance according to actual needs.

[0128] In step S405, in a case where the first preset direction is the same as the moving direction of the package and the first number is greater than or equal to the second number, the sorted package images are screened by a preset screening rule based on the first number and the second number to obtain fifth images. The fifth images can be sorted package images with numbers q, q+1, …, p-1, which are screened out in a case where the first preset direction is the same as the moving direction of the package and p is greater than q, where p is the first number and q is the second number.

[0129] In step S406, the minimum bounding rectangle containing all the fifth images is calculated by the boundingRect function of OpenCV.

[0130] The present application improves the efficiency and accuracy of package contraband detection by intercepting the image in which the minimum bounding rectangle of the fifth image is located as a contraband image, and taking the contraband image as subsequent data.

[0131] In some embodiments, step S104 can include but is not limited to steps S501 to S502:

[0132] Step S501: In a case where the first preset direction is the same as the moving direction of the package, the current split image and a plurality of second historical split images are image spliced in ascending order of time to obtain a first image.

[0133] In the case that the second preset direction is the same as the moving direction of the package, the current split image and a plurality of second historical split images are stitched in a time descending order to obtain a first image.

[0134] The application improves the accuracy of the first image by sequentially stitching the current split image and the plurality of second historical split images to obtain the first image.

[0135] In some embodiments, step S107 can include but is not limited to steps S601-S602:

[0136] Step S601: input the contraband image into the trained neural network detection model to obtain a first detection result output by the trained neural network detection model;

[0137] Step S602: obtain the number of package detections of the package where each contraband corresponds to the minimum bounding rectangle in the first detection result.

[0138] The application outputs the first detection result by the neural network detection model and obtains the number of package detections, which provides data basis for subsequent calculation of the detection result of the contraband, and improves the efficiency and accuracy of the detection of the contraband in the package.

[0139] In some embodiments, step S108 can include but is not limited to steps S701-S705:

[0140] Step S701: obtain the horizontal coordinate of the first preset vertex of each contraband minimum bounding rectangle, the vertical coordinate of the first preset vertex of the contraband minimum bounding rectangle, the rectangular width of the contraband minimum bounding rectangle, and the rectangular length of the contraband minimum bounding rectangle;

[0141] Step S702: in the case that the number of package detections is one, the horizontal coordinate of the first preset vertex of each contraband minimum bounding rectangle, the vertical coordinate of the first preset vertex, the rectangular width, the rectangular length, and the contraband confidence value are taken as the detection result of the corresponding contraband in the contraband image;

[0142] Step S703: in the case that the number of package detections is greater than one, the historical detection result of each contraband at the previous moment is obtained;

[0143] Step S704: calculate the package weight factor at the current moment based on a preset integral function and the number of package detections;

[0144] Step S705: based on the horizontal coordinate of the first preset vertex of each contraband minimum bounding rectangle, the horizontal coordinate of the first preset vertex, the rectangular width, the rectangular length, and the contraband confidence value, the historical detection result, and the package weight factor, the detection result of the corresponding contraband in the contraband image is calculated.

[0145] The first preset vertex can be a top-left corner vertex.

[0146] The historical detection result includes a historical horizontal coordinate of a first preset vertex of each contraband minimum circumscribed rectangle, a historical vertical coordinate of the first preset vertex, a historical rectangle width, a historical rectangle length, and a historical contraband confidence value at a previous time.

[0147] In step S704, the parcel weight factor at the current time based on the preset integral function and the parcel detection number can be calculated by the following formula based on the preset integral function and the parcel detection number:

[0148]

[0149] wherein, is the parcel weight factor at the current time when the parcel detection number is n, is an integral variable with an integral interval of 0 to 1, is the parcel weight factor when the parcel detection number is n.

[0150] In some embodiments, step S705 can include, but is not limited to, steps S7051 to S7056:

[0151] Step S7051, the current horizontal coordinate is calculated based on the horizontal coordinate of the first preset vertex, the historical horizontal coordinate of the first preset vertex, and the parcel weight factor at the current time by the following formula:

[0152]

[0153] wherein, is the current horizontal coordinate, is the horizontal coordinate of the first preset vertex, is the historical horizontal coordinate of the first preset vertex.

[0154] Step S7052, the current vertical coordinate is calculated based on the vertical coordinate of the first preset vertex, the historical vertical coordinate of the first preset vertex, and the parcel weight factor at the current time by the following formula:

[0155]

[0156] wherein, is the current vertical coordinate, is the vertical coordinate of the first preset vertex, is the historical vertical coordinate of the first preset vertex.

[0157] ​​​​​Step S7053, the current rectangle width is calculated based on the rectangle width, the historical rectangle width and the package weight factor at the current time by the following formula:

[0158] ;

[0159] wherein, the current rectangle width, the rectangle width, the historical rectangle width.

[0160] Step S7054, the current rectangle length is calculated based on the rectangle length, the historical rectangle length and the package weight factor at the current time by the following formula:

[0161] ;

[0162] wherein, the current rectangle length, the rectangle length, the historical rectangle length.

[0163] Step S7055, the current contraband confidence value is calculated based on the contraband confidence value, the historical contraband confidence value and the package weight factor at the current time by the following formula:

[0164] ;

[0165] wherein, the current contraband confidence value, the contraband confidence value, the historical contraband confidence value.

[0166] Step S7056, the current horizontal coordinate, the current vertical coordinate, the current rectangle width, the current rectangle length and the current contraband confidence value are taken as the detection result of the corresponding contraband in the contraband image.

[0167] The present application can start the contraband identification process when the package is not completely through the security inspection machine, breaking the traditional detection mode of "waiting for complete image", so that the average time consumption of the package from entering the security inspection machine to the completion of the detection of all contraband is shortened by seventy percent.

[0168] In addition, with reference to Figure 2 , one embodiment of the present application provides a package contraband detection system, comprising a data acquisition module 1100, a first image standard deviation calculation module 1200, a second image standard deviation acquisition module 1300, a first image generation module 1400, a third image standard deviation calculation module 1500, an image intercepting module 1600, a first detection result determination module 1700 and a contraband detection result calculation module 1800, wherein:

[0169] The data acquisition module 1100 is configured to acquire a current slice image; wherein the current slice image is an image frame of a package passing acquired by the security inspection machine at a current time;

[0170] The first image standard deviation calculation module 1200 is configured to calculate a first image standard deviation of the current slice image;

[0171] The second image standard deviation acquisition module 1300 is configured to acquire a second image standard deviation of a plurality of historical slice images in a case that the current slice image exists and the first image standard deviation is less than a first threshold value, wherein the plurality of historical slice images are all image frames of the package passing acquired before the current time;

[0172] The first image generation module 1400 is configured to generate a first image according to the current slice image and a plurality of second historical slice images in a case that the plurality of second historical slice images are all less than the first threshold value; wherein the plurality of second historical slice images are continuous adjacent image frames, and there is a historical slice image adjacent to the current slice image in the plurality of second historical slice images, and a historical slice image adjacent to the earliest second historical slice image in the plurality of second historical slice images is a first historical slice image, the first historical slice image is a historical slice image with an image standard deviation greater than or equal to the first threshold value, and the second historical slice image is a historical slice image with an image standard deviation less than the first threshold value;

[0173] The third image standard deviation calculation module 1500 is configured to calculate a third image standard deviation of each slice image in the first image;

[0174] The image interception module 1600 is configured to intercept a contraband image in the first image based on a second threshold value and the third image standard deviation;

[0175] The first detection result determination module 1700 is configured to determine a first detection result of the contraband image, wherein the first detection result includes a contraband category, a minimum bounding rectangle of the contraband, a confidence value of the contraband, and a package detection number of a package in which the contraband is located;

[0176] The contraband detection result calculation module 1800 is configured to calculate a detection result of all contrabands in the contraband image based on the first detection result and a preset integral function.

[0177] The system obtains a current slice image, calculates a first image standard deviation of the current slice image, obtains second image standard deviations of a plurality of historical slice images in a case that the first image standard deviation is less than a first threshold and the current slice image has the plurality of historical slice images, the plurality of historical slice images being all image frames collected before the current time and through which a package passes, generates a first image according to the current slice image and the plurality of second historical slice images in a case that the plurality of second historical slice images are all less than the first threshold, calculates a third image standard deviation of each slice image in the first image, intercepts a contraband image in the first image based on a second threshold and the third image standard deviation, determines a first detection result of the contraband image, and calculates detection results of all contrabands in the contraband image based on the first detection result and a preset integral function. The first image standard deviation, the second image standard deviation and the first threshold are used to screen a to-be-detected image with a package, and then the second threshold and the third image standard deviation are used to intercept a contraband image of the to-be-detected image in the to-be-detected image with the package, and the first detection result of the contraband image and the preset integral function are used to calculate the detection results of all contrabands in the contraband image, thereby improving the efficiency and accuracy of package contraband detection.

[0178] It should be noted that the system embodiment and the method embodiment described above are based on the same inventive concept, and therefore the related content of the method embodiment described above is also applicable to the system embodiment, which will not be described here.

[0179] Figure 3 A hardware structure schematic diagram of package contraband detection provided by an embodiment of the application is shown.

[0180] The package contraband detection device can include a processor 301 and a memory 302 having computer program instructions stored therein.

[0181] Specifically, the processor 301 described above can include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or can be configured as one or more integrated circuits that implement one or more embodiments of the application.

[0182] The memory 302 can include mass storage for data or instructions. As an example and not by way of limitation, the memory 302 can include a Hard Disk Drive (HDD), a floppy disk drive, a flash memory, a Compact Disc (CD) or other optical disk, a Universal Serial Bus (USB) drive, or a combination of two or more of these. Where appropriate, the memory 302 can include removable or non-removable (or fixed) media, where appropriate. Where appropriate, the memory 302 can be internal or external to the integrated gateway disaster recovery appliance. In particular embodiments, the memory 302 is non-volatile, solid-state memory.

[0183] In some embodiments, the memory 302 can include read-only memory (ROM), random-access memory (RAM), a disk storage medium device, an optical storage medium device, a flash memory device, an electrical, optical, or other physical / tangible memory storage device. Thus, generally, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., a memory device) encoded with software that, when executed (e.g., by the one or more processors), is operable to perform operations described with reference to the methods according to an aspect of the present disclosure.

[0184] The processor 301 implements any one of the parcel contraband detection methods in the above embodiments by reading and executing computer program instructions stored in the memory 302.

[0185] In one example, the parcel contraband detection device can further include a communication interface 303 and a bus 310. Wherein, as shown in the figure, the processor 301, the memory 302, the communication interface 303 are connected through the bus 310 and complete the communication between each other. Figure 3

[0186] The communication interface 303 is mainly used to realize the communication between each module, device, unit and / or equipment in the embodiments of the present application.

[0187] ​Bus 310 includes a hardware, software, or both that couples components of the package contraband detection device to each other. By way of example, and not limitation, a bus can be an Accelerated Graphics Port (AGP) or other graphics bus, a Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a HyperTransport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an InfiniBand (IB) interconnect, a Low Pin Count (LPC) bus, a memory bus, a Micro Channel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local (VLB) bus, or another suitable bus or a combination of two or more of these. Where appropriate, bus 310 can include one or more buses. Although the present application is described and illustrated with a particular bus, the present application contemplates any suitable bus or interconnect.

[0188] The package contraband detection device can perform the package contraband detection method in the embodiments of the present application based on the three-dimensional design model, thereby realizing the package contraband detection method and system described in combination Figure 1 and Figure 2 with the above embodiments.

[0189] In addition, in combination with the package contraband detection method in the above embodiments, the embodiments of the present application can provide a computer storage medium to realize. The computer storage medium has computer program instructions stored thereon; the computer program instructions are executed by a processor to realize any one of the package contraband detection methods in the above embodiments.

[0190] It needs to be clear that the present application is not limited to the specific configurations and processes described above and shown in the drawings. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between steps, after understanding the spirit of the present application.

[0191] The functional blocks shown in the above block diagram can be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, they can be, for example, electronic circuits, application-specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, etc. When implemented in software, the elements of this application are programs or code segments used to perform the required tasks. Programs or code segments can be stored on a machine-readable medium or transmitted over a transmission medium or communication link via data signals carried on a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, fiber optic media, radio frequency (RF) links, etc. Code segments can be downloaded via computer networks such as the Internet, intranets, etc.

[0192] It should also be noted that the exemplary embodiments mentioned in this application describe methods or systems based on a series of steps or apparatus. However, this application is not limited to the order of the above steps; that is, the steps can be performed in the order mentioned in the embodiments, or in a different order, or several steps can be performed simultaneously.

[0193] The aspects of this disclosure have been described above with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block in the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that these instructions, executable via the processor of the computer or other programmable data processing apparatus, enable the implementation of the functions / actions specified in one or more blocks of the flowchart illustrations and / or block diagrams. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field-programmable logic circuit. It is also understood that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can also be implemented by special-purpose hardware performing the specified functions or actions, or can be implemented by a combination of special-purpose hardware and computer instructions.

[0194] The above merely describes a specific implementation of the present application. Those skilled in the art can clearly understand the specific working processes of the system, modules and units described above for the convenience and brevity of description, and can refer to the corresponding processes in the foregoing method embodiments, which will not be described herein again. It should be understood that the protection scope of the present application is not limited to this, and any person skilled in the art can easily think of various equivalent modifications or replacements within the technical range disclosed by the present application, and these modifications or replacements should be covered within the protection scope of the present application.

Claims

1. A contraband package detection method, characterized by, The parcel contraband detection method comprises: acquiring a current slice image; wherein the current slice image is an image frame of a parcel passing collected by the security inspection machine at a current time; calculating a first image standard deviation of the current slice image; in a case where the current slice image has a plurality of historical slice images and the first image standard deviation is less than a first threshold value, acquiring a second image standard deviation of the plurality of historical slice images, wherein the plurality of historical slice images are all image frames of a parcel passing collected before the current time; in a case where the plurality of second historical slice images are all less than the first threshold value, generating a first image according to the current slice image and the plurality of second historical slice images; wherein the plurality of second historical slice images are consecutive adjacent image frames, and there is a historical slice image adjacent to the current slice image in the plurality of second historical slice images, and an adjacent historical slice image collected before a second historical slice image with the earliest collection time in the plurality of second historical slice images is a first historical slice image, the first historical slice image is a historical slice image with an image standard deviation greater than or equal to the first threshold value, and the second historical slice image is a historical slice image with an image standard deviation less than the first threshold value; calculating a third image standard deviation of each slice image in the first image; based on a second threshold value and the third image standard deviation, intercepting a contraband image in the first image, specifically: acquiring a parcel moving direction; determining all parcel images in the first image and a point coordinate set of each parcel image through a contour extraction algorithm; connecting adjacent points in the point coordinate set of each parcel image to obtain a closed loop image region of each parcel image; vertically slicing each closed loop image region according to a preset width to obtain a second image and a coordinate of each second image; sorting the second image based on the parcel moving direction and the coordinate of the second image to obtain a sorted parcel image; traversing each sorted parcel image to filter out all sorted parcel images with a third image standard deviation less than the second threshold value as a third image; traversing each sorted parcel image to filter out all sorted parcel images with a third image standard deviation greater than or equal to the second threshold value as a fourth image; based on the third image and the fourth image, intercepting the contraband image; determining a first detection result of the contraband image, wherein the first detection result comprises a contraband category, a minimum circumscribed rectangle of the contraband, a contraband confidence value, and a parcel detection number of a parcel where the contraband is located; based on the first detection result and a preset integral function, calculating a detection result of all contrabands in the contraband image.

2. A method of contraband detection according to claim 1, wherein, Before the current slice image is acquired, the method further comprises: acquire a first initial image, a second initial image and a third initial image, wherein the first initial image is an image acquired when the x-ray is off and no package passes through the security inspection machine, the second initial image is an image acquired when the x-ray is on and no package passes through the security inspection machine, and the third initial image is an initial image acquired at the current moment when the x-ray is on and a package passes through the security inspection machine, and the image width of the third initial image is equal to a preset width; calculate the average value of the pixels in each row of the first initial image; and calculate the average value of the pixels in each row of the second initial image; the acquisition of the current slice image comprises: based on the average value of the pixels in each row of the first initial image and the average value of the pixels in each row of the second initial image, the third initial image is normalized to obtain the current slice image.

3. A method of contraband detection according to claim 2, wherein, the acquisition of the contraband image based on the third image and the fourth image comprises: numbering the sorted package images according to a preset rule to obtain the numbers of the sorted package images, wherein the numbers are constant values; adding a first marker symbol to each third image and a second marker symbol to each fourth image, wherein the first marker symbol is different from the second marker symbol; traversing each sorted package image, acquiring, based on a first preset direction, the number of the first sorted package image with the first marker symbol as the first number; traversing each sorted package image, acquiring, based on a second preset direction, the number of the first sorted package image with the second marker symbol as the second number, wherein the first preset direction and the second preset direction are opposite directions; when the first preset direction is the same as the moving direction of the package and the first number is greater than or equal to the second number, screening the sorted package images based on the first number and the second number through a preset screening rule to obtain a fifth image; calculating the minimum bounding rectangle containing all the fifth images; acquiring the image in which the minimum bounding rectangle of the fifth image is located as the contraband image.

4. A method of contraband detection according to claim 3, wherein, the generation of a first image according to the current slice image and a plurality of second historical slice images comprises: when the first preset direction is the same as the moving direction of the package, sequentially splicing the current slice image and the plurality of second historical slice images in ascending order of time to obtain the first image; when the second preset direction is the same as the moving direction of the package, sequentially splicing the current slice image and the plurality of second historical slice images in descending order of time to obtain the first image.

5. A method of contraband detection according to claim 4, wherein, the determination of the first detection result of the contraband image comprises: inputting the contraband image into a trained neural network detection model to obtain the first detection result output by the trained neural network detection model; Obtain the number of times of package detection of the package where each of the contraband minimum bounding rectangles corresponds to in the first detection result.

6. The method of claim 1, wherein, The detection result of all contraband in the contraband image is calculated based on the first detection result and a preset integral function, and the method comprises the steps of: Obtaining the horizontal coordinate of the first preset vertex of each of the contraband minimum bounding rectangles, the vertical coordinate of the first preset vertex of the contraband minimum bounding rectangle, the rectangular width of the contraband minimum bounding rectangle, and the rectangular length of the contraband minimum bounding rectangle; In the case where the number of times of package detection is one, the horizontal coordinate of the first preset vertex of each of the contraband minimum bounding rectangles, the vertical coordinate of the first preset vertex, the rectangular width, the rectangular length, and the contraband confidence value are taken as the detection result of the corresponding contraband in the contraband image; In the case where the number of times of package detection is greater than one, the historical detection result of each of the contraband at the previous moment is obtained; A package weight factor at the current moment is calculated based on a preset integral function and the number of times of package detection; The detection result of the corresponding contraband in the contraband image is calculated based on the horizontal coordinate of the first preset vertex of each of the contraband minimum bounding rectangles, the vertical coordinate of the first preset vertex, the rectangular width, the rectangular length, and the contraband confidence value, the historical detection result, and the package weight factor.

7. A contraband wrapped item detection system characterized by, The package contraband detection system comprises: A data acquisition module is configured to acquire a current slice image; wherein the current slice image is an image frame of a package passing through collected by a security inspection machine at a current moment; A first image standard deviation calculation module is configured to calculate a first image standard deviation of the current slice image; A second image standard deviation acquisition module is configured to, in the case where the current slice image exists a plurality of historical slice images and the first image standard deviation is less than a first threshold value, acquire a second image standard deviation of the plurality of historical slice images, wherein the plurality of historical slice images are all image frames of a package passing through collected before the current moment; A first image generation module is configured to, in the case where a plurality of second historical slice images are all less than the first threshold value, generate a first image according to the current slice image and the plurality of second historical slice images; wherein the plurality of second historical slice images are consecutive adjacent image frames, and there exists a historical slice image adjacent to the current slice image in the plurality of second historical slice images, and a historical slice image adjacent to the second historical slice image collected earliest in time is a first historical slice image, the first historical slice image is a historical slice image with an image standard deviation greater than or equal to the first threshold value, and the second historical slice image is a historical slice image with an image standard deviation less than the first threshold value; A third image standard deviation calculation module is configured to calculate a third image standard deviation of each slice image in the first image; An image interception module is configured to intercept a contraband image in the first image based on a second threshold value and the third image standard deviation, and specifically: Obtaining a moving direction of the package; Determining all package images in the first image and a point coordinate set of each package image by a contour extraction algorithm; Connecting adjacent points in the point coordinate set of each package image by a straight line to obtain a closed-loop image region of each package image; Vertically slicing each closed-loop image region according to a preset width to obtain a second image and a coordinate of each second image; Sorting the second image based on the moving direction of the package and the coordinate of the second image to obtain a sorted package image; Iterating through each sorted package image to filter out all sorted package images whose third image standard deviation is less than the second threshold value as a third image; Iterating through each sorted package image to filter out all sorted package images whose third image standard deviation is greater than or equal to the second threshold value as a fourth image; Based on the third image and the fourth image, intercepting the contraband image; A first detection result determination module is configured to determine a first detection result of the contraband image, wherein the first detection result includes a contraband category, a contraband minimum circumscribed rectangle, a contraband confidence value, and a package detection number of a package where the contraband is located; A contraband detection result calculation module is configured to calculate a detection result of all contrabands in the contraband image based on the first detection result and a preset integral function.

8. A contraband wrapped item detection apparatus, characterized by, The at least one control processor and a memory connected in communication with the at least one control processor; the memory stores instructions executable by the at least one control processor, and the instructions are executed by the at least one control processor to enable the at least one control processor to perform the package contraband detection method of any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: The computer readable storage medium stores computer executable instructions for causing a computer to perform the package contraband detection method of any one of claims 1 to 6.

Citation Information

Patent Citations

  • X-ray security check image prohibited article detection method based on style feature channel attention

    CN113657493A

  • Intelligent identification device and system for contraband goods

    CN113706497A