Commodity warehousing detection method, device and equipment and storage medium

By segmenting the visual image into appearance regions and combining it with weight data for dual comparison, the problem of high false positive rate in single-modal detection methods is solved, achieving efficient and accurate product warehousing detection.

CN121766899AInactive Publication Date: 2026-03-31SHENZHEN YOUZHIPAI ELECTRONIC COMMERCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-25
Publication Date
2026-03-31
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing methods for inspecting incoming goods rely on single-modal data, which makes it difficult to cope with minor packaging damage or visually similar product categories, resulting in a high misjudgment rate and affecting the accuracy and efficiency of the warehousing operation.

Method used

By segmenting the visual image into different regions, feature parameters of the packaging and the main product are extracted separately. These parameters are then compared with weight data to generate an order to allow entry into the warehouse.

Benefits of technology

It significantly improves the accuracy and reliability of goods receiving inspection, reduces the false judgment rate, enhances the adaptability to goods of various specifications, optimizes the data processing flow, and reduces the cost of manual re-inspection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121766899A_ABST
    Figure CN121766899A_ABST
Patent Text Reader

Abstract

The invention relates to a commodity warehousing detection method, device and equipment and a storage medium, and the method comprises the steps: collecting a visual image and weight data of a to-be-warehoused commodity, carrying out the appearance region segmentation of the visual image, and obtaining a target region image; identifying package apparent characteristics of the target area image, and extracting a commodity identity characteristic set from a commodity main body area of the target area image; according to the commodity identity feature set, extracting a reference weight interval and a reference packaging feature template from a pre-stored category database, and carrying out weight comparison on the weight data and the reference weight interval; analyzing an apparent difference value between the packaging apparent characteristics and the reference packaging characteristic template; if the apparent difference value is within a preset tolerance range, generating a warehousing permission instruction; according to the method, the commodity identity and the packaging state can be independently and cooperatively verified, so that the abnormal condition that the packaging is slightly damaged or the category is visually similar can be effectively identified.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the technical field of goods warehousing, and in particular to a method, apparatus, equipment, and storage medium for goods warehousing inspection. Background Technology

[0002] With the rapid development of e-commerce logistics, higher demands are being placed on the intelligence and automation of the goods receiving process. Currently, automated inspection methods based on sensor technology are widely used, such as using visual sensors to collect images of the product's appearance or using weight sensors to obtain product quality data. However, existing inspection solutions often rely on data from a single modality for independent judgment. For example, they may only verify packaging integrity through visual template matching or determine whether the product category is correct based solely on weight thresholds. This verification strategy based on single-dimensional data is difficult to cope with minor packaging damage, diverse product specifications, or interference from visually similar product categories in real-world scenarios, leading to a higher false positive rate and thus affecting the accuracy and overall efficiency of the receiving operation. Summary of the Invention

[0003] The main objective of this invention is to provide a method, apparatus, equipment, and storage medium for detecting incoming goods. By segmenting the exterior area and extracting the feature parameters of the packaging and the main body of the goods, the invention can independently and collaboratively verify the identity of the goods and the condition of the packaging, thereby effectively identifying abnormal situations such as minor packaging damage or visually similar product categories.

[0004] To achieve the above objectives, the present invention provides a method for detecting incoming goods, comprising: Collect visual images and weight data of goods to be put into storage, and perform appearance region segmentation on the visual images to obtain target region images; Identify the packaging appearance features of the target area image, and extract a set of product identity features from the main product area of ​​the target area image; Based on the product identity feature set, a baseline weight range and a baseline packaging feature template are extracted from the pre-stored category database, and the weight data is compared with the baseline weight range. If the weight data is within the baseline weight range, then analyze the apparent difference between the packaging appearance features and the baseline packaging feature template; If the apparent difference value is within the preset tolerance range, an instruction to allow entry into the warehouse is generated.

[0005] Preferably, the step of collecting visual images and weight data of goods to be put into storage, and segmenting the visual images to obtain target region images, includes: The visual image and weight data of the goods to be put into storage are obtained through the warehousing equipment; Analyze the pixel classification features of the visual image, and convert the visual image into a binary segmented image including a foreground region and a background region based on the pixel classification features; Identify connected regions in the binary segmented image and calculate the area parameter and shape parameter of each connected region; Filter out target connected regions from all the connected regions, where both the area parameter and the region shape parameter meet the preset regularity conditions; Extract the boundary coordinates of the target connected region, and perform image region cropping on the visual image based on the boundary coordinates to obtain the target region image.

[0006] Preferably, identifying the packaging appearance features of the target region image includes: Map all image pixels of the packaging area to a preset visual perception color space to obtain image components, calculate the mean and standard deviation of the pixel values ​​of the image components, and combine the mean and standard deviation of the pixel values ​​to form the color vector. The packaging area is divided into multiple sub-windows, and the gradient direction histogram of the local pixels contained in each sub-window is calculated. All the gradient direction histograms are concatenated in sequence to form the texture feature. Extract the texture pixels of the packaging area, fit the minimum bounding rectangle of the packaging area based on the texture pixels, calculate the aspect ratio of the minimum bounding rectangle, calculate the area ratio between the minimum bounding rectangle and the packaging area, and combine the aspect ratio and the area ratio into the morphological geometric parameters. The color vector, the texture feature, and the morphological geometry parameters are concatenated to form the packaging appearance feature.

[0007] Preferably, extracting a product identity feature set from the product subject region of the target region image includes: Identify the pixel boundaries of the main product area and connect the pixel boundaries with discontinuous points to form a closed contour; The total number of pixels in the region of the closed contour is calculated as the first contour parameter, and the total length of the curve of the closed contour is calculated as the second contour parameter. The first contour parameter and the second contour parameter are combined into a contour shape parameter. The main body area of ​​the product is scanned according to a preset identification scanning rule, and the area that conforms to the preset identification scanning rule is positioned as a surface identification candidate area; The identification feature information, including characters, graphics and symbols, is extracted from the surface identification candidate area, and the identification feature information is encoded into surface identification parameters; The product identity feature set is obtained by integrating the contour shape parameters and the surface identification parameters.

[0008] Preferably, the step of extracting a baseline weight range and a baseline packaging feature template from a pre-stored category database based on the product identity feature set, and comparing the weight data with the baseline weight range, includes: Traverse each category entry in the category database and calculate the first similarity between the contour shape parameters in the product identity feature set and the standard contour shape of the category entry; Calculate the second similarity between the surface identifier parameters in the commodity identity feature set and the standard surface identifiers in the category entries; Determine whether there are any category entries that meet the filtering conditions, wherein the filtering conditions are: the first similarity is greater than a preset first threshold, and the second similarity is greater than a preset second threshold; When there are category entries that meet the filtering conditions, the category entries are weighted and sorted according to the first similarity and the second similarity, and the category entry with the highest ranking in the sorting result is marked as the target matching record; Based on the target matching records, the benchmark weight range and the benchmark packaging feature template are extracted from the category database; The baseline weight range is divided into multiple weight sub-ranges, and each weight sub-range corresponds to a weight class. The weight data is compared sequentially with the upper and lower limits of each weight sub-interval.

[0009] Preferably, if the weight data is within the reference weight range, analyzing the apparent difference between the packaging appearance features and the reference packaging feature template includes: If the weight data falls within any of the weight sub-intervals, then the weight data is determined to be within the baseline weight interval, and the weight level corresponding to the weight sub-interval is read. The weight matching degree of the weight data is calculated based on the preset weight coefficient corresponding to the target weight level; The weight matching degree is compared with a preset qualified threshold. If the weight matching degree is greater than or equal to the qualified threshold; The appearance features of the packaging are compared with the reference packaging feature template one by one to generate the appearance difference value.

[0010] Preferably, the step of generating an allow-to-enter instruction when the apparent difference value is within a preset tolerance range includes: The apparent difference value is matched and compared one by one with the tolerance threshold of each parameter in the preset tolerance range; If any of the apparent difference values ​​is greater than the parameter tolerance threshold, it is determined that the apparent difference value is not within the preset tolerance range, and the corresponding goods to be put into storage are marked as unqualified. If all the apparent difference values ​​are not greater than the parameter tolerance threshold, then the apparent difference values ​​are determined to be within the preset tolerance range. When the apparent difference value is determined to be within the preset tolerance range, the permission to enter the database instruction is generated.

