Full-stack cigarette quantity statistical method based on YOLOv5 algorithm
By applying the YOLOv5 algorithm to the full-stack cigarette quantity statistics method in the cigarette warehouse, the problems of low efficiency and difficulty in accuracy of the traditional inventory method are solved, efficient and accurate cigarette quantity detection is achieved, and the risk of manual operation is reduced.
Patent Information
- Application Number
- CN202411375037.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2025-02-11
AI Technical Summary
The traditional cigarette warehouse inventory method relies on manual operations, which is inefficient and difficult to guarantee, and has safety risks, so it cannot effectively deal with the inclusion complexity of large-scale inventory.
The total number of cigarettes on the tray is automatically calculated through image acquisition, preprocessing, feature extraction, quantity detection and other steps. This method combines the detection of front view and top view, and utilizes the feature extraction and real-time detection capabilities of deep learning models to improve the accuracy and robustness of the detection.
It greatly improves inventory efficiency, reduces the time and labor intensity of manual operations, enhances the accuracy and reliability of detection, reduces safety risks, and ensures the accuracy of data through an intelligent abnormality detection mechanism.
Abstract
Description
Technical Field
[0001] The invention relates to the field of tobacco, and in particular to a method for counting the number of full stacks of cigarettes based on a YOLOv5 algorithm. Background Art
[0002] With the development of modern manufacturing and logistics industries, warehouse management in the tobacco industry is also facing increasingly complex challenges. Warehouse inventory, as a key link in tobacco supply chain management, directly affects the accuracy of inventory and the efficiency of logistics. In traditional warehouse management, the inventory of cigarettes usually relies on manual operations. Inventory personnel need to count the cigarettes on each pallet by climbing up and counting layer by layer. This method is not only time-consuming and labor-intensive, but also prone to human errors. Especially when faced with large-scale inventory, the complexity and difficulty of inventory work are further increased.
[0003] Common challenges in the manual inventory process include: First, manual operation is inefficient, and it may take a lot of time to count a batch of goods, especially in large-scale warehouses, where a single inventory may last for several days. Second, the accuracy of manual inventory is difficult to guarantee, because the limitations of human eye recognition and memory, especially when visual fatigue or operational errors occur, can easily lead to counting errors. In addition, inventory work also has certain safety risks, especially when operating at heights, where climbing operations may cause accidental injuries to personnel.
[0004] In order to deal with these problems, in recent years, researchers and enterprises have begun to explore the use of automation and intelligent technology to replace the traditional manual inventory method. For example, inventory management systems based on barcode scanning have been applied in some fields. This system can improve the efficiency and accuracy of inventory counting to a certain extent by attaching barcodes to each piece of goods and using barcode scanners for inventory counting. However, barcode scanning systems also have certain limitations. For example, they need to scan each piece at a time, and cannot obtain the quantity information of the entire batch of goods at one time. In addition, when the label is damaged or the position is inaccurate, the performance of the system will be affected.
[0005] With the rapid development of computer vision technology, warehouse inventory systems based on image recognition have become a new research hotspot. Traditional image processing techniques, such as edge detection, morphological operations, and template matching-based methods, have been applied in some simple scenarios. However, these methods perform poorly when dealing with complex scenes. For example, when there is uneven lighting, complex background, or object occlusion in the image, the stability and accuracy of the algorithm often cannot meet actual needs. Especially in the tobacco industry, traditional image processing methods are easily disturbed when identifying the number of cigarettes, resulting in inaccurate detection results. Summary of the invention
[0006] In order to solve the above technical problems, the present invention provides a method for counting the number of full stacks of cigarettes based on the YOLOv5 algorithm.
[0007] The present invention is achieved through the following technical solutions:
[0008] A method for counting the number of full stacks of cigarettes based on the YOLOv5 algorithm comprises the following steps:
[0009] Image acquisition: Use a camera to acquire images of a full stack of cigarettes on a pallet at a certain location from different viewing angles within a preset time interval to obtain image data including front view and top view;
[0010] Image preprocessing: preprocess the collected image data, including image cropping, brightness adjustment, and geometric transformation operations, to enhance the feature information of the image and improve the accuracy of subsequent detection;
[0011] Image feature extraction: Based on the YOLOv5 deep learning model, feature information related to the number of cigarettes is extracted from the preprocessed image, including the number of stacking layers and the number of single-layer cigarettes;
[0012] Quantity detection: Detect the number of stacked layers of cigarettes on the pallet by analyzing the front view; detect the number of cigarettes in a single layer by analyzing the top view;
[0013] Calculation of cigarette quantity: multiply the detected stacking layer number and the single layer number to calculate the total number of cigarettes on each pallet;
[0014] Data storage and comparison: The calculated total number of cigarettes is automatically associated with the storage location information and saved.
[0015] This method uses the YOLOv5 algorithm to count the number of images of full stacks of cigarettes. It mainly uses image acquisition, preprocessing, feature extraction, quantity detection and other steps to ensure accurate detection of the number of layers and single-layer pieces of cigarettes on the tray under different viewing angles. YOLOv5 is a deep learning model widely used in the field of target detection. It has strong feature extraction and real-time detection capabilities and is suitable for multi-target detection tasks in complex scenarios. In this method, the combination of the front view and the top view greatly improves the accuracy of detection. In particular, the preprocessing step further enhances the feature information in the image, ensuring the robustness and accuracy of the detection.
[0016] Preferably, the YOLOv5 deep learning model is a trained target detection algorithm model, and image feature extraction and quantity detection include the following steps:
[0017] Image input: Input the preprocessed front view and top view image data into the trained YOLOv5 model;
[0018] Cigarette detection: The model performs object detection in the input image, identifies the bounding boxes of cigarettes, and returns the coordinates, confidence, and category labels of these bounding boxes;
[0019] Stacking layer feature: For the front view, the model calculates the number of cigarette stacking layers based on the longitudinal distribution of the detected cigarette bounding box; each layer of cigarettes is marked as an independent object, and the final number of layers is determined by the number of detected objects;
[0020] Single layer cigarette count feature: For the top view, the model detects and counts the number of cigarettes in each layer; these cigarette targets are located on the same horizontal plane, so the total number of cigarettes in a single layer is calculated through the lateral distribution;
[0021] Coordinates and labels: The model outputs the bounding box coordinates of each cigarette target and its classification label of the number of cigarette layers or pieces;
[0022] Feature summary: The feature data of the coordinates and labels are summarized to obtain the number of stacking layers and single-layer pieces of cigarettes on the pallet, and input them into the cigarette quantity calculation module in the next step for calculation.
[0023] After pre-training, the YOLOv5 algorithm can perform efficient target detection on input image data. Through this algorithm, the system can detect the number of stacking layers from the front view and the number of single-layer cigarettes from the top view. This bounding box-based detection method can not only identify the location of each cigarette, but also return the confidence and category labels associated with it, providing a reliable data basis for subsequent quantity calculations. During the training process, the model continuously adjusts parameters to gradually optimize the detection accuracy, ensuring that the final output results can meet industrial-level accuracy requirements.
[0024] Preferably, before the image is captured, an environmental condition monitoring step is provided, using a light sensor to monitor the light intensity of the image capture area in real time. If the light is too strong or too weak, the system automatically adjusts the exposure parameters of the camera or prompts the user to adjust the light source position;
[0025] The image acquisition comprises the following steps:
[0026] Camera equipment setting: Install the camera equipment at the front and top view positions of the cigarette tray to ensure that the image covers the entire tray area;
[0027] Image acquisition execution: within a preset time interval, the camera device automatically captures the front view and top view image data of the pallet to ensure that the acquired images have good lighting conditions and clarity; the image data is a video stream or a single picture.
[0028] The environmental condition monitoring step before image acquisition ensures that the lighting conditions are stable during the image acquisition process, thereby ensuring the clarity and consistency of the image. The reasonable setting of the camera equipment and the automatic acquisition at time intervals ensure the integrity and quality of the image data. In practical applications, the influence of light intensity on the image is crucial. Through real-time monitoring and automatic adjustment of exposure parameters, the system can adapt to work requirements under various environmental conditions, further improving the reliability of image acquisition.
[0029] Preferably, the image preprocessing comprises the following steps:
[0030] Image cropping: crop the captured image according to the tray area to remove irrelevant background to reduce interference;
[0031] Brightness adjustment: By adjusting the brightness and contrast of the image, the image details can be enhanced, especially the clarity of the cigarette edge;
[0032] Geometric transformation: Perform necessary rotation, scaling and distortion correction on the image to ensure that the presentation of cigarettes in the image conforms to the actual layout;
[0033] Application of segmentation algorithm: Use image segmentation algorithm to segment the preprocessed image and separate the cigarette area from the background area, so as to perform subsequent feature extraction and quantity detection more accurately;
[0034] Segmentation optimization: Analyze and optimize the segmentation results to ensure that the cigarette area is segmented completely and accurately.
[0035] Image preprocessing is a key step to ensure the accuracy of subsequent feature extraction and quantity detection. The system can minimize detection errors by cropping to remove irrelevant background, adjusting brightness to enhance the clarity of cigarette edges, and geometric transformation to ensure that the image is consistent with the actual layout. In particular, the application of image segmentation algorithms enables the cigarette area to be clearly separated from the background area, providing an accurate basis for subsequent feature extraction. The segmentation optimization step further ensures the integrity of the segmentation results and avoids detection errors caused by inaccurate segmentation.
[0036] Preferably, after the stacking layer number feature and the single-layer cigarette piece number feature are identified, an intelligent anomaly detection process is provided, which specifically includes the following steps:
[0037] The extracted features are analyzed through anomaly detection algorithms to identify and mark possible anomalies, including abnormal number of cigarettes and image quality issues.
[0038] Abnormal feedback: The system automatically terminates, notifies the user of the abnormal situation, and provides detailed information for the user to verify.
[0039] Intelligent anomaly detection can promptly detect possible anomalies, such as abnormal number of cigarettes or image quality issues, by analyzing the extracted features. The system will automatically terminate after detecting an anomaly and prompt the user to verify to ensure the accuracy and reliability of the test results. This anomaly detection mechanism provides additional protection for the entire quantitative statistical method, avoiding misjudgments due to external factors or internal reasons of the system. At the same time, user feedback information will also be further used to optimize the model and improve its stability in different scenarios.
[0040] Preferably, the training steps of the YOLOv5 deep learning model are as follows:
[0041] Training image data acquisition: collecting front and top views of a known number of full stacks of cigarettes as training image data;
[0042] Data annotation: manually or semi-automatically annotate the positions of cigarettes in the front and top views of a known number of full stacks of cigarettes; the annotation content includes the bounding box and label of each cigarette, with the label being the number of layers or the number of pieces;
[0043] Data enhancement: Perform data enhancement operations on the annotated data set, including rotation, scaling, cropping, and brightness adjustment, to increase the diversity of the data set and improve the generalization ability of the model;
[0044] Pre-trained model loading: Load a YOLOv5 model pre-trained on a large-scale dataset to take advantage of its learned features;
[0045] Training process: Divide the labeled data set into training set and validation set;
[0046] Through the training set, the model gradually learns how to detect and identify the number of stacked layers and single-layer pieces of cigarettes in the image;
[0047] Use the validation set to test the model and adjust the model parameters, including learning rate and batch size, to improve detection accuracy and convergence speed;
[0048] Detection accuracy evaluation: Evaluate the detection results and analyze the detection accuracy of the model under different conditions; further adjust the model parameters or increase the diversity of training data to improve the model's feature extraction capabilities;
[0049] Actual data testing: In actual scenarios, use the trained model to test new image data to verify its feature extraction effect;
[0050] Feedback adjustment: Based on feedback from actual use, further optimize the feature extraction process to ensure the stability and applicability of the model.
[0051] The training steps of the YOLOv5 model ensure that the model can adapt to specific application scenarios. By collecting and annotating a known number of cigarette image data, the system can gradually learn how to accurately identify and detect the number of stacked layers and single-layer pieces of cigarettes during the training process. The application of data enhancement technology greatly improves the generalization ability of the model, enabling it to maintain high detection accuracy under different lighting, angles and positions. Through the loading of the pre-trained model and subsequent actual data testing, the system finally formed a highly adaptable and robust detection model that can cope with changing industrial scenarios.
[0052] A method for counting the number of full stacks of cigarettes based on the YOLOv5 algorithm comprises the following steps:
[0053] The full stack cigarette quantity counting method based on the YOLOv5 algorithm is used to count the number of full stack cigarettes on a pallet at a certain storage location;
[0054] Data storage and comparison: The calculated number of full stacks of cigarettes is associated with the storage location information and saved, and the test results are compared with the preset original inventory data to determine the accuracy of the inventory data;
[0055] Repeat the above steps to count the quantity of all storage locations in the warehouse;
[0056] Result visualization and report generation: Display the test results through charts and visualization interfaces, and automatically generate statistical reports for warehouse management personnel to view and analyze;
[0057] User feedback and adjustment: Allow warehouse managers to manually review and provide feedback on test results; the system automatically adjusts algorithm parameters based on feedback information to gradually improve the accuracy and reliability of future tests.
[0058] This inventory counting method compares the quantity statistics with the original inventory data to ensure the accuracy of the inventory data. Through comprehensive statistics of all storage locations in the warehouse, this method can help warehouse managers to promptly discover abnormalities in the inventory, and through the visualization of results and report generation functions, data analysis is more intuitive and efficient. The system's user feedback mechanism allows warehouse managers to manually review the test results, thereby continuously optimizing the algorithm parameters and gradually improving the accuracy and reliability of future tests. This process not only improves the efficiency of inventory management, but also reduces the workload and errors of manual inventory counting.
[0059] Preferably, before the data is stored and compared, intelligent anomaly detection is performed on the counted number of full stacks of cigarettes to automatically identify possible anomalies. If a large fluctuation in the number occurs, a warning message is generated to indicate that further verification is required.
[0060] Before data is stored and compared, the system further verifies the reliability of the statistical results through intelligent anomaly detection. This automated detection mechanism can promptly identify and handle abnormal situations, such as large fluctuations in quantity, and generate warning messages to prompt users to check. This step increases the intelligence level of the system, making the entire inventory process more rigorous and efficient, reducing the need for manual intervention, and improving the accuracy and security of inventory management.
[0061] Preferably, the result visualization and report generation comprises the following steps:
[0062] Collect test results: extract all test data from the system, including the number of cigarette layers, the number of pieces per layer, the total number of pieces, and any abnormalities detected on each tray; perform preliminary sorting of these data to ensure data integrity and accuracy, and remove duplicate or invalid data;
[0063] Data format conversion: convert the inspection data into a format suitable for visualization tools and report generation and store it;
[0064] Choose a visualization tool: Use a visualization tool or library to generate a bar chart, pie chart, or line chart;
[0065] Create visual charts: Create a bar chart or bar graph to display the total number of cigarettes per pallet, the number of layers, and the number of pieces per layer, so that warehouse managers can intuitively see the number of cigarettes on different pallets;
[0066] Abnormal situation display: Generate anomaly detection charts, including abnormal quantity distribution charts and abnormal type pie charts, to help analyze which type of abnormal situation occurs most frequently;
[0067] Inventory comparison results: Display the difference between the test results and the original inventory data through a line chart or radar chart, so as to find out the specific inventory location and quantity deviation of the inaccurate inventory;
[0068] Chart layout and interface display: The generated charts are laid out in a logical order in the visual interface of the system to ensure that warehouse managers can easily browse and analyze data;
[0069] Report template: Standardized report template includes title, date, test result summary, detailed statistics, anomaly analysis, and inventory comparison results;
[0070] Automatically fill in report content: Use programming or scripts to automatically fill in the test data into the report template, and the corresponding charts are automatically embedded in the report to generate a report file;
[0071] Automatic storage: The generated report files are automatically saved to the folder or database specified by the system, and classified and archived by date, storage location and other information;
[0072] Automatic distribution: The system is configured with an automatic email sending function to send the generated report files to relevant warehouse managers, management or other designated recipients or upload them to cloud storage.
[0073] The process of result visualization and report generation makes the display of test results clearer and more concise. Through a variety of visualization tools such as bar charts, pie charts and line charts, warehouse managers can quickly grasp the number of cigarettes and abnormalities on each pallet. The display of abnormal detection charts and inventory comparison results further helps managers analyze the accuracy and abnormal distribution of inventory data. The automated report generation function not only saves time, but also ensures the accuracy and consistency of the report content, making it easier for relevant personnel to make decisions and adjust inventory management strategies quickly.
[0074] The beneficial effects of the present invention are:
[0075] Improve inventory efficiency: Traditional cigarette inventory usually requires manual counting layer by layer, which is time-consuming and labor-intensive. The present invention can automatically collect and analyze images and quickly calculate the total number of cigarettes on the pallet, greatly shortening the inventory time and improving the efficiency of warehouse management.
[0076] Enhanced accuracy and reliability: Through the application of the YOLOv5 deep learning model, the system can accurately identify the bounding box of cigarettes and accurately calculate the number of stacked layers and single-layer pieces of cigarettes, thereby effectively avoiding the errors that may occur in manual inventory. The system also has an intelligent anomaly detection function, which automatically issues an alarm when an abnormal situation is detected to ensure the accuracy of the data.
[0077] Reduce labor intensity and ensure personnel safety: In the traditional inventory process, workers need to frequently perform high-altitude operations, which poses certain safety hazards. This invention completely eliminates the need for high-altitude operations through automated image acquisition and processing technology, reduces the labor intensity of workers, and improves operational safety.
[0078] Automated data management and analysis: The present invention can not only automatically calculate the number of cigarettes, but also compare the test results with the original inventory data, generate visual reports and statistical analysis, and help warehouse managers better understand inventory dynamics and make scientific decisions.
[0079] Adaptability and scalability: The present invention can be configured and adjusted according to the needs of different warehouses to meet the needs of cigarette quantity statistics in different scenarios. At the same time, the present invention has good scalability and can further integrate other intelligent functions in the future to further improve the intelligent level of warehouse management. DETAILED DESCRIPTION
[0080] The present invention will be further described below in conjunction with specific embodiments:
[0081] Embodiment 1: A method for counting the number of full stacks of cigarettes based on the YOLOv5 algorithm, comprising the following steps:
[0082] Image acquisition: Use a camera to acquire images of a full stack of cigarettes on a pallet at a certain location from different viewing angles within a preset time interval to obtain image data including front view and top view;
[0083] Image preprocessing: preprocess the collected image data, including image cropping, brightness adjustment, and geometric transformation operations, to enhance the feature information of the image and improve the accuracy of subsequent detection;
[0084] Image feature extraction: Based on the YOLOv5 deep learning model, feature information related to the number of cigarettes is extracted from the preprocessed image, including the number of stacking layers and the number of single-layer cigarettes;
[0085] Quantity detection: Detect the number of stacked layers of cigarettes on the pallet by analyzing the front view; detect the number of cigarettes in a single layer by analyzing the top view;
[0086] Calculation of cigarette quantity: multiply the detected stacking layer number and the single layer number to calculate the total number of cigarettes on each pallet;
[0087] Data storage and comparison: The calculated total number of cigarettes is automatically associated with the storage location information and saved.
[0088] This method uses the YOLOv5 algorithm to count the number of images of full stacks of cigarettes. It mainly uses image acquisition, preprocessing, feature extraction, quantity detection and other steps to ensure accurate detection of the number of layers and single-layer pieces of cigarettes on the tray under different viewing angles. YOLOv5 is a deep learning model widely used in the field of target detection. It has strong feature extraction and real-time detection capabilities and is suitable for multi-target detection tasks in complex scenarios. In this method, the combination of the front view and the top view greatly improves the accuracy of detection. In particular, the preprocessing step further enhances the feature information in the image, ensuring the robustness and accuracy of the detection.
[0089] The YOLOv5 deep learning model is a trained target detection algorithm model. Image feature extraction and quantity detection include the following steps:
[0090] Image input: Input the preprocessed front view and top view image data into the trained YOLOv5 model;
[0091] Cigarette detection: The model performs object detection in the input image, identifies the bounding boxes of cigarettes, and returns the coordinates, confidence, and category labels of these bounding boxes;
[0092] Stacking layer feature: For the front view, the model calculates the number of cigarette stacking layers based on the longitudinal distribution of the detected cigarette bounding box; each layer of cigarettes is marked as an independent object, and the final number of layers is determined by the number of detected objects;
[0093] Single layer cigarette count feature: For the top view, the model detects and counts the number of cigarettes in each layer; these cigarette targets are located on the same horizontal plane, so the total number of cigarettes in a single layer is calculated through the lateral distribution;
[0094] Coordinates and labels: The model outputs the bounding box coordinates of each cigarette target and its classification label of the number of cigarette layers or pieces;
[0095] Feature summary: The feature data of the coordinates and labels are summarized to obtain the number of stacking layers and single-layer pieces of cigarettes on the pallet, and input them into the cigarette quantity calculation module in the next step for calculation.
[0096] After pre-training, the YOLOv5 algorithm can perform efficient target detection on input image data. Through this algorithm, the system can detect the number of stacking layers from the front view and the number of single-layer cigarettes from the top view. This bounding box-based detection method can not only identify the location of each cigarette, but also return the confidence and category labels associated with it, providing a reliable data basis for subsequent quantity calculations. During the training process, the model continuously adjusts parameters to gradually optimize the detection accuracy, ensuring that the final output results can meet industrial-level accuracy requirements.
[0097] Before the image is captured, an environmental condition monitoring step is provided, using a light sensor to monitor the light intensity of the image capture area in real time. If the light is too strong or too weak, the system automatically adjusts the exposure parameters of the camera or prompts the user to adjust the light source position;
[0098] The image acquisition comprises the following steps:
[0099] Camera equipment setting: Install the camera equipment at the front and top view positions of the cigarette tray to ensure that the image covers the entire tray area;
[0100] Image acquisition execution: within a preset time interval, the camera device automatically captures the front view and top view image data of the pallet to ensure that the acquired image has good lighting conditions and clarity; the image data is a video stream or a single picture.
[0101] The environmental condition monitoring step before image acquisition ensures that the lighting conditions are stable during the image acquisition process, thereby ensuring the clarity and consistency of the image. The reasonable setting of the camera equipment and the automatic acquisition at time intervals ensure the integrity and quality of the image data. In practical applications, the influence of light intensity on the image is crucial. Through real-time monitoring and automatic adjustment of exposure parameters, the system can adapt to work requirements under various environmental conditions, further improving the reliability of image acquisition.
[0102] The image preprocessing comprises the following steps:
[0103] Image cropping: crop the captured image according to the tray area to remove irrelevant background to reduce interference;
[0104] Brightness adjustment: By adjusting the brightness and contrast of the image, the image details can be enhanced, especially the clarity of the cigarette edge;
[0105] Geometric transformation: Perform necessary rotation, scaling and distortion correction on the image to ensure that the presentation of cigarettes in the image conforms to the actual layout;
[0106] Application of segmentation algorithm: Use image segmentation algorithm to segment the preprocessed image and separate the cigarette area from the background area, so as to perform subsequent feature extraction and quantity detection more accurately;
[0107] Segmentation optimization: Analyze and optimize the segmentation results to ensure that the cigarette area is segmented completely and accurately.
[0108] Image preprocessing is a key step to ensure the accuracy of subsequent feature extraction and quantity detection. The system can minimize detection errors by cropping to remove irrelevant background, adjusting brightness to enhance the clarity of cigarette edges, and geometric transformation to ensure that the image is consistent with the actual layout. In particular, the application of image segmentation algorithms enables the cigarette area to be clearly separated from the background area, providing an accurate basis for subsequent feature extraction. The segmentation optimization step further ensures the integrity of the segmentation results and avoids detection errors caused by inaccurate segmentation.
[0109] Image segmentation is a key step in computer vision, which is used to separate different areas in an image for better subsequent feature extraction and analysis. In the method for counting the number of full stacks of cigarettes, the specific process and steps of image segmentation are as follows:
[0110] 1. Application of segmentation algorithm:
[0111] Input image preprocessing results:
[0112] Input images that have been pre-processed (such as cropping, brightness adjustment, geometric transformation, etc.), which contain cigarettes on the tray and the background;
[0113] Select a segmentation algorithm:
[0114] Use common image segmentation algorithms such as U-Net, MaskR-CNN, etc., or semantic segmentation methods based on convolutional neural networks (CNN); these algorithms can divide images into different regions (i.e., foreground and background);
[0115] Model loading and configuration:
[0116] Load the pre-trained segmentation model and configure the model parameters, such as learning rate and batch size, according to the characteristics of the image dataset to adapt to the characteristics of cigarette images;
[0117] Segmentation model run:
[0118] The preprocessed image is fed into the segmentation model, which classifies the image pixel by pixel, labeling each pixel as a cigarette (foreground) or background.
[0119] The segmentation model uses a deep convolutional network to identify features such as edges and textures in the image, thereby separating the cigarette area from the background area;
[0120] Generate segmentation mask:
[0121] The model outputs a binary segmentation mask, in which the pixels corresponding to the cigarette area are marked as 1 (foreground) and the pixels corresponding to the background area are marked as 0 (background);
[0122] 2. Segmentation optimization:
[0123] Analysis of preliminary segmentation results:
[0124] Analyze the generated segmentation mask to check whether the cigarette area is completely segmented, especially focusing on edges and complex areas (such as the junction of cigarette stacks);
[0125] If the initial segmentation result is not ideal (for example, there is mis-segmentation or missed segmentation), further optimization is required;
[0126] Post-processing technology:
[0127] Morphological operations: Use morphological operations (such as dilation, erosion, opening, and closing) to modify the segmentation mask, eliminate noise, fill small holes, or connect broken areas; these operations can improve the coherence and integrity of the segmentation results;
[0128] Edge refinement: Apply edge detection algorithms (such as Canny edge detection) combined with segmentation masks to refine the boundaries of the cigarette area to improve segmentation accuracy;
[0129] Overlapping area processing:
[0130] When processing multi-layer cigarette stacks, if there are overlapping areas or shadows that cause inaccurate segmentation, deep learning-enhanced edge detection methods can be used to further optimize the segmentation of overlapping areas in combination with contextual information;
[0131] Manual Adjustment and Feedback:
[0132] For some complex scenes, allow users to manually adjust the segmentation results (e.g., through interactive segmentation tools) and feed these adjustments back into the model to optimize future automatic segmentation results;
[0133] Final segmentation result confirmation:
[0134] Final confirmation of the optimized segmentation mask is performed to ensure that the cigarette area is completely and accurately segmented and the background area is correct; the optimized segmentation mask is used as the basis for subsequent feature extraction and quantity detection;
[0135] 3. Save the segmentation results:
[0136] Save the mask image:
[0137] The final generated segmentation mask image is saved in the folder specified by the system as input data for cigarette quantity detection;
[0138] Record segmentation parameters:
[0139] Save the parameters and model configuration used in the segmentation process to facilitate future reproduction and further optimization;
[0140] Through the above process, the cigarette area in the image is accurately segmented, providing clear input data for subsequent feature extraction and quantity detection;
[0141] After the stacking layer number feature and the single-layer cigarette piece number feature are identified, an intelligent anomaly detection process is provided, which specifically includes the following steps:
[0142] The extracted features are analyzed through anomaly detection algorithms to identify and mark possible anomalies, including abnormal number of cigarettes and image quality issues.
[0143] Abnormal feedback: The system automatically terminates, notifies the user of the abnormal situation, and provides detailed information for the user to verify.
[0144] Intelligent anomaly detection can promptly detect possible anomalies, such as abnormal number of cigarettes or image quality issues, by analyzing the extracted features. The system will automatically terminate after detecting an anomaly and prompt the user to verify to ensure the accuracy and reliability of the test results. This anomaly detection mechanism provides additional protection for the entire quantitative statistical method, avoiding misjudgments due to external factors or internal reasons of the system. At the same time, user feedback information will also be further used to optimize the model and improve its stability in different scenarios.
[0145] Anomaly detection is used in the cigarette counting system to identify possible anomalies, such as abnormal deviations in cigarette counts or image quality issues. The specific process and steps are as follows:
[0146] 1. Selection and configuration of anomaly detection algorithms:
[0147] Select anomaly detection algorithm:
[0148] Select a suitable anomaly detection algorithm based on the data characteristics; commonly used algorithms include:
[0149] Statistical methods: such as mean-variance analysis, Z-Score, IQR (interquartile range), etc., are used to detect quantitative anomalies;
[0150] Machine learning-based methods: such as Isolation Forest and Support Vector Machine (SVM), which are used to detect complex anomalies;
[0151] Deep learning-based methods: using autoencoders or LSTM (Long Short-Term Memory Network) to detect anomalies in time series or images;
[0152] Model training and configuration:
[0153] If using a machine learning or deep learning model, use the existing normal data to train the model so that it can learn the normal pattern of the number of cigarettes;
[0154] Configure parameters such as detection thresholds to ensure that the algorithm can distinguish between normal and abnormal situations;
[0155] 2. Anomaly detection of feature extraction results:
[0156] Enter feature data:
[0157] Input feature data extracted from the image, including the number of layers of cigarette stacks, the number of cigarettes in a single layer, and image quality indicators, etc.;
[0158] Quantity Anomaly Detection:
[0159] Statistical analysis: Calculate the difference between the number of detected cigarettes and the expected normal range. If it exceeds the preset upper and lower limits, it will be marked as abnormal;
[0160] Machine learning detection: Use the trained machine learning model to analyze the extracted feature data and identify abnormal data points; these data points may correspond to abnormal number of cigarettes or other feature anomalies;
[0161] Image quality anomaly detection:
[0162] Image clarity detection: Determine whether the image is clear by calculating the image's edge density, blurriness and other indicators; blurriness, overexposure, excessive noise and other conditions are marked as abnormal image quality;
[0163] Image integrity detection: detect whether the image is lost, partially blocked, or has other problems that affect the detection effect; abnormal images will be marked for re-capture or processing;
[0164] Exception marking and recording:
[0165] Marking detected anomalies, including the type of anomaly (e.g., quantity anomaly, image quality anomaly, etc.), the severity of the anomaly, and the specific features involved (e.g., number of cigarette layers, number of pieces, etc.);
[0166] Record detailed information of abnormal data to facilitate subsequent processing and analysis;
[0167] 3. Exception handling and feedback:
[0168] Automatic exception handling:
[0169] For some abnormal situations that can be automatically handled (such as blurred images), the system can automatically re-acquire images or adjust detection parameters to try to correct the abnormality;
[0170] For minor abnormalities in the number of cigarettes, secondary testing or comparison with historical data can be performed to confirm whether there is indeed a problem;
[0171] Human feedback mechanism:
[0172] For anomalies that cannot be automatically processed, the system can prompt the user to perform manual inspection and intervention, such as rechecking the number of cigarettes or adjusting image acquisition settings;
[0173] Users can provide feedback on anomalies through the system interface, and the system will record these feedbacks to optimize subsequent detection processes;
[0174] Abnormal data storage:
[0175] The anomaly detection results and processing logs are saved in the system database as a basis for further analysis and system improvement;
[0176] Mark and classify abnormal situations confirmed by users to facilitate continuous learning and improvement of future anomaly detection models;
[0177] 4. Summary and optimization:
[0178] Anomaly detection result evaluation:
[0179] Evaluate the entire anomaly detection process, analyze the accuracy, false positive rate, and missed negative rate of detection, and ensure that the system can effectively identify true anomalies;
[0180] Adjust and optimize anomaly detection algorithms and models based on the evaluation results;
[0181] Continuous learning and model updating:
[0182] Using the real anomaly data detected, the anomaly detection model is continuously updated and trained to make it more accurate in future detections;
[0183] Based on user feedback, the system's anomaly detection logic is iteratively optimized to improve the system's robustness and intelligence.
[0184] Through these steps, the system can effectively identify and handle abnormal situations in the cigarette quantity counting process, ensuring the accuracy and reliability of the final results;
[0185] The training steps of the YOLOv5 deep learning model are as follows:
[0186] Training image data acquisition: collecting front and top views of a known number of full stacks of cigarettes as training image data;
[0187] Data annotation: manually or semi-automatically annotate the positions of cigarettes in the front and top views of a known number of full stacks of cigarettes; the annotation content includes the bounding box and label of each cigarette, with the label being the number of layers or the number of pieces;
[0188] Data enhancement: Perform data enhancement operations on the annotated data set, including rotation, scaling, cropping, and brightness adjustment, to increase the diversity of the data set and improve the generalization ability of the model;
[0189] Pre-trained model loading: Load a YOLOv5 model pre-trained on a large-scale dataset to take advantage of its learned features;
[0190] Training process: Divide the labeled data set into training set and validation set;
[0191] Through the training set, the model gradually learns how to detect and identify the number of stacked layers and single-layer pieces of cigarettes in the image;
[0192] Use the validation set to test the model and adjust the model parameters, including learning rate and batch size, to improve detection accuracy and convergence speed;
[0193] Detection accuracy evaluation: Evaluate the detection results and analyze the detection accuracy of the model under different conditions; further adjust the model parameters or increase the diversity of training data to improve the model's feature extraction capabilities;
[0194] Actual data testing: In actual scenarios, use the trained model to test new image data to verify its feature extraction effect;
[0195] Feedback adjustment: Based on feedback from actual use, further optimize the feature extraction process to ensure the stability and applicability of the model.
[0196] The training steps of the YOLOv5 model ensure that the model can adapt to specific application scenarios. By collecting and annotating a known number of cigarette image data, the system can gradually learn how to accurately identify and detect the number of stacked layers and single-layer pieces of cigarettes during the training process. The application of data enhancement technology greatly improves the generalization ability of the model, enabling it to maintain high detection accuracy under different lighting, angles and positions. Through the loading of the pre-trained model and subsequent actual data testing, the system finally formed a highly adaptable and robust detection model that can cope with changing industrial scenarios.
[0197] The working process is as follows:
[0198] 1. Environmental Condition Monitoring and Image Acquisition
[0199] First, before image acquisition, the system will monitor the lighting conditions, temperature, humidity and other environmental parameters in the warehouse through preset sensors. After ensuring that the environmental conditions are stable, the system automatically starts the camera to capture images of the pallet. In order to improve the accuracy of detection, the camera is installed directly above and on the side of the pallet to obtain top view and front view images respectively.
[0200] 2. Image Preprocessing
[0201] The captured image first passes through the preprocessing module, where it is cropped to remove irrelevant background, and the brightness and contrast are adjusted according to the monitored lighting conditions. To ensure that the image geometry is consistent with the actual situation, the system performs geometric transformation processing on the image, including rotation and scaling. Then, the image segmentation algorithm is applied to the image to separate the cigarette and background parts in preparation for subsequent target detection.
[0202] 3. Cigarette quantity detection
[0203] The preprocessed images are fed into the YOLOv5 object detection model to detect the number of cigarettes. The YOLOv5 model has been trained with a large amount of cigarette image data and can accurately identify and mark the bounding box of each layer of cigarettes. The system counts the number of cigarettes in each layer in the top view and calculates the total number of cigarettes on each tray based on the number of stacking layers in the front view.
[0204] 4. Anomaly Detection
[0205] During the detection process, the system will analyze the output test results in real time and compare them with the normal cigarette stacking form. If there are abnormalities in the test results, such as too few cigarettes in a layer or a significant difference in the total number of pieces detected compared with historical data, the system will automatically issue an alarm and prompt the operator to conduct manual verification. In this way, quantitative errors caused by detection errors or image quality problems can be effectively avoided.
[0206] Finally, the statistical results are obtained.
[0207] Embodiment 2: A method for counting the number of full stacks of cigarettes based on the YOLOv5 algorithm. After the number of full stacks of cigarettes on a pallet at a certain storage location is counted using the method of Embodiment 1, the following steps are performed:
[0208] Data storage and comparison: The calculated number of full stacks of cigarettes is associated with the storage location information and saved, and the test results are compared with the preset original inventory data to determine the accuracy of the inventory data;
[0209] Repeat the above steps to count the quantity of all storage locations in the warehouse;
[0210] Result visualization and report generation: Display the test results through charts and visualization interfaces, and automatically generate statistical reports for warehouse management personnel to view and analyze;
[0211] User feedback and adjustment: Allow warehouse managers to manually review and provide feedback on test results; the system automatically adjusts algorithm parameters based on feedback information to gradually improve the accuracy and reliability of future tests.
[0212] This inventory counting method compares the quantity statistics with the original inventory data to ensure the accuracy of the inventory data. Through comprehensive statistics of all storage locations in the warehouse, this method can help warehouse managers to promptly discover abnormalities in the inventory, and through the visualization of results and report generation functions, data analysis is more intuitive and efficient. The system's user feedback mechanism allows warehouse managers to manually review the test results, thereby continuously optimizing the algorithm parameters and gradually improving the accuracy and reliability of future tests. This process not only improves the efficiency of inventory management, but also reduces the workload and errors of manual inventory counting.
[0213] Before the data is stored and compared, intelligent anomaly detection is performed on the counted number of full stacks of cigarettes to automatically identify possible anomalies. If a large fluctuation in the number occurs, a warning message is generated to indicate that further verification is required.
[0214] Before data is stored and compared, the system further verifies the reliability of the statistical results through intelligent anomaly detection. This automated detection mechanism can promptly identify and handle abnormal situations, such as large fluctuations in quantity, and generate warning messages to prompt users to check. This step increases the intelligence level of the system, making the entire inventory process more rigorous and efficient, reducing the need for manual intervention, and improving the accuracy and security of inventory management.
[0215] The result visualization and report generation includes the following steps:
[0216] Collect test results: extract all test data from the system, including the number of cigarette layers, the number of pieces per layer, the total number of pieces, and any abnormalities detected on each tray; perform preliminary sorting of these data to ensure data integrity and accuracy, and remove duplicate or invalid data;
[0217] Data format conversion: convert the inspection data into a format suitable for visualization tools and report generation and store it;
[0218] Choose a visualization tool: Use a visualization tool or library to generate a bar chart, pie chart, or line chart;
[0219] Create visual charts: Create a bar chart or bar graph to display the total number of cigarettes per pallet, the number of layers, and the number of pieces per layer, so that warehouse managers can intuitively see the number of cigarettes on different pallets;
[0220] Abnormal situation display: Generate anomaly detection charts, including abnormal quantity distribution charts and abnormal type pie charts, to help analyze which type of abnormal situation occurs most frequently;
[0221] Inventory comparison results: Display the difference between the test results and the original inventory data through a line chart or radar chart, so as to find out the specific inventory location and quantity deviation of the inaccurate inventory;
[0222] Chart layout and interface display: The generated charts are laid out in a logical order in the visual interface of the system to ensure that warehouse managers can easily browse and analyze data;
[0223] Report template: Standardized report template includes title, date, test result summary, detailed statistics, anomaly analysis, and inventory comparison results;
[0224] Automatically fill in report content: Use programming or scripts to automatically fill in the test data into the report template, and the corresponding charts are automatically embedded in the report to generate a report file;
[0225] Automatic storage: The generated report files are automatically saved to the folder or database specified by the system, and classified and archived by date, storage location and other information;
[0226] Automatic distribution: The system is configured with an automatic email sending function to send the generated report files to relevant warehouse managers, management or other designated recipients or upload them to cloud storage.
[0227] The process of result visualization and report generation makes the display of test results clearer and more concise. Through a variety of visualization tools such as bar charts, pie charts and line charts, warehouse managers can quickly grasp the number of cigarettes and abnormalities on each pallet. The display of abnormal detection charts and inventory comparison results further helps managers analyze the accuracy and abnormal distribution of inventory data. The automated report generation function not only saves time, but also ensures the accuracy and consistency of the report content, making it easier for relevant personnel to make decisions and adjust inventory management strategies quickly.
[0228] The working process is as follows:
[0229] 1. Environmental Condition Monitoring and Image Acquisition
[0230] First, before image acquisition, the system will monitor the lighting conditions, temperature, humidity and other environmental parameters in the warehouse through preset sensors. After ensuring that the environmental conditions are stable, the system automatically starts the camera to capture images of the pallet. In order to improve the accuracy of detection, the camera is installed directly above and on the side of the pallet to obtain top view and front view images respectively.
[0231] 2. Image Preprocessing
[0232] The captured image first passes through the preprocessing module, where it is cropped to remove irrelevant background, and the brightness and contrast are adjusted according to the monitored lighting conditions. To ensure that the image geometry is consistent with the actual situation, the system performs geometric transformation processing on the image, including rotation and scaling. Then, the image segmentation algorithm is applied to the image to separate the cigarette and background parts in preparation for subsequent target detection.
[0233] 3. Cigarette quantity detection
[0234] The preprocessed images are fed into the YOLOv5 object detection model to detect the number of cigarettes. The YOLOv5 model has been trained with a large amount of cigarette image data and can accurately identify and mark the bounding box of each layer of cigarettes. The system counts the number of cigarettes in each layer in the top view and calculates the total number of cigarettes on each tray based on the number of stacking layers in the front view.
[0235] 4. Anomaly Detection
[0236] During the detection process, the system will analyze the output test results in real time and compare them with the normal cigarette stacking form. If there are abnormalities in the test results, such as too few cigarettes in a layer or a significant difference in the total number of pieces detected compared with historical data, the system will automatically issue an alarm and prompt the operator to conduct manual verification. In this way, quantitative errors caused by detection errors or image quality problems can be effectively avoided.
[0237] 5. Result comparison and storage
[0238] After the quantity detection is completed, the system automatically compares the test results with the inventory data in the warehouse management system. The comparison results are displayed on the system interface, and the operator can intuitively view the number of cigarettes on each pallet and whether there are any abnormalities. The test results and comparison information are then stored in the database for subsequent analysis and auditing.
[0239] 6. Visualization and report generation
[0240] Finally, the system will generate corresponding visual reports based on the test results, including a bar chart of the number of cigarettes on each pallet, a pie chart of the inventory status of each warehouse location, etc. These reports can help managers quickly understand the inventory situation and identify potential inventory management issues. The report content can be automatically generated into PDF or Excel files for easy archiving and sharing.
[0241] Finally, it should be noted that the above is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the aforementioned embodiments, it is still possible for those skilled in the art to modify the technical solutions described in the aforementioned embodiments or to make equivalent substitutions for some of the technical features therein. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for counting the number of full stacks of cigarettes based on the YOLOv5 algorithm, characterized in that: The following steps are involved: Image acquisition: Use a camera to acquire images of a full stack of cigarettes on a pallet at a certain location from different viewing angles within a preset time interval to obtain image data including front view and top view; Image preprocessing: preprocess the collected image data, including image cropping, brightness adjustment, and geometric transformation operations, to enhance the feature information of the image and improve the accuracy of subsequent detection; Image feature extraction: Based on the YOLOv5 deep learning model, feature information related to the number of cigarettes is extracted from the preprocessed image, including the number of stacking layers and the number of single-layer cigarettes; Quantity detection: Detect the number of stacked layers of cigarettes on the pallet by analyzing the front view; detect the number of cigarettes in a single layer by analyzing the top view; Calculation of cigarette quantity: multiply the detected stacking layer number and the single layer number to calculate the total number of cigarettes on each pallet; Data storage and comparison: The calculated total number of cigarettes is automatically associated with the storage location information and saved.
2. The method for counting the number of full stacks of cigarettes based on the YOLOv5 algorithm as claimed in claim 1, characterized in that: The YOLOv5 deep learning model is a trained target detection algorithm model. Image feature extraction and quantity detection include the following steps: Image input: Input the preprocessed front view and top view image data into the trained YOLOv5 model; Cigarette detection: The model performs object detection in the input image, identifies the bounding boxes of cigarettes, and returns the coordinates, confidence, and category labels of these bounding boxes; Stacking layer feature: For the front view, the model calculates the number of cigarette stacking layers based on the longitudinal distribution of the detected cigarette bounding box; each layer of cigarettes is marked as an independent object, and the final number of layers is determined by the number of detected objects; Single layer cigarette count feature: For the top view, the model detects and counts the number of cigarettes in each layer; these cigarette targets are located on the same horizontal plane, so the total number of cigarettes in a single layer is calculated through the lateral distribution; Coordinates and labels: The model outputs the bounding box coordinates of each cigarette target and its classification label of the number of cigarette layers or pieces; Feature summary: The feature data of the coordinates and labels are summarized to obtain the number of stacking layers and single-layer pieces of cigarettes on the pallet, and input them into the cigarette quantity calculation module in the next step for calculation.
3. The method for counting the number of full stacks of cigarettes based on the YOLOv5 algorithm as claimed in claim 1, characterized in that: Before the image is captured, an environmental condition monitoring step is provided, using a light sensor to monitor the light intensity of the image capture area in real time. If the light is too strong or too weak, the system automatically adjusts the exposure parameters of the camera or prompts the user to adjust the light source position; The image acquisition comprises the following steps: Camera equipment setting: Install the camera equipment at the front and top view positions of the cigarette tray to ensure that the image covers the entire tray area; Image acquisition execution: within a preset time interval, the camera device automatically captures the front view and top view image data of the pallet to ensure that the acquired images have good lighting conditions and clarity; the image data is a video stream or a single picture.
4. The method for counting the number of full stacks of cigarettes based on the YOLOv5 algorithm as claimed in claim 1, characterized in that: The image preprocessing comprises the following steps: Image cropping: crop the captured image according to the tray area to remove irrelevant background to reduce interference; Brightness adjustment: By adjusting the brightness and contrast of the image, the image details can be enhanced, especially the clarity of the cigarette edge; Geometric transformation: Perform necessary rotation, scaling and distortion correction on the image to ensure that the presentation of cigarettes in the image conforms to the actual layout; Application of segmentation algorithm: Use image segmentation algorithm to segment the preprocessed image and separate the cigarette area from the background area, so as to perform subsequent feature extraction and quantity detection more accurately; Segmentation optimization: Analyze and optimize the segmentation results to ensure that the cigarette area is segmented completely and accurately.
5. The method for counting the number of full stacks of cigarettes based on the YOLOv5 algorithm as claimed in claim 2, characterized in that: After the stacking layer number feature and the single-layer cigarette piece number feature are identified, an intelligent anomaly detection process is provided, which specifically includes the following steps: The extracted features are analyzed through anomaly detection algorithms to identify and mark possible anomalies, including abnormal number of cigarettes and image quality issues. Abnormal feedback: The system automatically terminates, notifies the user of the abnormal situation, and provides detailed information for the user to verify.
6. The method for counting the number of full stacks of cigarettes based on the YOLOv5 algorithm as claimed in claim 2, characterized in that: The training steps of the YOLOv5 deep learning model are as follows: Training image data acquisition: collecting front and top views of a known number of full stacks of cigarettes as training image data; Data annotation: manually or semi-automatically annotate the positions of cigarettes in the front and top views of a known number of full stacks of cigarettes; the annotation content includes the bounding box and label of each cigarette, with the label being the number of layers or the number of pieces; Data enhancement: Perform data enhancement operations on the annotated data set, including rotation, scaling, cropping, and brightness adjustment, to increase the diversity of the data set and improve the generalization ability of the model; Pre-trained model loading: Load a YOLOv5 model pre-trained on a large-scale dataset to take advantage of its learned features; Training process: Divide the labeled data set into training set and validation set; Through the training set, the model gradually learns how to detect and identify the number of stacked layers and single-layer pieces of cigarettes in the image; Use the validation set to test the model and adjust the model parameters, including learning rate and batch size, to improve detection accuracy and convergence speed; Detection accuracy evaluation: Evaluate the detection results and analyze the detection accuracy of the model under different conditions; further adjust the model parameters or increase the diversity of training data to improve the model's feature extraction capabilities; Actual data testing: In actual scenarios, use the trained model to test new image data to verify its feature extraction effect; Feedback adjustment: Based on feedback from actual use, further optimize the feature extraction process to ensure the stability and applicability of the model.
7. A method for counting the number of full stacks of cigarettes based on the YOLOv5 algorithm according to any one of claims 1 to 6, characterized in that: The following steps are involved: The full stack cigarette quantity counting method based on the YOLOv5 algorithm is used to count the number of full stack cigarettes on a pallet at a certain storage location; Data storage and comparison: The calculated number of full stacks of cigarettes is associated with the storage location information and saved, and the test results are compared with the preset original inventory data to determine the accuracy of the inventory data; Repeat the above steps to count the quantity of all storage locations in the warehouse; Result visualization and report generation: Display the test results through charts and visualization interfaces, and automatically generate statistical reports for warehouse management personnel to view and analyze; User feedback and adjustment: Allow warehouse managers to manually review and provide feedback on test results; the system automatically adjusts algorithm parameters based on feedback information to gradually improve the accuracy and reliability of future tests.
8. The method for counting the number of full stacks of cigarettes based on the YOLOv5 algorithm according to claim 7, characterized in that: Before the data is stored and compared, intelligent anomaly detection is performed on the counted number of full stacks of cigarettes to automatically identify possible anomalies. If a large fluctuation in the number occurs, a warning message is generated to indicate that further verification is required.
9. The method for counting the number of full stacks of cigarettes based on the YOLOv5 algorithm according to claim 7, characterized in that: The result visualization and report generation includes the following steps: Collect test results: extract all test data from the system, including the number of cigarette layers, the number of pieces per layer, the total number of pieces, and any abnormalities detected on each tray; perform preliminary sorting of these data to ensure data integrity and accuracy, and remove duplicate or invalid data; Data format conversion: convert the inspection data into a format suitable for visualization tools and report generation and store it; Choose a visualization tool: Use a visualization tool or library to generate a bar chart, pie chart, or line chart; Create visual charts: Create a bar chart or bar graph to display the total number of cigarettes per pallet, the number of layers, and the number of pieces per layer, so that warehouse managers can intuitively see the number of cigarettes on different pallets; Abnormal situation display: Generate anomaly detection charts, including abnormal quantity distribution charts and abnormal type pie charts, to help analyze which type of abnormal situation occurs most frequently; Inventory comparison results: Display the difference between the test results and the original inventory data through a line chart or radar chart, so as to find out the specific inventory location and quantity deviation of the inaccurate inventory; Chart layout and interface display: The generated charts are laid out in a logical order in the visual interface of the system to ensure that warehouse managers can easily browse and analyze data; Report template: Standardized report template includes title, date, test result summary, detailed statistics, anomaly analysis, and inventory comparison results; Automatically fill in report content: Use programming or scripts to automatically fill in the test data into the report template, and the corresponding charts are automatically embedded in the report to generate a report file; Automatic storage: The generated report files are automatically saved to the folder or database specified by the system, and classified and archived by date, storage location and other information; Automatic distribution: The system is configured with an automatic email sending function to send the generated report files to relevant warehouse managers, management or other designated recipients or upload them to cloud storage.