Cigarette packaging defect detection method based on deep mutual learning in cloud-edge collaborative scenario

By constructing defect detection models with different parameter values ​​in a cloud-edge collaborative scenario and combining mutual learning strategies and global parameter updates, the problem of data heterogeneity was solved, enabling efficient real-time detection of cigarette packaging defects and improving detection accuracy and adaptability.

CN115760739BActive Publication Date: 2026-03-17CHINA TOBACCO ZHEJIANG IND CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-09
Publication Date
2026-03-17

AI Technical Summary

Technical Problem

In cloud-edge collaborative scenarios, the original data of various cigarette factories cannot be shared, and there is a data heterogeneity problem in the cigarette packaging images of various production lines. This results in low accuracy and generalization of existing models, and it is difficult to achieve real-time defect monitoring on edge devices using large models trained in a federated manner.

Method used

First and second defect detection models based on deep autoencoders are constructed, and a global model is built in the cloud. The model is trained by mutual learning strategy and global parameter update strategy in cloud-edge collaborative scenario. The presence of defects in cigarette packaging is determined by combining the reconstruction error threshold.

Benefits of technology

It enables effective integration of information across different cigarette production lines, breaks down information silos, provides a lightweight model suitable for real-time defect detection on high-speed cigarette production lines, and improves detection accuracy and generalization ability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115760739B_ABST
    Figure CN115760739B_ABST
Patent Text Reader

Abstract

The application discloses a kind of cloud edge collaborative scene based on deep mutual learning's cigarette packaging defect detection method, based on the cigarette packaging image sample of different edge end is constructed defect detection dataset, and the global model of different size defect detection model and cloud end is built, utilize defect detection dataset and alternately circulate and execute mutual learning strategy and the global parameter updating strategy under cloud edge collaborative scene training model, fixedly trained each edge end small model parameter and obtain reconstruction error threshold value;Utilize edge end small model processing to be measured packaging appearance image and obtain reconstructed image, according to the comparison relationship of reconstruction error and reconstruction error threshold value of reconstructed image, determine whether there is appearance defect.The application combines the framework of cloud edge collaboration, fuses the information between different cigarette factories and cigarette production lines, breaks the information silos in industrial production, effectively solves the problem of data distribution difference caused by different imaging equipment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of cigarette manufacturing, and in particular to a method for detecting cigarette packaging defects based on deep mutual learning in a cloud-edge collaborative scenario. Background Technology

[0002] During the high-speed production of cigarettes on assembly lines, complex factors such as the production environment, materials, and processing equipment can all lead to damage to cigarette packaging or the presence of foreign objects. To ensure the quality of cigarettes leaving the factory, real-time defect detection of cigarette packaging is necessary. Manual inspection methods are time-consuming and labor-intensive, making them unsuitable for today's high-speed assembly line production.

[0003] In recent years, with the development of computer vision and monitoring technologies, intelligent monitoring of industrial production has become possible. Since the number of defective packaging samples available during cigarette production is far less than the number of normal samples, these tasks typically employ unsupervised learning, meaning they are trained using only normal samples. A deep autoencoder learns the feature distribution of normal product appearance, and during online monitoring, defect detection is achieved based on feature similarity in the latent space or reconstruction errors. However, in actual cigarette production scenarios, different cigarette factories often cannot directly share cigarette packaging image data due to privacy concerns. Therefore, existing solutions generally involve each cigarette factory training its own model. This approach often suffers from low accuracy and generalization because the data encountered during model training does not cover a sufficient number of normal cigarette packaging modalities. With the emergence of the cloud-edge collaboration concept and the development of federated learning methods, it has become possible to integrate the resources of various cigarette factories without sharing original cigarette image data. The cloud-edge collaboration framework breaks down data silos in the industrial field. Under this framework, cloud servers handle computationally intensive tasks such as model training and optimization, while edge devices provide model training and deployment, performing real-time cigarette packaging defect diagnosis. Therefore, how to effectively integrate data from different cigarette factories and production lines using the federated learning framework to obtain a more robust cigarette packaging defect model is a direction worth exploring.