[0011] The present invention also provides a goods receiving inspection device, applied to any of the goods receiving inspection methods described above, comprising: The acquisition module acquires visual images and weight data of goods to be put into storage, and performs appearance region segmentation on the visual images to obtain target region images; The analysis module is used to identify the packaging appearance features of the target area image and extract a set of product identity features from the product main body area of ​​the target area image; The association module is used to extract a benchmark weight range and a benchmark packaging feature template from a pre-stored category database based on the product identity feature set, and compare the weight data with the benchmark weight range. The processing module is used to analyze the apparent difference value between the packaging appearance feature and the benchmark packaging feature template if the weight data is within the benchmark weight range. A control module is used to generate an allow entry instruction if the apparent difference value is within a preset tolerance range.

[0012] The present invention also provides a commodity receiving inspection device, comprising: Memory, used to store programs; A processor is used to execute the program to implement each step of the commodity warehousing detection method described in any of the above-mentioned embodiments.

[0013] The present invention also provides a storage medium storing computer instructions for causing a computer to perform any of the methods described above.

[0014] This invention provides a method, apparatus, equipment, and storage medium for inspecting goods upon entry into the warehouse, which has the following beneficial effects: By employing a multimodal detection strategy that integrates visual images and weight data, the limitations of single-data source verification are effectively overcome, significantly improving the accuracy and reliability of inbound product inspection. By segmenting the appearance area and extracting feature parameters from both packaging and the main product, independent and collaborative verification of product identity and packaging condition is achieved, effectively identifying minor packaging damage or visually similar anomalies. Dynamically acquiring corresponding benchmark data based on the product identity feature set and performing dual comparisons of weight and appearance differences reduces reliance on fixed thresholds and enhances adaptability to multi-specification products. Constructing a structured feature set and step-by-step judgment logic optimizes the data processing flow while ensuring detection accuracy, helping to reduce false positives, lower manual re-inspection costs, and improve warehouse operation efficiency. Attached Figure Description

[0015] Figure 1 This is a flowchart of a commodity warehousing inspection method provided by the present invention; Figure 2 This is a structural diagram of a commodity warehousing detection device provided by the present invention; Figure 3 This is a structural diagram of a commodity warehousing inspection device provided by the present invention.

[0016] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0017] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.

[0018] The present invention will now be further described in conjunction with the accompanying drawings and specific embodiments.

[0019] Reference Figure 1 As shown, the present invention provides a method for detecting incoming goods, including: Step S1: Collect visual images and weight data of the goods to be put into storage, segment the appearance region of the visual image, and obtain the target region image; Step S2: Identify the packaging appearance features of the target area image, and extract the product identity feature set from the product main body area of ​​the target area image; Step S3: Extract the baseline weight range and baseline packaging feature template from the pre-stored category database based on the product identity feature set, and compare the weight data with the baseline weight range; Step S4: If the weight data is within the reference weight range, analyze the apparent difference between the packaging appearance feature and the reference packaging feature template; Step S5: If the apparent difference value is within the preset tolerance range, then generate an instruction to allow entry into the warehouse.

[0020] Based on the steps described above, the detailed process is as follows: Step S1: Visual images are acquired using industrial cameras fixed above the conveyor belt or control panel. These cameras have a resolution of at least 5 megapixels and are equipped with uniform lighting to ensure stable illumination. Weight data is acquired synchronously using embedded weighing sensors with an accuracy controlled within ±1 gram. Visual images and weight data are associated using a unified timestamp to ensure that the data corresponds to the same product to be inspected. For appearance region segmentation of the visual images, a deep learning-based semantic segmentation model is employed. This model is pre-trained on a set of labeled images containing packaging areas, product main body areas, and background. Pixel-level classification is performed on the input images, outputting the probability distribution of each pixel belonging to packaging, product main body, or background.

[0021] The original visual image is converted into a binary segmented image containing foreground and background regions by setting a probability threshold. The foreground region includes a preliminary division of the packaging area and the main product area. Morphological closing operations are performed on the binary segmented image to eliminate holes within the regions, and then edge detection algorithms are used to extract the contours of connected regions.

[0022] The area and shape parameters of each connected region are calculated. The area parameter is measured by the total number of pixels, and the shape parameter is characterized by the ratio of the square of the contour perimeter to the area, representing the region's regularity. Connected regions with area parameters within a preset pixel range and shape parameters below a preset threshold are selected as target connected regions. This selection process excludes noise regions with excessively small areas and interference regions with extremely irregular shapes. Based on the boundary coordinates of the target connected regions, the original visual image is cropped to obtain a target region image containing the complete packaging and the main product.

[0023] Step S2: Based on the relative spatial relationship between the packaging area and the main product area in the target region image, a region growing algorithm is used to expand from the image edge inwards to determine the boundary of the packaging area. The color vector is constructed by converting the pixels of the packaging area from the RGB color space to the HSV color space, and calculating the mean and standard deviation of the pixel values ​​for the hue, saturation, and lightness components.

[0024] Six statistical measures are combined in a preset order to form a six-dimensional color vector, which represents the overall color characteristics and color distribution uniformity of the packaging area. Texture feature extraction divides the packaging area into sub-windows of the same size, and a pixel gradient direction histogram is calculated within each sub-window. The gradient direction histogram evenly divides the 0-degree to 180-degree angle range into 9 directional intervals, and the cumulative gradient magnitude value within each directional interval is calculated.

[0025] The gradient direction histograms of all sub-windows are concatenated in raster scan order to form a high-dimensional texture feature vector, which characterizes the material texture properties of the packaging surface. The calculation of morphological geometry parameters first determines the minimum bounding rectangle of the packaging area, obtaining the aspect ratio of the rectangle as the first morphological parameter. The ratio of the actual pixel area of ​​the packaging area to the area of ​​the minimum bounding rectangle is then calculated as the fill factor parameter. These two parameters together constitute the morphological geometry parameter set.

[0026] When extracting the contour shape parameters from the main product area, an edge tracking algorithm is used to obtain the closed contour of the main product. The total number of pixels enclosed by the contour is calculated as the area parameter, and the pixel length of the contour curve is calculated as the perimeter parameter. Surface label parameters are extracted by scanning the region of maximum stable extrema within the main product area to locate the area containing text or graphic labels.

[0027] After binarizing the identification area, skeleton and contour features are extracted, and the coordinate sequence of feature points is encoded into a feature vector. The packaging area features and the product body area features constitute the packaging appearance feature set and the product identity feature set, respectively. The two types of features together form a complete visual feature description of the product.

[0028] Step S3: The process of extracting baseline weight ranges and baseline packaging feature templates from a pre-stored category database based on product identity feature sets is built on a feature matching mechanism. The category database stores standard product data in a key-value pair structure, where the key is the standardized code of the product identity feature set, and the value is the corresponding baseline weight range and baseline packaging feature template.

[0029] The extraction process calculates the similarity between the real-time acquired product identity feature set and the standard feature codes in the database. Contour shape parameters are compared using Hausdorff distance to measure contour similarity, while surface identification parameters are matched using cosine similarity between feature vectors. When the overall similarity exceeds a preset threshold, the system determines it as a valid match and locks the baseline data for the corresponding product item. The baseline weight range is stored as a triplet, containing a lower limit, an upper limit, and a recommended weight value. This range is determined based on the statistical distribution of historical weight data. The baseline packaging feature template includes a standard color vector range, a texture feature vector set, and a morphological geometric parameter tolerance band. This baseline data originates from multiple batches of measurements of standard product samples.

[0030] In the weight comparison stage, the collected weight data is compared with the baseline weight range, and the range judgment algorithm is used to verify whether the weight value falls within the upper and lower limits.

[0031] Step S4: The comparison results generate a binary flag and record the percentage deviation between the actual weight and the recommended weight. This percentage serves as a quantitative indicator of weight matching. When the weight data is completely within the baseline weight range, a reset pass information message containing a timestamp and the percentage deviation is generated. This message serves as a prerequisite for initiating subsequent packaging inspections.

[0032] The color vector comparison uses Mahalanobis distance to calculate the difference between the real-time color vector and the reference color vector template. This distance calculation takes into account the correlation between the various color components. Texture feature difference analysis involves projecting and matching the real-time texture feature vector with the reference texture feature set. After dimensionality reduction through principal component analysis, the projected distance of the feature vector on the principal components is calculated.

