Parcel size identification method, device and equipment, and storage medium
By combining dual-view image recognition and physical constraint rules, the problem of large errors and low efficiency in logistics package size recognition is solved, realizing low-cost and high-precision automatic 3D size estimation, which is suitable for small and medium-sized sorting centers and last-mile delivery points.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHANGHAI DONGPU INFORMATION TECH CO LTD
- Filing Date
- 2026-02-06
- Publication Date
- 2026-06-09
AI Technical Summary
Existing technologies suffer from large errors, low efficiency, and high costs in identifying the size of logistics parcels, making it difficult to achieve high-precision automatic estimation of three-dimensional dimensions, especially in small and medium-sized sorting centers and last-mile delivery points.
A dual-view image recognition method is adopted. By acquiring the top and side view images of the target package, and combining them with reference objects with known physical dimensions, a pre-trained 3D size estimation model is used to predict the size. The model is then verified and corrected through global transformation coefficients and physical constraint rules to achieve high-precision 3D size measurement.
It enables high-precision automatic estimation of the three-dimensional dimensions of logistics packages under low-cost conditions, reducing hardware costs, improving measurement accuracy and efficiency, and possessing cross-scenario adaptability, making it easy to deploy and maintain.
Smart Images

Figure CN122176030A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of logistics technology, and in particular to a method, apparatus, equipment and storage medium for identifying the size of logistics parcels. Background Technology
[0002] In express delivery and e-commerce logistics, the volumetric weight rule has been widely adopted for parcel billing. That is, the volume is calculated based on the length, width and height of the parcel, and then divided by a specific volumetric weight coefficient to obtain the volumetric weight. The larger of the volumetric weight and the actual weight are compared and used as the basis for billing. Therefore, quickly and accurately obtaining the three-dimensional physical dimensions of the parcel has become a key link for logistics sorting centers to achieve automated and refined operation. However, the current logistics sorting centers mainly obtain the parcel dimensions in the following ways: (1) manual visual inspection or manual measurement using tools such as tape measures, and estimation by inserting fixed-size grids. This method has large measurement errors, resulting in inaccurate billing, increased customer complaints, and low efficiency, making it difficult to cope with the processing needs of massive parcels during peak periods; (2) measurement using fixed measuring equipment such as light curtains and laser radar arrays. This type of solution usually requires two conveyor belts. Multiple sensors are installed on the side to calculate the size by detecting the occlusion of the light beam when the package passes by. Although this improves the accuracy, the hardware system is complex and the deployment cost is high, making it difficult to widely apply in small and medium-sized sorting centers or end-point outlets; (3) A single 2D industrial camera collects package images. However, this type of solution is limited by the inherent defects of monocular vision, namely, there is a serious scale uncertainty problem in recovering the three-dimensional size from the two-dimensional image information. It is also easily affected by the camera installation height, viewing angle, lens distortion, and the color, texture, and lighting conditions of the package itself. Therefore, this type of solution can usually only perform coarse-grained classification of packages at a limited level such as "large, medium, and small", and cannot output three-dimensional size data accurate to the centimeter level. This makes it impossible to meet the demand for billing based on accurate volume weight, and it is also difficult to use it to optimize loading rate and sorting path planning, so its application value is limited. It can be seen that how to achieve high-precision automatic estimation of the three-dimensional size of logistics packages based on low-cost, deployed ordinary 2D vision equipment without relying on expensive dedicated hardware has become a technical bottleneck that the industry urgently needs to overcome. Summary of the Invention
[0003] This invention provides a method, device, and storage medium for identifying the size of logistics parcels, which solves the problems of large errors, low efficiency, and high cost in the existing technology for identifying the size of logistics parcels.
[0004] According to one aspect of this application, a method for identifying the size of a logistics package is disclosed, the method comprising: Acquire dual-view images of the target package, wherein the dual-view images are a top view image and a side view image of the target package, and both the top view image and the side view image contain reference objects of known physical size for scale calibration; The dual-view image of the target is input into a pre-trained three-dimensional size estimation model to obtain the pixel size prediction value corresponding to the three-dimensional shape of the target package output by the model. Determine the global conversion coefficients from pixel size to physical size in the dual-view image; Based on the global transformation coefficients, the pixel size prediction value is scaled back to obtain the preliminary physical size prediction value of the target package; The preliminary physical dimension prediction value is verified and corrected based on predefined physical constraint rules to obtain the three-dimensional physical dimension prediction value of the target package.
[0005] According to another aspect of this application, a logistics parcel size identification device is also disclosed, the device comprising: The image acquisition module is used to acquire dual-view images of the target package, wherein the dual-view images are a top view image and a side view image of the target package, and both the top view image and the side view image contain a reference object with known physical size for scale calibration. The pixel size prediction output module is used to input the dual-view image of the target into a pre-trained three-dimensional size estimation model to obtain the pixel size prediction value output by the model corresponding to the three-dimensional shape of the target package. A global conversion coefficient calculation module is used to determine the global conversion coefficient from pixel size to physical size in the dual-view image; The scale restoration module is used to perform scale restoration on the pixel size prediction value based on the global transformation coefficient to obtain the preliminary physical size prediction value of the target package; The verification and correction module is used to verify and correct the preliminary physical size prediction value based on predefined physical constraint rules, so as to obtain the three-dimensional physical size prediction value of the target package.
[0006] According to another aspect of this application, an electronic device is also disclosed, the electronic device including a memory and at least one processor, the memory storing instructions; the at least one processor invokes the instructions in the memory to cause the electronic device to perform various steps of the logistics package size identification method as described in any of the preceding claims.
[0007] According to another aspect of this application, a computer-readable storage medium is also disclosed, wherein instructions are stored on the computer-readable storage medium, characterized in that, when executed by a processor, the instructions implement the various steps of the logistics package size identification method as described in any of the preceding claims.
[0008] The present invention includes, but is not limited to, the following beneficial effects: (1) By introducing dual-view images and mandating that the images contain reference objects of known physical size, the present invention achieves adaptive calibration of the reference objects, dynamically and in real time calculates the accurate conversion coefficient from pixel size to physical size, thereby transforming the traditional scheme that relies on complex fixed calibration into adaptive intelligent calibration, fundamentally ensuring the accuracy of the absolute scale of the measurement results; (2) Using ordinary 2D industrial cameras, the present invention eliminates the need for expensive lidar, 3D sensors or precision light curtain arrays, resulting in low cost and making large-scale deployment possible; no complex and professional on-site calibration is required, and existing objects in the scene are used as reference objects, which has cross-scene adaptive capability, quick installation and debugging, and low maintenance cost; (3) Utilizing the powerful Swin Transformer network constructs a model, extracts dual-view depth features, performs intelligent fusion through attention weighting mechanism, and then predicts the initial size that conforms to physical common sense through specially designed geometric constraint regression head, realizing high-precision end-to-end mapping; (4) set physical constraint rule library at the end of the algorithm to perform forced logical verification and correction on the initial prediction value, effectively filtering out the absurd output that the model may produce, and improving the accuracy, reliability and stability of the output results. Attached Figure Description
[0009] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below.
[0010] Figure 1 This is a flowchart of a logistics parcel size recognition method according to an embodiment of this application; Figure 2 This is another flowchart of the logistics parcel size recognition method according to an embodiment of this application; Figure 3 This is another flowchart of the logistics parcel size recognition method according to an embodiment of this application; Figure 4 This is another flowchart of the logistics parcel size recognition method according to an embodiment of this application; Figure 5 This is another flowchart of the logistics parcel size recognition method according to an embodiment of this application; Figure 6 This is another flowchart of the logistics parcel size recognition method according to an embodiment of this application; Figure 7This is another flowchart of the logistics parcel size recognition method according to an embodiment of this application; Figure 8 This is a structural block diagram of the logistics parcel size recognition device according to an embodiment of this application; Figure 9 This is a schematic diagram of the structure of the electronic device provided in an embodiment of the present invention. Detailed Implementation
[0011] This invention provides a method, apparatus, device, and storage medium for identifying the size of a logistics package. The method includes acquiring a dual-view image of a target package, comprising a top view and a side view of the target package, both of which include reference objects of known physical size for scale calibration; inputting the dual-view image into a pre-trained three-dimensional size estimation model to obtain pixel size prediction values corresponding to the three-dimensional shape of the target package; determining global conversion coefficients from pixel size to physical size in the dual-view image; performing scale restoration on the pixel size prediction values based on the global conversion coefficients to obtain preliminary physical size prediction values for the target package; and verifying and correcting the preliminary physical size prediction values based on predefined physical constraint rules to obtain three-dimensional physical size prediction values for the target package. This solution addresses the problems of large errors, low efficiency, and high cost in logistics package size identification.
[0012] The terms "first," "second," "third," "fourth," etc. (if present) in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" or "having" and any variations thereof are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0013] For ease of understanding, the specific process of the embodiments of the present invention will be described below. Figure 1 A flowchart of a method for identifying the size of logistics parcels, such as Figure 1 As shown, it includes the following steps: S100: Obtain dual-view images of the target package.
[0014] Among them, the dual-view images of the target are a top view image and a side view image of the target wrapped in the target. Both the top view image and the side view image of the target contain reference objects with known physical dimensions for scale calibration.
[0015] Specifically, such as Figure 2 The diagram shown is another flowchart of the logistics package size recognition method according to an embodiment of this application. This flowchart is an exemplary illustration of step S100 in this method. (See attached diagram.) Figure 2 It includes the following steps: S200 receives initial top-view and initial side-view images of the target package from a top-view industrial camera and a side-view industrial camera deployed above and to the side of the sorting line, which are simultaneously exposed and acquired.
[0016] Both the initial top view image and the initial side view image contain reference objects for scale calibration.
[0017] Specifically, at key nodes of the parcel sorting line, 2D industrial cameras with top-view and side-view perspectives are installed respectively. Both cameras are set to high frame rate acquisition mode to ensure that the camera's field of view can completely cover the parcels passing through the sorting line. The two 2D industrial cameras are activated to synchronously acquire top-view images of the target parcels, and simultaneously acquire corresponding side-view images of the same parcels, forming a dual-view image of the target parcel. The top-view camera excels at capturing the maximum projected surface of the parcel, accurately measuring the length and width of the target parcel, but cannot perceive the height. The side-view camera, on the other hand, can see the vertical surface of the target parcel, which is crucial for measuring the height and side shape. At the same time, if the target parcel has labels or special textures that make the features unclear in one viewpoint, the other viewpoint can provide redundant information. The dual-view deployment of top-view and side-view overcomes the problem of missing information in monocular vision. Synchronous acquisition ensures that the shutters of the two cameras open at exactly the same moment, so that the position, posture, and lighting conditions of the parcel in the two images captured are consistent, achieving a physical guarantee for high-precision measurement and providing a data foundation for subsequent feature alignment and 3D information fusion.
[0018] Specifically, to address the issue of scale uncertainty in monocular vision, this solution requires that each top-view and side-view image capture a reference object of known size. The reference object can be a standard-sized tray, the edge of a conveyor belt, or a fixed ruler, etc., providing a basis for subsequent calculation of the conversion coefficient from pixel size to physical size.
[0019] S202. Bind the initial top view image to the initial side view image.
[0020] Specifically, when a package is detected entering the field of view, the top-view and side-view cameras simultaneously receive the same trigger signal to capture images. They expose and capture images of the target package at the same time. For this target package, the system generates a pair of images with completely synchronized timestamps. The system automatically marks these two images as belonging to the same capture time, binds them together, and generates a unique ID for this image pair.
[0021] S204. Preprocess the initial top view image and initial side view image after binding to obtain the target top view image and target side view image of the target package for input.
[0022] Specifically, preprocessing includes, but is not limited to: image distortion correction of the initial top-view and initial side-view images: using the intrinsic parameter matrix and distortion coefficients calibrated at the camera's factory, mathematical transformations are used to correct the images, restoring straight lines at image edges caused by optical distortion to straight lines; image alignment and size normalization: adjusting the images to a fixed resolution size, maintaining the aspect ratio, and avoiding shape distortion; image enhancement and background noise suppression: using Gaussian filtering, median filtering, and other methods to suppress random noise generated by the image sensor and minor blurring caused by conveyor belt movement; pixel value normalization, etc. Since the initial images captured directly from industrial cameras are raw data, they are full of various task-irrelevant distortions, lighting changes, noise, and other interferences, and cannot be directly input into the trained model. By preprocessing the initial top-view and initial side-view images, most task-irrelevant interferences are eliminated, ensuring that the data input to the model is clean, standardized, effective, and of high quality, thus blocking the possibility of model misjudgment due to data problems at the source.
[0023] S206. Integrate the top view image and the side view image of the target to obtain a dual-view image of the target package.
[0024] In a specific example, if the bottom surfaces of the target packages are the same, the top view image alone cannot distinguish between a short and wide package and a tall and thin package; if the side projections of the target packages are the same, the side view image alone cannot distinguish between a wide and flat package and a narrow and thick package. In this case, in order to eliminate these ambiguities, it is necessary to integrate the top view image and the side view image, and fuse these two feature maps into a single dual-view image to determine the unique three-dimensional size of the target package.
[0025] S102. Input the dual-view image of the target into the pre-trained three-dimensional size estimation model to obtain the pixel size prediction value corresponding to the three-dimensional shape of the target package output by the model.
[0026] Specifically, the 3D size estimation model is pre-established, such as... Figure 3The diagram shown is another flowchart of the logistics package size recognition method according to an embodiment of this application. This flowchart is an exemplary illustration of training the three-dimensional size estimation model in this method. (See attached diagram.) Figure 3 It includes the following steps: S300: Collect historical dual-view images of historical packages and their corresponding actual three-dimensional size data, and associate the historical dual-view images of each historical package with their corresponding actual three-dimensional size data to obtain a training dataset.
[0027] Specifically, the method for acquiring historical dual-view images of historical packages is the same as the method for acquiring target dual-view images of target packages, and will not be repeated here.
[0028] Simultaneously with image acquisition, real-time 3D dimension measurements are performed on passing packages, recording the actual length, width, and height data for each package. The unique ID of each dual-view image pair generated during image acquisition is associated with its corresponding actual length, width, and height data. A data index is established based on the image ID to ensure that the corresponding image pair and actual size data can be quickly found using the ID. Then, the associated raw dataset undergoes manual or semi-automatic filtering to remove invalid data such as blurry images, missing or incorrect size information. This results in a structured, clean training dataset that can be directly used for model training. A typical recording format for this training dataset can be: image number, top-view image path, side-view image path, actual length, actual width, and actual height.
[0029] By constructing a high-quality training dataset with real-size labels, the model repeatedly learns from thousands of image-size pairing samples, mastering the complex mapping relationship from pixel information to physical size, providing the model with a standard answer, and ultimately achieving high-precision measurement by the model.
[0030] S302. Construct a multi-view feature extraction network based on a sliding window Transformer as the backbone of the model.
[0031] The multi-view feature extraction network includes a top-view branch for processing historical top-view images and a side-view branch for processing historical side-view images.
[0032] S304. Input the images in the training dataset into the multi-view feature extraction network. Based on window attention calculation and shift window mechanism, obtain the top view feature output by the top view branch and the side view feature output by the side view branch.
[0033] Specifically, in the constructed training dataset, a batch of bound top-view images, side-view images, and real-size label data are extracted. These top-view images are fed into the top-view branch of the multi-view feature extraction network, while the side-view images are fed into the side-view branch. Within each branch, the input image is segmented into multiple non-overlapping local windows. Self-attention calculation is performed within each window, enabling each pixel within the window to perform correlation calculations with all other pixels within the same window, learning the relationships between them. After the window attention calculation is completed, a window shifting operation is performed to re-divide the window boundaries of the feature map, causing the originally non-overlapping windows to intersect. Then, attention calculation is performed again within the new shifted window to achieve feature interaction between adjacent windows, thereby breaking the window boundary constraints and completing the global structural feature modeling of the wrapped image. At the same time, feature downsampling and dimensionality upscaling operations are performed at the end of each network stage, outputting the final high-level semantic features: top-view features and side-view features. The top-view features encode key information about the shape, aspect ratio, and top surface texture of the wrapped plane, while the side-view features encode key information about the contour, height, and side structure inside the wrapped image.
[0034] S306. Based on the attention weighting mechanism, the top view feature and the side view feature are fused to obtain the comprehensive feature vector of the historical package.
[0035] Specifically, an attention weighting mechanism is used to assign weights to top-view and side-view features. In a specific example, a flat package, such as an envelope, has very rich and reliable top-view information, but weak side-view information, almost appearing as a line. In this case, the attention mechanism will automatically assign a very high weight to the top-view features and a very low weight to the side-view features. For a tall cylindrical package, the side view clearly reflects the height, while the top view is just a circle. In this case, the attention mechanism will increase the weight of the side-view features and correspondingly decrease the weight of the top-view features. The weights calculated by the attention mechanism are used to sum the weighted top-view and side-view features to obtain the comprehensive feature vector of the package.
[0036] S308. Connect the geometric constraint regression head after the multi-view feature extraction network.
[0037] S310. Input the comprehensive feature vector into the geometric constraint regression head to obtain the predicted pixel size of the historical package output by the geometric constraint regression head.
[0038] Specifically, a geometrically constrained regression head typically includes a preliminary regression layer, a constraint application layer, and a final output layer. After inputting the comprehensive feature vector into the geometrically constrained regression head, three raw prediction values are initially regressed. The constraint application layer then applies physical constraints to these raw prediction values, such as non-negativity constraints, proportional constraints, order constraints, and size relationship constraints. Finally, the reasonable pixel size prediction is output after being corrected by the constraint layer.
[0039] S312. The parameters of the multi-view feature extraction network and the geometric constraint regression head are iteratively optimized based on the composite loss function to obtain a well-trained 3D size estimation model.
[0040] Among them, the composite loss function aims to minimize the total loss function. The composite loss function is a weighted sum of the L1 loss function and the size scale consistency loss function. The L1 loss function is used to measure the absolute error between the predicted size and the actual physical size, and the size scale consistency loss function is used to measure the scale difference between the predicted size and the actual physical size.
[0041] Specifically, a composite loss function is constructed, and the L1 loss is calculated. The initially predicted size values are compared one by one with the corresponding true size values in the training dataset. The absolute difference in each size dimension is calculated, and then the absolute differences in the three dimensions are summed to obtain the L1 loss value. Then, the size proportion consistency loss is calculated. The length, width, and height proportions of the predicted size and the true size are calculated separately, and then the absolute difference between the two sets of proportions is calculated and summed to obtain the size proportion consistency loss value. Finally, the L1 loss value and the size proportion consistency loss value are weighted and summed according to the preset weight coefficients to obtain the total loss function. With minimizing the total loss function as the optimization objective, the backpropagation algorithm is used to propagate the total loss value from the regression head to the Swin Transformer backbone network. The weight parameters of all layers in the network are updated according to the magnitude of the loss value. The training is continuously iterated until the total loss value tends to converge and the predicted sizes all conform to the physical constraint rules, thus completing the collaborative optimization of the geometric constraint regression head and the backbone network.
[0042] S104. Determine the global conversion coefficients from pixel size to physical size in the dual-view image.
[0043] Specifically, such as Figure 4 The diagram shown is another flowchart of the logistics package size recognition method according to an embodiment of this application. This flowchart is an exemplary illustration of step S104 in this method. (See attached diagram.) Figure 4 It includes the following steps: S400. Obtain at least one geometric feature template of a reference object with known physical dimensions from the predefined reference object template library.
[0044] Specifically, objects that are fixed in the field, have regular shapes, known dimensions, and are easy to detect are selected as candidate reference objects to construct a predefined reference object template library. Candidate reference objects can be the edge contour features of a conveyor belt's metal frame, a standard logistics pallet of fixed size, a conveyor belt roller of known height, fixed floor tiles in the work area, or equipment guardrails with fixed spacing, etc. For the selected reference objects, high-resolution images are taken from multiple angles and under different lighting conditions. Image processing algorithms or manual annotation are used to extract the geometric feature templates of the reference objects. In a specific example, for a standard pallet, its complete quadrilateral contour and the precise coordinates of its four corner points are extracted; for parallel guardrails, the equations of two long straight lines are extracted. These templates are associated with their known, precise physical dimensions and stored in the system's template library, forming the predefined reference object template library. When the system begins processing a new image of a target package being sorted, algorithms such as template matching, feature matching, or neural network detection are used in real time to search for features that match any reference object template in the template library. Once at least one match is successfully found, the geometric feature template of that reference object is obtained.
[0045] By acquiring geometric feature templates of reference objects with known physical dimensions, the system is provided with a ruler of known length. This transforms the dependence on camera parameters into a dependence on known objects in the scene. As long as there are reference objects in the template library in the scene, the system can perform calibration dynamically and adaptively without recalibrating the camera. Regardless of changes in ambient lighting or slight camera vibrations, as long as the reference object can still be detected, the system can recalibrate the scale using it, maintaining long-term accuracy. It is also easy to manage and expand, enhancing the system's robustness.
[0046] S402. In the top view image or side view image of the target, identify the reference object based on the target detection algorithm and extract the image contour of the reference object with sub-pixel precision.
[0047] Specifically, the position and range of the reference object in the image are located based on the target detection algorithm. Within the located range, the edge extraction algorithm is used in combination with the contour tracking algorithm, and sub-pixel thinning technology is applied to obtain the sub-pixel precision image contour data of the reference object.
[0048] S404. Based on the image contour, measure the pixel length corresponding to the key dimensions of the reference object in the pixel space of the target dual-view image.
[0049] Among them, the critical dimension is the dimension corresponding to the known physical dimensions of the reference object.
[0050] S406. Real-time calculation of the conversion coefficient for each reference object.
[0051] Conversion factor = Known physical size of reference object / Corresponding pixel length; S408. Perform a weighted average of each calculated conversion coefficient to obtain the global conversion coefficient.
[0052] Specifically, for multiple stable reference objects detected in the same image, the conversion coefficient of each reference object is calculated, and these conversion coefficients are weighted and averaged to eliminate the measurement error of a single reference object, thus obtaining the global conversion coefficient from pixel size to physical size.
[0053] S410, Obtain the preset threshold for conversion coefficient fluctuation.
[0054] S412. Real-time acquisition of global conversion coefficient fluctuation value. When the global conversion coefficient fluctuation value is greater than the preset threshold for conversion coefficient fluctuation, update the global conversion coefficient.
[0055] Specifically, the fluctuation value of the global conversion coefficient calculated each time is monitored in real time. When the fluctuation value of the global conversion coefficient is detected to be greater than the preset threshold for the fluctuation of the conversion coefficient, it is determined that there is scale drift caused by changes in camera installation height, lens distortion or lighting differences. Then, the latest calculated global conversion coefficient is automatically called to replace the original conversion coefficient. All subsequent conversions from pixel size to physical size of the package size are calculated using the updated global conversion coefficient to eliminate the impact of scale drift.
[0056] S106. Scale the pixel size prediction value based on the global transformation coefficient to obtain the preliminary physical size prediction value of the target package.
[0057] Specifically, such as Figure 5 The diagram shown is another flowchart of the logistics package size recognition method according to an embodiment of this application. This flowchart is an exemplary illustration of step S106 in this method. (See attached diagram.) Figure 5 It includes the following steps: S500, obtain global conversion coefficients.
[0058] S502. Preliminary physical size predictions are obtained based on scale reduction calculations.
[0059] Preliminary physical size prediction = pixel size prediction × global conversion coefficient.
[0060] S108. Based on predefined physical constraint rules, the preliminary physical dimension prediction value is verified and corrected to obtain the three-dimensional physical dimension prediction value of the target package.
[0061] Specifically, such as Figure 6 The diagram shown is another flowchart of the logistics package size recognition method according to an embodiment of this application. This flowchart is an exemplary illustration of step S108 in this method. (See attached diagram.) Figure 6 It includes the following steps: S600: Input the preliminary physical dimension prediction values into the predefined physical constraint rule base for logical verification.
[0062] The rule base must contain at least one of the following: size non-negative rules, size relationship rules, and proportion rationality rules. Among them, the size non-negative rule requires that the predicted length, width, and height values of the target package must all be greater than zero; the size relationship rule requires that the predicted height value of the target package must not exceed a preset proportion threshold of the sum of the predicted length and width values; and the proportion rationality rule requires that the predicted aspect ratio, length-to-height ratio, or width-to-height ratio of the target package must be within a reasonable range based on statistics of common package shapes.
[0063] Specifically, a predefined physical constraint rule library is used to verify and correct the rationality of the initial physical dimension predictions. Among these, the dimension non-negative rule is a fundamental physical impossibility check, with the rule stating: predicted length > 0, width > 0, height > 0. This rule forces all negative or zero values to be clamped to a very small integer, ensuring no invalid data is output and preventing subsequent calculations and business logic from crashing due to illegal input, thus guaranteeing system robustness. The dimension relationship rule states: height ≤ (length + width) * α, where α is a preset proportional threshold. This rule is used to capture and correct severe model misjudgments. In real-world logistics scenarios, the height of a package typically does not exceed the sum of its base length and width. A package with a height significantly greater than its base perimeter is extremely unstable, indicating a potential model misjudgment of height. In such cases, the rule will mark it as an anomaly, forcibly correcting it or triggering an alarm, requiring manual review to prevent physically impossible or highly unstable package configurations. The proportional rationality rule is used to correct systematic deviations and identify special and abnormal items. The rule content is as follows: the length-to-width ratio, length-to-height ratio, and width-to-height ratio of the package are within a reasonable range based on a large amount of historical package data; by using the law of large numbers in the logistics industry, the shape proportion distribution of the vast majority of ordinary packages is statistically analyzed by analyzing a large number of real package dimensions, and abnormal packages are identified.
[0064] S602. If the verification result satisfies all the rules in the rule base, the preliminary physical size prediction value is directly output as the three-dimensional physical size prediction value of the target package.
[0065] S604. If a correctable rule is violated, the preliminary physical dimension prediction value is corrected based on the rule, and the corrected value is output as the three-dimensional physical dimension prediction value of the target package.
[0066] Specifically, correctable rules refer to rules that can be automatically corrected through deterministic logic or calculation, such as non-negative rules. If the height prediction is negative, it will be automatically corrected to a preset minimum positive value. Unit / dimension errors, such as abnormally large values, may be due to incorrect unit labeling, such as outputting meters as centimeters. In this case, scaling the unit proportionally will solve the problem. For violations of uncorrectable rules, an anomaly alarm will be triggered and marked.
[0067] In one instance, Figure 7 Another flowchart for logistics parcel size recognition according to an embodiment of this application includes the following steps: S700: Obtain the pre-set volume category classification standard.
[0068] Specifically, the length, width, and height ranges or volume ranges corresponding to each volume category (S / M / L / XL) are preset.
[0069] S702. Calculate the volume of the target package based on the predicted three-dimensional physical dimensions.
[0070] S704. Match the volume with the volume category classification standard to obtain the volume category of the target package.
[0071] Specifically, the dimensions or calculated volume of the package are compared and matched with the preset volume classification standards to determine the corresponding volume category of the package. The predicted length, width, and height of the package and the corresponding volume category are then structured and packaged in a data format recognizable by the sorting control system to form a standard data message for storage.
[0072] Furthermore, Figure 8 This is a structural block diagram of the logistics package size recognition device according to an embodiment of this application, such as... Figure 8 As shown, the device includes: The image acquisition module is used to acquire dual-view images of the target package. The dual-view images are a top view image and a side view image of the target package. Both the top view image and the side view image contain reference objects with known physical dimensions for scale calibration. The pixel size prediction output module is used to input the dual-view image of the target into a pre-trained three-dimensional size estimation model to obtain the pixel size prediction value output by the model corresponding to the three-dimensional shape of the target package. The global conversion coefficient calculation module is used to determine the global conversion coefficients from pixel size to physical size in dual-view images; The scale restoration module is used to scale the pixel size prediction values based on the global transformation coefficients to obtain the preliminary physical size prediction values of the target package. The verification and correction module is used to verify and correct the preliminary physical dimension prediction value based on predefined physical constraint rules, so as to obtain the three-dimensional physical dimension prediction value of the target package.
[0073] Furthermore, the image acquisition module includes: The image receiving unit is used to receive the initial top view image and initial side view image of the target package that are simultaneously exposed and acquired by the top view industrial camera and the side view industrial camera deployed above the sorting line. Both the initial top view image and the initial side view image contain reference objects for scale calibration. An image binding unit is used to bind an initial top view image to an initial side view image; The image preprocessing unit is used to preprocess the initial top view image and initial side view image after binding to obtain the target top view image and target side view image of the target package for input; The image integration unit is used to integrate the top view image and the side view image of the target to obtain a dual-view image of the target package.
[0074] Furthermore, the global conversion coefficient calculation module includes: The feature template acquisition unit is used to acquire the geometric feature template of at least one reference object with known physical dimensions from a predefined reference object template library; The reference object image contour extraction unit is used to identify reference objects in a top view image or side view image of a target based on a target detection algorithm and extract the image contours of the reference objects with sub-pixel precision. The reference object pixel length measurement unit is used to measure the pixel length of the reference object in the pixel space of the target dual-view image based on the image contour. The key dimension is the dimension corresponding to the known physical dimension of the reference object. The conversion factor calculation unit is used to calculate the conversion factor of each reference object in real time. Conversion factor = Known physical size of reference object / Corresponding pixel length; The global conversion coefficient calculation unit is used to perform a weighted average of each calculated conversion coefficient to obtain the global conversion coefficient. The conversion coefficient fluctuation preset threshold acquisition unit is used to acquire the conversion coefficient fluctuation preset threshold. The global conversion coefficient update unit is used to obtain the global conversion coefficient fluctuation value in real time. When the global conversion coefficient fluctuation value is greater than the preset threshold for conversion coefficient fluctuation, the global conversion coefficient is updated.
[0075] Furthermore, in some embodiments, the scale reduction module includes: The global conversion coefficient acquisition unit is used to acquire global conversion coefficients. The preliminary physical size prediction calculation unit is used to obtain the preliminary physical size prediction value based on scale restoration calculation: Preliminary physical size prediction value = pixel size prediction value × global conversion coefficient.
[0076] Furthermore, in some embodiments, the verification correction module includes: The preliminary physical dimension prediction value input unit is used to input the preliminary physical dimension prediction value into a predefined physical constraint rule base for logical verification. The rule base contains at least one of the following: dimension non-negative rule, dimension relationship rule, and proportion rationality rule. The dimension non-negative rule requires that the predicted length, width, and height values of the target package must all be greater than zero. The dimension relationship rule requires that the predicted height value of the target package must not exceed a preset proportion threshold of the sum of the predicted length and width values. The proportion rationality rule requires that the predicted aspect ratio, length-to-height ratio, or width-to-height ratio of the target package must be within a reasonable range based on statistics of common package shapes. The rule verification unit is used to directly output the preliminary physical size prediction value as the three-dimensional physical size prediction value of the target package if the verification result satisfies all the rules in the rule base. The correction output unit is used to correct the preliminary physical size prediction value based on the rule if a correctable rule is violated, and output the corrected value as the three-dimensional physical size prediction value of the target package.
[0077] Furthermore, in some embodiments, the apparatus further includes: The volume category classification standard acquisition module is used to acquire the pre-set volume category classification standard; The volume calculation module is used to calculate the volume of the target package based on the predicted three-dimensional physical dimensions. The volume category matching module is used to match the volume with the volume category classification criteria to obtain the volume category of the target package.
[0078] Furthermore, in some embodiments, the apparatus further includes a three-dimensional size estimation model training module, which includes: The training dataset acquisition unit is used to collect historical dual-view images of historical packages and their corresponding actual three-dimensional size data, and associate the historical dual-view images of each historical package with their corresponding actual three-dimensional size data to obtain the training dataset. Multi-view feature extraction network building unit is used to construct a multi-view feature extraction network based on sliding window Transformer as the backbone of the model. The multi-view feature extraction network includes a top view branch for processing historical top view images and a side view branch for processing historical side view images. The viewpoint feature output unit is used to input images from the training dataset into the multi-viewpoint feature extraction network, and obtain the top viewpoint features output by the top viewpoint branch and the side viewpoint features output by the side viewpoint branch based on window attention calculation and shift window mechanism. The comprehensive feature vector acquisition unit is used to fuse top view features and side view features based on an attention weighting mechanism to obtain a comprehensive feature vector of historical packages. The geometric constraint regression head access unit is used to connect the geometric constraint regression head after the multi-view feature extraction network; The historical package pixel size prediction output unit is used to input the comprehensive feature vector into the geometric constraint regression head to obtain the historical package pixel size prediction value output by the geometric constraint regression head; The parameter optimization unit is used to iteratively optimize the parameters of the multi-view feature extraction network and the geometric constraint regression head based on the composite loss function to obtain a trained 3D size estimation model. The composite loss function aims to minimize the total loss function and is a weighted sum of the L1 loss function and the size scale consistency loss function. The L1 loss function measures the absolute error between the predicted size and the actual physical size, and the size scale consistency loss function measures the scale difference between the predicted size and the actual physical size.
[0079] This solution introduces dual-view images and mandates the inclusion of reference objects with known physical dimensions within the images, achieving adaptive calibration of the reference objects. It dynamically and in real-time calculates the precise conversion coefficients from pixels to physical dimensions, transforming the traditional method, which relies on complex fixed calibration, into adaptive intelligent calibration. This fundamentally ensures the absolute scale accuracy of the measurement results. Using ordinary 2D industrial cameras eliminates the need for expensive LiDAR, 3D sensors, or precision light curtain arrays, resulting in low cost and enabling large-scale deployment. It eliminates the need for complex and professional on-site calibration, utilizing existing objects in the scene as reference objects, providing cross-scene adaptability, quick installation and debugging, and low maintenance costs. The powerful SwingTransformer network is used to build the model, extracting dual-view depth features, and intelligently fusing them through an attention-weighted mechanism. A specially designed geometric constraint regression head then predicts the initial dimensions that conform to physical common sense, achieving high-precision end-to-end mapping. A physical constraint rule base is set at the end of the algorithm to enforce logical verification and correction of the initial prediction values, effectively filtering out potentially absurd outputs from the model and improving the accuracy, reliability, and stability of the output results.
[0080] The application of the relevant modules of the device in this example can be referred to the relevant introduction of the method principle above, and will not be repeated here.
[0081] above Figure 8The logistics package size recognition device in this embodiment of the invention will be described in detail from the perspective of modular functional entities. The electronic device in this embodiment of the invention will be described in detail from the perspective of hardware processing.
[0082] Figure 9 This is a schematic diagram of the structure of an electronic device 900 provided in an embodiment of the present invention. The electronic device 900 can vary significantly due to different configurations or performance characteristics. It may include one or more central processing units (CPUs) 910 (e.g., one or more processors) and a memory 920, and one or more storage media 930 (e.g., one or more mass storage devices) for storing application programs 933 or data 932. The memory 920 and storage media 930 may be temporary or persistent storage. The program stored in the storage media 930 may include one or more modules (not shown in the diagram), each module including a series of instruction operations on the electronic device 900. Furthermore, the processor 910 may be configured to communicate with the storage media 930 and execute the series of instruction operations in the storage media 930 on the electronic device 900.
[0083] Electronic device 900 may also include one or more power supplies 940, one or more wired or wireless network interfaces 950, one or more input / output interfaces 960, and / or one or more operating systems 931, such as Windows Server, MacOSX, Unix, Linux, FreeBSD, etc. Those skilled in the art will understand that... Figure 9 The illustrated electronic device structure does not constitute a limitation on electronic devices and may include more or fewer components than illustrated, or combine certain components, or have different component arrangements.
[0084] The present invention also provides a computer-readable storage medium, which can be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium, wherein the computer-readable storage medium stores instructions that, when executed on a computer, cause the computer to perform the steps of the logistics package size identification method.
[0085] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the system, device, or unit described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0086] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0087] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for identifying the size of a logistics parcel, characterized in that, The method includes: Acquire dual-view images of the target package, wherein the dual-view images are a top view image and a side view image of the target package, and both the top view image and the side view image contain reference objects of known physical size for scale calibration; The dual-view image of the target is input into a pre-trained three-dimensional size estimation model to obtain the pixel size prediction value corresponding to the three-dimensional shape of the target package output by the model. Determine the global conversion coefficients from pixel size to physical size in the dual-view image; Based on the global transformation coefficients, the pixel size prediction value is scaled back to obtain the preliminary physical size prediction value of the target package; The preliminary physical dimension prediction value is verified and corrected based on predefined physical constraint rules to obtain the three-dimensional physical dimension prediction value of the target package.
2. The method for identifying the size of logistics parcels according to claim 1, characterized in that, The method further includes training a three-dimensional size estimation model, wherein the trained three-dimensional size estimation model includes: Collect historical dual-view images of historical packages and their corresponding actual three-dimensional size data, and associate the historical dual-view images of each historical package with their corresponding actual three-dimensional size data to obtain a training dataset; A multi-view feature extraction network based on a sliding window Transformer is constructed as the backbone of the model. The multi-view feature extraction network includes a top view branch for processing historical top view images and a side view branch for processing historical side view images. The images in the training dataset are input into the multi-view feature extraction network. Based on window attention calculation and shift window mechanism, the top view feature output by the top view branch and the side view feature output by the side view branch are obtained. The top-view and side-view features are fused based on an attention-weighted mechanism to obtain a comprehensive feature vector of the historical package. A geometric constraint regression head is then connected after the multi-view feature extraction network. The comprehensive feature vector is input into the geometric constraint regression head to obtain the predicted pixel size of the historical package output by the geometric constraint regression head; The parameters of the multi-view feature extraction network and the geometric constraint regression head are iteratively optimized based on the composite loss function to obtain a trained 3D size estimation model. The composite loss function aims to minimize the total loss function and is a weighted sum of the L1 loss function and the size scale consistency loss function. The L1 loss function measures the absolute error between the predicted size and the actual physical size, and the size scale consistency loss function measures the proportional difference between the predicted size and the actual physical size.
3. The method for identifying the size of logistics parcels according to claim 1, characterized in that, The acquisition of the target package's dual-view image includes: The system receives initial top-view and initial side-view images of the target package, which are simultaneously exposed and acquired by a top-view industrial camera deployed above the sorting line and a side-view industrial camera deployed on the side. Both the initial top-view and initial side-view images contain reference objects for scale calibration. Bind the initial top view image to the initial side view image; The initial top view image and initial side view image after binding are preprocessed to obtain the target top view image and target side view image of the target package for input; The top view image and the side view image of the target are integrated to obtain a dual-view image of the target packaged in the target.
4. The method for identifying the size of logistics parcels according to claim 1, characterized in that, The process of determining the conversion coefficient from pixel size to physical size in the dual-view image includes: Obtain the geometric feature template of at least one reference object with known physical dimensions from the predefined reference object template library; In the top view image or side view image of the target, the reference object is identified based on the target detection algorithm, and the sub-pixel precision image contour of the reference object is extracted; Based on the image contour, the pixel length corresponding to the key dimension of the reference object in the pixel space of the target dual-view image is measured, where the key dimension is the dimension corresponding to the known physical dimension of the reference object; Real-time calculation of the conversion coefficient for each reference object: Conversion coefficient = Known physical size of reference object / Corresponding pixel length; A weighted average of each calculated conversion coefficient is performed to obtain the global conversion coefficient; Obtain the preset threshold for the fluctuation of the conversion coefficient; The global conversion coefficient fluctuation value is acquired in real time. When the global conversion coefficient fluctuation value is greater than the preset threshold for conversion coefficient fluctuation, the global conversion coefficient is updated.
5. The method for identifying the size of logistics parcels according to claim 1, characterized in that, The step of scaling the pixel size prediction value based on the global transformation coefficient to obtain the preliminary physical size prediction value of the target package includes: Get the global conversion coefficients; Preliminary physical size predictions are obtained based on scale reduction calculations: Preliminary physical size prediction = Pixel size prediction × Global conversion coefficient.
6. The method for identifying the size of logistics parcels according to claim 1, characterized in that, The process of verifying and correcting the preliminary physical dimension prediction value based on predefined physical constraint rules to obtain the three-dimensional physical dimension prediction value of the target package includes: The preliminary physical dimension prediction value is input into a predefined physical constraint rule base for logical verification. The rule base includes at least one of the following: dimension non-negative rule, dimension relationship rule, and proportion rationality rule. The dimension non-negative rule requires that the predicted length, width, and height values of the target package must all be greater than zero. The dimension relationship rule requires that the predicted height value of the target package must not exceed a preset proportion threshold of the sum of the predicted length and width values. The proportion rationality rule requires that the predicted aspect ratio, length-to-height ratio, or width-to-height ratio of the target package must be within a reasonable range based on statistics of common package shapes. If the verification result satisfies all the rules in the rule base, the preliminary physical size prediction value is directly output as the three-dimensional physical size prediction value of the target package; If a correctable rule is violated, the preliminary physical size prediction value is corrected based on the rule, and the corrected value is output as the three-dimensional physical size prediction value of the target package.
7. The method for identifying the size of logistics parcels according to claim 1, characterized in that, The method further includes: Obtain the pre-defined volume category classification criteria; The volume of the target package is calculated based on the predicted three-dimensional physical dimensions; The volume is matched with the volume category classification criteria to obtain the volume category of the target package.
8. A logistics parcel size recognition device, characterized in that, The device includes: The image acquisition module is used to acquire dual-view images of the target package, wherein the dual-view images are a top view image and a side view image of the target package, and both the top view image and the side view image contain a reference object with known physical size for scale calibration. The pixel size prediction output module is used to input the dual-view image of the target into a pre-trained three-dimensional size estimation model to obtain the pixel size prediction value output by the model corresponding to the three-dimensional shape of the target package. A global conversion coefficient calculation module is used to determine the global conversion coefficient from pixel size to physical size in the dual-view image; The scale restoration module is used to perform scale restoration on the pixel size prediction value based on the global transformation coefficient to obtain the preliminary physical size prediction value of the target package; The verification and correction module is used to verify and correct the preliminary physical size prediction value based on predefined physical constraint rules, so as to obtain the three-dimensional physical size prediction value of the target package.
9. An electronic device, characterized in that, The electronic device includes a memory and at least one processor, the memory storing instructions; the at least one processor invokes the instructions in the memory to cause the electronic device to perform the steps of the logistics package size identification method as described in any one of claims 1-7.
10. A computer-readable storage medium storing instructions thereon, characterized in that, When the instructions are executed by the processor, they implement the various steps of the logistics parcel size recognition method as described in any one of claims 1-7.