[0004] However, the imaging equipment on different production lines is installed in different locations, with varying shooting angles and lighting conditions, resulting in different modal distributions of normal cigarette packaging. Therefore, models obtained by directly using federated parameter averaging perform worse than those trained solely on edge cigarette packaging data. Furthermore, due to computational limitations, large models trained via federated learning are difficult to implement in real-time defect monitoring on edge devices in cigarette factory production lines. Therefore, finding a better way to combine federated learning methods to address the heterogeneity of data across edge devices in cloud-edge collaborative scenarios, while simultaneously obtaining lightweight models suitable for edge devices to achieve real-time defect monitoring of cigarette packaging, presents a significant challenge. Summary of the Invention

[0005] In view of the above, the present invention aims to provide a method for detecting cigarette packaging defects based on deep mutual learning in a cloud-edge collaborative scenario, so as to solve the problem that the original data of various cigarette factories cannot be shared and the cigarette packaging images obtained from various production lines are heterogeneous in a cloud-edge collaborative scenario.

[0006] The technical solution adopted in this invention is as follows:

[0007] This invention provides a method for detecting cigarette packaging defects based on deep mutual learning in a cloud-edge collaborative scenario, including:

[0008] Based on cigarette packaging image samples obtained from different edge devices during the production process, a defect detection dataset is constructed, and a first defect detection model and a second defect detection model based on a deep autoencoder are built at each edge device, as well as a global defect detection model is built in the cloud; wherein, the number of parameters of the first defect detection model is greater than that of the second defect detection model.

[0009] Initialize the parameters of the global defect detection model in the cloud, and initialize the parameters of the first defect detection model based on the initialized parameters of the global model, and randomly initialize the parameters of the second defect detection model.

[0010] The first defect detection model and the second defect detection model are trained using the defect detection dataset and a mutual learning strategy; and are executed synchronously and alternately in a loop: combined with the global parameter update strategy in the cloud-edge collaboration scenario, the parameters of the first defect detection model are aggregated and optimized in the cloud.

[0011] After training, the parameters of the second defect detection model at each edge are saved, and the reconstruction error threshold is obtained;

[0012] Collect images of the cigarette packaging to be tested;

[0013] The second defect detection model is used to process the appearance image of the cigarette packaging to be tested, and the reconstructed image is obtained.

[0014] The reconstruction error of the reconstructed image is calculated, and the presence of appearance defects in the cigarette packaging is determined based on the comparison between the reconstruction error and the reconstruction error threshold.

[0015] In at least one possible implementation, obtaining the reconstruction error threshold includes: calculating the mean and variance of the reconstruction loss, and fusing the mean and variance to obtain the reconstruction error threshold.

[0016] In at least one possible implementation, the obtained cigarette packaging image sample includes: cropping and obtaining the effective area of ​​the cigarette packaging image sample by marking key areas for each edge.

[0017] In at least one of the possible implementations, the method of building a defect detection model based on a deep autoencoder includes: an encoder consisting of a multi-layer two-dimensional convolution and a decoder consisting of a multi-layer two-dimensional deconvolution, which are used to map the input cigarette packaging image into latent space features and to recover the cigarette packaging image using the latent space features, respectively.

[0018] In at least one possible implementation, the obtained reconstructed image includes: cropping and scaling the effective area of ​​the cigarette packaging appearance image to be tested, and then reconstructing the effective area of ​​the cigarette packaging image to be tested using a second defect detection model.

[0019] In at least one possible implementation, the mutual learning strategy includes:

[0020] Input a normal cigarette packaging image from the defect detection dataset, extract features using the feature extractors of the first defect detection model and the second defect detection model respectively, and then use the decoders of the first defect detection model and the second defect detection model respectively to obtain the reconstructed cigarette packaging image. Use the first loss to optimize the reconstruction ability of the first defect detection model and the second defect detection model for normal cigarette packaging image samples.