[0033] The comparison of morphological geometric parameters separately addresses differences in aspect ratio and area fill rate. Aspect ratio is calculated using absolute error, while area fill rate is measured using relative error. Each feature difference value is standardized using a preset normalization coefficient, transforming it into a sequence of apparent difference values ​​with uniform dimensions. The preset tolerance range exists in the form of a multi-dimensional tolerance threshold vector, with each dimension corresponding to the upper limit of the allowable deviation for a specific feature parameter.

[0034] Step S5: In the difference value judgment stage, the standardized apparent difference values ​​are compared element-by-element with the tolerance threshold vector. When all difference values ​​do not exceed the corresponding threshold, the overall result is considered acceptable. The judgment logic adopts a parallel processing architecture, where each feature channel is compared independently and the results are summarized by a logical AND operation.

[0035] When the apparent difference value is completely within the preset tolerance range, an allow-to-enter instruction is generated. This instruction includes dual verification results of weight and appearance compliance. Simultaneously, the generation of the instruction triggers the actuator to send a control signal to the sorting device via the industrial bus and updates the product entry status record in the database.

[0036] This invention provides a product receiving inspection method that effectively overcomes the limitations of single-data source verification by integrating visual images and weight data through a multimodal detection strategy, significantly improving the accuracy and reliability of product receiving inspection. By segmenting the appearance area and extracting feature parameters of packaging and the main product separately, the method enables independent and collaborative verification of product identity and packaging status, effectively identifying minor packaging damage or visually similar anomalies. Dynamically acquiring corresponding benchmark data based on the product identity feature set and performing dual comparisons of weight and appearance differences reduces reliance on fixed thresholds and enhances adaptability to multi-specification products. By constructing a structured feature set and step-by-step judgment logic, the method optimizes the data processing flow while ensuring detection accuracy, helping to reduce misjudgments, lower manual re-inspection costs, and improve warehouse operation efficiency.

[0037] In one embodiment, visual images and weight data of goods to be put into storage are collected, and appearance region segmentation is performed on the visual images to obtain target region images, including: The inbound equipment includes an image acquisition module and a weighing sensor module. The image acquisition module uses an industrial-grade color camera fixed above the conveyor belt. The camera is equipped with a ring LED light source to provide a uniform lighting environment. The camera resolution is set to 5 megapixels or higher, and the frame rate is adjusted to a sampling frequency that matches the speed of the conveyor belt.

[0038] The weighing sensing module employs a high-precision digital load cell, installed beneath the conveyor belt's support panel. Its measurement range covers 0 to 50 kilograms, with a resolution down to the gram level. During visual image acquisition, the camera automatically captures an image when it triggers the photoelectric sensor in the detection area, simultaneously recording the image acquisition timestamp and device number. Weight data acquisition involves real-time monitoring of pressure changes on the support panel using the load cell. Once the weight reading stabilizes, the peak value is recorded, along with the weight acquisition timestamp.

[0039] Visual images and weight data are correlated and matched using a unified time stamp to ensure that both sets of data originate from the same individual product being inspected. The image acquisition module outputs a digital image in RGB color space, stored in a lossless compression format to preserve complete color and detail information. The weighing sensor module outputs a weight value that has undergone temperature compensation and digital filtering, eliminating measurement errors caused by mechanical vibration and environmental interference. The visual images and weight data are transmitted to the central processing unit via an industrial bus, forming the raw input set of data to be processed.

[0040] Pixel classification feature analysis employs a pre-trained deep learning semantic segmentation model. This model is based on an encoder-decoder architecture, where the encoder uses a deep convolutional neural network to extract multi-scale image features, and the decoder recovers the spatial resolution of the feature map through upsampling. The model training data includes thousands of fully labeled product image samples, with each pixel in each sample image labeled as either a packaging region, a product body region, or a background region. During inference, the original visual image is input into the segmentation model, and the model outputs a probability distribution matrix for each pixel belonging to each category.

[0041] The probability distribution matrix is ​​indexed by the maximum value in the channel dimension to generate a category label map for each pixel. Based on the category label map, the original image is converted into a binary segmentation image. Specifically, pixels belonging to the packaging area and the main product area are labeled as foreground regions and assigned the value white, while background pixels are labeled as background regions and assigned the value black. This conversion process produces a single-channel binary image containing only pure white and pure black pixel values.

[0042] After morphological post-processing, the binary segmented image undergoes structuring element closing operations to fill holes in the foreground region, and opening operations to eliminate small noise points. In the post-processed binary segmented image, white connected regions correspond to the overall projection range of the product packaging and the main body, while black regions represent the background environment.

[0043] Connected region identification uses the eight-neighbor connectivity criterion for region labeling and traverses all pixels in the binary image using a scan-line seed filling algorithm. When a foreground pixel is encountered, a region growing mechanism is initiated, recursively checking the membership status of its neighboring pixels and merging spatially contiguous foreground pixels into the same connected region.

[0044] Each connected region is assigned an independent label number, forming a labeled region. The area parameter is calculated based on the pixel counting principle, counting the total number of foreground pixels contained in each labeled region; this value directly represents the physical size of the connected region in the image. The region shape parameter is calculated using a feature description method based on contour moments, extracting the sequence of external contour points for each connected region through a boundary tracking algorithm. The zeroth and first moments of the region are calculated based on the contour point coordinates, deriving the coordinates of the region's center position.

[0045] The second-order moment features are calculated based on the central moment to obtain the orientation angle and principal axis length of the region. The region shape parameters are specifically composed of two indices: roundness and elongation. Roundness is characterized by the ratio of the square of the region's perimeter to its area, reflecting the degree to which the outline approximates a circle. Elongation reflects the elongated shape's characteristics by the aspect ratio of the region's smallest bounding rectangle. These parameters are calculated using a combination of integer and floating-point arithmetic to optimize processing efficiency while ensuring computational accuracy. The area and shape parameters of all connected regions form a feature vector set.

[0046] The preset regularization conditions include two dimensions: area threshold range and shape parameter constraints. The area threshold range sets upper and lower limits based on the expected pixel size of the product in the image, excluding noise interference that is too small and background foreign objects that are too large. The shape parameter constraints set the allowable range of roundness and the maximum value of elongation, ensuring that the selected area has appropriate compactness and reasonable shape proportions. The selection process adopts a region-by-region judgment mechanism, checking in turn whether the area parameter of each connected region is within the preset threshold range, while verifying whether its roundness and elongation meet the constraints.

[0047] When a region passes both area and shape checks, it is marked as a candidate connected region. For multiple candidate regions, a comprehensive scoring mechanism is used for selection. The scoring formula weights the degree to which the region's area closely approximates the standard area, the deviation of its circularity from the ideal value, and the difference between its elongation and the optimal ratio. The candidate region with the highest comprehensive score is selected as the final connected region; when scores are tied, the region with the larger area is prioritized. The selection results generate a label number and feature parameter record for the target region, along with the coordinates of the region's bounding rectangle in the image coordinate system.

[0048] The process of extracting the boundary coordinates of the target connected region and cropping the image region achieves precise localization from the binary mask to the original image. Boundary coordinate extraction employs an edge tracking algorithm, starting from any boundary point of the target connected region and traversing the entire contour path according to the Moore's neighborhood tracking principle. Contour point coordinates are stored in chain code form, recording the directional change of each boundary point relative to the previous point, while also saving the absolute coordinates of the starting point.

[0049] The complete set of contour point coordinates is reconstructed based on the chain code sequence, and the convex hull structure of the contour point set is calculated to simplify the boundary description. A minimum bounding rectangle is calculated based on the contour point set, and the coordinates of its four vertices serve as a reference for image cropping. The image region cropping operation is expanded based on this minimum bounding rectangle, with the expansion range having fixed margins set according to the product type to ensure complete inclusion of the target area and its surrounding transition areas.

[0050] Image pixel coordinates are mapped to memory buffer addresses, and pointer operations are used to achieve fast reading and writing of image data. During region cropping, a bilinear interpolation algorithm is used to maintain image quality while updating the image's metadata, including new origin coordinates and size parameters. The resulting target region image contains complete product packaging and subject information, while preserving the original image's color depth and resolution characteristics.

[0051] This embodiment effectively overcomes the limitations of single-sensor data by employing a multimodal detection mechanism that integrates visual images and weight data. It leverages the complementarity of visual and weight information to enhance the reliability of product identity verification. By using appearance region segmentation technology to separate the packaging area from the main product area, it achieves independent analysis and collaborative verification of the product's packaging integrity and its intrinsic identity features, enhancing the ability to identify products with complex appearances. Based on a method of dynamically retrieving benchmark data from the product identity feature set and performing step-by-step comparisons, weight detection serves as a rapid initial screening step. After confirming that the weight is within acceptable limits, a more computationally complex visual difference analysis is then performed, optimizing the overall efficiency of the detection process.

