Parcel image processing method and device, computer device and storage medium
By using an image detection model based on object detection or semantic segmentation in the security inspection machine, combined with closed graphic annotation and judgment, the problem of poor package cutting effect in the existing technology is solved, and more accurate and efficient package image processing is achieved.
Patent Information
- Application Number
- CN202110687708.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-21
- Publication Date
- 2026-02-06
- Estimated Expiration
- 2041-06-21
AI Technical Summary
Existing image segmentation methods are not effective in cutting packages in security inspection machines, especially in the case of continuous or side-by-side packages and in the case of different security inspection machines with background noise imaging quality issues, resulting in poor generalization ability.
An image detection model based on object detection or semantic segmentation is used to identify and cut package images through closed graphic annotations, including rectangular boxes or edge contour graphic annotations. Combined with area comparison, size threshold and matching degree judgment, more accurate package cutting is achieved.
It improves the accuracy and generalization of package cutting, reduces unnecessary blank edges, saves storage resources, and supports further package processing.
Smart Images

Figure CN115512283B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of image processing, in particular to a parcel image processing method and device, computer equipment and storage medium. BACKGROUND
[0002] The security inspection machine is an electronic device that sends the checked goods into the X-ray inspection channel for inspection by means of a conveyor belt, and is widely used in public places such as subway stations, stations and airports. It can be specifically used for counting the number of luggage parcels, automatically detecting prohibited items, or in the logistics industry for automatically identifying and binding parcels with express barcodes. In the specific application process, an image recognition device is needed to accurately segment the multiple parcel pictures detected by the security inspection machine.
[0003] The current image segmentation method mainly includes two ways: one is that the security inspection machine manufacturer relies on sensors to cut pictures, and the other is that video images are cut. When cutting by relying on sensors, the cutting effect of continuous or side-by-side parcels is not good, and when cutting video images by relying on traditional image processing methods, imaging quality problems caused by different security inspection machine background noises will also lead to poor parcel cutting effect. It can be seen that the existing image cutting method has poor generalization ability. SUMMARY
[0004] Therefore, it is necessary to provide a parcel image processing method, device, computer equipment and storage medium to solve the above technical problems.
[0005] A parcel image processing method, the method comprising:
[0006] obtaining a to-be-processed image;
[0007] inputting the to-be-processed image into a pre-constructed image detection model, so that the pre-constructed image detection model detects a parcel image from the to-be-processed image; a parcel object contained in the parcel image is labeled by a closed graph;
[0008] outputting an image composed of the closed graph, and taking the image composed of the closed graph as a cut parcel image.
[0009] In one embodiment, the to-be-processed image includes a single image; after taking the image composed of the closed graph as the cut parcel image, the method further comprises:
[0010] if the ratio of the area of the cut parcel image to the area of the to-be-processed image is less than a preset proportion threshold, saving the cut parcel image and transmitting the cut parcel image to a parcel processing end.
[0011] In one of the embodiments, before the obtaining the image to be processed, the method further comprises:
[0012] obtaining a sample image; the package object contained in the sample image is labeled by the closed figure;
[0013] training the image detection model to be trained using the sample image to obtain the pre-constructed image detection model.
[0014] In one of the embodiments, the image to be processed comprises a video stream image; the inputting the image to be processed into the pre-constructed image detection model to make the pre-constructed image detection model detect the package image from the image to be processed comprises:
[0015] determining a sampling interval according to the frame rate of the video stream image;
[0016] sampling the video stream image according to the sampling interval to obtain a plurality of sampling images;
[0017] inputting the plurality of sampling images into the pre-constructed image detection model to make the pre-constructed image detection model detect a plurality of package images from the plurality of sampling images;
[0018] taking the plurality of package images as suspected package images;
[0019] After the taking the image composed of the closed figure as the cut package image, the method further comprises:
[0020] determining the suspected package image with the size of the closed figure greater than or equal to a size threshold as a real package image;
[0021] if the distance between the closed figure of the real package image and the input side of the package is greater than or equal to a distance threshold, determining the real package image as a complete package image; the input side of the package is a side representing the input direction of the package in the image to be processed;
[0022] if the matching degree between the complete package image and the pre-stored historical package image is greater than or equal to a matching degree threshold, determining the complete package image as a non-repeated package image and transmitting it to a package processing end.
[0023] In one of the embodiments, the method further comprises:
[0024] obtaining the output time interval of two adjacent cut package images;
[0025] if the output time interval is greater than or equal to a preset time threshold, outputting an abnormal alarm signal.
[0026] In one of the embodiments, the closed figure is a rectangular frame, and the pre-constructed image detection model is constructed based on a target detection model.
[0027] In one of the embodiments, the closed figure is an edge contour figure, and the pre-constructed image detection model is constructed based on a semantic segmentation model.
[0028] A parcel image processing apparatus, the apparatus comprising:
[0029] an image acquisition module configured to acquire a to-be-processed image;
[0030] a parcel detection module configured to input the to-be-processed image into a pre-constructed image detection model, so that the pre-constructed image detection model detects a parcel image from the to-be-processed image; a parcel object contained in the parcel image is labeled by a closed figure;
[0031] an image output module configured to output an image constituted by the closed figure, and take the image constituted by the closed figure as a cut parcel image.
[0032] A computer device comprising a memory and a processor, the memory storing a computer program, and the processor implementing the steps in the parcel image processing method embodiments as described above when executing the computer program.
[0033] A computer readable storage medium having a computer program stored thereon, the computer program being executed by a processor to implement the steps in the parcel image processing method embodiments as described above.
[0034] The above-mentioned parcel image processing method, apparatus, computer device and storage medium, acquire a to-be-processed image, input the to-be-processed image into a pre-constructed image detection model, so that the pre-constructed image detection model detects a parcel image from the to-be-processed image, and a parcel object contained in the parcel image is labeled by a closed figure; output an image constituted by the closed figure, and take the image constituted by the closed figure as a cut parcel image. The method can further cut the parcel, compared with the traditional method of cutting only in the flow direction of the security inspection machine, and can also cut in the direction perpendicular to the flow direction, so as to remove the redundant blank edge, which is beneficial to saving storage resources and facilitating further processing of the parcel image. BRIEF DESCRIPTION OF DRAWINGS
[0035] Figure 1 An application environment diagram of the parcel image processing method in one of the embodiments;
[0036] Figure 2 A flowchart of the parcel image processing method in one of the embodiments;
[0037] Figure 3 Flowchart of the package image processing method in another embodiment;
[0038] Figure 4 Flowchart of repeated package detection in an embodiment;
[0039] Figure 5 Flowchart of complete package and incomplete package in an embodiment
[0040] Figure 6 Block diagram of the structure of the package image processing device in an embodiment;
[0041] Figure 7 Internal structure diagram of the computer device in an embodiment. DETAILED DESCRIPTION
[0042] In order to make the purposes, technical solutions and advantages of the present application clearer, the present application is further described in detail below with reference to the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and do not limit the present application.
[0043] The package image processing method provided by the present application can be applied to the application environment as shown in Figure 1 . Among them, the server 101 communicates with the image detection device 102 on the security inspection machine through the network, and the communication is divided into two modes. One is the video stream mode, that is, the security inspection machine collects the package video stream through the VGA, DVI and other interfaces through the image detection device 102, and transmits the package video stream to the server 101 through a special data interface for further image processing. The other is the single image mode, that is, the image detection device 102 also contains a corresponding sensor, which obtains the cut package picture after cutting the collected package picture, and then transmits the cut package picture to the server 101 through the special interface opened by the security inspection machine manufacturer. This is the single image mode, and the image detection device 102 obtains the video stream or the single image of the package transmitted by the X-ray scanning security inspection machine. The image detection device server 101 can be a single server or can be implemented using a server cluster.
[0044] In an embodiment, as shown in Figure 2 , a package image processing method is provided. Taking the server 101 in Figure 1 as an example, the method includes the following steps:
[0045] Step S201, obtaining a to-be-processed image.
[0046] The to-be-processed image can be a package single image or a package video stream image detected by an image detection device on the security inspection machine using X-rays and transmitted to the server 101 image detection device through an image interface.
[0047] Specifically, the package single image or the package video stream is acquired by an image detection device on the security inspection machine.
[0048] When the security inspection machine collects a package video stream using a VGA or DVI interface through the image detection device 102, the security inspection machine manufacturer can open a special data interface to transmit the package video stream to the server 101 for further video stream processing. When the security inspection machine collects a package single image through the image detection device 102 and performs cutting processing on the package single image through a sensor, a cut single image is obtained. Since the package image in the cut single image still has a large number of blank areas, and different security inspection machine background noises and imaging problems can cause poor package cutting effect, the cutting method generalization ability is poor, and therefore further processing is required for the cut single image.
[0049] In step S202, the to-be-processed image is input into a pre-constructed image detection model, so that the pre-constructed image detection model detects a package image from the to-be-processed image; the package object contained in the package image is labeled by a closed graph.
[0050] The pre-constructed image detection model refers to an image detection model constructed based on a target detection model or a semantic segmentation method, which is used to identify and label target objects in an image, such as a package.
[0051] Specifically, after the server 101 acquires the single image or the video stream image, the image detection model is input into a pre-constructed image detection model, the image detection model identifies target objects in the image, such as a package, and cuts the packages from the original image. The cut image has only one package image, and each package is labeled by a closed graph, which is a rectangular frame or an edge contour graph.
[0052] In step S203, the image composed of the closed graph is output, and the image composed of the closed graph is taken as a cut package image.
[0053] Specifically, the server 101 outputs the package image detected and labeled by the image detection model, and takes the image composed of the closed graph as a cut package image.
[0054] The above embodiment obtains a to-be-processed image, inputs the to-be-processed image into a pre-constructed image detection model, so that the pre-constructed image detection model detects a parcel image from the to-be-processed image, a parcel object contained in the parcel image is labeled by a closed graph, an image formed by the closed image is output, and the image formed by the closed graph is taken as a cut parcel image. The method can further cut the parcel, and compared with the traditional method of cutting only in the flow direction of the security inspection machine, the method can also cut in a direction perpendicular to the flow direction, so that the excess blank edge is removed, and the further processing of the parcel image is facilitated.
[0055] In an embodiment, the to-be-processed image includes a single image, and after step S203, the method further includes: if a ratio of an area of the cut parcel image to an area of the to-be-processed image is less than a preset proportion threshold, saving the cut parcel image and transmitting the cut parcel image to a parcel processing end.
[0056] Specifically, the single image is a single image picture output by the security inspection machine, and is a picture obtained by cutting an original picture acquired by the security inspection machine manufacturer through a preset program. The model in this embodiment is used to further cut the image cut by the security inspection machine manufacturer. Since the security inspection machine manufacturer cuts in the horizontal direction (i.e., the conveying direction of the conveying belt of the security inspection machine), there are still a large number of blank areas on the top and bottom sides of the parcel image. In this embodiment, the parcel object is labeled by a closed graph, and the closed graph is output. When the area of the closed graph (i.e., the cut parcel image) is less than the preset proportion threshold, it is indicated that the blank area in the original single image is too large, and thus the original single image is discarded. The image labeled by the closed graph is saved as the cut parcel image, and the cut parcel image is transmitted to the parcel processing end for further processing, such as counting the number of parcels. When the coincidence degree of the cut parcel image and the original single image is greater than or equal to the preset proportion threshold, it is indicated that the cutting effect of the original single image is good, and thus the original single image is saved. For the continuous and side-by-side parcel images that cannot be cut, when the image detection model detects that multiple parcels are contained in a single picture, the multiple parcel images are saved separately.
[0057] The above embodiment compares the areas of the parcel images detected in the single picture mode, so that the excess blank area is cut, and a better cutting effect is achieved.
[0058] In an embodiment, before step S201, the method further includes: acquiring a sample image; a parcel object contained in the sample image is labeled by a closed graph; and using the sample image to train a to-be-trained image detection model to obtain the pre-constructed image detection model.
[0059] The sample images refer to images containing various packaged objects, including both complete and incomplete packages. These sample images primarily consist of packages with significant blank areas, continuous packages, and side-by-side packages. These packages can be labeled using bounding boxes or along their edges. To reduce the workload, bounding boxes are preferred. The `labelImg` file is used to label the data, and the labeled images are saved in XML format.
[0060] The labeled files are used to train the image detection model to be trained. The model parameters are adjusted, and finally, the pre-built image detection model can be obtained that can recognize the package.
[0061] The above embodiments train the model by acquiring a large number of sample images, thereby obtaining an image detection model that can identify packages, improving the model's recognition accuracy, and providing a data foundation for further package processing.
[0062] In one embodiment, such as Figure 3 As shown, Figure 3 The flowchart illustrates the steps of package detection in video stream mode. The image to be processed includes a video stream image. Step S202 includes:
[0063] Step S301: Determine the sampling interval based on the frame rate of the video stream image.
[0064] Specifically, the frame rate of the video stream image varies depending on the settings of the security inspection machine manufacturer. If the frame rate of the acquired video stream image is 30 frames per second, then the sampling detection is determined to be 1 / 3 second, that is, 3 frames of images are sampled per second. This ensures that no object package is missed and that the number of overlapping images is relatively small.
[0065] Step S302: Sample the video stream image according to the above sampling interval to obtain multiple sampled images;
[0066] Specifically, the video stream is sampled according to the above sampling interval to obtain multiple images. For example, in the above steps, 3 sampled images are obtained per second.
[0067] Step S303: Input multiple sampled images into the pre-built image detection model so that the pre-built image detection model can detect multiple package images from the multiple sampled images;
[0068] Specifically, the sampled images are input into the pre-built image detection model, which detects multiple package images and uses closed graphics to label each package image.
[0069] Step S304, the above plurality of parcel images are regarded as suspected parcel images;
[0070] Specifically, since in the video stream detection mode, image noise is easily mistaken for a parcel, the above plurality of parcel images are regarded as suspected parcel images for the next step of detection.
[0071] Step S305, the suspected parcel image whose closed figure size is greater than or equal to a size threshold value is determined as a real parcel image.
[0072] Specifically, if the size of the detected parcel closed figure is less than the set size threshold value, it is determined that the parcel is noise, and the result is not saved. If the closed figure is a rectangular frame, the length-width ratio of the detected parcel rectangular frame exceeds the set threshold value, it is a long strip-shaped image, and it is determined that the size is abnormal parcel, and the image in the rectangular frame is not saved. Otherwise, the rectangular frame is a non-noise parcel to be processed, and the next step is continued.
[0073] Step S306, if the distance between the closed figure of the real parcel image and the input side of the parcel is greater than or equal to a distance threshold value, the real parcel image is determined as a complete parcel image; the input side of the parcel is a side in the to-be-processed image representing the input direction of the parcel.
[0074] Specifically, as shown in Figure 4 , for the rectangular frame filtered in step S305, whether it is a complete parcel is judged by the distance between the rectangular frame and the input screen side. When the distance is greater than the set threshold value, it is determined to be a complete parcel, otherwise it is an incomplete parcel. Taking from left to right as an example, the distance between the left edge of the first detected rectangular frame on the left side of the screen and the left side of the screen is judged. When the distance is less than the set threshold value, it is determined that the parcel is an incomplete parcel, otherwise it is a complete parcel. When the left parcel is an incomplete parcel, the next parcel is judged, and so on. When it is determined that the current parcel is a complete parcel, the traversal is stopped, and the parcel image is saved.
[0075] Step S306, if the matching degree between the complete parcel image and the pre-stored historical parcel image is greater than or equal to a matching degree threshold value, the complete parcel image is determined as a non-repeated parcel image and transmitted to the parcel processing end.
[0076] Specifically, the first n parcel pictures cut off are saved in the template library in turn, and arranged from new to old according to the generation time. The newly cut parcel image is matched with the pictures in the template library in turn. When the matching similarity is greater than the set threshold value, it is determined that the parcel is an old saved picture, and then discarded; when the matching similarity is less than the set threshold value, it is determined that the parcel is a new parcel picture, and then the picture is saved. At the same time, the picture is updated to the template library, and the earliest picture in the template library is removed, so as to ensure that the number of pictures in the template library remains unchanged.
[0077] In order to solve the problem that the size of the cut-out picture is inaccurate when the same object is cut twice, when template matching is performed, a part of the newly cut-out package picture is selected to match the picture in the template library. For example, a template is generated with the center point of the newly cut-out picture as the center and the length and width of the template being 1 / 2 of the original size. In this way, when the same package exists, the selected template is the same part of the newly cut-out package picture and the picture in the template library, so that accurate matching is achieved.
[0078] Optionally, in the video stream detection mode, for the rectangular frame labeling method, the data result does not distinguish whether the package is complete; for the edge contour labeling method, the output result distinguishes whether the package is complete.
[0079] In addition, in the video stream training step, there may be a phenomenon that multiple packages exist in one image, and each package in the image is labeled separately during labeling. At the same time, since the package gradually enters the display, there is a phenomenon that only a part of the package exists in the image. As shown in FIG. 6, two labeling schemes are selected during labeling: (1) the incomplete package and the complete package are set as the same class and labeled as a package; (2) the incomplete package and the complete package are labeled separately and marked as two classes of incomplete package and complete package. In order to reduce the workload and error rate, the first labeling method is preferred. Figure 5
[0080] In the above embodiment, multiple packages in multiple sampling images obtained by video stream mode sampling are recognized, noise filtering, complete package and incomplete package are distinguished, and de-duplication processing is performed, so that the package that needs to be processed in the next step is obtained, which is beneficial to reduce the resource consumption of the next step.
[0081] In an embodiment, the above method further comprises: obtaining an output time interval of two adjacent cut-out package images; if the output time interval is greater than or equal to a preset time threshold, outputting an abnormal alarm signal.
[0082] Specifically, the server 101 records the input time of each frame of image and the output time of each cut-out picture.
[0083] If no new picture is input for more than (greater than or equal to) a set time, it may be due to that the security inspection machine host is closed or the signal line transmission fails, etc., resulting in no video and picture information input. At this time, an input abnormal alarm is generated.
[0084] If no cut-out package picture is output for more than (greater than or equal to) a set time, it may be due to that no package passes for a long time or the input image produces large distortion, etc., resulting in no cut-out package picture output. At this time, an output abnormal alarm is generated.
[0085] The above embodiment realizes the alarm prompt processing on the input and output abnormities through the alarm function, which is beneficial to timely find system faults and process them.
[0086] In an embodiment, the closed figure is a rectangular frame, and the pre-constructed image detection model is constructed based on a target detection model.
[0087] Specifically, when the rectangular frame mode is used for labeling, the target detection model is used to train the labeled data. Taking the rectangular frame labeling mode as an example, the model that can be selected includes a single-stage YOLO series detection model, a double-stage RCNN series target detection model, an anchor-free series such as a CenterNet model, a lightweight series such as a MobileNet model, an automatic network search network such as a NASNet, and the like.
[0088] The above embodiment realizes target detection by selecting a target detection model, and uses rectangular frame labeling, which is beneficial to further area calculation and comparison.
[0089] In an embodiment, the closed figure is an edge contour figure, and the pre-constructed image detection model is constructed based on a semantic segmentation model.
[0090] Specifically, when the edge contour labeling is used, the semantic segmentation method is used for model training. The model is optimized and the parameter setting is adjusted to ensure that the model has good detection performance. Taking the edge contour labeling as an example, the model that can be selected includes UNet, DeepLab, PSPnet, and the like. The model can also be optimized and adjusted, specifically including data enhancement, loss function adjustment, adjustment of a backbone network, use of a pre-trained model, model structure adjustment, multi-scale fusion, test enhancement, and the like.
[0091] The above embodiment realizes target detection by selecting a target detection model, and uses rectangular frame labeling, which is beneficial to further area calculation and comparison.
[0092] It should be understood that although each step in the above flowchart is displayed in sequence according to the indication of the arrow, these steps are not necessarily executed in sequence according to the indication of the arrow. Unless explicitly stated herein, the execution of these steps is not strictly limited in sequence, and these steps can be executed in other sequences. Moreover, at least part of the steps in the above flowchart can include multiple steps or multiple stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution sequence of these steps or stages is not necessarily sequential, but can be executed in rotation or alternation with at least part of other steps or steps or stages in other steps.
[0093] In one embodiment, as Figure 6As shown, a parcel image processing apparatus 600 is provided, comprising: an image acquisition module 601, a parcel detection module 602, and an image output module 603, wherein:
[0094] The image acquisition module 601 acquires a to-be-processed image.
[0095] The parcel detection module 602 is configured to input the to-be-processed image into a pre-constructed image detection model, so that the pre-constructed image detection model detects a parcel image from the to-be-processed image; a parcel object contained in the parcel image is labeled by a closed graph.
[0096] The image output module 603 is configured to output an image formed by the closed graph, and take the image formed by the closed graph as a cut parcel image.
[0097] In an embodiment, the to-be-processed image includes a single image, and the parcel image processing apparatus further comprises an image processing unit configured to, if a ratio of an area of the cut parcel image to an area of the to-be-processed image is less than a preset proportion threshold, save the cut parcel image and transmit the cut parcel image to a parcel processing end.
[0098] In an embodiment, the apparatus further comprises a model training unit configured to acquire a sample image; a parcel object contained in the sample image is labeled by the closed graph; and the pre-constructed image detection model is obtained by training a to-be-trained image detection model using the sample image.
[0099] In an embodiment, the to-be-processed image includes a video stream image; the parcel detection module 602 is further configured to determine a sampling interval according to a frame rate of the video stream image; sample the video stream image according to the sampling interval to obtain a plurality of sample images; input the plurality of sample images into the pre-constructed image detection model, so that the pre-constructed image detection model detects a plurality of parcel images from the plurality of sample images; and take the plurality of parcel images as suspected parcel images. The image processing unit is further configured to: determine a suspected parcel image with a size of the closed graph greater than or equal to a size threshold as a real parcel image; if a distance between the closed graph of the real parcel image and a parcel input side is greater than or equal to a distance threshold, determine the real parcel image as a complete parcel image; the parcel input side is a side representing a parcel input direction in the to-be-processed image; and if a matching degree between the complete parcel image and a pre-stored historical parcel image is greater than or equal to a matching degree threshold, determine the complete parcel image as a non-repeated parcel image and transmit the complete parcel image to the parcel processing end.
[0100] In an embodiment, an exception alarm unit is further included, configured to acquire an output time interval of two adjacent images of the cut parcel; and output an exception alarm signal if the output time interval is greater than or equal to a preset time threshold.
[0101] In an embodiment, the closed figure is a rectangular frame, and the pre-constructed image detection model is constructed based on a target detection model.
[0102] In an embodiment, the closed figure is an edge contour figure, and the pre-constructed image detection model is constructed based on a semantic segmentation model.
[0103] The specific limitations of the parcel image processing apparatus can refer to the limitations of the parcel image processing method described above, which will not be repeated here. Each module in the parcel image processing apparatus described above can be realized by software, hardware and their combination in whole or in part. The above-mentioned modules can be embedded in or independent of the processor in the computer device in hardware form, or can be stored in the memory in the computer device in the form of software, so as to call and execute the operations corresponding to each module by the processor.
[0104] In one embodiment, a computer device is provided, which can be a server, and its internal structure diagram can be as shown in Figure 7 The computer device includes a processor, a memory and a network interface connected by a system bus. The processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is configured to store parcel image data. The network interface of the computer device is configured to communicate with an external terminal through a network connection. The computer program is executed by the processor to implement a parcel image processing method.
[0105] Those skilled in the art can understand that Figure 7 The structure shown in the figure is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device can include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0106] In one embodiment, a computer device is provided, including a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the steps of the parcel image processing method embodiments described above.
[0107] In one embodiment, a computer readable storage medium is provided, having stored thereon a computer program which, when executed by a processor, implements the steps of the package image processing method embodiment as described above.
[0108] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiments can be completed by a computer program instructing related hardware, and the computer program can be stored in a non-volatile computer readable storage medium. When the computer program is executed, the processes of the above-mentioned embodiments can be included. Any reference to memory, storage, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration but not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0109] The technical features of the above embodiments can be combined in any way. In order to make the description simple, all possible combinations of the technical features in the above embodiments are not described, however, as long as the combination of the technical features does not exist contradictory, it should be considered as the scope of the present application.
[0110] The above embodiments only express several implementation manners of the present application, and the description is more specific and detailed, but it should not be understood as a limitation on the scope of the patent. It should be pointed out that for those of ordinary skill in the art, without departing from the concept of the present application, some modifications and improvements can be made, which are all within the scope of the present application. Therefore, the scope of the patent of the present application should be subject to the appended claims.
Claims
1. A parcel image processing method, characterized by, The method comprises: acquiring a to-be-processed image; inputting the to-be-processed image into a pre-constructed image detection model, so that the pre-constructed image detection model detects a parcel image from the to-be-processed image; a parcel object contained in the parcel image is labeled by a closed graph; outputting an image composed of the closed graph, and taking the image composed of the closed graph as a cut parcel image; the to-be-processed image comprises a video stream image; the inputting the to-be-processed image into the pre-constructed image detection model, so that the pre-constructed image detection model detects a parcel image from the to-be-processed image, comprises: determining a sampling interval according to a frame rate of the video stream image; sampling the video stream image according to the sampling interval to obtain a plurality of sampling images; inputting the plurality of sampling images into the pre-constructed image detection model, so that the pre-constructed image detection model detects a plurality of parcel images from the plurality of sampling images; taking the plurality of parcel images as suspected parcel images; after the taking the image composed of the closed graph as the cut parcel image, the method further comprises: determining a suspected parcel image with a closed graph size greater than or equal to a size threshold value as a real parcel image; if a distance between the closed graph of the real parcel image and a parcel input side is greater than or equal to a distance threshold value, determining the real parcel image as a complete parcel image; the parcel input side is a side representing a parcel input direction in the to-be-processed image; if a matching degree between the complete parcel image and a pre-stored historical parcel image is greater than or equal to a matching degree threshold value, determining the complete parcel image as a non-repeated parcel image and transmitting the complete parcel image to a parcel processing end; wherein, when template matching is performed, a part of a newly cut parcel picture is matched with a picture in a template library.
2. The method of claim 1, wherein, the to-be-processed image comprises a single image; after the taking the image composed of the closed graph as the cut parcel image, the method further comprises: if a ratio of an area of the cut parcel image to an area of the to-be-processed image is less than a preset proportion threshold value, saving the cut parcel image and transmitting the cut parcel image to the parcel processing end.
3. The method of claim 1, wherein, before the acquiring the to-be-processed image, the method further comprises: acquiring a sample image; a parcel object contained in the sample image is labeled by the closed graph; training a to-be-trained image detection model using the sample image to obtain the pre-constructed image detection model.
4. The method of claim 1, wherein, the method further comprises: acquiring an output time interval of two adjacent cut parcel images; if the output time interval is greater than or equal to a preset time threshold value, outputting an abnormal alarm signal.
5. The method according to any one of claims 1 to 4, characterized in that, the closed graph is a rectangular frame, and the pre-constructed image detection model is constructed based on a target detection model.
6. The method according to any one of claims 1 to 4, characterized in that, the closed graph is an edge contour graph, and the pre-constructed image detection model is constructed based on a semantic segmentation model.
7. A package image processing apparatus, characterized by comprising: the device comprises: an image acquisition module configured to acquire a to-be-processed image; The package detection module is configured to input the to-be-processed image into a pre-constructed image detection model, so that the pre-constructed image detection model detects a package image from the to-be-processed image; and a package object contained in the package image is labeled by a closed graph. The image output module is configured to output the image constituted by the closed graph, and output the image constituted by the closed graph as a cut package image. The to-be-processed image includes a video stream image; the package detection module is further configured to determine a sampling interval according to a frame rate of the video stream image; sample the video stream image according to the sampling interval to obtain a plurality of sampling images; input the plurality of sampling images into the pre-constructed image detection model, so that the pre-constructed image detection model detects a plurality of package images from the plurality of sampling images; and output the plurality of package images as suspected package images. The image processing unit is further configured to determine a suspected package image, in which the closed graph has a size greater than or equal to a size threshold, as a real package image; determine a complete package image if a distance between the closed graph of the real package image and a package input side is greater than or equal to a distance threshold, the package input side being a side representing a package input direction in the to-be-processed image; and determine a non-repeated package image if a matching degree between the complete package image and a pre-stored historical package image is greater than or equal to a matching degree threshold, and transmit the non-repeated package image to a package processing end, wherein, when template matching is performed, a part of a newly cut package image is matched with an image in a template library.
8. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that, The processor executes the computer program to implement the steps of the method in any one of claims 1 to 6.
9. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the method in any one of claims 1 to 6.
Citation Information
Patent Citations
Parcel detection method and device, computer readable storage medium and computer equipment
CN110378912A