[0021] Based on the feature distillation method, the first defect detection model and the second defect detection model learn from each other, and the second loss is used to constrain the similarity of the latent space features obtained by the first defect detection model and the second defect detection model for the same cigarette packaging image.

[0022] The loss functions of the first and second defect detection models at the edge include reconstruction loss and feature distillation loss.

[0023] In at least one of the possible implementations, the global parameter update strategy in the cloud-edge collaborative scenario, which aggregates and optimizes the parameters of the first defect detection model in the cloud, includes:

[0024] The parameters of the first defect detection model are aggregated and optimized in the cloud using a federated learning method with federated parameter averaging. The parameters of the global defect detection model are used as the weighted average of the parameters of the first defect detection model at each edge, and the weight coefficients are determined by the number of cigarette packaging image samples participating in the training at different edge ends.

[0025] The main design concept of this invention is to construct a defect detection dataset based on cigarette packaging image samples obtained from different edge devices during the production process, and to build defect detection models of different sizes with varying parameter values, as well as a global model in the cloud. After initializing the model parameters, the defect detection dataset is used to train the small and large defect detection models by alternately executing a mutual learning strategy and a global parameter update strategy under a cloud-edge collaborative scenario. The parameters of the small models at each edge device are fixed after training, and a reconstruction error threshold is obtained. In the actual inference stage, the small models at the edge devices are used to process the appearance image of the cigarette packaging to be tested, and a reconstructed image is obtained. Based on the comparison between the reconstruction error of the reconstructed image and the reconstruction error threshold, it is determined whether the cigarette packaging to be tested has appearance defects. This invention combines a cloud-edge collaborative framework, integrates information from different cigarette factories and cigarette production lines, breaks down information silos in industrial production, and its lightweight model structure is well-suited for real-time packaging appearance defect detection on high-speed cigarette production lines. It effectively solves the problem of data distribution differences caused by different imaging equipment shooting angles, backgrounds, and lighting conditions on different cigarette production lines. Attached Figure Description

[0026] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described below with reference to the accompanying drawings, wherein:

[0027] Figure 1 A flowchart illustrating the method for detecting cigarette packaging defects based on deep mutual learning in a cloud-edge collaborative scenario provided in this embodiment of the invention;

[0028] Figure 2 This is a schematic diagram of the system architecture upon which the cloud-edge collaborative scenario-based cigarette packaging defect detection method based on deep mutual learning is based, as provided in this embodiment of the invention. Detailed Implementation

[0029] Embodiments of the present invention are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.

[0030] This invention proposes an embodiment of a cigarette packaging defect detection method based on deep mutual learning in a cloud-edge collaborative scenario, specifically including:

[0031] Step S1: Based on cigarette packaging image samples obtained from different edge terminals during the production process, construct a defect detection dataset, and build a first defect detection model and a second defect detection model based on a deep autoencoder at each edge terminal, as well as construct a global defect detection model in the cloud; wherein, the number of parameters of the first defect detection model is greater than that of the second defect detection model (in the following embodiments, the large model refers to the first defect detection model, and the small model refers to the second defect detection model).

[0032] Specifically, based on K defect-free cigarette packaging samples obtained during the production process from different cigarette factories or different production lines, an unsupervised appearance defect detection dataset is constructed, denoted as {C1, C2, ..., C...}. K}, C i This represents the training data for the i-th edge, denoted by N(C). k The number of samples is indicated by (). Each cigarette factory or production line inevitably faces interference from varying imaging equipment angles, backgrounds, and lighting conditions. Therefore, for each edge, since the imaging equipment's position is fixed, a method of manually marking key areas can be used to crop out the effective area of ​​the cigarette packaging, reducing background interference.