[0052] In one embodiment, identifying the color vector, texture features, and morphological geometric parameters of the packaging region in the target region image to constitute the packaging appearance features includes: The visual perception color space uses the HSV model, which separates color information into three independent components: hue, saturation, and lightness. The mapping process converts the original RGB pixel values ​​into HSV coordinates through a nonlinear transformation formula, where the hue component represents the color type, saturation characterizes the color purity, and lightness reflects the color brightness.

[0053] Statistical calculations for image components are performed independently for each color channel. The pixel mean reflects the overall color tendency of the region, while the pixel standard deviation reflects the uniformity of color distribution. The mean is calculated by averaging the channel values ​​of all pixels within the region using the arithmetic mean method, and the standard deviation is calculated based on the mean result to determine the dispersion of each pixel value.

[0054] The color vectors are combined by arranging six statistical measures—the mean and standard deviation of the three channels—in a fixed order to form a six-dimensional color feature vector. The numerical range of each component in the vector is normalized to the interval between zero and one, eliminating the influence of differences in the dimensions of different color channels.

[0055] The sub-window partitioning employs an overlapping sliding window mechanism, with the window size dynamically adjusted based on the total area of ​​the packaging region. This ensures that each window contains sufficient texture detail while covering the entire analysis area. The gradient orientation histogram is calculated based on the gradient magnitude and direction of pixels within each sub-window. The gradient components of each pixel in the horizontal and vertical directions are calculated using a difference operator, thereby deriving the gradient magnitude and orientation angle.

[0056] Orientation quantization discretizes the continuous range of 0 to 180 degrees into nine orientation intervals, each covering a 20-degree angle range. The gradient magnitude of each pixel is accumulated into the corresponding interval according to the orientation angle, forming the gradient orientation histogram of the sub-window.

[0057] Histogram values ​​are normalized using the L2 norm to enhance robustness to changes in illumination and contrast. The gradient orientation histograms of all sub-windows are concatenated in raster scan order to form a high-dimensional texture feature vector, which simultaneously contains local texture patterns and spatial distribution information. The concatenated feature vector is further dimensionality-reduced using principal component analysis, retaining 95% of the feature variance while reducing data redundancy. The resulting texture feature vector effectively characterizes the material properties, printing texture, and surface roughness of the packaging surface.

[0058] Texture pixel extraction is based on a dual screening mechanism of gradient magnitude thresholding and local variance analysis. By calculating the gradient magnitude of each pixel within the packaging region, a dynamic threshold is set to filter out smooth pixels with low gradient magnitudes. For pixels filtered by the gradient threshold, the grayscale variance within their local window is further calculated, retaining pixels with variance values ​​higher than the region's average level as valid texture pixels. These valid texture pixels constitute the spatial distribution set of the surface texture features of the packaging region, providing a basic data point set for geometric parameter calculation.

[0059] The minimum bounding rectangle fitting employs the rotating caliper algorithm, which searches for the smallest area rectangle that completely encloses all texture pixels by traversing the convex hull boundary of the texture pixel set. The algorithm first calculates the convex hull structure of the texture pixel set, and then, based on the points on the convex hull boundary, rotates the rectangle's direction and calculates the enclosing area to finally determine the smallest bounding rectangle.

[0060] The aspect ratio is calculated using the longer side of the circumscribed rectangle as the numerator and the shorter side as the denominator. The ratio reflects the basic shape and proportion characteristics of the packaging area. The area ratio is calculated using the total number of actual pixels in the packaging area as the numerator and the area of ​​the smallest circumscribed rectangle as the denominator. This ratio characterizes the degree of filling and shape compactness of the packaging area relative to its circumscribed rectangle. The aspect ratio and area ratio describe the geometric characteristics of the packaging area from different dimensions, and their combination forms a complementary morphological geometric parameter description system.

[0061] The process of concatenating color vectors, texture features, and morphological geometric parameters into packaging appearance features completes the integration and standardization of packaging appearance features. Before feature concatenation, feature normalization preprocessing is performed. The six components of the color vector are normalized using a minimum-maximum normalization method, linearly mapping the values ​​of each component to the zero-to-one interval. The texture feature vector has been normalized using the L2 norm to maintain a uniform standard for its feature vector magnitude.

[0062] The two components of the morphological geometric parameters are logarithmically transformed and then Z-score standardized to eliminate the influence of parameter distribution skew. The normalized feature vectors are then vertically concatenated in a fixed order of color, texture, and geometric features to form a high-dimensional packaged appearance feature vector. During the concatenation process, a feature dimension index mapping table is maintained to record the position range and physical meaning of each original feature in the final vector.

[0063] The feature vectors undergo principal component analysis for dimensionality reduction, retaining principal components with a cumulative contribution rate of over 95%, eliminating redundant information between features and reducing computational complexity. The resulting packaging appearance feature vector possesses triple feature representation capabilities, including color statistical properties, texture structure information, and geometric morphology description, forming a comprehensive digital description of the packaging appearance.

[0064] This embodiment maps the color information of the packaging area to a visually perceived color space and calculates statistical features, enabling a more accurate characterization of the overall color attributes and distribution uniformity of the packaging, and improving the robustness of color features to changes in illumination. By dividing the region, calculating local gradient direction histograms, and concatenating them to form texture features, it can simultaneously capture local texture details and global spatial distribution patterns on the packaging surface, enhancing the ability to distinguish material differences and surface wear. By extracting texture pixels and fitting geometric parameters, the visual representation of the packaging area is transformed into a quantifiable morphological description, providing an objective basis for packaging deformation detection. By fusing three heterogeneous visual features—color, texture, and morphology—a feature vector comprehensively describing the appearance characteristics of the packaging is constructed, overcoming the limitations of insufficient description capabilities of single features and significantly improving the accuracy and reliability of packaging integrity detection.

[0065] In one embodiment, extracting contour shape parameters and surface identification parameters from the product subject region of the target region image to construct a product identity feature set includes: Pixel boundary recognition employs a gradient threshold-based edge detection method. This method calculates the gradient magnitude and direction of each pixel in the main product area image, marking pixels with gradient magnitudes exceeding a dynamic threshold as valid edge pixels. The dynamic threshold is determined based on the 70th percentile of the overall image gradient distribution, preserving significant boundaries while suppressing noise interference. Morphological thinning is then applied to the acquired set of edge pixels, converging multi-pixel width edges to a single pixel width to ensure boundary line accuracy.

[0066] Edge connection operations are performed on existing discontinuities. A heuristic search algorithm is used to trace the boundary path along the edge direction. When the path is interrupted, edge pixels with the same gradient direction are found within a preset search radius and connected. Connection is determined based on the directional continuity and spatial proximity of edge pixels. Edge points with a directional difference of no more than 22.5 degrees and a spatial distance of within three pixels are considered to belong to the same boundary.

[0067] The resulting closed contour must satisfy the topological closure condition. The continuity of the contour is verified through a contour tracking algorithm to ensure that every edge pixel has exactly two adjacent pixels. Non-closed contours are forced to close by connecting the first and last points to form a virtual closed path. The final generated closed contour is stored as an ordered sequence of points, with each point containing its horizontal and vertical coordinates in the image coordinate system.

[0068] The process of calculating the total number of pixels in a closed contour region and the total length of the curve, and combining them into contour shape parameters, achieves a quantitative description of geometric features. The calculation of the total number of pixels in a region employs a scan-line seed filling algorithm, using the closed contour as the boundary condition, and starting region growth from any seed point inside the contour. During region growth, the four-neighbor connectivity rule is used, sequentially visiting the top, bottom, left, and right adjacent pixels of each pixel to determine whether it is located inside the contour.

[0069] Interior point identification uses a ray-mapping method. A ray is emitted from the point to be identified in any direction, and the number of intersections with the contour edges is counted. An odd number of intersections are identified as interior points. The total number of pixels marked as interior points is accumulated to obtain the total number of pixels in the region, which is the first contour parameter. The total curve length is calculated based on the vertex sequence of the closed contour, and the Euclidean distance between adjacent vertices is calculated sequentially.

