Method, device, system and equipment for counting number of container bodies in container stack
Through multi-view image processing and target detection algorithms, the problem of inaccurate box counting when the stack is not full is solved, accurate counting of container stacks is achieved, and the scope of application of the automatic statistics scheme is expanded.
Patent Information
- Application Number
- CN202410242809.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-04
- Publication Date
- 2024-08-23
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing box counting scheme for container stacking cannot accurately obtain box counting results when the stack is not full.
Using multi-view image acquisition and target detection algorithms, through comprehensive processing of the main view, rear view, left view, right view and top view images, the number of boxes in the full stack part of the container stack and the number above are calculated The number of boxes ensures accurate counting even if there are missing boxes above the stack.
It expands the applicable scenarios of the automatic counting scheme for the number of boxes in the cargo stack, realizes accurate box counting under non-full stack conditions, and improves the accuracy and reliability of counting.
Smart Images

Figure CN118537397A
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of image processing technology, and in particular relates to a method, device, system and equipment for counting the number of boxes in a cargo box stack. Background Art
[0002] With the continuous development of the logistics industry, the cold chain warehousing industry is constantly increasing. The counting of boxes in the cargo box stacks in most cold chain warehouses requires manual counting, or the use of three-dimensional infrared sensors, visual sensors combined with artificial intelligence to automatically count the number of cargo boxes in the cargo stack.
[0003] In order to solve the problem of slow speed and false alarm risk in manual counting, the existing patent technology CN115908322A "Stacked Box Counting Method, Device, Equipment and Medium" proposes a solution to automatically count the number of boxes in a stack using two 2D cameras (one of which is arranged at the top of the passage and the other is arranged at the side of the passage), that is, the camera at the top obtains the number of boxes, and the camera on the side analyzes the number of box layers, and finally calculates the number of cartons in the stack. However, this solution can only be applied to neatly arranged full stacks. If there are missing boxes on the top of the stack, such as if there are two missing cartons on the top layer of a 3×3×3 rectangular box stack, the box counting result cannot be accurately obtained. Summary of the invention
[0004] The object of the present invention is to provide a method, device, system, computer equipment, computer readable storage medium and computer program product for counting the number of boxes in a cargo box stack, so as to solve the problem that the existing stack box counting scheme cannot accurately obtain the box counting result for the non-full stack situation.
[0005] In order to achieve the above object, the present invention adopts the following technical solutions:
[0006] In a first aspect, a method for counting the number of boxes in a stack of boxes is provided, comprising:
[0007] Acquire a front view image, a rear view image, a left view image, a right view image, and a top view image of a stack of cargo boxes, wherein the top view image is acquired by a 3D camera;
[0008] For each of the front view image, the rear view image, the left view image, and the right view image, box detection processing is performed on the corresponding image based on the first target detection algorithm to obtain the minimum number of boxes and the maximum number of boxes stacked on the corresponding view;
[0009] According to the minimum number of layers and the maximum number of columns of the cargo box stack on each viewing plane, the number of boxes in the full stack of the cargo box stack n is calculated according to the following formula:bottom :
[0010] n bottom =length×width×height
[0011] Where, length represents the length of the full stack of the container stack and length = max(A left ,A right ), width represents the length of the full stack of the cargo box and width = max(A main ,A rear ), height represents the height of the full stack of the cargo box and height = min (S left ,S right ,S main ,S rear ), A left A represents the maximum number of boxes stacked on the left side. right A represents the maximum number of boxes stacked on the right side. main A represents the maximum number of boxes stacked on the main viewing surface. rear Indicates the maximum number of boxes stacked on the rear view plane, S left Indicates the minimum number of layers of the cargo boxes stacked on the left viewing surface, S right Indicates the minimum number of layers of boxes stacked on the right viewing surface, S main Indicates the minimum number of layers of boxes stacked on the main viewing surface, S rear Indicates the minimum number of layers of the cargo boxes stacked on the rear view plane, max() indicates the maximum value function, and min() indicates the minimum value function;
[0012] Performing box detection processing on the top-view image based on a second object detection algorithm to obtain at least one top-surface box detection frame and at least one height value corresponding to the at least one top-surface box detection frame;
[0013] The height value H of the full stack portion of the container stack is determined from the at least one height value. full , and according to the height value H of the full stack part full The calculated box height h=H full / height;
[0014] For each top surface box detection frame in the at least one top surface box detection frame, the number of boxes above the corresponding full stack portion is calculated according to the following formula:
[0015]
[0016] In the formula, k is a positive integer, n is top,k represents the number of boxes above the full stack portion corresponding to the kth top box detection frame in the at least one top box detection frame, H k represents the height value corresponding to the k-th top box detection frame, and round() represents the rounding function;
[0017] According to the number of boxes n in the full stack of the cargo box stack bottom The total number of boxes in the stack of the cargo boxes N is calculated according to the following formula:
[0018]
[0019] Wherein, K represents the total number of detection frames of the at least one top surface box detection frame.
[0020] Based on the above invention content, a new solution is provided for automatically detecting boxes and completing counting based on main, rear, left and right top-view images, that is, after obtaining the main, rear, left and right view images of the cargo box stack, on the one hand, for each of the main, rear, left and right view images, the minimum number of boxes on the corresponding view surface and the maximum number of boxes in the stack are obtained through box detection processing, and on the other hand, at least one top box detection frame and at least one height value are obtained by performing box detection processing on the top-view image, and for each top box detection frame, the number of boxes above the corresponding full stack is calculated based on these height values, and finally the number of boxes in the full stack and the number of boxes above all the full stacks are superimposed to obtain the total number of boxes in the stack of the cargo box stack, thereby even if there is a missing box above the cargo box stack, the box counting result can be accurately obtained, which expands the applicable scenarios of the automatic counting solution for the number of boxes in the entire cargo stack, and is convenient for practical application and promotion.
[0021] In a possible design, for each of the front view image, the rear view image, the left view image, and the right view image, a box detection process is performed on the corresponding image based on a first target detection algorithm to obtain the minimum number of boxes and the maximum number of boxes stacked on the corresponding view, including:
[0022] Based on the first target detection algorithm, a box detection process is performed on a certain viewing surface image among the front viewing surface image, the rear viewing surface image, the left viewing surface image and the right viewing surface image to obtain at least one side box detection frame;
[0023] For each side box detection frame in the at least one side box detection frame, determine the corresponding column number according to the position relationship of the corresponding detection frame in the at least one side box detection frame;
[0024] The column numbers of the side box detection frames are combined into a first column number array;
[0025] Determine a first column number with the least number of repetitions from the first column number array, and use the number of the first column number as the minimum number of layers of the cargo boxes stacked on a certain viewing surface, wherein the certain viewing surface corresponds one-to-one to the certain viewing surface image;
[0026] A maximum column value is determined from the first column number array, and the maximum column value is used as the maximum column number of boxes stacked on the certain viewing plane.
[0027] In a possible design, for each side box detection frame in the at least one side box detection frame, determining the corresponding column number according to the positional relationship of the corresponding detection frame in the at least one side box detection frame includes:
[0028] Assume that the upper left corner of the certain viewing surface image is the origin of the camera coordinate system, wherein the X-axis direction of the camera coordinate system is rightward and the Y-axis direction of the camera coordinate system is downward;
[0029] Traversing the coordinates of the lower left corner points of each side box detection frame in the at least one side box detection frame in the camera coordinate system, and determining the minimum X-axis coordinate of the lower left corner point and the maximum Y-axis coordinate of the lower left corner point;
[0030] Establishing a new relative coordinate system with the smallest X-axis coordinate of the lower left corner point and the largest Y-axis coordinate of the lower left corner point as new origins, wherein the X-axis of the new relative coordinate system faces right, and the Y-axis of the new relative coordinate system faces upward;
[0031] According to the positional relationship between the origin and the new origin and the coordinates of the upper right corner points of the side box detection frames in the camera coordinate system, the coordinates of the upper right corner points of the side box detection frames in the new relative coordinate system are transformed;
[0032] For each side box detection frame, the corresponding column number is calculated according to the following formula:
[0033]
[0034] In the formula, represents a positive integer, Indicates the first The number of columns where the side box detection frame is located, Indicates the The X-axis coordinate of the upper right corner of the side box detection frame in the new relative coordinate system, represents the average horizontal width of the at least one side box detection frame, and round() represents a rounding function.
[0035] In one possible design, box detection processing is performed on the top-view image based on a second target detection algorithm to obtain at least one top box detection frame and at least one height value corresponding to the at least one top box detection frame, including:
[0036] Performing box detection processing on the top-view image based on a second object detection algorithm to obtain at least one top-surface box detection frame;
[0037] For each top surface box detection frame in the at least one top surface box detection frame, the average distance value from all pixels in the corresponding frame to the 3D camera is calculated based on the depth information of all pixels in the corresponding frame. And based on the average distance value and the known height H of the 3D camera relative to the bottom of the cargo box stack, the corresponding height value is calculated to be equal to
[0038] In a possible design, the full stack height value H of the container stack is determined from the at least one height value. full ,include:
[0039] For each top surface box detection frame in the at least one top surface box detection frame, determine the corresponding column number and row number according to the positional relationship of the corresponding detection frame in the at least one top surface box detection frame;
[0040] The column numbers of the top surface box body detection frames are grouped into a second column number array, and the row numbers of the top surface box body detection frames are grouped into a second row number array;
[0041] Determine a second column number with the least number of repetitions from the second column number array, and use the number of the second column number as the minimum number of rows of boxes stacked on the top view surface;
[0042] Determine a second row number with the least number of repetitions from the second row number array, and use the number of the second row number as the minimum number of columns of the cargo boxes stacked on the top view surface;
[0043] Determine whether the minimum number of rows of the box and the minimum number of columns of the box are both greater than or equal to 3;
[0044] If so, first determine multiple edge detection frames at the peripheral edge position from the at least one top surface box body detection frame, and then select the minimum height value from the multiple height values corresponding to the multiple edge detection frames as the full stack height value H of the cargo box stack. full Otherwise, directly select the minimum height value from at least one height value corresponding to the at least one top box detection frame as the full stack height value H of the cargo box stack. full .
[0045] In a second aspect, a device for counting the number of boxes in a cargo box stack is provided, comprising a stacking image acquisition module, a first box detection module, a first box number calculation module, a second box detection module, a box height calculation module, a second box number calculation module and a stacking box number accumulation module;
[0046] The stacking image acquisition module is used to acquire a front view image, a rear view image, a left view image, a right view image and a top view image of a cargo box stack, wherein the top view image is acquired by a 3D camera;
[0047] The first box detection module is communicatively connected to the stacking image acquisition module, and is used to perform box detection processing on the corresponding image based on the first target detection algorithm for each of the front view image, the rear view image, the left view image, and the right view image, so as to obtain the minimum number of boxes and the maximum number of boxes stacked on the corresponding view.
[0048] The first box number calculation module is communicatively connected to the first box detection module, and is used to calculate the number of boxes n in the full stack of the cargo box stack according to the minimum number of layers and the maximum number of columns of the cargo box stacked on each viewing plane according to the following formula: bottom :
[0049] n bottom =length×width×height
[0050] Where, length represents the length of the full stack of the container stack and length = max(A left ,A right ), width represents the length of the full stack of the cargo box and width = max(A main ,A rear ), height represents the height of the full stack of the cargo box and height = min (S left ,S right ,S main ,S rear ), A leftA represents the maximum number of boxes stacked on the left side. right A represents the maximum number of boxes stacked on the right side. main A represents the maximum number of boxes stacked on the main viewing surface. rear Indicates the maximum number of boxes stacked on the rear view plane, S left Indicates the minimum number of layers of the cargo boxes stacked on the left viewing surface, S right Indicates the minimum number of layers of boxes stacked on the right viewing surface, S main Indicates the minimum number of layers of boxes stacked on the main viewing surface, S rear Indicates the minimum number of layers of the cargo boxes stacked on the rear view plane, max() indicates the maximum value function, and min() indicates the minimum value function;
[0051] The second box detection module is communicatively connected to the stacking image acquisition module, and is used to perform box detection processing on the top view image based on a second target detection algorithm to obtain at least one top box detection frame and at least one height value corresponding to the at least one top box detection frame;
[0052] The box height calculation module is respectively connected to the first box number calculation module and the second box detection module for determining the full stack height value H of the stack of the cargo boxes from the at least one height value. full , and according to the height value H of the full stack part full The calculated box height h=H full / height;
[0053] The second box number calculation module is communicatively connected to the box height calculation module, and is used to calculate the number of boxes above the corresponding full stack part according to the following formula for each top surface box detection frame in the at least one top surface box detection frame:
[0054]
[0055] In the formula, k is a positive integer, n is top,k represents the number of boxes above the full stack portion corresponding to the kth top box detection frame in the at least one top box detection frame, H k represents the height value corresponding to the k-th top box detection frame, and round() represents the rounding function;
[0056] The stacking box number accumulation module is respectively connected to the first box number calculation module and the second box number calculation module for calculating the number of boxes n in the full stack of the cargo box stack. bottomThe total number of boxes in the stack of the cargo boxes N is calculated according to the following formula:
[0057]
[0058] Wherein, K represents the total number of detection frames of the at least one top surface box detection frame.
[0059] In a third aspect, the present invention provides a system for counting the number of boxes in a cargo box stack, comprising a first gantry, a second gantry, a first conveyor belt, a second conveyor belt, a first 2D camera, a second 2D camera, a third 2D camera, a fourth 2D camera, a 3D camera and an image processing device, wherein the first conveyor belt is connected to the second conveyor belt to form an L-shaped conveying path;
[0060] The first conveyor belt passes under the first gantry and is used to convey the stack of cargo boxes to be counted, and allows the stack of cargo boxes to pass under the first gantry during the conveying process;
[0061] The second conveyor belt passes under the second gantry and is used to receive and convey the stack of cargo boxes from the first conveyor belt, and to allow the stack of cargo boxes to pass under the second gantry during the conveying process;
[0062] The first 2D camera is installed on the left support column of the first gantry, and is used to collect and obtain the left-view image of the stack of cargo boxes when the stack of cargo boxes passes under the first gantry, and transmit the left-view image to the image processing device;
[0063] The second 2D camera is installed on the right side support of the first gantry, and is used to collect and obtain the right side image of the stack of cargo boxes when the stack of cargo boxes passes under the first gantry, and transmit the right side image to the image processing device;
[0064] The third 2D camera is installed on a side support of the second gantry, and is used to collect and obtain a main view image of the stack of cargo boxes when the stack of cargo boxes passes under the second gantry, and transmit the main view image to the image processing device;
[0065] The fourth 2D camera is installed on the other side support of the second gantry, and is used to collect and obtain the rear view image of the stack of cargo boxes when the stack of cargo boxes passes under the second gantry, and transmit the rear view image to the image processing device;
[0066] The 3D camera is mounted on the crossbeam of the first gantry or the second gantry, and is used to collect and obtain a top view image of the stack of cargo boxes when the stack of cargo boxes is below the gantry where the stack of cargo boxes is located, and transmit the top view image to the image processing device;
[0067] The image processing device is used to execute the method for counting the number of boxes in a cargo box stack as described in the first aspect or any possible design of the first aspect.
[0068] In a fourth aspect, the present invention provides a computer device comprising a memory, a processor and a transceiver which are communicatively connected in sequence, wherein the memory is used to store a computer program, the transceiver is used to send and receive messages, and the processor is used to read the computer program to execute the method for counting the number of boxes in a stack of cargo boxes as described in the first aspect or any possible design of the first aspect.
[0069] In a fifth aspect, the present invention provides a computer-readable storage medium having instructions stored thereon, which, when executed on a computer, executes the method for counting the number of boxes in a cargo box stack as described in the first aspect or any possible design of the first aspect.
[0070] In a sixth aspect, the present invention provides a computer program product, comprising a computer program or instructions, which, when executed by a computer, implements the method for counting the number of boxes in a stack of containers as described in the first aspect or any possible design of the first aspect.
[0071] Beneficial effects of the above scheme:
[0072] (1) The present invention creatively provides a new solution for automatically detecting boxes and completing counting based on the main, rear, left and right top-view images, that is, after obtaining the main, rear, left and right view images of the cargo box stack, on the one hand, for each of the main, rear, left and right view images, the minimum number of boxes on the corresponding view surface and the maximum number of boxes in the stack are obtained through box detection processing; on the other hand, by performing box detection processing on the top-view image, at least one top box detection frame and at least one height value are obtained, and for each top box detection frame, the corresponding number of boxes above the full stack is calculated based on these height values; finally, the number of boxes in the full stack and the number of boxes above all the full stacks are added together to obtain the total number of boxes in the cargo box stack. Therefore, even if there are missing boxes above the cargo box stack, the box counting result can be accurately obtained, thereby expanding the applicable scenarios of the entire cargo box number automatic counting solution, which is convenient for practical application and promotion. BRIEF DESCRIPTION OF THE DRAWINGS
[0073] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0074] Figure 1 A schematic diagram of a flow chart of a method for counting the number of boxes in a cargo box stack provided in an embodiment of the present application.
[0075] Figure 2 This is an example diagram of the positional relationship between the camera coordinate system provided in an embodiment of the present application and a side box detection frame.
[0076] Figure 3 This is an example diagram of the positional relationship between the new relative coordinate system provided in an embodiment of the present application and multiple side box detection frames.
[0077] Figure 4 This is an example diagram of the height values of each top surface box detection frame provided in an embodiment of the present application.
[0078] Figure 5 This is an example diagram of the number of boxes above the full stack part of each top surface box detection frame provided in an embodiment of the present application.
[0079] Figure 6 A schematic diagram of the structure of a device for counting the number of boxes in a cargo box stack provided in an embodiment of the present application.
[0080] Figure 7 A schematic diagram of the structure of a system for counting the number of boxes in a cargo box stack provided in an embodiment of the present application.
[0081] Figure 8 An example diagram of the positional relationship between a cargo box stack and a first gantry, a first 2D camera, a second 2D camera and a 3D camera in a system for counting the number of boxes in a cargo box stack provided in an embodiment of the present application.
[0082] Fig. 9 An example diagram of the positional relationship between a cargo box stack and a second gantry, a third 2D camera, and a fourth 2D camera in a system for counting the number of boxes in a cargo box stack provided in an embodiment of the present application.
[0083] Fig.10 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0084] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the present invention will be briefly introduced below in combination with the drawings and the description of the embodiments or the prior art. Obviously, the following description of the structure of the drawings is only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. It should be noted that the description of these embodiments is used to help understand the present invention, but does not constitute a limitation of the present invention.
[0085] It should be understood that although the terms first and second, etc. may be used herein to describe various objects, these objects should not be limited by these terms. These terms are only used to distinguish one object from another object. For example, a first object can be referred to as a second object, and similarly, a second object can be referred to as a first object without departing from the scope of the exemplary embodiments of the present invention.
[0086] It should be understood that the term "and / or" that may appear in this document is merely a description of the association relationship between associated objects, indicating that there may be three relationships. For example, A and / or B can indicate three situations: A exists alone, B exists alone, or A and B exist at the same time. For another example, A, B and / or C can indicate the existence of any one of A, B and C or any combination of them. The term " / and" that may appear in this document describes another type of association object relationship, indicating that there may be two relationships. For example, A / and B can indicate two situations: A exists alone or A and B exist at the same time. In addition, the character " / " that may appear in this document generally indicates that the previous and next associated objects are in an "or" relationship.
[0087] Example:
[0088] like Figure 1 As shown, the method for counting the number of boxes in a cargo box stack provided in the first aspect of this embodiment can be executed by, but is not limited to, a computer device having certain computing resources and communicating with a plurality of 2D cameras and 3D cameras, such as an edge computing device or a monitoring server. Figure 1 As shown, the method for counting the number of boxes in a cargo box stack may include, but is not limited to, the following steps S1 to S7.
[0089] S1. Acquire a front view image, a rear view image, a left view image, a right view image and a top view image of a cargo box stack, wherein the top view image is acquired by a 3D camera.
[0090] In step S1, the stack of cargo boxes is the object to be counted. To ensure the feasibility of the subsequent steps, the following prerequisites need to be met: the cargo boxes are neatly stacked; the cargo boxes are of the same size and type; the cargo boxes will fall to the bottom due to gravity, so that there will be no hanging cargo boxes in the stack; by default, the cargo boxes are neatly placed according to the same rules, and there will be no uneven heights due to some being placed upright and some being placed sideways. The main view image (i.e., the front view image) of the stack of cargo boxes can be, but is not limited to, the following: Figures 7 to 9 The rear view image of the container stack can be obtained by, but is not limited to, the third 2D camera 33 in the container quantity counting system in the container stack; Figures 7 to 9 The fourth 2D camera 34 in the box number counting system in the container stack is shown and is acquired; the left side image of the container stack can be, but is not limited to, Figures 7 to 9 The right side image of the container stack can be, but is not limited to, acquired by the first 2D camera 31 in the container quantity counting system as shown in FIG. Figures 7 to 9 The top view image of the container stack can be obtained by, but is not limited to, the second 2D camera 32 in the container quantity counting system in the container stack. Figures 7 to 9 The 3D camera 5 in the box body quantity counting system in the cargo box stack is shown. In addition, the front view image, the rear view image, the left view image and the right view image are acquired by a 2D camera and are general RGB (color standard, various colors are obtained by changing the three color channels of red, green and blue and superimposing them with each other) images; the top view image is acquired by a 3D camera and is an RGB image with depth information for each pixel.
[0091] S2. For each of the viewing surface images among the front viewing surface image, the rear viewing surface image, the left viewing surface image and the right viewing surface image, box detection processing is performed on the corresponding image based on the first target detection algorithm to obtain the minimum number of layers and the maximum number of columns of boxes stacked on the corresponding viewing surface.
[0092] In the step S2, the front-view surface image, the rear-view surface image, the left-view surface image and the right-view surface image are all side-view surface images, so their box detection processes are the same. The target detection algorithm is an existing artificial intelligence recognition algorithm for identifying objects in a picture and marking the location of the objects. Specifically, it can be but not limited to FasterR-CNN (Faster Regions with Convolutional Neural Networks features, a target detection algorithm proposed by He Kaiming et al. in 2015, which won multiple first places in the 2015 ILSVRV and COCO competitions) target detection algorithm, SSD (Single Shot Multi Box Detector, a target detection algorithm proposed by Wei Liu at ECCV 2016, which is one of the main popular detection frameworks) target detection algorithm or YOLO (You only look once, currently the latest version has been developed to V5, and is also widely used in the industry. Its basic principle is: first, the input image is divided into 7x7 grids, and 2 borders are predicted for each grid. Then, the target windows with relatively low probability are removed according to the threshold, and finally, the redundant windows are removed by border merging to obtain the detection result) target detection algorithm, etc. Therefore, the box detection processing can be performed based on the aforementioned target detection algorithm. For example, the first target detection algorithm is implemented using the YOLOv5 target detection algorithm. Specifically, for each of the front view image, the rear view image, the left view image, and the right view image, a box detection process is performed on the corresponding image based on the first target detection algorithm to obtain the minimum number of boxes and the maximum number of boxes stacked on the corresponding view, including but not limited to the following steps S21 to S25.
[0093] S21. Based on the first target detection algorithm, box detection processing is performed on a certain viewing surface image among the front viewing surface image, the rear viewing surface image, the left viewing surface image and the right viewing surface image to obtain at least one side box detection frame.
[0094] In step S21, the box detection model obtained through conventional training based on the first target detection algorithm can predict the area where each box in the stack is located in the certain visual surface image, and provide a detection frame and confidence. Specifically, the detection frames with low confidence can be filtered out by a preset confidence threshold, thereby ensuring that the obtained detection frame can completely include all boxes in the certain visual surface image. In addition, if no box is detected in the certain visual surface image, it is necessary to make the result of the box count in the stack directly output a specific negative number (for example, -1, in order to distinguish the case where the box count in the stack is 0); if a box is detected, the subsequent steps are executed.
[0095] S22. For each side box detection frame in the at least one side box detection frame, determine the corresponding column number according to the positional relationship of the corresponding detection frame in the at least one side box detection frame.
[0096] In the step S22, specifically, for each side box detection frame in the at least one side box detection frame, the corresponding column number is determined according to the positional relationship of the corresponding detection frame in the at least one side box detection frame, including but not limited to the following steps S221 to S225.
[0097] S221. Assume that the upper left corner point of the certain visual surface image is the origin of the camera coordinate system, wherein the X-axis direction of the camera coordinate system is rightward, and the Y-axis direction of the camera coordinate system is downward.
[0098] In step S221, the positional relationship between the camera coordinate system and a side box detection frame is as follows: Figure 2 As shown, w represents the width of the detection box and h represents the height of the detection box.
[0099] S222. Traverse the coordinates of the lower left corner points of each side box detection frame in the at least one side box detection frame in the camera coordinate system, and determine the minimum X-axis coordinate of the lower left corner point and the maximum Y-axis coordinate of the lower left corner point.
[0100] S223. Establish a new relative coordinate system with the minimum X-axis coordinate of the lower left corner point and the maximum Y-axis coordinate of the lower left corner point as new origins, wherein the X-axis of the new relative coordinate system faces right, and the Y-axis of the new relative coordinate system faces upward.
[0101] In step S223, the positional relationship between the new relative coordinate system and the plurality of side box detection frames is as follows: Figure 3 shown.
[0102] S224. According to the positional relationship between the origin and the new origin and the coordinates of the upper right corner points of the side box detection frames in the camera coordinate system, the coordinates of the upper right corner points of the side box detection frames in the new relative coordinate system are transformed.
[0103] In step S224, the specific process of coordinate transformation is existing mathematical knowledge and will not be described in detail here.
[0104] S225. For each side box detection frame, the corresponding column number is calculated according to the following formula:
[0105]
[0106] In the formula, represents a positive integer, Indicates the first The number of columns where the side box detection frame is located, Indicates the The X-axis coordinate of the upper right corner of the side box detection frame in the new relative coordinate system, represents the average horizontal width of the at least one side box detection frame, and round() represents the rounding function.
[0107] In the step S22, the number of rows of the side box detection frames can also be calculated by referring to the above step S225:
[0108]
[0109] In the formula, Indicates the The row number of the side box detection frame, Indicates the The Y-axis coordinate of the upper right corner of the side box detection frame in the new relative coordinate system, represents the average longitudinal height of at least one side box detection frame. Figure 3 The number of rows and columns of each side box detection frame shown
[0110] S23. Group the column numbers of the side box detection frames into a first column number array.
[0111] In step S23, Figure 3 For example, the first column number array can be obtained as {1,1,1,1,1,2,2,3,3,3,4,4,4,4}, where 5 1s come from the first column, 2 2s come from the second column, 3 3s come from the third column, and 4 4s come from the fourth column.
[0112] S24. Determine a first column number with the least number of repetitions from the first column number array, and use the number of the first column number as the minimum number of layers of the cargo boxes stacked on a certain viewing surface, wherein the certain viewing surface corresponds one-to-one to the certain viewing surface image.
[0113] In step S24, Figure 3 For example, the number of the first columns is 2 (because it has the minimum repetition number 1), and the number of the first columns is 2, so it can be used as the minimum number of layers of the cargo boxes stacked on a certain viewing plane.
[0114] S25. Determine a maximum column value from the first column number array, and use the maximum column value as the maximum column number of the cargo boxes stacked on the certain viewing plane.
[0115] In step S25, the first column number array may be subjected to column deduplication processing first, and then the maximum column value (i.e. 4) or length (i.e. 4) of the column number array after deduplication processing may be used as the maximum column number of boxes stacked on the certain viewing plane.
[0116] S3. According to the minimum number of layers and the maximum number of columns of the cargo box stack on each viewing plane, the number of boxes in the full stack of the cargo box stack n is calculated according to the following formula: bottom :
[0117] n bottom =length×width×height
[0118] Where, length represents the length of the full stack of the container stack and length = max(A left ,A right ), width represents the length of the full stack of the cargo box and width = max(A main ,A rear ), height represents the height of the full stack of the cargo box and height = min (S left ,S right ,S main ,S rear ), A left A represents the maximum number of boxes stacked on the left side. right A represents the maximum number of boxes stacked on the right side. main A represents the maximum number of boxes stacked on the main viewing surface. rear Indicates the maximum number of boxes stacked on the rear view plane, S leftIndicates the minimum number of layers of the cargo boxes stacked on the left viewing surface, S right Indicates the minimum number of layers of boxes stacked on the right viewing surface, S main Indicates the minimum number of layers of boxes stacked on the main viewing surface, S rear It indicates the minimum number of layers of boxes stacked on the rear view plane, max() indicates the maximum value function, and min() indicates the minimum value function.
[0119] In step S3, the full stack portion is defined as follows: there are no missing containers inside the stack, and there are no missing containers on the four exposed sides and the top. Therefore, the theoretical basis of the above calculation is: through observation, it is found that at the minimum number of layers min (S left ,S right ,S main ,S rear ) is the full stack part, and at the minimum number of layers min(S left ,S right ,S main ,S rear ) There are scattered boxes above, so the number of boxes in the full stack can be calculated first.
[0120] S4. Perform box detection processing on the top-view image based on the second target detection algorithm to obtain at least one top surface box detection frame and at least one height value corresponding to the at least one top surface box detection frame.
[0121] In the step S4, the second target detection algorithm can be implemented by, but is not limited to, using the YOLOv5 target detection algorithm. Specifically, the top view image is subjected to box detection processing based on the second target detection algorithm to obtain at least one top box detection frame and at least one height value corresponding to the at least one top box detection frame, including but not limited to the following steps S41 to S42.
[0122] S41. Perform box detection processing on the top-view image based on a second object detection algorithm to obtain at least one top-surface box detection frame.
[0123] In the step S41, the specific details of the box detection process refer to the aforementioned step S21, which will not be repeated here.
[0124] S42. For each top surface box detection frame in the at least one top surface box detection frame, according to the depth information of all pixels in the corresponding frame, calculate the average distance value from all pixels in the corresponding frame to the 3D camera. And based on the average distance value and the known height H of the 3D camera relative to the bottom of the cargo box stack, the corresponding height value is calculated to be equal to
[0125] In step S42, the known height value H is Figure 6 As shown in FIG. 1 and the relative height from the first conveyor belt 21 to the 3D camera 5. For example, the height values corresponding to the top surface box detection frames are as follows: Figure 4 shown.
[0126] S5. Determine the full stack height value H of the container stack from the at least one height value full , and according to the height value H of the full stack part full The calculated box height h=H full / height.
[0127] In the step S5, specifically, the height value H of the full stack portion of the container stack is determined from the at least one height value. full , including but not limited to the following steps S51 to S56.
[0128] S51. For each top surface box detection frame in the at least one top surface box detection frame, determine the corresponding column number and row number according to the positional relationship of the corresponding detection frame in the at least one top surface box detection frame.
[0129] In the step S51, the specific process of determining the column number and row number of each top surface box detection frame can be referred to the aforementioned step S225, which will not be repeated here.
[0130] S52. Grouping the column numbers where the top surface box body detection frames are located into a second column number array, and grouping the row numbers where the top surface box body detection frames are located into a second row number array.
[0131] S53. Determine a second column number with the least number of repetitions from the second column number array, and use the number of the second column number as the minimum number of rows of boxes stacked on the top view.
[0132] S54. Determine a second row number with the least number of repetitions from the second row number array, and use the number of the second row number as the minimum number of columns of the cargo boxes stacked on the top view.
[0133] The specific details of the aforementioned steps S52 to S54 refer to the aforementioned steps S23 to S24 and are not repeated here.
[0134] S55. Determine whether the minimum number of rows of the box and the minimum number of columns of the box are both greater than or equal to 3.
[0135] S56. If yes, first determine multiple edge detection frames at the peripheral edge position from the at least one top surface box body detection frame, and then select the minimum height value from the multiple height values corresponding to the multiple edge detection frames as the full stack part height value H of the cargo box stack full Otherwise, directly select the minimum height value from at least one height value corresponding to the at least one top box detection frame as the full stack height value H of the cargo box stack. full .
[0136] In step S56, Figure 4 For example, since the minimum number of rows of boxes is 3 and the minimum number of columns of boxes is 4, there are boxes hidden in the stack. Therefore, it is necessary to first determine 10 edge detection frames at the outer edge position, and then select the minimum height value of 400mm from the 10 height values corresponding to these 10 edge detection frames as the full stack height value H of the box stack. full If the minimum number of rows or columns of boxes is less than 3, it indicates that there are no boxes in the stack. At this time, the minimum height value can be directly selected from at least one height value corresponding to at least one top box detection frame as the full stack height value H of the box stack. full .
[0137] S6. For each top surface box detection frame in the at least one top surface box detection frame, the number of boxes above the corresponding full stack portion is calculated according to the following formula:
[0138]
[0139] In the formula, k is a positive integer, n is top,k represents the number of boxes above the full stack portion corresponding to the kth top box detection frame in the at least one top box detection frame, H k represents the height value corresponding to the k-th top box detection frame, and round() represents the rounding function.
[0140] In step S6, Figure 4 For example, if the full stack height value H of the cargo box stack is full is 400mm and the full stack part height is 2, then we can calculate Figure 7The number of boxes above the full stack part of each top surface box detection frame is shown, wherein a value of 0 indicates that there is no box above the full stack part, a positive value indicates that there are boxes above the full stack part and the value indicates the number of boxes present, and a negative value indicates that there are missing boxes in the full stack part and the value indicates the number of missing boxes (if there are missing boxes inside the full stack part, it will be surrounded by the surrounding boxes and appear concave. At this time, the side camera can only capture the outer surface of the stacked boxes, but cannot capture the missing items inside the stack, so that the height value in the detection frame can only be analyzed by looking down from a bird's-eye view, and then the number of concave missing items can be analyzed).
[0141] S7. According to the number of boxes n in the full stack of the cargo box stack bottom The total number of boxes in the stack of the cargo boxes N is calculated according to the following formula:
[0142]
[0143] Wherein, K represents the total number of detection frames of the at least one top surface box detection frame.
[0144] After step S7, the total number N of boxes in the stack of boxes can be output and displayed for corresponding industrial applications.
[0145] Therefore, based on the method for counting the number of boxes in a cargo box stack described in the aforementioned steps S1 to S7, a new solution is provided for automatically detecting boxes and completing the counting work based on the main, rear, left and right top-view images of the cargo box stack, that is, after obtaining the main, rear, left and right view images of the cargo box stack, on the one hand, for each of the main, rear, left and right view images, the minimum number of boxes on the corresponding view surface, the maximum number of boxes in the column, and the number of boxes in the full stack are obtained through box detection processing; on the other hand, by performing box detection processing on the top-view image, at least one top surface box detection frame and at least one height value are obtained, and for each top surface box detection frame, the number of boxes above the corresponding full stack is calculated based on these height values, and finally the number of boxes in the full stack and the number of boxes above all the full stacks are superimposed to obtain the total number of boxes in the cargo box stack, thereby even if there is a missing box on the top of the cargo box stack, the box counting result can be accurately obtained, which expands the applicable scenarios of the entire cargo box number automatic counting solution and facilitates practical application and promotion.
[0146] like Figure 6As shown, the second aspect of this embodiment provides a virtual device for implementing the method for counting the number of boxes in a cargo box stack described in the first aspect, comprising a stacking image acquisition module, a first box detection module, a first box number calculation module, a second box detection module, a box height calculation module, a second box number calculation module and a stacking box number accumulation module;
[0147] The stacking image acquisition module is used to acquire a front view image, a rear view image, a left view image, a right view image and a top view image of a cargo box stack, wherein the top view image is acquired by a 3D camera;
[0148] The first box detection module is communicatively connected to the stacking image acquisition module, and is used to perform box detection processing on the corresponding image based on the first target detection algorithm for each of the front view image, the rear view image, the left view image, and the right view image, so as to obtain the minimum number of boxes and the maximum number of boxes stacked on the corresponding view.
[0149] The first box number calculation module is communicatively connected to the first box detection module, and is used to calculate the number of boxes n in the full stack of the cargo box stack according to the minimum number of layers and the maximum number of columns of the cargo box stacked on each viewing plane according to the following formula: bottom :
[0150] n bottom =length×width×height
[0151] Where, length represents the length of the full stack of the container stack and length = max(A left ,A right ), width represents the length of the full stack of the cargo box and width = max(A main ,A rear ), height represents the height of the full stack of the cargo box and height = min (S left ,S right ,S main ,S rear ), A left A represents the maximum number of boxes stacked on the left side. right A represents the maximum number of boxes stacked on the right side. main A represents the maximum number of boxes stacked on the main viewing surface. rear Indicates the maximum number of boxes stacked on the rear view plane, S left Indicates the minimum number of layers of the cargo boxes stacked on the left viewing surface, S rightIndicates the minimum number of layers of boxes stacked on the right viewing surface, S main Indicates the minimum number of layers of boxes stacked on the main viewing surface, S rear Indicates the minimum number of layers of the cargo boxes stacked on the rear view plane, max() indicates the maximum value function, and min() indicates the minimum value function;
[0152] The second box detection module is communicatively connected to the stacking image acquisition module, and is used to perform box detection processing on the top view image based on a second target detection algorithm to obtain at least one top box detection frame and at least one height value corresponding to the at least one top box detection frame;
[0153] The box height calculation module is respectively connected to the first box number calculation module and the second box detection module for determining the full stack height value H of the stack of the cargo boxes from the at least one height value. full , and according to the height value H of the full stack part full The calculated box height h=H full / height;
[0154] The second box number calculation module is communicatively connected to the box height calculation module, and is used to calculate the number of boxes above the corresponding full stack part according to the following formula for each top surface box detection frame in the at least one top surface box detection frame:
[0155]
[0156] In the formula, k is a positive integer, n is top,k represents the number of boxes above the full stack portion corresponding to the kth top box detection frame in the at least one top box detection frame, H k represents the height value corresponding to the k-th top box detection frame, and round() represents the rounding function;
[0157] The stacking box number accumulation module is respectively connected to the first box number calculation module and the second box number calculation module for calculating the number of boxes n in the full stack of the cargo box stack. bottom The total number of boxes in the stack of the cargo boxes N is calculated according to the following formula:
[0158]
[0159] Wherein, K represents the total number of detection frames of the at least one top surface box detection frame.
[0160] The working process, working details and technical effects of the aforementioned device provided in the second aspect of this embodiment can be referred to the method for counting the number of boxes in a cargo box stack described in the first aspect, and will not be described in detail here.
[0161] like Figures 7 to 9 As shown, the third aspect of this embodiment provides a physical system for implementing the method for counting the number of boxes in a cargo box stack described in the first aspect, comprising a first gantry 11, a second gantry 12, a first conveyor belt 21, a second conveyor belt 22, a first 2D camera 31, a second 2D camera 32, a third 2D camera 33, a fourth 2D camera 34, a 3D camera 5 and an image processing device, wherein the first conveyor belt 21 is connected to the second conveyor belt 22 to form an L-shaped conveying path;
[0162] The first conveyor belt 21 passes under the first gantry 11 and is used to convey the cargo box stack 100 to be counted, and allows the cargo box stack 100 to pass under the first gantry 11 during the conveying process;
[0163] The second conveyor belt 22 passes under the second gantry 12, and is used to receive and convey the cargo box stack 100 from the first conveyor belt 21, and allows the cargo box stack 100 to pass under the second gantry 12 during the conveying process;
[0164] The first 2D camera 31 is installed on the left support column of the first gantry 11, and is used to collect and obtain the left-view image of the stack of cargo boxes 100 when the stack of cargo boxes 100 passes under the first gantry 11, and transmit the left-view image to the image processing device;
[0165] The second 2D camera 32 is installed on the right side support of the first gantry 11, and is used to collect and obtain the right side image of the stack of cargo boxes 100 when the stack of cargo boxes 100 passes under the first gantry 11, and transmit the right side image to the image processing device;
[0166] The third 2D camera 33 is installed on a side support of the second gantry 12, and is used to collect and obtain the main view image of the stack of cargo boxes 100 when the stack of cargo boxes 100 passes under the second gantry 11, and transmit the main view image to the image processing device;
[0167] The fourth 2D camera 34 is installed on the other side support of the second gantry 12, and is used to collect and obtain the rear view image of the stack of cargo boxes 100 when the stack of cargo boxes 100 passes under the second gantry 11, and transmit the rear view image to the image processing device;
[0168] The 3D camera 5 is mounted on the crossbeam of the first gantry 11 (such as Figure 8 As shown, it can also be installed in Fig. 9 The image processing device is used to capture a top view image of the stack of containers 100 when the stack of containers 100 passes under the gantry, and transmit the top view image to the image processing device;
[0169] The image processing device is used to execute the method for counting the number of boxes in a cargo box stack as described in the first aspect.
[0170] The working process, working details and technical effects of the aforementioned system provided in the third aspect of this embodiment can be referred to the method for counting the number of boxes in a cargo box stack described in the first aspect, and will not be described in detail here.
[0171] like Fig.10 As shown, the fourth aspect of this embodiment provides a computer device for executing the method for counting the number of boxes in the cargo box stack as described in the first aspect, including a memory, a processor and a transceiver that are sequentially connected in communication, wherein the memory is used to store a computer program, the transceiver is used to send and receive messages, and the processor is used to read the computer program to execute the method for counting the number of boxes in the cargo box stack as described in the first aspect. Specifically, the memory may include, but is not limited to, a random access memory (RAM), a read-only memory (ROM), a flash memory, a first-in-first-out memory (FIFO) and / or a first-in-last-out memory (FILO), etc.; the processor may include, but is not limited to, a microprocessor of the STM32F105 series. In addition, the computer device may also include, but is not limited to, a power module, a display screen and other necessary components.
[0172] The working process, working details and technical effects of the aforementioned computer equipment provided in the fourth aspect of this embodiment can be referred to the method for counting the number of boxes in a cargo box stack described in the first aspect, and will not be described in detail here.
[0173] In a fifth aspect of this embodiment, there is provided a computer-readable storage medium storing instructions for the method for counting the number of boxes in a stack of containers as described in the first aspect, that is, the computer-readable storage medium stores instructions, and when the instructions are executed on a computer, the method for counting the number of boxes in a stack of containers as described in the first aspect is executed. The computer-readable storage medium refers to a carrier for storing data, which may include but is not limited to computer-readable storage media such as floppy disks, optical disks, hard disks, flash memories, USB flash drives, and / or memory sticks, and the computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices.
[0174] The working process, working details and technical effects of the aforementioned computer-readable storage medium provided in the fifth aspect of this embodiment can be referred to the method for counting the number of boxes in a cargo box stack as described in the first aspect, and will not be repeated here.
[0175] In a sixth aspect of the present embodiment, a computer program product is provided, including a computer program or an instruction, wherein when the computer program or the instruction is executed by a computer, the method for counting the number of boxes in a stack of boxes as described in the first aspect is implemented. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device.
[0176] Finally, it should be noted that the above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for counting the number of boxes in a cargo box stack, characterized in that: include: Acquire a front view image, a rear view image, a left view image, a right view image, and a top view image of a stack of cargo boxes, wherein the top view image is acquired by a 3D camera; For each of the front view image, the rear view image, the left view image, and the right view image, box detection processing is performed on the corresponding image based on the first target detection algorithm to obtain the minimum number of boxes and the maximum number of boxes stacked on the corresponding view; According to the minimum number of layers and the maximum number of columns of the cargo box stack on each viewing plane, the number of boxes in the full stack of the cargo box stack n is calculated according to the following formula: bottom : n bottom =length×width×height Where, length represents the length of the full stack of the container stack and length = max(A left ,A right ), width represents the length of the full stack of the cargo box and width = max(A main ,A rear ), height represents the height of the full stack of the cargo box and height = min (S left ,S right ,S main ,S rear ), A left A represents the maximum number of boxes stacked on the left side. right A represents the maximum number of boxes stacked on the right side. main A represents the maximum number of boxes stacked on the main viewing surface. rear Indicates the maximum number of boxes stacked on the rear view plane, S left Indicates the minimum number of layers of the cargo boxes stacked on the left viewing surface, S right Indicates the minimum number of layers of boxes stacked on the right viewing surface, S main Indicates the minimum number of layers of boxes stacked on the main viewing surface, S rear Indicates the minimum number of layers of the cargo boxes stacked on the rear view surface, max() indicates the maximum value function, and min() indicates the minimum value function; Performing box detection processing on the top-view image based on a second object detection algorithm to obtain at least one top-surface box detection frame and at least one height value corresponding to the at least one top-surface box detection frame; The height value H of the full stack portion of the container stack is determined from the at least one height value. full , and according to the height value H of the full stack part full The calculated box height h=H full / height; For each top surface box detection frame in the at least one top surface box detection frame, the number of boxes above the corresponding full stack portion is calculated according to the following formula: In the formula, k is a positive integer, n is top,k represents the number of boxes above the full stack portion corresponding to the kth top box detection frame in the at least one top box detection frame, H k represents the height value corresponding to the k-th top box detection frame, and round() represents the rounding function; According to the number of boxes n in the full stack of the cargo box stack bottom The total number of boxes in the stack of the cargo boxes N is calculated according to the following formula: Wherein, K represents the total number of detection frames of the at least one top surface box detection frame.
2. The method for counting the number of boxes in a cargo box stack according to claim 1, characterized in that: For each of the front view image, the rear view image, the left view image, and the right view image, box detection processing is performed on the corresponding image based on the first target detection algorithm to obtain the minimum number of boxes and the maximum number of boxes stacked on the corresponding view, including: Based on the first target detection algorithm, a box detection process is performed on a certain viewing surface image among the front viewing surface image, the rear viewing surface image, the left viewing surface image and the right viewing surface image to obtain at least one side box detection frame; For each side box detection frame in the at least one side box detection frame, determine the corresponding column number according to the position relationship of the corresponding detection frame in the at least one side box detection frame; The column numbers of the side box detection frames are combined into a first column number array; Determine a first column number with the least number of repetitions from the first column number array, and use the number of the first column number as the minimum number of layers of the cargo boxes stacked on a certain viewing surface, wherein the certain viewing surface corresponds one-to-one to the certain viewing surface image; A maximum column value is determined from the first column number array, and the maximum column value is used as the maximum column number of boxes stacked on the certain viewing plane.
3. The method for counting the number of boxes in a cargo box stack according to claim 2, characterized in that: For each side box detection frame in the at least one side box detection frame, determining the corresponding column number according to the position relationship of the corresponding detection frame in the at least one side box detection frame includes: Assume that the upper left corner of the certain viewing surface image is the origin of the camera coordinate system, wherein the X-axis direction of the camera coordinate system is rightward and the Y-axis direction of the camera coordinate system is downward; Traversing the coordinates of the lower left corner points of each side box detection frame in the at least one side box detection frame in the camera coordinate system, and determining the minimum X-axis coordinate of the lower left corner point and the maximum Y-axis coordinate of the lower left corner point; Establishing a new relative coordinate system with the minimum X-axis coordinate of the lower left corner point and the maximum Y-axis coordinate of the lower left corner point as new origins, wherein the X-axis of the new relative coordinate system faces right and the Y-axis of the new relative coordinate system faces upward; According to the positional relationship between the origin and the new origin and the coordinates of the upper right corner points of the side box detection frames in the camera coordinate system, the coordinates of the upper right corner points of the side box detection frames in the new relative coordinate system are transformed; For each side box detection frame, the corresponding column number is calculated according to the following formula: In the formula, represents a positive integer, Indicates the first The number of columns where the side box detection frame is located, Indicates the The X-axis coordinate of the upper right corner of the side box detection frame in the new relative coordinate system, represents the average horizontal width of the at least one side box detection frame, and round() represents a rounding function.
4. The method for counting the number of boxes in a cargo box stack according to claim 1, characterized in that: The top-view image is subjected to box detection processing based on a second target detection algorithm to obtain at least one top-surface box detection frame and at least one height value corresponding to the at least one top-surface box detection frame, including: Performing box detection processing on the top-view image based on a second object detection algorithm to obtain at least one top-surface box detection frame; For each top surface box detection frame in the at least one top surface box detection frame, the average distance value from all pixels in the corresponding frame to the 3D camera is calculated based on the depth information of all pixels in the corresponding frame. And based on the average distance value and the known height H of the 3D camera relative to the bottom of the cargo box stack, the corresponding height value is calculated to be equal to 5. The method for counting the number of boxes in a cargo box stack according to claim 1, characterized in that: The height value H of the full stack portion of the container stack is determined from the at least one height value. full ,include: For each top surface box detection frame in the at least one top surface box detection frame, determine the corresponding column number and row number according to the positional relationship of the corresponding detection frame in the at least one top surface box detection frame; The column numbers of the top surface box body detection frames are grouped into a second column number array, and the row numbers of the top surface box body detection frames are grouped into a second row number array; Determine a second column number with the least number of repetitions from the second column number array, and use the number of the second column number as the minimum number of rows of boxes stacked on the top view surface; Determine a second row number with the least number of repetitions from the second row number array, and use the number of the second row number as the minimum number of columns of the cargo boxes stacked on the top view surface; Determine whether the minimum number of rows of the box and the minimum number of columns of the box are both greater than or equal to 3; If so, first determine multiple edge detection frames at the peripheral edge position from the at least one top surface box body detection frame, and then select the minimum height value from the multiple height values corresponding to the multiple edge detection frames as the full stack height value H of the cargo box stack. full Otherwise, directly select the minimum height value from at least one height value corresponding to the at least one top box detection frame as the full stack height value H of the cargo box stack. full .
6. A device for counting the number of boxes in a cargo box stack, characterized in that: It includes a stacking image acquisition module, a first box detection module, a first box number calculation module, a second box detection module, a box height calculation module, a second box number calculation module and a stacking box number accumulation module; The stacking image acquisition module is used to acquire a front view image, a rear view image, a left view image, a right view image and a top view image of a cargo box stack, wherein the top view image is acquired by a 3D camera; The first box detection module is communicatively connected to the stacking image acquisition module, and is used to perform box detection processing on the corresponding image based on the first target detection algorithm for each of the front view image, the rear view image, the left view image, and the right view image, so as to obtain the minimum number of boxes and the maximum number of boxes stacked on the corresponding view. The first box number calculation module is communicatively connected to the first box detection module, and is used to calculate the number of boxes n in the full stack of the cargo box stack according to the minimum number of layers and the maximum number of columns of the cargo box stacked on each viewing plane according to the following formula: bottom : n bottom =length×width×height Where, length represents the length of the full stack of the container stack and length = max(A left ,A right ), width represents the length of the full stack of the cargo box and width = max(A main ,A rear ), height represents the height of the full stack of the cargo box and height = min (S left ,S right ,S main ,S rear ), A left A represents the maximum number of boxes stacked on the left side. right A represents the maximum number of boxes stacked on the right side. main A represents the maximum number of boxes stacked on the main viewing surface. rear Indicates the maximum number of boxes stacked on the rear view plane, S left Indicates the minimum number of layers of the cargo boxes stacked on the left viewing surface, S right Indicates the minimum number of layers of boxes stacked on the right viewing surface, S main Indicates the minimum number of layers of boxes stacked on the main viewing surface, S rear Indicates the minimum number of layers of the cargo boxes stacked on the rear view surface, max() indicates the maximum value function, and min() indicates the minimum value function; The second box detection module is communicatively connected to the stacking image acquisition module, and is used to perform box detection processing on the top view image based on a second target detection algorithm to obtain at least one top box detection frame and at least one height value corresponding to the at least one top box detection frame; The box height calculation module is respectively connected to the first box number calculation module and the second box detection module for determining the full stack height value H of the stack of the cargo boxes from the at least one height value. full , and according to the height value H of the full stack part full The calculated box height h=H full / height; The second box number calculation module is communicatively connected to the box height calculation module, and is used to calculate the number of boxes above the corresponding full stack part according to the following formula for each top surface box detection frame in the at least one top surface box detection frame: In the formula, k is a positive integer, n is top,k represents the number of boxes above the full stack portion corresponding to the kth top box detection frame in the at least one top box detection frame, H k represents the height value corresponding to the k-th top box detection frame, and round() represents the rounding function; The stacking box number accumulation module is respectively connected to the first box number calculation module and the second box number calculation module for calculating the number of boxes n in the full stack of the cargo box stack. bottom The total number of boxes in the stack of the cargo boxes N is calculated according to the following formula: Wherein, K represents the total number of detection frames of the at least one top surface box detection frame.
7. A system for counting the number of boxes in a cargo box stack, characterized in that: The invention comprises a first gantry (11), a second gantry (12), a first conveyor belt (21), a second conveyor belt (22), a first 2D camera (31), a second 2D camera (32), a third 2D camera (33), a fourth 2D camera (34), a 3D camera (5) and an image processing device, wherein the first conveyor belt (21) is connected to the second conveyor belt (22) to form an L-shaped conveying path; The first conveyor belt (21) passes through the bottom of the first gantry (11) and is used to convey the stack of cargo boxes (100) to be counted, and allows the stack of cargo boxes (100) to pass under the first gantry (11) during the conveying process; The second conveyor belt (22) passes through the bottom of the second gantry (12) and is used to receive and convey the cargo box stack (100) from the first conveyor belt (21), and to allow the cargo box stack (100) to pass under the second gantry (12) during the conveying process; The first 2D camera (31) is mounted on a left support column of the first gantry (11), and is used to collect a left-view image of the stack of cargo boxes (100) when the stack of cargo boxes (100) passes under the first gantry (11), and transmit the left-view image to the image processing device; The second 2D camera (32) is mounted on the right side support of the first gantry (11), and is used to collect a right side image of the stack of cargo boxes (100) when the stack of cargo boxes (100) passes under the first gantry (11), and transmit the right side image to the image processing device; The third 2D camera (33) is mounted on a side support of the second gantry (12), and is used to collect a main view image of the stack of cargo boxes (100) when the stack of cargo boxes (100) passes under the second gantry (11), and transmit the main view image to the image processing device; The fourth 2D camera (34) is installed on the other side support of the second gantry (12), and is used to collect a rear view image of the stack of cargo boxes (100) when the stack of cargo boxes (100) passes under the second gantry (11), and transmit the rear view image to the image processing device; The 3D camera (5) is mounted on a crossbeam of the first gantry (11) or the second gantry (12), and is used to collect a top view image of the stack of cargo boxes (100) when the stack of cargo boxes (100) passes under the gantry, and transmit the top view image to the image processing device; The image processing device is used to execute the method for counting the number of boxes in a cargo box stack as described in any one of claims 1 to 5.
8. A computer device, characterized in that: It includes a memory, a processor and a transceiver which are communicatively connected in sequence, wherein the memory is used to store a computer program, the transceiver is used to send and receive messages, and the processor is used to read the computer program to execute the method for counting the number of boxes in a cargo box stack as described in any one of claims 1 to 5.
9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores instructions, and when the instructions are executed on the computer, the method for counting the number of boxes in a cargo box stack as described in any one of claims 1 to 5 is executed.
10. A computer program product comprising a computer program or instructions, characterized in that The computer program or the instructions, when executed by a computer, implements the method for counting the number of boxes in a stack of boxes as claimed in any one of claims 1 to 5.
Citation Information
Patent Citations
Stacked box counting method, device, equipment and medium
CN115908322A
Cited By
Cargo box stacking planning method
CN119612195A
Pallet container stack checking and counting method and system based on visual algorithm
CN119648777A