[0033] The most basic unsupervised defect detection model is constructed based on a deep autoencoder. It consists of an encoder E composed of multiple layers of two-dimensional convolutions and a decoder D composed of multiple layers of two-dimensional deconvolutions. These are used to map the input cigarette packaging image I into latent space features z, and to recover the cigarette packaging image using the latent space features z, respectively.

[0034] Step S2: Initialize the parameters of the global defect detection model in the cloud, and initialize the parameters of the first defect detection model based on the initialized parameters of the global model, and randomly initialize the parameters of the second defect detection model.

[0035] Specifically, model M can be initialized in the cloud. G Initialize the large model M at each edge. L and small model M s Among them, the large model M L It has the same number of parameters and network structure as the cloud model, while the small model M S It has fewer parameters.

[0036] Step S3: Use the defect detection dataset and a mutual learning strategy to train the first defect detection model and the second defect detection model; and execute them synchronously and alternately in a loop: combine the global parameter update strategy in the cloud-edge collaboration scenario to summarize and optimize the parameters of the first defect detection model in the cloud.

[0037] Step S4: After training is completed, save the parameters of the second defect detection model at each edge and obtain the reconstruction error threshold;

[0038] Overall, each cropped cigarette packaging image sample in the dataset is used as input to the defect detection model to minimize the MSE reconstruction loss of normal cigarette packaging images. The model is trained to have a small reconstruction loss for normal cigarette packaging images and a large reconstruction loss for defective cigarette packaging images.

[0039] The parameter iterative update loop operations involved in steps S3 and S4 can specifically include the following two steps:

[0040] Step (1) The edge parameter update strategy based on deep mutual learning is as follows:

[0041] The data distribution is different at each edge. At time t, the large model M at each edge... L The parameters of the small model Ms are denoted as follows: and Based on the principle of minimizing the reconstruction loss of a normal cigarette packaging image, the specific process for updating parameters at the edges is as follows:

[0042] Input an image I of a normal cigarette package, and use a large model M respectively. L and small model M S Feature extractor, extracts features f L and f S Then, the decoders of the two models are used to obtain the reconstructed cigarette packaging images. and The MSE loss is used to optimize the reconstruction capabilities of the two models for normal cigarette packaging image samples. The reconstruction loss is:

[0043]

[0044] The larger model participates in the next step of global parameter updates, thus summarizing information from other cigarette production lines and possessing stronger feature representation capabilities for cigarette packaging images. The smaller model is more suitable for real-time inference tasks in the online detection stage of cigarette packaging defects. Simultaneously, the smaller model does not involve global parameter updates and contains more information related to cigarette packaging defect detection from that production line. Therefore, feature distillation is used to enable the two models to learn from each other. Specifically, a smooth L1 loss is used to constrain the latent space features of the two models to be as similar as possible, and the training loss function also includes feature distillation loss.

[0045]

[0046] When updating parameters at the edge, the loss function includes reconstruction loss. and characteristic distillation loss Two parts:

[0047]

[0048] Where λ represents an adjustable parameter.

[0049] Update edge model parameters based on the above methods. and

[0050] (2) Global model update mechanism in cloud-edge collaborative scenarios:

[0051] The parameters of large-scale ML models from different cigarette production lines are aggregated and optimized in the cloud using a federated learning method with federated parameter averaging, and then distributed to various edge devices.

[0052] The parameters w of the global model t+1 For each edge end model parameter The weighted average,

[0053]

[0054] Where the weighting coefficient α k The number of cigarette packaging image samples N(C) in the training set at different edge ends k )Decide.

[0055]

[0056] The local parameters at each edge are updated using the method in (1), and the global model is obtained by summing the results using the method in (2), which is then used to update the large model. These two steps are repeated alternately until the model parameters converge, at which point each edge obtains its final model parameters. and

[0057] After the model training is completed, the parameters of the small model at the edge are fixed, and all training samples at the edge are reconstructed. The reconstruction loss is calculated: where the mean is denoted as μ, the variance is denoted as σ, and the threshold of reconstruction error is set as θ = μ + 3σ.