[0070] For continuous edge points, the distance is calculated using the standard two-point distance formula; for discrete edge points, linear interpolation is used to supplement the intermediate point positions to improve accuracy. The total contour length, i.e., the second contour parameter, is obtained by summing all segmented distances. After calculating both parameters, scale normalization is performed, using the image diagonal pixel length as a reference to convert the parameter values ​​to a relative scale. The normalized first and second contour parameters are combined in a fixed order to form a two-dimensional feature vector, which constitutes the contour shape parameters describing the basic shape features of the product.

[0071] A preliminary screening mechanism for label detection is established by scanning the main area of ​​a product according to preset label scanning rules and locating areas that meet the rules as candidate areas for surface labels. The preset label scanning rules are formulated based on the visual saliency characteristics of the label area, including multiple conditions such as contrast threshold, color consistency, and area aspect ratio range.

[0072] The target scanning employs a multi-scale sliding window mechanism. The window size is dynamically adjusted proportionally to the area of ​​the main product region to ensure coverage of different sized marking areas. Within each scanning window, a local contrast index is calculated. The region's contrast is quantified by the ratio of the standard deviation to the mean of the pixel grayscale values ​​within the window. Windows with contrast values ​​exceeding a preset threshold are selected for further processing. Color consistency is checked by calculating the degree of clustering of the main colors within the window, using the color histogram entropy value as a metric. Low entropy values ​​indicate concentrated color distribution, consistent with the characteristic of uniform color distribution in marking areas.

[0073] The aspect ratio check is based on the window's geometry, excluding windows with extremely abnormal aspect ratios and retaining candidate areas that conform to common logo shape proportions. Windows that pass multiple criteria screening enter the morphological verification stage, where opening operations are used to eliminate minor noise, and closing operations are used to fill internal holes to ensure the integrity of the logo area. The final determined surface logo candidate areas record the coordinates of their bounding rectangle and the region's feature description.

[0074] The process of extracting identifier feature information, including characters, graphics, and symbols, from surface identifier candidate regions and encoding it as surface identifier parameters achieves digital representation of identifiers. Before feature extraction, image enhancement preprocessing is performed on the identifier candidate regions, employing a contrast-limited adaptive histogram equalization algorithm to improve local image contrast while suppressing noise amplification. For character identifiers, feature extraction uses the oriented gradient histogram descriptor, dividing the identifier region into dense cellular units and calculating the distribution statistics of gradient directions within each unit. For graphic identifiers, feature extraction is based on shape context descriptors, establishing a polar coordinate reference system on the identifier contour points and statistically analyzing the spatial distribution characteristics of surrounding contour points.

[0075] The feature extraction of symbolic identifiers combines scale-invariant feature transformation with keypoint detection and description methods, detecting stable feature points and generating feature vectors across multiple scales. All feature information undergoes dimensionality reduction through principal component analysis, retaining the feature component with the largest variance and eliminating correlations between features. The encoding process normalizes the dimensionality-reduced feature vectors, unifying their dimensions and organizing them into a structured data format with fixed dimensions. Surface identifier parameters are ultimately stored as feature vectors, while also recording the parameter configuration and version information for feature extraction.

[0076] The process of integrating contour shape parameters and surface marker parameters to obtain a product identity feature set completes the fusion and standardization of multimodal features. Before the integration operation, the two types of parameters are weighted, and different weight coefficients are assigned to the parameters according to their importance in product recognition. The weight of contour shape parameters is determined based on their intra-class and inter-class distance ratios; shape parameters with small intra-class distances and large inter-class distances are given higher weights. The weight of surface marker parameters considers the uniqueness and stability of the markers; unique and stable marker features receive higher weight values.

[0077] The weighted parameters undergo min-max normalization to map each feature value to the zero-to-one range, eliminating the influence of differences in parameter dimensions. Feature integration employs an early fusion strategy, directly concatenating the normalized contour shape parameters and surface marker parameters into a high-dimensional feature vector. The concatenated feature vector is then further dimensionality-reduced using linear discriminant analysis, reducing feature dimensions while preserving discriminative information and improving the efficiency of subsequent calculations. The final product identity feature set contains comprehensive descriptive information of contour shape and surface markers, while also storing feature extraction timestamps and version metadata.

[0078] This embodiment extracts the outline shape parameters of the product body and calculates its geometric features, accurately describing the basic shape characteristics of the product and providing a stable and reliable basis for shape-based product classification. By performing multi-scale target scanning on the product surface using preset marking scanning rules, it can effectively locate marking areas of different sizes and types, improving the adaptability and coverage of marking detection. By extracting feature information of characters, graphics, and symbols from the marking candidate area and uniformly encoding them, standardized representation of diverse surface markings is achieved, enhancing compatibility with different marking types.

[0079] In one embodiment, a baseline weight range and baseline packaging feature template are extracted from a pre-stored category database based on a product identity feature set, and the weight data is compared with the baseline weight range, including: The process of traversing each category entry in the category database and calculating the first similarity score achieves preliminary matching of product outline features. The category database is stored using a relational data table structure, and each category entry contains fields such as standard outline shape parameters, standard surface marking parameters, baseline weight range, and baseline packaging feature template.

[0080] The traversal operation sequentially accesses the database starting from the first record, reading the standard outline shape parameters of one category entry at a time. These standard outline shape parameters are stored as feature vectors, containing two dimensions: area and perimeter, and have the same data structure as the outline shape parameters of the product to be inspected. The first similarity is calculated using the cosine similarity measure, treating the outline shape parameters in the product identity feature set and the standard outline shape parameters of the category entry as two vectors, and calculating the cosine of the angle between them in the same vector space.

[0081] The calculation process first normalizes the two vectors to eliminate the influence of vector magnitude on similarity calculation. Then, the dot product of the two unit vectors is taken as the similarity value. The cosine similarity value ranges from zero to one; the closer the value is to one, the more consistent the directions of the two vectors, i.e., the more similar their outlines. For each category entry, the calculated first similarity value is temporarily stored in a memory cache, along with the corresponding category number and calculation timestamp. The traversal process continues until all category entries in the database have been processed, ensuring that every potential match is included in the similarity calculation.

[0082] The process of calculating the second similarity between surface identifier parameters in the product identity feature set and standard surface identifiers in the category entries completes the fine-grained matching of identifier features. Surface identifier parameters exist in the form of high-dimensional feature vectors, containing multi-dimensional information such as texture, shape, and gradient features extracted from the identifier region. Standard surface identifier parameters are also stored in the category database in the form of feature vectors, and representative feature mean vectors are obtained through training with a large number of samples.

[0083] The second similarity calculation employs a similarity metric based on Mahalanobis distance. The calculation process first obtains the feature covariance matrix of the standard surface identification parameters for this product category. This matrix is ​​pre-calculated during the training phase using a machine learning algorithm and stored in a database. The Mahalanobis distance calculation formula involves the product of the difference vector between the surface identification parameters to be tested and the standard surface identification parameters, the inverse of the covariance matrix, and the transpose of the difference vector.

[0084] The calculated Mahalanobis distance is mapped to the zero-to-one interval using an exponential function, converting it into a similarity value. The mapping function uses the negative exponential form of the natural exponential function. This conversion ensures that the smaller the distance, the closer the similarity is to one, aligning with intuitive similarity perception. After the second similarity of each category item is calculated, it is combined with the previously calculated first similarity to form a matching pair for that item, which is temporarily stored in the matching result set.

[0085] The process of determining whether there are category entries that meet the screening criteria constitutes the core decision-making step of the multi-level screening mechanism. The preset first and second thresholds are determined through statistical analysis of a large amount of sample data. The first threshold sets a relatively lenient boundary for contour shape similarity, allowing a certain degree of tolerance for shape deformation, while the second threshold sets a stricter standard for surface mark similarity to ensure the accuracy of mark matching.

[0086] The filtering criteria employ a logical AND relationship, requiring that both the first similarity score and the second similarity score be greater than a first threshold and a second threshold, respectively, be satisfied simultaneously. The judgment process iterates through a temporary result set storing all category item similarity pairs, comparing the first and second similarity scores of each item with their corresponding thresholds. A binary flag is established to represent the filtering status of each item; the flag is set to true only if both similarity values ​​exceed their respective thresholds.

[0087] The system counts the number of entries with all flags set to true. If the count is greater than zero, a category entry meeting the filtering criteria is considered to exist; otherwise, no matching entry is found. For cases where matching entries exist, the index numbers of all matching entries and their corresponding similarity values ​​are recorded to form a candidate matching set. Cases without matching entries trigger an exception handling process, including recalculating the similarity, adjusting threshold parameters, or transferring the case to a manual review channel.

