Corrugated box prepress proofreading method based on global attention measurement
By building a global attention measurement pre-press calibration neural network, the problem that traditional corrugated carton pre-press calibration process relies on manual operation and is difficult to accurately evaluate printing defects is solved, efficient and accurate automatic detection and positioning are achieved, and printing quality and production efficiency are improved.
Patent Information
- Application Number
- CN202411912708.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-24
- Publication Date
- 2025-04-01
AI Technical Summary
The pre-printing proofreading process of traditional corrugated cartons relies on manual operations, which is time-consuming and labor-intensive and prone to human errors, making it difficult to achieve accurate evaluation and quantitative analysis of printing defects.
The corrugated carton pre-press proofing method based on global attention measurement is adopted. By constructing a global attention measurement pre-press proofing neural network, the encoder with a twin network structure extracts global multi-scale features, and combines the measurement module and the deep supervision module to realize automated detection and positioning of printing defects.
It realizes efficient and accurate automatic detection of defects such as slight deviations, pattern misalignment and color distortion in the printing process of corrugated cartons, significantly improving printing quality and production efficiency.
Smart Images

Figure CN119741286A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of industrial visual inspection, and in particular relates to a corrugated box prepress proofreading method based on global attention measurement. Background Art
[0002] With the booming development of the logistics industry, corrugated boxes have occupied an important position in the packaging industry due to their excellent compression resistance and environmental friendliness. In this context, the printing quality of corrugated boxes not only affects the visual presentation of the product, but is also an important part of the brand image. The production quality of the printing plate, as the core element of printing quality, plays an important role in ensuring the aesthetics and market competitiveness of the final product.
[0003] However, the traditional corrugated box pre-press proofing process mainly relies on manual operation, which is completed by visually comparing the design drawings with the actual printing plates or the first printing samples. This approach is not only time-consuming and labor-intensive, but also prone to human errors. More importantly, it is difficult to achieve accurate evaluation and quantitative analysis of printing defects. Although digital inspection technology has begun to penetrate into the printing field in recent years, helping to improve the accuracy and efficiency of inspection, existing technologies are still unable to cope with the subtle deviations, pattern misalignment and color deviations that are unique to corrugated box printing. This is mainly because these technologies lack an effective comparison mechanism that can fully consider all variables, resulting in their poor performance in identifying and locating subtle defects.
[0004] In view of this, how to develop a method that can efficiently and accurately automatically detect plate production defects in the corrugated box printing process has become an urgent task facing the current printing industry. Summary of the invention
[0005] The main purpose of the present invention is to overcome the shortcomings and deficiencies of the prior art and to provide a corrugated cardboard prepress proofreading method based on global attention measurement, which can effectively capture and quantify defect information such as slight deviations, pattern misalignment and color distortion that may exist in the printing process, and realize automated and efficient detection and positioning of defects in corrugated cardboard printing plate production.
[0006] In order to achieve the above object, the present invention adopts the following technical solutions:
[0007] In a first aspect, the present invention provides a corrugated box prepress proofreading method based on global attention measurement, comprising the following steps:
[0008] Acquire a corrugated box printing image dataset; the dataset includes a printed digital template and actual printed images;
[0009] A global attention metric pre-press proofreading neural network is constructed, and the global attention metric pre-press proofreading neural network includes a global feature extractor, a metric module, and a deep supervision module; the global feature extractor uses an encoder of a twin network structure to automatically extract global multi-scale features from a dual-source input of a printed digital template and an actual printed image; the metric module learns a change map by comparing the embedded feature vectors of the dual-source images, and in this process, a convolutional block attention module is first used to make the features more distinguishable in channels and spaces; the deep supervision module assists the hidden layer in capturing more useful features by adding two deep supervision layers in the feature extractor;
[0010] The global attention metric prepress proofreading neural network is trained to obtain a trained prepress proofreading neural network; the training loss function is the sum of the contrast loss used by the metric module and the dice loss of the deep supervision module, the contrast loss is used to measure the similarity between the distance map and the true value; the dice loss is used to measure the degree of similarity between the predicted map and the true value;
[0011] Based on the trained prepress proofreading neural network, prepress proofreading is performed on the corrugated box printing image to be inspected.
[0012] As a preferred technical solution, the global feature extractor includes two residual networks with shared parameters, each residual network includes one convolution block and three residual blocks with the same structure, and the calculation process of the residual block is expressed as:
[0013] F(x)+x=W 2 σ(W 1 (x))+x
[0014] Among them, W 1 and W 2 represents the weights of the two layers, and σ represents the linear rectification unit function.
[0015] As a preferred technical solution, in the metric module, multi-scale feature fusion is first performed, and the multi-scale features of each branch of the global feature extractor are used to reconstruct paired features, and the channels of each feature are unified to a set size using a convolution layer, and then the size is adjusted to half of the input image using bilinear interpolation; and the features from the same branch are sequentially connected and fed into a convolution block, which consists of two convolution layers, and feature pairs are obtained after reconstruction;
[0016] In the multi-scale fusion process, a convolutional attention module is added to further fuse multi-layer features, wherein the convolutional attention module includes a channel attention submodule and a spatial attention submodule;
[0017] The channel attention submodule captures channel-level global context information through a channel attention map;
[0018] The spatial attention submodule performs average pooling and maximum pooling on the input channel refinement feature F′, compressing the input channel refinement feature F′ into two 1×H×W s The two matrices are concatenated and forwarded to a convolutional layer with a kernel size of k. Finally, the sigmoid function is used to obtain the final spatial attention map Ms(F′).
[0019] The channel submodule and the spatial submodule are passed to the convolutional attention module in sequence to obtain a more discriminative feature F″; this process is expressed as:
[0020]
[0021]
[0022] Then, the Euclidean distance graph Dist is calculated based on the improved feature pairs. The formula is as follows:
[0023]
[0024] Among them, F T1 and F T2 They represent the feature maps T1 and T2 refined by the convolutional attention block respectively;
[0025] In the training phase, the distance map Dist is compared with the true value of the distance map calculated from the manually annotated image to obtain the contrast loss for optimization. In the prediction phase, a simple threshold segmentation is performed on the distance map to obtain a change map.
[0026] As a preferred technical solution, the global context information is calculated by the following formula:
[0027] M c (F) = σ(MLP r (AvgPool(F))+MLP r (MaxPool(F)))
[0028] F represents the input feature of size C×H×W, and two aggregate vectors of size C×1×1 are generated by using the average pooling layer and the maximum pooling layer on the input feature; then a weight-sharing multi-layer perception MLP module with a channel reduction ratio r is applied to each vector to assign weights to each channel; the MLP layer contains two 1×1 convolutional layers, which are connected by a ReLU layer; the channel attention map M is obtained by using the element sum of the above two aggregate vectors and a sigmoid function σ c (F); Finally, the original feature is multiplied with the channel attention map to obtain the channel refined feature F′;
[0029] The spatial attention map M s(F') is calculated by the following formula:
[0030] M s (F′)=σ(f (k×k) (AvgPool(F′); MaxPool(F′)))
[0031] Among them, f (k×k) (x) represents a convolutional layer with a kernel size of k×k.
[0032] As a preferred technical solution, the deep supervision module introduces a deep supervision network. For a common deep convolutional network with a total of M layers, the weights of all layers are expressed as W = {W (1) ,...,W (M-1)}, the output layer weight is w (out) , the objective function of the deep supervision network is:
[0033] P(W)=L(W,w (out) )
[0034] Among them, L(W,w (out) ) is composed of w (out) The total loss determined by , which depends on the weights W of each layer;
[0035] Now apply M-1 classifiers to all hidden layers to obtain additional outputs for deep supervision, and then write the weights of the classifiers as w = {w(1), ..., w(M-1)}; the accompanying objective function of the hidden layer is:
[0036]
[0037] Where m represents the hidden layer, l(W,w (m) ) represents the adjoint loss of the mth hidden layer, α m Provide weight to it.
[0038] Different from the overall loss, each accompanying loss l(W,w (m) ) (m) It depends on the mth hidden layer and the previous hidden layer; finally, the objective function of the deep supervision module is defined as:
[0039] F(W)=P(W)+Q(W).
[0040] As a preferred technical solution, the deep supervision module only adds two DS layers to the second and third layer features of the global feature extractor. Each deep supervision layer contains two 3×3 deconvolution layers and a sigmoid layer. The deconvolution layer is used to upsample the feature map to the size of the input image, and the sigmoid layer is used to obtain the probability distribution of each pixel category. In order to screen more effective change information for supervision and learning during the training process, the absolute difference between the features selected by each branch at the same level is forwarded to the deep supervision layer. The outputs of these supervision layers are used together with the output of the metric module for supervision parameter optimization, so that the hidden layer has better feature learning ability.
[0041] As a preferred technical solution, the contrast loss of the metric module is expressed as follows:
[0042]
[0043] In the formula, Represents the distance graph value at point (i, j); y i,j represents the value of the label map at point (i, j), and M is the size of the distance map. 0 means unchanged, 1 means changed, and m is the margin for filtering out pixel pairs whose distance is greater than this value;
[0044] The loss of the deep supervision module is expressed as follows:
[0045]
[0046] Among them, N represents the total number of input training image pairs, and n represents the nth input image pair.
[0047] In a second aspect, the present invention provides a corrugated carton prepress proofreading system based on global attention metric, which is applied to the corrugated carton prepress proofreading method based on global attention metric, including a data acquisition module, a network construction module, a network training module and a proofreading module;
[0048] The data acquisition module is used to acquire a corrugated box printing image data set; the data set includes a printing digital template and an actual printing image;
[0049] The network construction module is used to construct a global attention metric pre-press proofreading neural network, and the global attention metric pre-press proofreading neural network includes a global feature extractor, a metric module and a deep supervision module; the global feature extractor uses an encoder of a twin network structure to automatically extract global multi-scale features from a dual-source input of a printed digital template and an actual printed image; the metric module learns a change map by comparing the embedded feature vectors of the dual-source images, and in this process, a convolutional block attention module is first used to make the features more distinguishable in channels and spaces; the deep supervision module assists the hidden layer in capturing more useful features by adding two deep supervision layers in the feature extractor;
[0050] The network training module is used to train the global attention metric prepress proofreading neural network to obtain a trained prepress proofreading neural network; the training loss function is the sum of the contrast loss used by the metric module and the dice loss of the deep supervision module, the contrast loss is used to measure the similarity between the distance map and the true value; the dice loss is used to measure the similarity between the predicted map and the true value;
[0051] The proofreading module is used to perform pre-press proofreading on the corrugated box printing image to be detected based on the trained pre-press proofreading neural network.
[0052] In a third aspect, the present invention provides an electronic device, the electronic device comprising:
[0053] at least one processor; and,
[0054] a memory communicatively connected to the at least one processor; wherein,
[0055] The memory stores computer program instructions that can be executed by the at least one processor, and the computer program instructions are executed by the at least one processor to enable the at least one processor to execute the corrugated box prepress proofreading method based on global attention measurement.
[0056] In a fourth aspect, the present invention provides a computer-readable storage medium storing a program, which, when executed by a processor, implements the corrugated box prepress proofreading method based on global attention metric.
[0057] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0058] By innovatively applying the global attention measurement algorithm, an in-depth comparative analysis of the digital design drawings and actual printed images of corrugated cardboard printing is carried out to accurately and efficiently discover and locate potential defects in plate production, thereby significantly improving the printing quality and production efficiency of corrugated cardboard boxes, and meeting the urgent needs of the modern packaging industry for high-quality and high-efficiency production. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0060] Figure 1 This is a general scheme diagram of the corrugated box prepress proofreading method using global attention measurement in an implementation method.
[0061] Figure 2 Schematic diagram of the original block of the convolutional network in the implementation method.
[0062] Figure 3 Schematic diagram of residual block in an implementation method.
[0063] Figure 4 Schematic diagram of the residual network connected through 1×1 convolution in an implementation method.
[0064] Figure 5 Schematic diagram of the overall architecture of the convolutional attention module in the implementation method.
[0065] Figure 6 Schematic diagram of the channel attention submodule in the implementation method.
[0066] Figure 7 Schematic diagram of the spatial attention submodule in an implementation method.
[0067] Figure 8 The present invention is a block diagram of a corrugated box prepress proofreading system based on global attention measurement according to an embodiment of the present invention.
[0068] Fig. 9 4 is a structural diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0069] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present application.
[0070] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described in this application may be combined with other embodiments.
[0071] like Figure 1 As shown, the present embodiment provides a corrugated box prepress proofreading method based on global attention measurement, comprising the following steps:
[0072] S1. Obtain a corrugated box printing image dataset; the dataset includes a printing digital template and actual printing images.
[0073] S2. Construct a global attention metric pre-press proofreading neural network, which includes a global feature extractor, a metric module and a deep supervision module; the global feature extractor uses an encoder with a twin network structure to automatically extract global multi-scale features from the dual-source inputs of the printed digital template and the actual printed image; the metric module learns the change map by comparing the embedded feature vectors of the dual-source images. In this process, the convolutional block attention module is first used to make the features more distinguishable in channels and space; the deep supervision module assists the hidden layer in capturing more useful features by adding two deep supervision layers in the feature extractor.
[0074] In a specific embodiment, the encoder of the global feature extractor adopts a twin architecture design, including two weight-sharing branches to efficiently extract features from a dual-source image pair. Figure 2 As shown, the encoder constructs a two-layer stacked original block structure, and its output formula is expressed as:
[0075] F(x)=W 2 σ(W 1 (x)) (1)
[0076] Where W 1 and W 2 They represent the weights of the two layers respectively, and σ is the rectified linear unit (ReLU) function.
[0077] When the original block is expected to achieve an identity mapping, i.e. f(x) = x, fine tuning of the parameters is required. However, it may be difficult to directly learn nonlinear mappings. To this end, the present invention draws on the residual block design concept in ResNet. Figure 3 As shown in Figure 1, feature shortcut connections are used to directly transfer the input signal x to the output, thereby simplifying the learning process. The output form of the residual block is as follows:
[0078] F(x)+x=W 2 σ(W 1 (x))+x (2)
[0079] After removing the initial global pooling layer and the fully connected layer, a ResNet variant with 18 layers is obtained. The feature extractor consists of five stages. First, a convolutional layer with a kernel size of 7×7 is used to extract low-level features from the input image; followed by a batch normalization layer and ReLU. In order to avoid the smoothing effect of the convolution operation and increase the receptive field, a max-pooling layer with a stride of 2 is used to resize the features to half the size of the input image. The remaining four stages consist of four basic blocks, each of which consists of two layers. The basic blocks also have two forms, such as Figure 4 As shown in the figure: One is to pass the initial input x, which is the same as formula (2). The other is to use a 1×1 convolutional layer to increase the dimension and downsample. At this time, the output of the residual block is expressed as:
[0080] Furthermore, by modifying the initial ResNet-18 model, removing the global pooling layer and the fully connected layer, a ResNet variant with 18 layers of depth was constructed as a feature extractor. The feature extractor consists of five stages:
[0081] First, the input image is processed with a 7×7 convolution kernel to extract the underlying features; then the batch normalization layer and the ReLU activation function are used to enhance the feature expression capability. In order to expand the receptive field and avoid over-smoothing, we set the max-pooling layer with a stride of 2 to halve the feature map size to half of the input image.
[0082] The next four stages each contain two basic blocks, and the layers in each stage are connected to each other through two different types of basic blocks. Figure 4 As shown in Figure 2, one type is to keep the initial input x directly propagated through the shortcut connection, and its calculation method is the same as formula (2); the other type is to increase the dimension or downsample the operation by introducing a 1×1 convolution layer. At this time, the output of the residual block is updated as:
[0083] F(x)+x=W 2 σ(W 1 (x))+W s x (3)
[0084] Among them, W s is the weight of the 1×1 layer.
[0085] It is worth noting that the stride of the first two basic blocks is set to 2, which means that the spatial size of the feature map will be halved; while the stride of the last two basic blocks is 1, so that the final feature map size is consistent with the input image. The basic block depths corresponding to the four stages increase in sequence, namely 64, 128, 256, and 512 channels.
[0086] The feature extractor generates four feature maps at different levels: feat1, feat2, feat3 and feat4, where the size of feat4 is 1 / 8 of the original input image, while the other three intermediate feature maps (feat1, feat2, feat3) retain detailed information at different scales. These intermediate results are used by subsequent modules for further analysis and processing.
[0087] In a specific embodiment, the metric module learns the change map by comparing the embedded feature vectors of the dual source images. The metric module first performs multi-scale feature fusion and reconstructs the paired features using the multi-scale features of each branch of the feature extractor. The channels of each feature are first unified to 96 using a 1×1 convolution layer, and then resized to half of the input image using bilinear interpolation. Features from the same branch are sequentially concatenated and fed into a convolution block, which consists of two convolution layers with convolution kernel sizes of 3 and 1, respectively. After reconstruction, feature pairs with a channel size of 64 are obtained.
[0088] In the above process, a convolutional attention module is added to further fuse multi-layer features, such as Figure 5 As shown, the convolutional attention module consists of two submodules, the channel attention submodule ( Figure 6 ) and the spatial attention submodule ( Figure 7 ), to help strengthen the useful information in the extracted features in different dimensions. The channel attention submodule aims to capture the global context information at the channel level through the channel attention map, which can be calculated using the following formula:
[0089] M c (F) = σ(MLP r (AvgPool(F))+MLP r (MaxPool(F))). (4)
[0090] F represents the input features of size C×H×W, on which the average pooling layer and the maximum pooling layer are used to generate two aggregate vectors of size C×1×1. Then, a weight-sharing multi-layer perception (MLP) module with a channel reduction ratio r is applied to each vector to assign weights to each channel. The MLP layer contains two 1×1 convolutional layers; the first method reduces the channels of the input features by a factor of r, while the latter restores the number of channels to the same size as the original input. The two layers are connected by a ReLU layer. The channel attention map M is obtained by the element-wise sum of the above two vectors and a sigmoid function σ. c (F). Finally, the original feature is multiplied with the channel attention map to obtain the channel refined feature F′.
[0091] Similarly, the spatial attention submodule also uses average pooling (AvgPool) and maximum pooling (MaxPool) in the first step to compress the input channel refinement feature F′ into two 1×H×W s The matrix of is connected together and forwarded to a convolutional layer with a kernel size of k. Finally, the sigmoid function is used to obtain the final spatial attention map Ms(F). The formula can be expressed as:
[0092] M s (F′)=σ(f (k×k) (AvgPool(F′); MaxPool(F′))). (5)
[0093] The channel submodule and the spatial submodule are passed to the convolutional attention module in sequence to obtain a more discriminative feature F″. This process can be expressed as:
[0094]
[0095]
[0096] Then, the Euclidean distance graph Dist is calculated based on the improved feature pairs. The formula is as follows:
[0097]
[0098] Among them, F T1 and F T2 They represent the feature maps T1 and T2 refined by the convolutional attention block, respectively.
[0099] In the training phase, the distance map Dist is compared with the true value to obtain the contrast loss for optimization, while in the prediction phase, a simple threshold segmentation is performed on the distance map to obtain the change map.
[0100] In a specific example, the deep supervision module introduces a deep supervision network. Specifically, for a common deep convolutional network with a total of M layers, we can express the weights of all layers as W = {W (1) ,...,W (M-1)}, the output layer weight is w (out) The objective function of this network is:
[0101] P(W)=L(W,w (out) ) (9)
[0102] Among them, L(W,w (out) ) is composed of w (out) The total loss is determined by the weights W of each layer.
[0103] Now apply M-1 classifiers to all hidden layers to obtain additional outputs for deep supervision, and then write the weights of the classifiers as w = {w(1), ..., w(M-1)}. The accompanying objective function of the hidden layer is
[0104]
[0105] Where m represents the hidden layer, l(W,w (m) ) represents the adjoint loss of the mth hidden layer, α m Provide weight to it.
[0106] Different from the overall loss, each accompanying loss l(W,w (m) ) (m) It depends on the mth hidden layer and the previous hidden layer. Finally, the objective function of the deep supervision module can be defined as:
[0107] F(W)=P(W)+Q(W) (11)
[0108] Considering computational efficiency, the deep supervision module is only used in the second and third layers of the feature extractor ( Figure 2 Only two DS layers are added to the deep supervision layer (referred to as feature 1 and feature 2 in ). Considering the characteristics of hierarchical features, these two intermediate features have rich spatial and semantic information and are more suitable for selection for supervision. Each deep supervision layer contains two 3×3 deconvolution layers for upsampling the feature map to the size of the input image, and a sigmoid layer for obtaining the probability distribution of each pixel category. In order to filter more effective change information for supervision and learning during training, the absolute difference between the features selected by each branch at the same level is forwarded to the deep supervision layer. The outputs of these supervision layers are used together with the output of the metric model to supervise parameter optimization, so that the hidden layer has better feature learning ability.
[0109] S3. Train the global attention metric prepress proofreading neural network to obtain a trained prepress proofreading neural network; the training loss function is the sum of the contrast loss used by the measurement module and the dice loss of the deep supervision module, and the contrast loss is used to measure the similarity between the distance map and the true value; the dice loss is used to measure the degree of similarity between the predicted map and the true value.
[0110] The metric module uses contrast loss to measure the similarity between the distance map and the true value. This method is usually applied to paired data in the twin network. BCL (X n ,Y n )) can be expressed as:
[0111]
[0112] In the formula, Represents the distance graph value at point (i, j); y i,j represents the value of the label map at point (i, j), and M is the size of the distance map. Among them, 0 means unchanged, 1 means changed, and m is the margin for filtering out pixel pairs whose distance is greater than this value.
[0113] From the formula, we can see that the loss of the unchanged pixel pair (y=0) depends on the distance d between the pixel pairs. i,j The larger the d i,j It will cause a larger loss at (i, j), which helps to reduce the distance between unchanged samples. For the changed pixel pair (y = 1), a similar strategy is used to increase the distance between changed samples. Contrastive loss can well express the matching degree of paired samples, which is very helpful for achieving accurate change extraction.
[0114] Under the influence of change detection class imbalance, the training direction of the model will be dominated by most of the "unchanged" pixels, ignoring the minority of "changed" information, resulting in low model efficiency. Dice loss is used in the supervision module to overcome class imbalance; this method uses the dice coefficient to measure the degree of similarity between the predicted image and the true value, ranging from 0 to 1. The objective function in the deep supervision module can be expressed as follows:
[0115]
[0116] in ^y and yy represent the prediction map and target label respectively.
[0117] Finally, the objective function of the network is:
[0118] L(X n ,Y n )=LBCL (X n ,Y n )+λL Dice (X n ,Y n ) (14)
[0119] where λ is a factor used to adjust the influence of the deep supervision module.
[0120] S4. Perform prepress proofreading on the corrugated box printing image to be inspected based on the trained prepress proofreading neural network.
[0121] It should be noted that, for the sake of convenience, the aforementioned method embodiments are all expressed as a series of action combinations, but those skilled in the art should know that the present invention is not limited to the described order of actions, because according to the present invention, certain steps can be performed in other orders or simultaneously.
[0122] Based on the same idea as the corrugated carton prepress proofreading method based on global attention metric in the above-mentioned embodiment, the present invention also provides a corrugated carton prepress proofreading system based on global attention metric, which can be used to execute the above-mentioned corrugated carton prepress proofreading method based on global attention metric. For ease of explanation, the structural schematic diagram of the embodiment of the corrugated carton prepress proofreading system based on global attention metric only shows the parts related to the embodiment of the present invention. Those skilled in the art can understand that the illustrated structure does not constitute a limitation on the device, and may include more or fewer components than shown in the diagram, or combine certain components, or arrange the components differently.
[0123] See also Figure 8 In another embodiment of the present application, a corrugated box prepress proofreading system 100 based on global attention measurement is provided, the system comprising a data acquisition module 101, a network construction module 102, a network training module 103 and a proofreading module 104;
[0124] The data acquisition module 101 is used to acquire a corrugated box printing image dataset; the dataset includes a printing digital template and an actual printing image;
[0125] The network construction module 102 is used to construct a global attention metric pre-press proofreading neural network, which includes a global feature extractor, a metric module and a deep supervision module; the global feature extractor uses an encoder of a twin network structure to automatically extract global multi-scale features from the dual-source input of the printed digital template and the actual printed image; the metric module learns the change map by comparing the embedded feature vectors of the dual-source images. In this process, a convolutional block attention module is first used to make the features more distinguishable in channels and spaces; the deep supervision module assists the hidden layer in capturing more useful features by adding two deep supervision layers in the feature extractor;
[0126] The network training module 103 is used to train the global attention metric prepress proofreading neural network to obtain a trained prepress proofreading neural network; the training loss function is the sum of the contrast loss used by the metric module and the dice loss of the deep supervision module, the contrast loss is used to measure the similarity between the distance map and the true value; the dice loss is used to measure the degree of similarity between the predicted map and the true value;
[0127] The proofreading module 104 is used to perform pre-press proofreading on the corrugated box printing image to be inspected based on the trained pre-press proofreading neural network.
[0128] It should be noted that the corrugated cardboard prepress proofreading system based on global attention measurement of the present invention corresponds one to one with the corrugated cardboard prepress proofreading method based on global attention measurement of the present invention. The technical features and beneficial effects described in the above-mentioned embodiment of the corrugated cardboard prepress proofreading method based on global attention measurement are applicable to the embodiment of the corrugated cardboard prepress proofreading method based on global attention measurement. For specific contents, please refer to the description in the embodiment of the method of the present invention, which will not be repeated here. This is hereby declared.
[0129] In addition, in the implementation of the corrugated cardboard prepress proofreading system based on global attention measurement in the above-mentioned embodiment, the logical division of each program module is only an example. In actual applications, the above-mentioned functions can be assigned to different program modules as needed, for example, for the convenience of corresponding hardware configuration requirements or software implementation. That is, the internal structure of the corrugated cardboard prepress proofreading system based on global attention measurement is divided into different program modules to complete all or part of the functions described above.
[0130] See also Fig. 9In one embodiment, an electronic device for implementing a corrugated box prepress proofreading method based on global attention metric is provided. The electronic device 200 may include a first processor 201, a first memory 202 and a bus, and may also include a computer program stored in the first memory 202 and executable on the first processor 201, such as a corrugated box prepress proofreading program 203 based on global attention metric.
[0131] Among them, the first memory 202 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, mobile hard disk, multimedia card, card-type memory (for example: SD or DX memory, etc.), magnetic memory, disk, optical disk, etc. In some embodiments, the first memory 202 can be an internal storage unit of the electronic device 200, such as a mobile hard disk of the electronic device 200. In other embodiments, the first memory 202 can also be an external storage device of the electronic device 200, such as a plug-in mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (SecureDigital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device 200. Further, the first memory 202 can also include both an internal storage unit of the electronic device 200 and an external storage device. The first memory 202 can not only be used to store application software and various types of data installed in the electronic device 200, such as the code of the corrugated box prepress proofreading program 203 based on global attention measurement, but also can be used to temporarily store data that has been output or is to be output.
[0132] In some embodiments, the first processor 201 may be composed of an integrated circuit, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and combinations of various control chips, etc. The first processor 201 is the control core (Control Unit) of the electronic device, and uses various interfaces and lines to connect various components of the entire electronic device, and executes various functions and processes data of the electronic device 200 by running or executing programs or modules stored in the first memory 202, and calling data stored in the first memory 202.
[0133] Fig. 9 Only an electronic device with components is shown, and those skilled in the art will understand that Fig. 9The structure shown does not constitute a limitation on the electronic device 200 , and may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.
[0134] The corrugated box prepress proofreading program 203 based on global attention metric stored in the first memory 202 of the electronic device 200 is a combination of multiple instructions, which can achieve the following when executed in the first processor 201:
[0135] Acquire a corrugated box printing image dataset; the dataset includes a printed digital template and actual printed images;
[0136] A global attention metric pre-press proofreading neural network is constructed, and the global attention metric pre-press proofreading neural network includes a global feature extractor, a metric module, and a deep supervision module; the global feature extractor uses an encoder of a twin network structure to automatically extract global multi-scale features from a dual-source input of a printed digital template and an actual printed image; the metric module learns a change map by comparing the embedded feature vectors of the dual-source images, and in this process, a convolutional block attention module is first used to make the features more distinguishable in channels and spaces; the deep supervision module assists the hidden layer in capturing more useful features by adding two deep supervision layers in the feature extractor;
[0137] The global attention metric prepress proofreading neural network is trained to obtain a trained prepress proofreading neural network; the training loss function is the sum of the contrast loss used by the metric module and the dice loss of the deep supervision module, the contrast loss is used to measure the similarity between the distance map and the true value; the dice loss is used to measure the degree of similarity between the predicted map and the true value;
[0138] Based on the trained prepress proofreading neural network, prepress proofreading is performed on the corrugated box printing image to be inspected.
[0139] Furthermore, if the module / unit integrated in the electronic device 200 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a non-volatile computer-readable storage medium. The computer-readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a mobile hard disk, a magnetic disk, an optical disk, a computer memory, and a read-only memory (ROM).
[0140] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the program can be stored in a non-volatile computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0141] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0142] The above embodiments are preferred implementation modes of the present invention, but the implementation modes of the present invention are not limited to the above embodiments. Any other changes, modifications, substitutions, combinations, and simplifications that do not deviate from the spirit and principles of the present invention should be equivalent replacement methods and are included in the protection scope of the present invention.
Claims
1. A corrugated box prepress proofreading method based on global attention measurement, characterized in that: The steps include: Acquire a corrugated box printing image dataset; the dataset includes a printed digital template and actual printed images; A global attention metric pre-press proofreading neural network is constructed, and the global attention metric pre-press proofreading neural network includes a global feature extractor, a metric module, and a deep supervision module; the global feature extractor uses an encoder of a twin network structure to automatically extract global multi-scale features from a dual-source input of a printed digital template and an actual printed image; the metric module learns a change map by comparing the embedded feature vectors of the dual-source images, and in this process, a convolutional block attention module is first used to make the features more distinguishable in channels and spaces; the deep supervision module assists the hidden layer in capturing more useful features by adding two deep supervision layers in the feature extractor; The global attention metric prepress proofreading neural network is trained to obtain a trained prepress proofreading neural network; the training loss function is the sum of the contrast loss used by the metric module and the dice loss of the deep supervision module, the contrast loss is used to measure the similarity between the distance map and the true value; the dice loss is used to measure the degree of similarity between the predicted map and the true value; Based on the trained prepress proofreading neural network, prepress proofreading is performed on the corrugated box printing image to be inspected.
2. The corrugated box prepress proofreading method based on global attention measurement according to claim 1, characterized in that: The global feature extractor includes two residual networks with shared parameters. Each residual network includes one convolution block and three residual blocks with the same structure. The calculation process of the residual block is expressed as: F(x)+x=W2σ(W1(x))+x Among them, W1 and W2 represent the weights of the two layers, and σ represents the linear correction unit function.
3. The corrugated box prepress proofreading method based on global attention measurement according to claim 1, characterized in that: In the metric module, multi-scale feature fusion is first performed, and paired features are reconstructed using multi-scale features of each branch of the global feature extractor. The channels of each feature are unified to a set size using a convolutional layer, and then their size is adjusted to half of the input image using bilinear interpolation; and the features from the same branch are sequentially connected and fed into a convolutional block, which consists of two convolutional layers, and feature pairs are obtained after reconstruction; In the multi-scale fusion process, a convolutional attention module is added to further fuse multi-layer features, wherein the convolutional attention module includes a channel attention submodule and a spatial attention submodule; The channel attention submodule captures channel-level global context information through a channel attention map; The spatial attention submodule performs average pooling and maximum pooling on the input channel refinement feature F′, compressing the input channel refinement feature F′ into two 1×H×W s The two matrices are concatenated and forwarded to a convolutional layer with a kernel size of k. Finally, the sigmoid function is used to obtain the final spatial attention map Ms(F′). The channel submodule and the spatial submodule are passed to the convolutional attention module in sequence to obtain a more discriminative feature F″; this process is expressed as: Then, the Euclidean distance graph Dist is calculated based on the improved feature pairs. The formula is as follows: Among them, F T1 and F T2 They represent the feature maps T1 and T2 refined by the convolutional attention block respectively; In the training phase, the distance map Dist is compared with the true value of the distance map calculated from the manually annotated image to obtain the contrast loss for optimization. In the prediction phase, a simple threshold segmentation is performed on the distance map to obtain a change map.
4. The corrugated box prepress proofreading method based on global attention measurement according to claim 3 is characterized in that: The global context information is calculated by the following formula: M c (F)=σ(MLPr(AvgPool(F))+MLPr(MaxPool(F))) F represents the input feature of size C×H×W, and two aggregate vectors of size C×1×1 are generated by using the average pooling layer and the maximum pooling layer on the input feature; then a weight-sharing multi-layer perception MLP module with a channel reduction ratio r is applied to each vector to assign weights to each channel; the MLP layer contains two 1×1 convolutional layers, which are connected by a ReLU layer; the channel attention map M is obtained by using the element sum of the above two aggregate vectors and a sigmoid function σ c (F); Finally, the original feature is multiplied with the channel attention map to obtain the channel refined feature F′; The spatial attention map M s (F) is calculated by the following formula: M s (F)=σ(f (k×k) (AvgPool(F);MaxPool(F))) Among them, f (k×k) (x) represents a convolutional layer with a kernel size of k×k.
5. The corrugated box prepress proofreading method based on global attention measurement according to claim 1, characterized in that: The deep supervision module introduces a deep supervision network. For a common deep convolutional network with M layers, the weights of all layers are expressed as W = {W (1) ,...,W (M-1) }, the output layer weight is w (out) , the objective function of the deep supervision network is: P(W)=L(W,w (out) ) Among them, L(W,w (out) ) is composed of w (out) The total loss determined by , which depends on the weights W of each layer; Now apply M-1 classifiers to all hidden layers to obtain additional outputs for deep supervision, and then write the weights of the classifiers as w = {w(1), ..., w(M-1)}; the accompanying objective function of the hidden layer is: Where m represents the hidden layer, represents the adjoint loss of the mth hidden layer, α m Provide weight to it; Unlike the overall loss, each incidental loss w in (m) It depends on the mth hidden layer and the previous hidden layer; finally, the objective function of the deep supervision module is defined as: F(W)=P(W)+Q(W).
6. The corrugated box prepress proofreading method based on global attention metric according to claim 5, characterized in that: The deep supervision module only adds two DS layers on the second and third layer features of the global feature extractor. Each deep supervision layer contains two 3×3 deconvolution layers and a sigmoid layer. The deconvolution layer is used to upsample the feature map to the size of the input image, and the sigmoid layer is used to obtain the probability distribution of each pixel category. In order to screen more effective change information for supervision and learning during training, the absolute difference between the features selected by each branch at the same level is forwarded to the deep supervision layer. The outputs of these supervision layers are used together with the output of the metric module for supervised parameter optimization, so that the hidden layer has better feature learning ability.
7. The corrugated box prepress proofreading method based on global attention measurement according to claim 1, characterized in that: The contrast loss of the metric module is expressed as follows: In the formula, Represents the distance graph value at point (i, j); y i,j represents the value of the label map at point (i, j), and M is the size of the distance map; where 0 means unchanged, 1 means changed, and m is the margin for filtering out pixel pairs whose distance is greater than this value; The loss of the deep supervision module is expressed as follows: Among them, N represents the total number of input training image pairs, and n represents the nth input image pair.
8. A corrugated box prepress proofreading system based on global attention measurement, characterized in that: A corrugated box prepress proofreading method based on global attention measurement applied to any one of claims 1-7, comprising a data acquisition module, a network construction module, a network training module and a proofreading module; The data acquisition module is used to acquire a corrugated box printing image data set; the data set includes a printing digital template and an actual printing image; The network construction module is used to construct a global attention metric pre-press proofreading neural network, and the global attention metric pre-press proofreading neural network includes a global feature extractor, a metric module and a deep supervision module; the global feature extractor uses an encoder of a twin network structure to automatically extract global multi-scale features from a dual-source input of a printed digital template and an actual printed image; the metric module learns a change map by comparing the embedded feature vectors of the dual-source images, and in this process, a convolutional block attention module is first used to make the features more distinguishable in channels and spaces; the deep supervision module assists the hidden layer in capturing more useful features by adding two deep supervision layers in the feature extractor; The network training module is used to train the global attention metric prepress proofreading neural network to obtain a trained prepress proofreading neural network; the training loss function is the sum of the contrast loss used by the metric module and the dice loss of the deep supervision module, the contrast loss is used to measure the similarity between the distance map and the true value; the dice loss is used to measure the similarity between the predicted map and the true value; The proofreading module is used to perform pre-press proofreading on the corrugated box printing image to be detected based on the trained pre-press proofreading neural network.
9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores computer program instructions that can be executed by the at least one processor, and the computer program instructions are executed by the at least one processor so that the at least one processor can execute the corrugated box prepress proofreading method based on global attention metric as described in any one of claims 1-7.
10. A computer-readable storage medium storing a program, characterized in that: When the program is executed by the processor, the corrugated box prepress proofreading method based on global attention measurement described in any one of claims 1 to 7 is implemented.