[0058] Step S5: Acquire images of the exterior of the cigarette packaging to be tested;

[0059] Step S6: Process the appearance image of the cigarette packaging to be tested using the second defect detection model to obtain the reconstructed image;

[0060] Step S7: Calculate the reconstruction error of the reconstructed image, and determine whether there are appearance defects in the cigarette packaging to be tested based on the comparison relationship between the reconstruction error and the reconstruction error threshold.

[0061] Specifically, in the online real-time detection phase, images of the packaging appearance provided by each edge are acquired. After cropping and scaling the effective area of ​​the image, a small model with fewer parameters is used to reconstruct the effective area of ​​the cigarette packaging image under test, resulting in the reconstructed image.

[0062]

[0063] The reconstruction error is calculated as follows:

[0064]

[0065] When the reconstruction error exceeds the set threshold θ, the cigarette packaging is considered to have an appearance defect.

[0066] Figure 1 This is a schematic diagram of the overall process of the above embodiments. The following text uses photos taken by four edge cameras of a cigarette factory as an example, combined with... Figure 2 The schematic architecture of this invention is used to illustrate the method for detecting cigarette packaging defects based on deep mutual learning in the aforementioned cloud-edge collaborative scenario.

[0067] (1) The normal images of cigarette packaging collected from each edge are cropped to remove most of the background and obtain the main area of ​​the cigarette packaging.

[0068] The details of the cigarette image dataset for each edge are shown in Table 1. Each edge contains a certain number of normal samples and defective samples. A portion of the normal samples and all the abnormal samples are randomly divided to form a test set, and the remaining normal samples are used as the training set for model training.

[0069] Table 1. Number of samples at each edge end

[0070]

[0071] During training and testing, the cropped cigarette packaging images were scaled to RGB images with a length of 448 and a width of 256, which were then used as input to the model.

[0072] (2) Build large and small defect detection models based on deep autoencoders at each edge. The specific model structures are shown in Table 2:

[0073] Table 2. Defect detection model structure based on deep autoencoder

[0074]

[0075]

[0076] Where conv(k,s,c) represents a convolutional layer with kernel size k, stride s, and number of layers c, and dconv(k,s,c) represents a deconvolutional layer with kernel size k, stride s, and number of layers c.

[0077] Initialize global model M G The parameters are used to initialize the edge model M. L parameters Randomly initialize M S The parameters.

[0078] (3) Train two cigarette packaging defect detection models with different parameter values ​​at each edge based on a mutual learning strategy. This is achieved through the following sub-steps:

[0079] ① The training is performed using cropped cigarette packaging images from each edge, with settings for training epochs, learning rate, and optimizer hyperparameters.

[0080] ② Input image I of a cropped normal cigarette packaging, and use the large model M respectively. L and small model M S Feature extractor, extracts features f L and f S Then, the decoders of the two models are used to obtain the reconstructed cigarette packaging images. and

[0081] The MSE loss is used to optimize the reconstruction capabilities of the two models for normal cigarette packaging image samples. Reconstruction Loss for:

[0082]

[0083] ③ Based on the feature distillation method, the two models learn from each other. The smooth L1 loss is used to constrain the latent space features obtained by the two models for the same cigarette pack image to be as similar as possible. The training loss function is the feature distillation loss.

[0084]

[0085] When updating parameters in the edge model, the loss function includes reconstruction loss. and characteristic distillation loss Two parts.

[0086]

[0087] The weighted loss function obtained in step (3.3) The network weights are updated using the SGD optimizer.

[0088] (4) Through the federated learning method of federated parameter averaging, the large model M is aggregated and optimized in the cloud. L The parameters.

[0089] The parameters w of the global model t+1 For each edge end model parameter The weighted average,

[0090]

[0091] Where the weighting coefficient α k The number of cigarette packaging images N(C) trained from different edge ends k )Decide.

[0092]