[0088] The process of weighted ranking of category entries that meet the screening criteria achieves a quantitative evaluation of optimal matching. The weighted calculation adopts a linear weighted summation model, assigning different weight coefficients to the first and second similarities. The weight coefficients are determined based on the relative importance of the two types of features in product identification.

[0089] The weighting coefficients for contour shape features take into account the deformation factors that may occur to the product in the actual environment, assigning appropriate weights to balance stability and distinguishability. The weighting coefficients for surface marking features consider their high uniqueness and stability, assigning relatively high weights to enhance distinguishability. The weighted score calculation multiplies the first similarity of each item by the first weighting coefficient, the second similarity by the second weighting coefficient, and the two products are added together to obtain the comprehensive matching score.

[0090] The sorting operation ranks candidate entries in descending order of their overall matching score. Entries with the same score are then further sorted according to their second similarity score. The sorted results form an ordered list, where each entry contains a category number, an overall matching score, and detailed similarity data. The target matching record is determined by selecting the first category entry in the sorted list. If the overall matching score of the first entry differs significantly from that of subsequent entries, the matching result is directly determined.

[0091] For multiple entries with similar scores, an additional verification mechanism is activated to make a final decision by comparing other auxiliary features or combining historical matching records. The determined target matching record is marked as the best matching result for the current detection period, and metadata information such as the matching timestamp and matching confidence level is recorded.

[0092] The process of extracting benchmark data from the category database based on target matching records enables the dynamic acquisition of testing standards. The category number contained in the target matching record serves as the key for database queries, and the corresponding data record row is quickly located by creating an index. The extraction of the benchmark weight range accesses the lower and upper weight limit fields in the database. This range value is derived from a large amount of historical weight data of products in this category, and a reasonable fluctuation range is determined by calculating the mean plus or minus three standard deviations.

[0093] Extracting the baseline packaging feature template involves reading multiple fields, including the standard color vector range, the standard texture feature set, and the standard morphological geometry parameter tolerance band. The color vector range stores the allowable fluctuation range of each color component in the form of a multi-dimensional vector. The texture feature set contains a set of feature vectors from representative samples, and the morphological geometry parameter tolerance band records the normal variation range of each morphological parameter. The extracted baseline data undergoes format validation and range checks to ensure data integrity and validity.

[0094] The data transformation process converts the raw format in the database into the internal data structure required by the detection algorithm, maintaining the consistency of data semantics. Simultaneously, it extracts auxiliary information for this product category, including standard image samples, detection parameter configurations, and historical statistical data, providing comprehensive reference for subsequent detection processes. It also extracts operation record data version information and extraction timestamps to establish a data traceability mechanism.

[0095] The process of dividing a baseline weight range into multiple sub-ranges enables refined hierarchical management of weight data. The baseline weight range is derived from the weight fluctuation range of products in that category stored in the category database. The lower and upper limits of the range are determined based on the statistical distribution characteristics of historical weight data. The division operation uses equal-width or equal-frequency methods to discretize the continuous weight range into a finite number of weight sub-ranges. Equal-width division ensures that each sub-range has the same width, while equal-frequency division ensures that each sub-range contains the same number of historical samples.

[0096] Weight grades are set corresponding to sub-intervals. The number of grades is determined based on the actual detection accuracy requirements, typically three to five grades covering different degrees from slight deviation to significant anomalies. Each weight sub-interval records its lower limit, upper limit, and corresponding grade number. Adjacent sub-intervals are represented by half-open and half-closed intervals to avoid boundary value repetition. The sub-interval width is dynamically adjusted according to the characteristics of the product. For weight-sensitive products, a narrower sub-interval width is set to improve detection sensitivity, while for products with large weight fluctuations, a wider sub-interval width is set to enhance adaptability.

[0097] Weight class numbers use sequential identifiers. The central weight class corresponds to the theoretical median weight of the baseline weight range, and the classes extending to both sides indicate the degree of positive or negative deviation of the weight value. Metadata information for all sub-ranges, including the range, class number, and weight coefficient, is pre-calculated and stored in the detection configuration file.

[0098] The precise determination of the weight value is achieved by comparing the weight data sequentially with the upper and lower limits of each weight sub-range. The weight data comes from real-time measurements of a high-precision weighing sensor and undergoes temperature compensation and digital filtering to ensure accuracy.

[0099] The comparison operation proceeds sequentially, starting from the first weight sub-interval. Each time, the lower and upper limits of a sub-interval are used as the judgment criteria. The comparison logic employs a closed-interval judgment principle, checking whether the weight data is greater than or equal to the lower limit of the current sub-interval and less than or equal to the upper limit of the current sub-interval. When the weight data meets the conditions of the current sub-interval, subsequent comparisons immediately terminate, and the matching sub-interval number and corresponding weight class are recorded.

[0100] This embodiment achieves dual verification of product identity by traversing the category database and calculating the similarity between outline shape and surface markings, effectively improving the accuracy of category matching. By setting a dual threshold screening mechanism, it ensures that only category entries that simultaneously meet the requirements of shape similarity and marking similarity can proceed to subsequent processing, significantly reducing the risk of false matching. Through a weighted calculation and ranking mechanism, the contribution of different features to product identification is comprehensively considered, allowing the most matching category entry to be prioritized, thus optimizing the reliability of the matching results. Based on dynamically determined target matching records, corresponding benchmark data is extracted, enabling the standards for weight comparison and packaging inspection to be precisely adapted to specific product categories, enhancing the targeting of the detection process.

[0101] In one embodiment, if the weight data falls within the baseline weight range, the apparent difference between the packaging appearance features and the baseline packaging feature template is analyzed, including: For reset data near the boundaries of sub-intervals, a boundary tolerance mechanism is used to handle measurement errors, setting a small tolerance band near the boundary values ​​to avoid misjudging critical values. During the comparison process, a status flag is maintained to record the matching results, including whether a match was found, the index of the matched sub-interval, and the matching timestamp. If no sub-interval matches successfully, the weight data is marked as exceeding the baseline weight range, triggering the weight anomaly handling process. The information of successfully matched sub-intervals is used for subsequent processing, including weight class reading and matching degree calculation.

[0102] The process of determining whether weight data falls within a weight sub-interval constitutes the initial screening for weight qualification. When the comparison operation finds that the weight data meets the range conditions of a certain sub-interval, the interval matching flag is immediately triggered, confirming that the weight data is within the benchmark weight interval. The judgment logic is based on the membership principle in set theory, treating weight data as elements and weight sub-intervals as sets. An element belonging to any set is determined to belong to the entire benchmark weight interval.

[0103] The read operation retrieves the corresponding weight class identifier from a predefined weight class mapping table based on the matched sub-interval index number. The weight class uses a hierarchical coding system, with the center class indicating a weight close to the ideal value and the edge class indicating an acceptable but significant deviation. The class identifier consists of two parts: a numerical code for machine processing and a textual description for human interpretation.

[0104] During the determination process, metadata such as matching timestamp, sub-interval number, and weight class are recorded to form a complete weight matching log. For boundary cases where multiple sub-intervals are matched simultaneously, a priority matching mechanism is adopted, selecting the first matched interval according to the sub-interval number order.

[0105] The process of calculating weight matching degree based on preset weight coefficients corresponding to the target weight class achieves a quantitative assessment of weight compliance. The preset weight coefficients are allocated based on the importance of the weight class, with higher weight coefficients for central weight classes and progressively decreasing weight coefficients for peripheral weight classes. The weight coefficients are determined using the analytic hierarchy process (AHP), considering the impact of weight deviation on product quality, and establishing a mapping relationship between the weight coefficients and the weight class.

[0106] The weight matching degree is calculated using a weighted evaluation model, which multiplies the base score corresponding to the weight class by a weighting coefficient to obtain the weighted score. The base score is calculated based on the relative position of the weight data within the sub-interval, with higher base scores assigned to positions closer to the center of the sub-interval and lower base scores assigned to positions closer to the interval boundary. The relative position is calculated using linear interpolation, mapping the weight data to a standardized position coefficient ranging from zero to one.