[0093] The updated model parameters were then distributed to each edge.

[0094] (5) Update the local parameters of each edge using the method described in (3), and summarize the results using the method described in (4) to obtain the global model, which is then used to update the large model. These two steps are repeated alternately until the model parameters converge, and each edge obtains its final model parameters. and

[0095] (6) After the model training is completed, fix the parameters of the small model at the edge and reconstruct all the training samples at the edge. Calculate the reconstruction loss: the mean is denoted as μ and the variance is denoted as σ. Set the threshold of reconstruction error θ = μ + 3σ.

[0096] (7) During the online real-time monitoring stage, a model with a small number of parameters is used to reconstruct the cigarette packaging image to obtain the reconstructed image.

[0097]

[0098] The reconstruction error is calculated as follows:

[0099]

[0100] When the reconstruction error exceeds the set threshold θ, the cigarette packaging is considered defective.

[0101] Table 3 shows the model validation results under different training strategies, and the area under the receiver operating characteristic curve (AUROC) is used to evaluate the model performance. Defect detection experiments were conducted on the following three training strategies: 1) Local training: Each edge initializes its own model and uses only the cigarette image data from that edge for local training; 2) Federated training: A global model is initialized in the cloud and distributed to each edge. Each edge adjusts the model's weights using its own cigarette packaging images, and the adjusted model parameters are uploaded to the cloud for parameter fusion; 3) The method proposed in this invention.

[0102] Table 3. Defect detection results under different training strategies

[0103]

[0104]

[0105] This set of experiments shows that due to differences in shooting angles and background lighting conditions at each edge, the normal modalities of each edge are different, leading to worse results when directly using federated learning algorithms. In each round of parameter updates, if the goal of cloud-edge collaboration is to learn a model with the same parameters for all devices, including the cloud and the edge, it will inevitably cause modal confusion, resulting in federated training results that are even worse than local training results. The method of this invention solves this problem by adding an extra model at the edge and introducing a mutual learning strategy into the local parameter update process, effectively reconstructing normal samples and obtaining more discriminative anomaly scores. While maintaining high accuracy in packet defect detection for edges 2 and 3, edges 1 and 4, which previously performed poorly, showed significant improvements of 2.38% and 4.97% respectively compared to local training.

[0106] In summary, the main design concept of this invention lies in constructing a defect detection dataset based on cigarette packaging image samples obtained from different edge devices during the production process. It also involves building defect detection models of varying sizes and parameters, as well as a global model in the cloud. After initializing the model parameters, the defect detection dataset is used to train the small and large defect detection models by alternately executing a mutual learning strategy and a global parameter update strategy under cloud-edge collaboration. The parameters of the trained small models at each edge device are fixed, and a reconstruction error threshold is obtained. In the actual inference stage, the small models at the edge devices are used to process the appearance image of the cigarette packaging to be tested, obtaining a reconstructed image. Based on the comparison between the reconstruction error of the reconstructed image and the reconstruction error threshold, it is determined whether the cigarette packaging to be tested has appearance defects. This invention combines a cloud-edge collaboration framework, integrating information from different cigarette factories and production lines, breaking down information silos in industrial production. Furthermore, the lightweight model structure is well-suited for real-time packaging appearance defect detection on high-speed cigarette production lines, effectively solving the problem of data distribution differences caused by factors such as different imaging equipment shooting angles, backgrounds, and lighting conditions across different cigarette production lines.

[0107] In this embodiment of the invention, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent the existence of A alone, A and B simultaneously, or B alone. A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects have an "or" relationship. "At least one of the following" and similar expressions refer to any combination of these items, including any combination of singular or plural items. For example, at least one of a, b, and c can represent: a, b, c, a and b, a and c, b and c, or a and b and c, where a, b, and c can be single or multiple.