[0107] The weight matching degree is a function of the weighted score and the position coefficient, using an S-curve function for nonlinear mapping to enhance the discrimination of critical values. The calculation process considers the measurement error of the weighing sensor, introducing an error tolerance factor into the matching degree formula to eliminate the influence of random errors on the matching degree. The obtained weight matching degree is a value between zero and one hundred; a higher value indicates a better degree of conformity between the weight data and the ideal value.

[0108] The comparison between weight matching degree and the pass threshold constitutes the final decision-making step in weight inspection. The pass threshold is determined through statistical learning methods, balancing the false positive rate and false negative rate based on the distribution characteristics of a large amount of historical weight data and inspection requirements. The comparison operation adopts a one-sided test principle: when the weight matching degree is greater than or equal to the pass threshold, the weight is considered acceptable; when it is lower than the threshold, the weight is considered abnormal. The pass threshold is dynamically adjusted according to the product type; a higher pass threshold is set for high-value products to improve inspection standards, while a relatively lenient pass threshold is set for ordinary products.

[0109] The comparison results trigger different processing branches. The qualified branch generates structured weight qualification information, including weight data, matching degree value, timestamp, and inspector identification. The qualified weight information is encapsulated in a standard data format to ensure compatibility with subsequent processing modules. The unqualified branch triggers a weight anomaly handling process, records anomaly details, and initiates a review mechanism.

[0110] The application of the pass / fail threshold takes into account the influence of environmental factors. When the weighing environment is unstable, the threshold requirement is automatically lowered to enhance the adaptability of the detection system. While generating weight pass / fail information, the detection status database is updated, recording all parameters and results of this detection, establishing a complete detection traceability chain.

[0111] The core technical step in packaging inspection is the process of comparing the appearance features of the packaging with the parameters of a benchmark packaging feature template one by one. The appearance features of the packaging include three feature groups: color vector, texture features, and morphological geometric parameters. The benchmark packaging feature template stores the reference standard values ​​and their allowable fluctuation ranges for the corresponding feature groups.

[0112] The comparison operation is performed in groups according to the physical meaning of the feature groups. For color vector comparison, the absolute difference between the current color vector and the standard color vector in each color component is calculated to generate a color difference vector. For texture feature comparison, the feature space distance metric is used to calculate the Euclidean distance between the current texture feature vector and the standard texture feature vector in the dimensionality-reduced feature space. This distance value characterizes the similarity of the texture structure.

[0113] The comparison of morphological geometric parameters separately processes aspect ratio and area fill degree parameters. Aspect ratio difference is calculated as the relative error between the current aspect ratio and the standard aspect ratio, while area fill degree difference is calculated as the absolute difference between the current fill degree and the standard fill degree. The difference values ​​for each feature group are normalized to eliminate the influence of different feature dimensions and numerical ranges; the normalized difference values ​​are mapped to a standardized interval of zero to one. The generated apparent difference value sequence includes quantitative indicators for three dimensions: color difference, texture difference, and morphological difference. The smaller the value of each indicator, the higher the degree of conformity between the feature and the standard template. The difference value sequence is accompanied by a quality assessment indicator, recording the reliability of each feature comparison.

[0114] This embodiment divides the baseline weight range into multiple sub-ranges and establishes a weight grading system, enabling refined hierarchical management of product weight and improving the adaptability and flexibility of weight detection. By comparing weight data with the upper and lower limits of each sub-range one by one, the accuracy of weight positioning is ensured, providing a reliable basis for subsequent matching degree calculation. By calculating the weight matching degree according to the weight coefficients corresponding to the weight grades, the simple weight qualification judgment is transformed into a quantitative assessment, enhancing the accuracy and reliability of the detection results.

[0115] In one embodiment, if the apparent difference value is within a preset tolerance range, an instruction to allow entry into the warehouse is generated, including: The process of matching and comparing apparent difference values ​​with preset tolerance ranges determines the pass / fail status of packaging quality. The preset tolerance range exists as a parameter tolerance threshold vector, with each dimension corresponding exactly to the sequence of apparent difference values. Each dimension stores the maximum permissible deviation value for that feature type. The tolerance thresholds are determined through the statistical distribution of a large number of qualified samples, using the mean plus three standard deviations to calculate the upper limit, ensuring that over 99% of qualified samples pass the inspection. The matching and comparison operation employs a sequential comparison strategy, taking each apparent difference value in turn and comparing it to its corresponding parameter tolerance threshold.

[0116] The comparison operation uses a less than or equal to condition to check if the current difference value does not exceed the tolerance threshold. A binary comparison result vector is established, and a true value is marked when the difference value of a certain feature meets the requirements; otherwise, it is marked as a false value. The decision logic is based on a logical AND operation of all comparison results. The overall apparent difference value is determined to be within the preset tolerance range if and only if all feature difference values ​​do not exceed the corresponding tolerance threshold. If any feature difference value exceeds the corresponding tolerance threshold, the overall apparent difference value is determined to be outside the preset tolerance range.

[0117] For critical cases approaching the threshold, an additional verification process is initiated, involving increasing the number of sampling points or improving feature extraction accuracy for further review. The decision process records comparison details for each feature, including the difference value, tolerance threshold, and deviation percentage, forming a complete decision log.

[0118] When the apparent difference value is determined to be outside the preset tolerance range, the corresponding goods to be put into storage are marked as unqualified, and a corresponding rejection instruction is generated to reject the goods to be put into storage. Then the next goods to be put into storage are re-inspected.

[0119] The process of generating an "allow entry" instruction when the apparent difference value is determined to be within a preset tolerance range completes the final decision of the inspection process. This instruction is generated based on the determination that the apparent difference value is within the preset tolerance range, and simultaneously incorporates weight compliance information to form a complete product compliance judgment. The "allow entry" instruction is encapsulated in a structured data format, containing core fields such as instruction type code, product identifier, inspection timestamp, operator code, and inspection equipment number.

[0120] Instruction type encoding distinguishes different levels of pass / fail conclusions, including fully passable and conditionally passable states, corresponding to different inbound processing procedures. Product identifiers are associated with product records in the database to ensure the correspondence between instructions and specific products. Inspection timestamps record the precise time of instruction generation, accurate to the millisecond, for subsequent traceability queries and log analysis. Multiple related operations are triggered simultaneously during instruction generation, including updating the product status database, activating the conveyor belt control system, and illuminating visual cues. The product status database updates the product's inspection status to passable, recording the inspection time and operator information.

[0121] Upon receiving the entry permission command, the conveyor belt control system activates the motor drive to transport the goods to the designated shelf area. A visual indicator light displays the pass status, providing intuitive feedback to operators. Command transmission utilizes an industrial communication protocol to ensure reliable data exchange. The protocol layer includes data verification and retransmission mechanisms to prevent command loss or errors. The generation of the entry permission command is accompanied by the automatic generation of an inspection report, which details the specific values ​​of each inspection parameter and the judgment result.

[0122] The test reports are stored in the database in a standard format, and paper copies are also generated for archiving. The reports include complete information such as weight measurement data, visual characteristic parameters, difference analysis results, and judgment criteria, forming a traceable quality record. For special products or important batches, the system automatically triggers a secondary sampling and testing mechanism, retaining re-inspection samples while allowing them to be put into storage.

[0123] This embodiment compares the appearance features of the packaging with a benchmark packaging feature template parameter by parameter, comprehensively evaluating the degree of conformity of multi-dimensional features such as color, texture, and shape, ensuring the integrity of packaging inspection. By matching the appearance difference values ​​with the tolerance thresholds of each parameter within a preset tolerance range, a multi-feature collaborative judgment mechanism is established, effectively improving the accuracy of packaging conformity judgment. The strict judgment condition requiring all appearance difference values ​​to be no greater than the corresponding parameter tolerance threshold avoids misjudgments that may result from a single feature conforming, enhancing the reliability of the inspection results. When the appearance difference value is within the preset tolerance range, an allow-to-enter-warehouse instruction is generated, realizing the automatic conversion from inspection conclusion to execution instruction and improving the automation level of the warehousing process.

[0124] Reference Figure 2 As shown, the present invention also provides a goods receiving inspection device, applied to the goods receiving inspection method of any of the above-mentioned methods, comprising: The data acquisition module collects visual images and weight data of the goods to be put into the warehouse, performs appearance region segmentation on the visual images, and obtains the target region image. The analysis module is used to identify the packaging appearance features of the target area image and extract the product identity feature set from the main product area of ​​the target area image; The association module is used to extract the benchmark weight range and benchmark packaging feature template from the pre-stored category database based on the product identity feature set, and compare the weight data with the benchmark weight range. The processing module is used to analyze the apparent difference between the packaging appearance features and the benchmark packaging feature template if the weight data is within the benchmark weight range. The control module generates an instruction to allow data entry if the apparent difference value is within a preset tolerance range.