[0108] The above description of the structure, features, and effects of the present invention is based on the embodiments shown in the figures. However, the above are only preferred embodiments of the present invention. It should be noted that the technical features involved in the above embodiments and their preferred methods can be reasonably combined and matched by those skilled in the art to form a variety of equivalent solutions without departing from or changing the design concept and technical effects of the present invention. Therefore, the present invention is not limited to the scope of implementation shown in the figures. Any changes made in accordance with the concept of the present invention, or modifications to equivalent embodiments, that do not exceed the spirit covered by the specification and figures, should be within the protection scope of the present invention.

Claims

1. A method for detecting cigarette packaging defects based on deep mutual learning in a cloud-edge collaboration scenario, characterized in that, The application comprises the following steps: Based on different edge terminals, a defect detection dataset is constructed in the production process, and a first defect detection model and a second defect detection model based on a deep autoencoder are built on each edge terminal, and a defect detection global model is built in the cloud; wherein the parameter amount of the first defect detection model is greater than that of the second defect detection model; The parameters of the defect detection global model are initialized in the cloud, and the parameters of the first defect detection model are initialized based on the initialized parameters of the global model, and the parameters of the second defect detection model are randomly initialized; The first defect detection model and the second defect detection model are trained using the defect detection dataset and combining a mutual learning strategy; and a global parameter updating strategy in a cloud-edge collaborative scenario is combined to synchronize and alternately cycle: the parameters of the first defect detection model are summarized and optimized in the cloud. The mutual learning strategy specifically comprises: inputting normal cigarette packaging image in the defect detection dataset, using the feature extractor of the first defect detection model and the second defect detection model to extract features respectively, then using the decoder of the first defect detection model and the second defect detection model to obtain the reconstructed cigarette packaging image respectively, and using the first loss to optimize the reconstruction ability of the first defect detection model and the second defect detection model for normal cigarette packaging image samples; based on the feature distillation method, the first defect detection model and the second defect detection model learn from each other, and the second loss is used to constrain the similarity of the hidden space features obtained by the first defect detection model and the second defect detection model for the same cigarette packaging image; wherein the loss function of the first defect detection model and the second defect detection model of the edge terminal includes reconstruction loss and feature distillation loss; After training is completed, the parameters of the second defect detection model of each edge terminal are saved, and a reconstruction error threshold is obtained; Collecting a to-be-tested cigarette packaging appearance image; Processing the to-be-tested cigarette packaging appearance image using the second defect detection model to obtain a reconstructed image; Calculating the reconstruction error of the reconstructed image, and determining whether the to-be-tested cigarette packaging has an appearance defect according to the comparison relationship between the reconstruction error and the reconstruction error threshold.

2. The method according to claim 1, wherein, The obtained reconstruction error threshold comprises: calculating the mean and variance of the reconstruction loss, and fusing the mean and variance to obtain the reconstruction error threshold.

3. The method according to claim 1, wherein, The obtained cigarette packaging image sample comprises: for each edge terminal, an effective region of the cigarette packaging image sample is cropped and obtained by labeling the key region.

4. The method according to claim 1, wherein, The method for building a defect detection model based on a deep autoencoder comprises: an encoder composed of a multi-layer two-dimensional convolution and a decoder composed of a multi-layer two-dimensional deconvolution, which are respectively used to map the input cigarette packaging image to a hidden space feature and restore the cigarette packaging image using the hidden space feature.

5. The method according to claim 1, wherein, The obtained reconstructed image comprises: after the effective region of the to-be-tested cigarette packaging appearance image is cropped and scaled, the effective region of the to-be-tested cigarette packaging image is reconstructed using the second defect detection model.

6. The method according to any one of claims 1-5, wherein, The global parameter updating strategy in the cloud edge collaborative scenario includes: The federated learning method through federated parameter averaging is used to collect and optimize the parameters of the first defect detection model on the cloud, and the parameters of the defect detection global model are used as the weighted average of the parameters of the first defect detection model of each edge, and wherein the weight coefficient is determined by the number of cigarette packaging image samples participating in training by different edges.