[0125] This invention provides a product receiving inspection device. By employing a multimodal detection strategy that integrates visual images and weight data, it effectively overcomes the limitations of single-data source verification, significantly improving the accuracy and reliability of product receiving inspection. By segmenting the appearance area and extracting feature parameters from both packaging and the product itself, it enables independent and collaborative verification of product identity and packaging condition, effectively identifying minor packaging damage or visually similar anomalies. Dynamically acquiring corresponding benchmark data based on the product identity feature set and performing dual comparisons of weight and appearance differences reduces reliance on fixed thresholds and enhances adaptability to multi-specification products. By constructing a structured feature set and step-by-step judgment logic, it optimizes the data processing flow while ensuring detection accuracy, helping to reduce misjudgments, lower manual re-inspection costs, and improve warehouse operation efficiency.

[0126] Reference Figure 3 As shown, the present invention also provides a commodity receiving inspection device, comprising: Memory, used to store programs; A processor is used to execute programs to implement the various steps of a commodity receiving inspection method, as described above.

[0127] In this embodiment, the processor and memory can be connected via a bus or other means. The memory may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as read-only memory, flash memory, hard disk, or solid-state drive. The processor may be a general-purpose processor, such as a central processing unit, digital signal processor, application-specific integrated circuit, or one or more integrated circuits configured to implement embodiments of the present invention.

[0128] The present invention also provides a storage medium storing computer instructions for causing a computer to perform any of the methods described above.

[0129] It should be noted that those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the system and each module described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0130] The above description is only a preferred embodiment of the present invention and does not limit the patent scope of the present invention. Any equivalent structural or procedural transformations made based on the content of the present invention specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of the present invention.

Claims

1. A method for inspecting incoming goods, characterized in that, include: Collect visual images and weight data of goods to be put into storage, and perform appearance region segmentation on the visual images to obtain target region images; Identify the packaging appearance features of the target area image, and extract a set of product identity features from the main product area of ​​the target area image; Based on the product identity feature set, a baseline weight range and a baseline packaging feature template are extracted from the pre-stored category database, and the weight data is compared with the baseline weight range. If the weight data is within the baseline weight range, then analyze the apparent difference between the packaging appearance features and the baseline packaging feature template; If the apparent difference value is within the preset tolerance range, an instruction to allow entry into the warehouse is generated.

2. The commodity warehousing inspection method according to claim 1, characterized in that, The process of collecting visual images and weight data of goods to be put into storage, and segmenting the visual images to obtain target region images includes: The visual image and weight data of the goods to be put into storage are obtained through the warehousing equipment; Analyze the pixel classification features of the visual image, and convert the visual image into a binary segmented image including a foreground region and a background region based on the pixel classification features; Identify connected regions in the binary segmented image and calculate the area parameter and shape parameter of each connected region; Filter out target connected regions from all the connected regions, where both the area parameter and the region shape parameter meet the preset regularity conditions; Extract the boundary coordinates of the target connected region, and perform image region cropping on the visual image based on the boundary coordinates to obtain the target region image.

3. The commodity warehousing inspection method according to claim 1, characterized in that, The identification of the packaging appearance features of the target region image includes: Map all image pixels of the packaging area to a preset visual perception color space to obtain image components, calculate the mean and standard deviation of the pixel values ​​of the image components, and combine the mean and standard deviation of the pixel values ​​to form the color vector. The packaging area is divided into multiple sub-windows, and the gradient direction histogram of the local pixels contained in each sub-window is calculated. All the gradient direction histograms are concatenated in sequence to form the texture feature. Extract the texture pixels of the packaging area, fit the minimum bounding rectangle of the packaging area based on the texture pixels, calculate the aspect ratio of the minimum bounding rectangle, calculate the area ratio between the minimum bounding rectangle and the packaging area, and combine the aspect ratio and the area ratio into the morphological geometric parameters. The color vector, the texture feature, and the morphological geometry parameters are concatenated to form the packaging appearance feature.

4. The commodity receiving inspection method according to claim 1, characterized in that, Extracting a product identity feature set from the product subject region of the target region image includes: Identify the pixel boundaries of the main product area and connect the pixel boundaries with discontinuous points to form a closed contour; The total number of pixels in the region of the closed contour is calculated as the first contour parameter, and the total length of the curve of the closed contour is calculated as the second contour parameter. The first contour parameter and the second contour parameter are combined into a contour shape parameter. The main body area of ​​the product is scanned according to a preset identification scanning rule, and the area that conforms to the preset identification scanning rule is positioned as a surface identification candidate area. The identification feature information, including characters, graphics and symbols, is extracted from the surface identification candidate area, and the identification feature information is encoded into surface identification parameters; The product identity feature set is obtained by integrating the contour shape parameters and the surface identification parameters.

5. The commodity warehousing inspection method according to claim 4, characterized in that, The step of extracting a baseline weight range and a baseline packaging feature template from a pre-stored category database based on the product identity feature set, and comparing the weight data with the baseline weight range, includes: Traverse each category entry in the category database and calculate the first similarity between the contour shape parameters in the product identity feature set and the standard contour shape of the category entry; Calculate the second similarity between the surface identifier parameters in the commodity identity feature set and the standard surface identifiers in the category entries; Determine whether there are any category entries that meet the filtering conditions, wherein the filtering conditions are: the first similarity is greater than a preset first threshold, and the second similarity is greater than a preset second threshold; When there are category entries that meet the filtering conditions, the category entries are weighted and sorted according to the first similarity and the second similarity, and the category entry with the highest ranking in the sorting result is marked as the target matching record; Based on the target matching records, the benchmark weight range and the benchmark packaging feature template are extracted from the category database; The baseline weight range is divided into multiple weight sub-ranges, and each weight sub-range corresponds to a weight class. The weight data is compared sequentially with the upper and lower limits of each weight sub-interval.

6. The commodity receiving inspection method according to claim 5, characterized in that, If the weight data is within the baseline weight range, then the apparent difference value between the packaging appearance feature and the baseline packaging feature template is analyzed, including: If the weight data falls within any of the weight sub-intervals, then the weight data is determined to be within the baseline weight interval, and the weight level corresponding to the weight sub-interval is read. The weight matching degree of the weight data is calculated based on the preset weight coefficient corresponding to the target weight level; The weight matching degree is compared with a preset qualified threshold. If the weight matching degree is greater than or equal to the qualified threshold; The appearance features of the packaging are compared with the reference packaging feature template one by one to generate the appearance difference value.

7. The method for detecting incoming goods according to claim 1, characterized in that, If the apparent difference value is within the preset tolerance range, an allow-in instruction is generated, including: The apparent difference value is matched and compared one by one with the tolerance threshold of each parameter in the preset tolerance range; If any of the apparent difference values ​​is greater than the parameter tolerance threshold, it is determined that the apparent difference value is not within the preset tolerance range, and the corresponding goods to be put into storage are marked as unqualified. If all the apparent difference values ​​are not greater than the parameter tolerance threshold, then the apparent difference values ​​are determined to be within the preset tolerance range. When the apparent difference value is determined to be within the preset tolerance range, the permission to enter the database instruction is generated.

8. A commodity receiving inspection device, characterized in that, The product warehousing inspection method applied to any one of claims 1-7 includes: The acquisition module acquires visual images and weight data of goods to be put into storage, and performs appearance region segmentation on the visual images to obtain target region images; The analysis module is used to identify the packaging appearance features of the target area image and extract a set of product identity features from the product main body area of ​​the target area image; The association module is used to extract a benchmark weight range and a benchmark packaging feature template from a pre-stored category database based on the product identity feature set, and compare the weight data with the benchmark weight range. The processing module is used to analyze the apparent difference value between the packaging appearance feature and the benchmark packaging feature template if the weight data is within the benchmark weight range. A control module is used to generate an allow entry instruction if the apparent difference value is within a preset tolerance range.

9. A commodity receiving inspection device, characterized in that, include: Memory, used to store programs; A processor is configured to execute the program to implement the various steps of the commodity warehousing detection method as described in any one of claims 1-7.

10. A storage medium, characterized in that, The computer contains computer instructions for causing the computer to perform the method according to any one of claims 1 to 7.