Mold cleaning effect inspection method based on sample dimension weighting of pre-detection weights
Through the sample dimension weighting method of convolutional neural network and deep residual network, the automated inspection of mold cleaning effect is realized, which solves the problem of tedious manual inspection, improves the accuracy and efficiency of inspection, and is suitable for complex shape molds.
Patent Information
- Application Number
- CN202011519124.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-21
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2040-12-21
AI Technical Summary
The existing mold cleaning effect mainly relies on manual inspection, which is cumbersome and inefficient, affecting the accuracy of the cleaning effect.
The sample dimension weighting method based on convolutional neural network is used to extract and weight features of the mold cleaning effect image through pre-detection weights. The deep residual network is used to improve the classification accuracy and model generalization ability, and realize automated cleaning effect inspection.
It improves the accuracy and efficiency of mold cleaning effect inspection, reduces manual intervention, can be applied to molds of various shapes, and enhances the generalization ability of detection.
Smart Images

Figure CN112529093B
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence, and more specifically, to a mold cleaning effect inspection method based on sample dimension weighting of pre-detection weights, a mold cleaning effect inspection system and electronic equipment based on sample dimension weighting of pre-detection weights. Background Art
[0002] Molds are various molds and tools used in industrial production to obtain the desired products by injection molding, blow molding, extrusion, die casting or forging molding, smelting, stamping and other methods. In short, molds are tools used to make molded objects. This tool is composed of various parts, and different molds are composed of different parts. At present, molds need to be cleaned by cleaning equipment after use, and the cleaning effect of the cleaning equipment will also affect the subsequent use of the mold.
[0003] However, the current cleaning effect of the mold is basically inspected manually, which is not only cumbersome but also affects the inspection effect.
[0004] Therefore, a technical solution that can be used to test the cleaning effect of molds is desired.
[0005] At present, deep learning and neural networks have been widely used in computer vision, natural language processing, text signal processing and other fields. In addition, deep learning and neural networks have also shown a level close to or even beyond that of humans in image classification, object detection, semantic segmentation, text translation and other fields.
[0006] In recent years, the development of deep learning and neural networks has provided new solutions and solutions for mold cleaning effect inspection. Summary of the invention
[0007] In order to solve the above technical problems, the present application is proposed. The embodiments of the present application provide a mold cleaning effect inspection method based on sample dimension weighting of pre-detection weights, a mold cleaning effect inspection system and electronic device based on sample dimension weighting of pre-detection weights, which learns the contribution value of the feature map of each angle to the final classification result based on a convolutional neural network, and then uses it as a weight to weight each feature map, so as to improve the accuracy of the final classification and improve the generalization ability of the model.
[0008] According to one aspect of the present application, a mold cleaning effect inspection method based on sample dimension weighting of pre-detection weights is provided, which includes:
[0009] The training phase includes:
[0010] Acquire images of the cleaned mold taken at multiple angles as multiple training images;
[0011] Inputting the plurality of training images into a pre-detection convolutional neural network to obtain a plurality of first training feature maps corresponding to the plurality of training images;
[0012] For the plurality of first training feature maps, performing global average pooling on each of the first training feature maps to obtain a feature value corresponding to each of the first training feature maps, so as to obtain a plurality of feature values as sample weighting weights;
[0013] Inputting the plurality of training images into a convolutional neural network to obtain a plurality of second training feature maps corresponding to the plurality of training images;
[0014] Weighting the plurality of second training feature maps with the sample weighting weights to obtain a training classification feature map;
[0015] Passing the training classification feature map through a classifier to obtain a classification loss function value; and
[0016] Updating parameters of the convolutional neural network and the classifier based on the classification loss function value; and
[0017] The inference phase includes:
[0018] Acquire multiple images of the cleaned mold to be inspected taken at multiple angles;
[0019] Inputting the plurality of images to be detected into the pre-detection convolutional neural network to obtain a plurality of first feature maps corresponding to the plurality of images to be detected;
[0020] For the plurality of first feature maps, performing global average pooling on each of the first feature maps to obtain a feature value corresponding to each of the first feature maps, so as to obtain a plurality of feature values as sample weighting weights;
[0021] Inputting the plurality of images to be detected into the convolutional neural network to obtain a plurality of second feature maps corresponding to the plurality of images to be detected;
[0022] Weighting the plurality of second feature maps with the sample weighting weight to obtain a classification feature map; and
[0023] The classification feature graph is passed through the classifier to obtain a classification result, and the classification result is used to indicate whether the cleaning effect of the cleaned mold to be inspected is qualified.
[0024] In the above-mentioned sample dimension weighted mold cleaning effect inspection method based on pre-detection weights, the parameters of the convolutional neural network and the classifier are updated based on the classification loss function value, including: updating the parameters of the convolutional neural network, the classifier and the pre-detection convolutional neural network based on the classification loss function value.
[0025] In the above-mentioned mold cleaning effect inspection method based on sample dimension weighting of pre-detection weights, the training classification feature map is passed through a classifier to obtain a classification loss function value, including: passing the training classification feature map through one or more fully connected layers to obtain a training classification feature vector; inputting the training classification feature vector into a classification function to obtain a classification result; and inputting the difference between the classification result and the true value into a loss function to obtain the classification loss function value.
[0026] In the above-mentioned mold cleaning effect inspection method based on sample dimension weighting of pre-detection weights, for the multiple first feature maps, each of the first feature maps is globally averaged and pooled to obtain a feature value corresponding to each of the first feature maps, so as to obtain multiple feature values as sample weighting weights, including: arranging the multiple feature values in the order of the shooting angles corresponding to the multiple images to be detected to obtain the sample weighting weights; wherein, weighting the multiple second feature maps with the sample weighting weights to obtain a classification feature map includes: arranging the multiple second feature maps in the order of the shooting angles corresponding to the multiple images to be detected; and calculating the weighted sum of the multiple second feature maps with the sample weighting weights in a consistent order to obtain the classification feature map.
[0027] In the above-mentioned mold cleaning effect inspection method based on sample dimension weighting of pre-detection weights, the convolutional neural network is a deep residual network.
[0028] According to another aspect of the present application, a mold cleaning effect inspection system based on sample dimension weighting of pre-detection weights is provided, comprising:
[0029] Training modules include:
[0030] A training image acquisition unit, used to acquire images of the cleaned mold taken at multiple angles as multiple training images;
[0031] A first training feature map generating unit, configured to input the plurality of training images obtained by the training image acquiring unit into a pre-detection convolutional neural network to obtain a plurality of first training feature maps corresponding to the plurality of training images;
[0032] a training sample weighted weight generating unit, configured to perform global average pooling on each of the plurality of first training feature maps obtained by the first training feature map generating unit to obtain a feature value corresponding to each of the first training feature maps, so as to obtain a plurality of feature values as sample weighted weights;
[0033] A second training feature map generating unit, configured to input the plurality of training images obtained by the training image acquiring unit into a convolutional neural network to obtain a plurality of second training feature maps corresponding to the plurality of training images;
[0034] a training classification feature map generating unit, configured to weight the plurality of second training feature maps obtained by the second training feature map generating unit with the sample weighting weight obtained by the sample weighting weight generating unit, so as to obtain a training classification feature map;
[0035] a classification loss function value calculation unit, configured to pass the training classification feature graph obtained by the training classification feature graph generation unit through a classifier to obtain a classification loss function value; and
[0036] a parameter updating unit, configured to update parameters of the convolutional neural network and the classifier based on the classification loss function value obtained by the classification loss function value calculating unit; and
[0037] Inference modules, including:
[0038] An image acquisition unit to be inspected, used to acquire multiple images to be inspected of the cleaned mold to be inspected, taken at multiple angles;
[0039] A first detection feature map generating unit, configured to input the plurality of images to be detected obtained by the image to be detected acquiring unit into the pre-detection convolutional neural network to obtain a plurality of first feature maps corresponding to the plurality of images to be detected;
[0040] a detection sample weighted weight generating unit, configured to perform global average pooling on each of the plurality of first feature maps obtained by the first detection feature map generating unit to obtain a feature value corresponding to each of the first feature maps, so as to obtain a plurality of feature values as sample weighted weights;
[0041] A second detection feature map generating unit, configured to input the plurality of images to be detected obtained by the image to be detected acquiring unit into the convolutional neural network to obtain a plurality of second feature maps corresponding to the plurality of images to be detected;
[0042] a detection classification feature map generating unit, configured to weight the plurality of second feature maps obtained by the second detection feature map generating unit with the sample weighting weight obtained by the detection sample weighting weight generating unit, so as to obtain a classification feature map; and
[0043] The classification result generating unit is used to pass the classification feature graph obtained by the detection classification feature graph generating unit through the classifier to obtain a classification result, wherein the classification result is used to indicate whether the cleaning effect of the cleaned mold to be detected is qualified.
[0044] In the above-mentioned sample dimension weighted mold cleaning effect inspection system based on pre-detection weights, the parameter updating unit is further used to: update the parameters of the convolutional neural network, the classifier and the pre-detection convolutional neural network based on the classification loss function value.
[0045] In the above-mentioned mold cleaning effect inspection system based on sample dimension weighting of pre-detection weights, the classification loss function value calculation unit includes: a training classification feature vector generation subunit, used to pass the training classification feature map through one or more fully connected layers to obtain a training classification feature vector; a training classification result generation subunit, used to input the training classification feature vector into a classification function to obtain a classification result; and a loss function calculation subunit, used to input the difference between the classification result and the true value into a loss function to obtain the classification loss function value.
[0046] In the above-mentioned mold cleaning effect inspection system based on sample dimension weighting of pre-detection weights, the detection sample weighted weight generation unit is further used to: arrange the multiple feature values in the order of shooting angles corresponding to the multiple images to be detected to obtain the sample weighted weights; wherein the detection classification feature map generation unit is further used to: arrange the multiple second feature maps in the order of shooting angles corresponding to the multiple images to be detected; and calculate the weighted sum of the multiple second feature maps with the sample weighted weights in a consistent order to obtain the classification feature map.
[0047] In the above-mentioned sample dimension weighted mold cleaning effect inspection system based on pre-detection weights, the convolutional neural network is a deep residual network.
[0048] According to another aspect of the present application, an electronic device is provided, comprising: a processor; and a memory, wherein computer program instructions are stored in the memory, and when the computer program instructions are executed by the processor, the processor executes the mold cleaning effect inspection method based on sample dimension weighting based on pre-detection weights as described above.
[0049] According to another aspect of the present application, a computer-readable medium is provided, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the processor executes the mold cleaning effect inspection method based on sample dimension weighting based on pre-detection weights as described above.
[0050] According to the mold cleaning effect inspection method based on sample dimension weighting of pre-detection weights, the mold cleaning effect inspection system and electronic device based on sample dimension weighting of pre-detection weights provided in the present application, the contribution value of the feature map of each angle to the final classification result is learned based on a convolutional neural network, and each feature map is weighted as a weight to improve the accuracy of the final classification and improve the generalization ability of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] By describing the embodiments of the present application in more detail in conjunction with the accompanying drawings, the above and other purposes, features and advantages of the present application will become more apparent. The accompanying drawings are used to provide a further understanding of the embodiments of the present application and constitute a part of the specification. Together with the embodiments of the present application, they are used to explain the present application and do not constitute a limitation of the present application. In the accompanying drawings, the same reference numerals generally represent the same components or steps.
[0052] Figure 1 The diagram illustrates a scenario schematic diagram of a method for inspecting mold cleaning effects based on sample dimension weighting based on pre-detection weights according to an embodiment of the present application.
[0053] Figure 2A The flowchart of the training phase in the mold cleaning effect inspection method based on sample dimension weighting of pre-detection weights according to an embodiment of the present application is illustrated.
[0054] Figure 2B The figure illustrates a flow chart of the inference phase in the mold cleaning effect inspection method based on sample dimension weighting of pre-detection weights according to an embodiment of the present application.
[0055] Figure 3A The diagram illustrates an architecture diagram of the training phase in a mold cleaning effect inspection method based on sample dimension weighting based on pre-detection weights according to an embodiment of the present application.
[0056] Figure 3B The diagram illustrates an architecture schematic diagram of the inference stage in a mold cleaning effect inspection method based on sample dimension weighting based on pre-detection weights according to an embodiment of the present application.
[0057] Figure 4 The diagram illustrates a flow chart of a method for inspecting mold cleaning effects based on sample dimension weighting based on pre-detection weights according to an embodiment of the present application, in which the training classification feature graph is passed through a classifier to obtain a classification loss function value.
[0058] Figure 5 The diagram illustrates a block diagram of a mold cleaning effect inspection system based on sample dimension weighting based on pre-detection weights according to an embodiment of the present application.
[0059] Figure 6The diagram illustrates a block diagram of a classification loss function value calculation unit in a mold cleaning effect inspection system based on sample dimension weighting based on pre-detection weights according to an embodiment of the present application.
[0060] Figure 7 A block diagram of an electronic device according to an embodiment of the present application is illustrated. DETAILED DESCRIPTION
[0061] Below, the exemplary embodiments according to the present application will be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments of the present application, and it should be understood that the present application is not limited to the exemplary embodiments described here.
[0062] Scenario Overview: As mentioned above, molds are various molds and tools used in industrial production to obtain the desired products by injection molding, blow molding, extrusion, die casting or forging molding, smelting, stamping and other methods. In short, molds are tools used to make molded objects. This tool is composed of various parts, and different molds are composed of different parts. At present, molds need to be cleaned by cleaning equipment after use, and the cleaning effect of the cleaning equipment will also affect the subsequent use of the mold.
[0063] However, the current cleaning effect of the mold is basically inspected manually, which is not only cumbersome but also affects the inspection effect.
[0064] Therefore, a technical solution that can be used to test the cleaning effect of molds is desired.
[0065] Specifically, the applicant of this application hopes to realize the inspection of the cleaning effect of the mold through mature deep learning-based computer vision technology, which extracts image features through convolutional neural networks and performs object detection to determine whether the mold after cleaning detects objects corresponding to predetermined stains. Obviously, this is a classification problem based on convolutional neural networks.
[0066] However, for a single mold, it usually has a more complex shape and also has concave surfaces such as cavities. In order to improve the generalization ability of the inspection model of the present application, it is hoped to develop a model suitable for molds of various shapes, rather than a model that is only suitable for the inspection of molds of a single shape.
[0067] Based on this, the applicant of this application discovered during the research process that when inspecting the mold, if images are acquired from different angles, then after the feature map is extracted from each image, the contribution of the feature map corresponding to each image to the final classification result is not the same. Therefore, it is expected to be able to learn the contribution value of the feature map of each angle to the final classification result based on the convolutional neural network, and then use it as a weight to weight each feature map to improve the accuracy of the final classification.
[0068] Therefore, in the technical solution of the present application, images at multiple angles are first input into the first convolutional neural network for pre-detection to obtain a first feature map corresponding to each image, and then global average pooling is performed on each first feature map to obtain a feature value corresponding to each image, which is used as a weight. That is, the first convolutional neural network can be regarded as a weight generation network.
[0069] Then, the images at the multiple angles are input as a detection image set into a second convolutional neural network to obtain a second feature map. Then, the second feature map is weighted in the sample dimension according to the weight value of the corresponding angle, that is, the feature map of each corresponding angle is weighted to obtain a classification feature map, and the classification result is obtained through a classification function.
[0070] Here, during the training process, the first convolutional neural network used for pre-detection may not be trained, but the second convolutional neural network may be trained to make the feature extraction of the second convolutional neural network compatible with the feature extraction of the first convolutional neural network, thereby reducing the amount of calculation.
[0071] Based on this, the present application proposes a mold cleaning effect inspection method based on sample dimension weighting of pre-detection weights, which includes: a training stage, including: obtaining images of cleaned molds taken at multiple angles as multiple training images; inputting the multiple training images into a pre-detection convolutional neural network to obtain multiple first training feature maps corresponding to the multiple training images; for the multiple first training feature maps, performing global average pooling on each of the first training feature maps to obtain a feature value corresponding to each of the first training feature maps, so as to obtain multiple feature values as sample weighting weights; inputting the multiple training images into a convolutional neural network to obtain multiple second training feature maps corresponding to the multiple training images; weighting the multiple second training feature maps with the sample weighting weights to obtain a training classification feature map; Pass the training classification feature map through a classifier to obtain a classification loss function value; and, based on the classification loss function value, update the parameters of the convolutional neural network and the classifier; and, the inference stage, including: obtaining multiple images of the cleaned mold to be inspected taken at multiple angles; inputting the multiple images to be inspected into the pre-detection convolutional neural network to obtain multiple first feature maps corresponding to the multiple images to be inspected; for the multiple first feature maps, performing global average pooling on each of the first feature maps to obtain a feature value corresponding to each of the first feature maps, so as to obtain multiple feature values as sample weighting weights; inputting the multiple images to be inspected into the convolutional neural network to obtain multiple second feature maps corresponding to the multiple images to be inspected; weighting the multiple second feature maps with the sample weighting weights to obtain a classification feature map; and, passing the classification feature map through the classifier to obtain a classification result, and the classification result is used to indicate whether the cleaning effect of the cleaned mold to be inspected is qualified.
[0072] Figure 1 The diagram illustrates a scenario schematic diagram of a method for inspecting mold cleaning effects based on sample dimension weighting based on pre-detection weights according to an embodiment of the present application.
[0073] like Figure 1 As shown, in this application scenario, during the training phase, a camera (e.g., Figure 1 C) as shown in the figure, images of the cleaned mold are taken at multiple angles to serve as a training image set; then, the training image set is input to a server (for example, as shown in the figure) that is equipped with a mold cleaning effect inspection algorithm weighted by sample dimensions based on pre-detection weights. Figure 1 In S) as shown in , the server can train a convolutional neural network for mold cleaning effect inspection based on a mold cleaning effect inspection algorithm weighted by a sample dimension of a pre-detection weight using the training image set.
[0074] After training is complete, in the inference phase, the camera (e.g. Figure 1 C) photographs multiple images of the cleaned mold at multiple angles; then, the multiple images to be detected are input to a server (for example, Figure 1 S as shown in ), wherein, the server can process the multiple images to be detected based on a mold cleaning effect inspection algorithm weighted by a sample dimension of a pre-detection weight to generate a detection result indicating whether the cleaning effect of the cleaned mold to be detected is qualified.
[0075] After introducing the basic principles of the present application, various non-limiting embodiments of the present application will be described in detail with reference to the accompanying drawings.
[0076] Exemplary methods; Figure 2A The flowchart of the training phase in the mold cleaning effect inspection method based on sample dimension weighting of pre-detection weights according to an embodiment of the present application is illustrated. Figure 2B The figure shows a flow chart of the inference stage in the mold cleaning effect inspection method based on sample dimension weighting of pre-detection weights according to an embodiment of the present application. Figure 2A As shown, according to the sample dimension weighting method of the embodiment of the present application, the mold cleaning effect inspection method based on the pre-detection weight includes: a training stage, including: S110, obtaining images of the cleaned mold taken at multiple angles as multiple training images; S120, inputting the multiple training images into the pre-detection convolutional neural network to obtain multiple first training feature maps corresponding to the multiple training images; S130, for the multiple first training feature maps, performing global average pooling on each of the first training feature maps to obtain a feature value corresponding to each of the first training feature maps, so as to obtain multiple feature values as sample weighting weights; S140, inputting the multiple training images into the convolutional neural network to obtain multiple second training feature maps corresponding to the multiple training images; S150, weighting the multiple second training feature maps with the sample weighting weights to obtain a training classification feature map; S160, passing the training classification feature map through a classifier to obtain a classification loss function value; and, S170, updating the parameters of the convolutional neural network and the classifier based on the classification loss function value.
[0077] like Figure 2BAs shown, according to the sample dimension weighted mold cleaning effect inspection method based on the pre-detection weights according to the embodiment of the present application, it also includes: an inference stage, including: S210, obtaining multiple images to be detected of the cleaned mold to be detected taken at multiple angles; S220, inputting the multiple images to be detected into the pre-detection convolutional neural network to obtain multiple first feature maps corresponding to the multiple images to be detected; S230, for the multiple first feature maps, performing global average pooling on each of the first feature maps to obtain a feature value corresponding to each of the first feature maps, so as to obtain multiple feature values as sample weighting weights; S240, inputting the multiple images to be detected into the convolutional neural network to obtain multiple second feature maps corresponding to the multiple images to be detected; S250, weighting the multiple second feature maps with the sample weighting weights to obtain a classification feature map; S260, passing the classification feature map through the classifier to obtain a classification result, and the classification result is used to indicate whether the cleaning effect of the cleaned mold to be detected is qualified.
[0078] Figure 3A The diagram shows a schematic diagram of the architecture of the training phase in the mold cleaning effect inspection method based on sample dimension weighting of pre-detection weights according to an embodiment of the present application. Figure 3A As shown, in the training phase, in the network architecture, firstly, a plurality of acquired training images (for example, IN0 as shown in FIG. 3 ) are input into a pre-detection convolutional neural network (for example, Figure 3A ) to obtain multiple first training feature maps (e.g., Figure 3A ), wherein the plurality of training images are images of the cleaned mold taken at multiple angles. Next, for the plurality of first training feature maps, each of the first training feature maps is pooled (for example, Figure 3A The PL shown in FIG. 1 is used to perform global average pooling to obtain a feature value corresponding to each of the first training feature maps, so as to obtain a plurality of feature values as sample weights. Then, the plurality of training images are input into a convolutional neural network (e.g., Figure 3A ) to obtain a plurality of second training feature maps corresponding to the plurality of training images (for example, Figure 3A Then, the plurality of second training feature maps are weighted by the sample weights to obtain a training classification feature map (for example, Figure 3A Then, the training classification feature map is passed through the classifier to obtain a classification loss function value. Then, the parameters of the convolutional neural network and the classifier are updated based on the classification loss function value until the training of the convolutional neural network and the classifier is completed.
[0079] Figure 3B The figure shows a schematic diagram of the architecture of the inference stage in the mold cleaning effect inspection method based on sample dimension weighting based on pre-detection weights according to an embodiment of the present application. Figure 3B As shown, in the inference stage, in the network structure, firstly, the acquired multiple images to be detected (for example, IN1 as shown in FIG. 3 ) are input into the pre-detection convolutional neural network (for example, Figure 3B ) to obtain multiple first feature maps (for example, Figure 3B F1 as shown in the figure), wherein the plurality of images to be detected are images of the cleaned mold taken at multiple angles. Then, for the plurality of first feature maps, each of the first feature maps is subjected to global average pooling to obtain a feature value corresponding to each of the first feature maps, so as to obtain a plurality of feature values as sample weights. Then, the plurality of images to be detected are input into the convolutional neural network (for example, Figure 3B ) to obtain a plurality of second feature maps corresponding to the plurality of images to be detected (for example, Figure 3B Then, the plurality of second feature maps are weighted by the sample weights to obtain a classification feature map (for example, Figure 3B Then, the classification feature map is passed through the classifier to obtain a classification result, and the classification result is used to indicate whether the cleaning effect of the cleaned mold to be detected is qualified.
[0080] More specifically, in the training phase, in step S110, images of the cleaned mold taken at multiple angles are obtained as multiple training images. It should be understood that in the process of detecting the cleaning effect of the mold, the mold usually has a relatively complex shape and also has a concave surface such as a cavity. Therefore, in order to improve the detection accuracy, it is necessary to take images of the cleaned mold at multiple angles to show the visual features of the cleaned mold from multiple perspectives.
[0081] In particular, during the training process, the cleaned mold image has a label indicating whether the cleaning effect is qualified or unqualified.
[0082] More specifically, in the training phase, in step S120, the plurality of training images are input into the pre-detection convolutional neural network to obtain a plurality of first training feature maps corresponding to the plurality of training images. As mentioned above, when detecting the mold cleaning effect, after extracting the feature map from each image, the contribution of the feature map corresponding to each image to the final classification result is not the same, so it is expected to be able to learn the contribution value of the feature map of each angle to the final classification result based on the convolutional neural network, so as to weight each feature map as a weight to improve the accuracy of the final classification.
[0083] Accordingly, in an embodiment of the present application, the pre-detection convolutional neural network is used to learn the contribution value of the feature map of each angle to the final classification result.
[0084] More specifically, in the training stage, in step S130, for the multiple first training feature maps, each of the first training feature maps is globally averaged pooled to obtain a feature value corresponding to each of the first training feature maps, so as to obtain multiple feature values as sample weighting weights. That is, after obtaining the first training feature maps corresponding to the multiple training images through the pre-detection convolutional neural network, each first training feature map is globally averaged pooled by a pooling layer to obtain a feature value corresponding to each image, and the obtained feature value is used as a weight. Accordingly, the pre-detection convolutional neural network can be regarded as a weight generation network.
[0085] In particular, a person skilled in the art can suppress the phenomenon of increased variance of the estimated value due to limited neighborhood size by performing a global average pooling operation on the first training feature map, so that the obtained eigenvalues can more effectively characterize the contribution value of the training feature map of the corresponding angle to the classification.
[0086] More specifically, in the training phase, in step S140, the plurality of training images are input into a convolutional neural network to obtain a plurality of second training feature maps corresponding to the plurality of training images. That is, the high-dimensional features in the plurality of training images are extracted by the convolutional neural network. It should be known to those skilled in the art that the convolutional neural network has an excellent performance surface in extracting local spatial features of images.
[0087] Preferably, in an embodiment of the present application, the convolutional neural network is implemented as a deep residual network, for example, ResNet 50. Compared with the traditional convolutional neural network, the deep residual network is an optimized network structure proposed on the basis of the traditional convolutional neural network, which mainly solves the problem of gradient vanishing during training. The deep residual network introduces a residual network structure, through which the network layer can be made deeper, and the problem of gradient vanishing will not occur. The residual network draws on the cross-layer connection idea of the high-speed network, which breaks the traditional neural network convention that the input layer of the N-1 layer can only give the N layer as input, so that the output of a certain layer can directly cross several layers as the input of a certain layer behind. Its significance lies in that it provides a new direction for the problem that the error rate of the entire learning model increases instead of decreases due to the superposition of multiple layers of networks.
[0088] More specifically, in the training stage, in step S150, the plurality of second training feature maps are weighted by the sample weighting weight to obtain a training classification feature map. That is, the plurality of second training feature maps are fused based on the contribution value of the feature map of each angle learned by the pre-detection convolutional neural network to the final classification result as a weight to obtain the training classification feature map. Accordingly, classification using the classification feature map can effectively improve the generalization ability of the model and the accuracy of classification.
[0089] More specifically, in an embodiment of the present application, the process of weighting the multiple second training feature maps with the sample weighting weights to obtain the training classification feature map includes: first, arranging the multiple second training feature maps in order of the shooting angles corresponding to the multiple training images; then, calculating the weighted sum of the multiple second training feature maps with the sample weighting weights in a consistent order to obtain the training classification feature map.
[0090] More specifically, in the training phase, in step S160, the training classification feature graph is passed through a classifier to obtain a classification loss function value. That is, the training classification feature graph is passed through a classifier to obtain a classification result, and the probability that the classification result conforms to the true value, i.e., the classification loss function value, is calculated.
[0091] More specifically, in an embodiment of the present application, the process of passing the training classification feature map through a classifier to obtain a classification loss function value includes: first, encoding the training classification feature map with one or more fully connected layers to obtain a training classification feature vector. It should be understood that the fully connected layer can fully utilize the information of each position in the training classification feature map to improve the accuracy of encoding. Next, the training classification feature vector is input into a classification function (e.g., a Softmax classification function) to obtain a classification result, and the classification result is a first probability that the second training feature map belongs to a qualified cleaning effect and a second probability that the second training feature map belongs to an unqualified cleaning effect. Then, the difference between the classification result and the true value is input into the loss function to obtain the classification loss function value.
[0092] Figure 4 The figure shows a flow chart of obtaining a classification loss function value by passing the training classification feature graph through a classifier in a mold cleaning effect inspection method based on sample dimension weighting based on pre-detection weights according to an embodiment of the present application. Figure 4As shown, in an embodiment of the present application, the training classification feature map is passed through a classifier to obtain a classification loss function value, including: S310, passing the training classification feature map through one or more fully connected layers to obtain a training classification feature vector; S320, inputting the training classification feature vector into a classification function to obtain a classification result; and, S330, inputting the difference between the classification result and the true value into a loss function to obtain the classification loss function value.
[0093] More specifically, in the training phase, in step S170, the parameters of the convolutional neural network and the classifier are updated based on the classification loss function value. That is, the parameters of the convolutional neural network and the classifier are updated by back propagation of gradient descent with the classification loss function value.
[0094] In particular, in the application embodiment, during the training process, the first convolutional neural network used for pre-detection may not be trained, but the feature extraction of the second convolutional neural network may be adapted to the feature extraction of the first convolutional neural network through the training of the second convolutional neural network, thereby reducing the amount of calculation. Of course, the pre-detection convolutional neural network may also be trained synchronously during the training process, that is, in the embodiment of the present application, the process of updating the parameters of the convolutional neural network and the classifier based on the classification loss function value may include: updating the parameters of the convolutional neural network, the classifier and the pre-detection convolutional neural network based on the classification loss function value.
[0095] After the training is completed, the inference phase begins.
[0096] More specifically, in the inference stage, in step S210, multiple images of the cleaned mold to be tested taken at multiple angles are obtained. That is, during the detection process, it is also necessary to collect images of the cleaned mold to be tested at multiple angles, so as to more fully demonstrate the cleaning effect of the mold through image information at multiple angles.
[0097] More specifically, in the inference stage, in step S220, the plurality of images to be detected are input into the pre-detection convolutional neural network to obtain a plurality of first feature maps corresponding to the plurality of images to be detected. And, in step S230, for the plurality of first feature maps, global average pooling is performed on each of the first feature maps to obtain a feature value corresponding to each of the first feature maps, so as to obtain a plurality of feature values as sample weighting weights.
[0098] It should be understood that in step S220 and step S230, the multiple images to be detected are input into the pre-detection convolutional neural network to obtain the contribution value of the detection feature maps corresponding to the multiple images to be detected taken at multiple angles to the classification result, that is, the sample weighting weight.
[0099] More specifically, in the inference stage, in step S240, the multiple images to be detected are input into the convolutional neural network to obtain multiple second feature maps corresponding to the multiple images to be detected. That is, the trained convolutional neural network extracts high-dimensional features from the multiple images to be detected. It should be understood that after the above training process, the convolutional neural network can extract features with discriminative ability from the multiple images to be detected, and the features with discriminative ability have a certain inter-class similarity to avoid overfitting.
[0100] More specifically, in the inference stage, in step S250, the plurality of second feature maps are weighted by the sample weighting weight to obtain a classification feature map. That is, the plurality of second feature maps are fused by the sample weighting weight obtained in step S230 to obtain the classification feature map.
[0101] More specifically, in the inference stage, in step S260, the classification feature graph is passed through the classifier to obtain a classification result, and the classification result is used to indicate whether the cleaning effect of the cleaned mold to be detected is qualified. That is, the obtained classification feature graph is input into the trained classifier to generate a classification result for indicating whether the cleaning effect of the cleaned mold to be detected is qualified.
[0102] In summary, a mold cleaning effect inspection method based on sample dimension weighting based on pre-detection weights according to an embodiment of the present application is explained, which is based on a convolutional neural network to learn the contribution value of the feature map of each angle to the final classification result, and then use it as a weight to weight each feature map to improve the accuracy of the final classification and improve the generalization ability of the model.
[0103] Example Systems: Figure 5 The diagram illustrates a block diagram of a mold cleaning effect inspection system based on sample dimension weighting based on pre-detection weights according to an embodiment of the present application.
[0104] like Figure 5As shown, according to the sample dimension weighting of the pre-detection weights according to the embodiment of the present application, the mold cleaning effect inspection system 600 includes: a training module 610, including: a training image acquisition unit 611, used to acquire images of the cleaned mold taken at multiple angles as multiple training images; a first training feature map generation unit 612, used to input the multiple training images obtained by the training image acquisition unit 611 into the pre-detection convolutional neural network to obtain multiple first training feature maps corresponding to the multiple training images; a training sample weight generation unit 613, used to generate a weight for the multiple first training feature maps obtained by the first training feature map generation unit 612 , performing global average pooling on each of the first training feature maps to obtain a feature value corresponding to each of the first training feature maps, so as to obtain a plurality of feature values as sample weighting weights; a second training feature map generating unit 614, used to input the plurality of training images obtained by the training image acquiring unit 611 into a convolutional neural network to obtain a plurality of second training feature maps corresponding to the plurality of training images; a training classification feature map generating unit 615, used to weight the plurality of second training feature maps obtained by the second training feature map generating unit 614 with the sample weighting weight obtained by the sample weighting weight generating unit, so as to obtain a training classification feature map ; a classification loss function value calculation unit 616, used to pass the training classification feature map obtained by the training classification feature map generation unit 615 through a classifier to obtain a classification loss function value; and a parameter updating unit 617, used to update the parameters of the convolutional neural network and the classifier based on the classification loss function value obtained by the classification loss function value calculation unit 616; and an inference module 620, including: a to-be-detected image acquisition unit 621, used to acquire multiple to-be-detected images of the cleaned mold to be detected taken at multiple angles; a first detection feature map generation unit 622, used to acquire the multiple to-be-detected images obtained by the to-be-detected image acquisition unit 621 The image to be detected is input into the pre-detection convolutional neural network to obtain a plurality of first feature maps corresponding to the plurality of images to be detected; a detection sample weighted weight generation unit 623 is used to perform global average pooling on each of the plurality of first feature maps obtained by the first detection feature map generation unit 622 to obtain a feature value corresponding to each of the first feature maps, so as to obtain a plurality of feature values as sample weighted weights; a second detection feature map generation unit 624 is used to input the plurality of images to be detected obtained by the image to be detected acquisition unit 621 into the convolutional neural network to obtain a plurality of second feature maps corresponding to the plurality of images to be detected;The detection classification feature map generation unit 625 is used to weight the plurality of second feature maps obtained by the second detection feature map generation unit 624 with the sample weight obtained by the detection sample weight generation unit 623 to obtain a classification feature map; and the classification result generation unit 626 is used to pass the classification feature map obtained by the detection classification feature map generation unit 625 through the classifier to obtain a classification result, and the classification result is used to indicate whether the cleaning effect of the cleaned mold to be detected is qualified. ;
[0105] In one example, in the above-mentioned inspection system 600, the parameter updating unit 617 is further used to: update the parameters of the convolutional neural network, the classifier and the pre-detection convolutional neural network based on the classification loss function value.
[0106] In one example, in the above inspection system 600, as Figure 6 As shown, the classification loss function value calculation unit 616 includes: a training classification feature vector generation subunit 6161, which is used to pass the training classification feature map through one or more fully connected layers to obtain a training classification feature vector; a training classification result generation subunit 6162, which is used to input the training classification feature vector into the classification function to obtain a classification result; and a loss function calculation subunit 6163, which is used to input the difference between the classification result and the true value into the loss function to obtain the classification loss function value.
[0107] In one example, in the above-mentioned inspection system 600, the detection sample weighted weight generation unit 623 is further used to: arrange the multiple feature values in the order of the shooting angles corresponding to the multiple images to be detected to obtain the sample weighted weights; wherein the detection classification feature map generation unit 625 is further used to: arrange the multiple second feature maps in the order of the shooting angles corresponding to the multiple images to be detected; and, calculate the weighted sum of the multiple second feature maps with the sample weighted weights in a consistent order to obtain the classification feature map.
[0108] Here, those skilled in the art will appreciate that the specific functions and operations of the various units and modules in the above-mentioned inspection system 600 have been described in detail above. Figures 1 to 4 The description of the mold cleaning effect inspection method based on sample dimension weighting of pre-detection weights has been introduced in detail, and therefore, its repeated description will be omitted.
[0109] As described above, the inspection system 600 according to the embodiment of the present application can be implemented in various terminal devices, such as a controller for mold cleaning effects. In one example, the inspection system 600 according to the embodiment of the present application can be integrated into the terminal device as a software module and / or a hardware module. For example, the inspection system 600 can be a software module in the operating system of the terminal device, or can be an application developed for the terminal device; of course, the inspection system 600 can also be one of the many hardware modules of the terminal device.
[0110] Alternatively, in another example, the inspection system 600 and the terminal device may also be separate devices, and the inspection system 600 may be connected to the terminal device via a wired and / or wireless network, and transmit interactive information in accordance with an agreed data format.
[0111] Example Electronic Devices: Below, reference Figure 7 To describe an electronic device according to an embodiment of the present application.
[0112] Figure 7 A block diagram of an electronic device according to an embodiment of the present application is illustrated.
[0113] like Figure 7 As shown, the electronic device 10 includes one or more processors 11 and a memory 12 .
[0114] The processor 11 may be a central processing unit (CPU) or other forms of processing units having data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device 10 to perform desired functions.
[0115] The memory 12 may include one or more computer program products, and the computer program product may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, random access memory (RAM) and / or cache memory (cache), etc. The non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 11 may run the program instructions to implement the mold cleaning effect inspection method based on sample dimension weighting of pre-detection weights and / or other desired functions of the various embodiments of the present application described above. Various contents such as training images, classification results, etc. may also be stored in the computer-readable storage medium.
[0116] In one example, the electronic device 10 may further include: an input device 13 and an output device 14 , and these components are interconnected via a bus system and / or other forms of connection mechanisms (not shown).
[0117] The input device 13 may include, for example, a keyboard, a mouse, etc.
[0118] The output device 14 can output various information to the outside, including classification results, etc. The output device 14 can include, for example, a display, a speaker, a printer, a communication network and a remote output device connected thereto, and the like.
[0119] Of course, to simplify, Figure 7 Only some of the components related to the present application in the electronic device 10 are shown, and components such as a bus, an input / output interface, etc. are omitted. In addition, according to specific application situations, the electronic device 10 may also include any other appropriate components.
[0120] Exemplary computer program products and computer readable storage media: In addition to the above-mentioned methods and devices, an embodiment of the present application may also be a computer program product, which includes computer program instructions, which, when executed by a processor, enable the processor to execute the steps of the mold cleaning effect inspection method based on sample dimension weighting based on pre-detection weights according to various embodiments of the present application described in the above "Exemplary Method" section of this specification.
[0121] The computer program product may be written in any combination of one or more programming languages to write program codes for performing the operations of the embodiments of the present application, including object-oriented programming languages, such as Java, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as an independent software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0122] In addition, an embodiment of the present application may also be a computer-readable storage medium having computer program instructions stored thereon, and when the computer program instructions are executed by a processor, the processor executes the steps of the mold cleaning effect inspection method based on sample dimension weighting based on pre-detection weights according to various embodiments of the present application described in the above "Exemplary Method" section of this specification.
[0123] The computer readable storage medium can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can include, for example, but is not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0124] The basic principles of the present application are described above in conjunction with specific embodiments. However, it should be noted that the advantages, strengths, effects, etc. mentioned in the present application are only examples and not limitations, and it cannot be considered that these advantages, strengths, effects, etc. are required by each embodiment of the present application. In addition, the specific details disclosed above are only for the purpose of illustration and ease of understanding, not for limitation, and the above details do not limit the present application to being implemented by adopting the above specific details.
[0125] The block diagrams of the devices, apparatuses, equipment, and systems involved in this application are only illustrative examples and are not intended to require or imply that they must be connected, arranged, and configured in the manner shown in the block diagram. As will be appreciated by those skilled in the art, these devices, apparatuses, equipment, and systems can be connected, arranged, and configured in any manner. Words such as "including", "comprising", "having", etc. are open words, referring to "including but not limited to", and can be used interchangeably with them. The words "or" and "and" used here refer to the words "and / or" and can be used interchangeably with them, unless the context clearly indicates otherwise. The words "such as" used here refer to the phrase "such as but not limited to", and can be used interchangeably with them.
[0126] It should also be noted that in the apparatus, device and method of the present application, each component or each step can be decomposed and / or recombined. Such decomposition and / or recombination should be regarded as equivalent solutions of the present application.
[0127] The above description of the disclosed aspects is provided to enable any person skilled in the art to make or use the present application. Various modifications to these aspects will be readily apparent to those skilled in the art, and the general principles defined herein may be applied to other aspects without departing from the scope of the present application. Therefore, the present application is not intended to be limited to the aspects shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
[0128] The above description has been given for the purpose of illustration and description. In addition, this description is not intended to limit the embodiments of the present application to the forms disclosed herein. Although multiple example aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, changes, additions and sub-combinations thereof.
Claims
1. A mold cleaning effect inspection method based on sample dimension weighting of pre-detection weights, characterized in that: include: The training phase includes: Acquire images of the cleaned mold taken at multiple angles as multiple training images; Inputting the plurality of training images into a pre-detection convolutional neural network to obtain a plurality of first training feature maps corresponding to the plurality of training images; For the plurality of first training feature maps, performing global average pooling on each of the first training feature maps to obtain a feature value corresponding to each of the first training feature maps, so as to obtain a plurality of feature values as sample weighting weights; Inputting the plurality of training images into a convolutional neural network to obtain a plurality of second training feature maps corresponding to the plurality of training images; Weighting the plurality of second training feature maps with the sample weighting weights to obtain a training classification feature map; Passing the training classification feature map through a classifier to obtain a classification loss function value; and Updating parameters of the convolutional neural network and the classifier based on the classification loss function value; and The inference phase includes: Acquire multiple images of the cleaned mold to be inspected taken at multiple angles; Inputting the plurality of images to be detected into the pre-detection convolutional neural network to obtain a plurality of first feature maps corresponding to the plurality of images to be detected; For the plurality of first feature maps, performing global average pooling on each of the first feature maps to obtain a feature value corresponding to each of the first feature maps, so as to obtain a plurality of feature values as sample weighting weights; Inputting the plurality of images to be detected into the convolutional neural network to obtain a plurality of second feature maps corresponding to the plurality of images to be detected; Weighting the plurality of second feature maps with the sample weighting weight to obtain a classification feature map; and The classification feature graph is passed through the classifier to obtain a classification result, and the classification result is used to indicate whether the cleaning effect of the cleaned mold to be inspected is qualified.
2. The mold cleaning effect inspection method based on sample dimension weighting of pre-detection weights according to claim 1, wherein: Updating the parameters of the convolutional neural network and the classifier based on the classification loss function value includes: The parameters of the convolutional neural network, the classifier and the pre-detection convolutional neural network are updated based on the classification loss function value.
3. The mold cleaning effect inspection method based on sample dimension weighting of pre-detection weights according to claim 1, wherein: Passing the training classification feature map through a classifier to obtain a classification loss function value includes: Passing the training classification feature map through one or more fully connected layers to obtain a training classification feature vector; Inputting the training classification feature vector into a classification function to obtain a classification result; and The difference between the classification result and the true value is input into the loss function to obtain the classification loss function value.
4. The mold cleaning effect inspection method based on sample dimension weighting of pre-detection weights according to claim 1, wherein: For the plurality of first feature maps, performing global average pooling on each of the first feature maps to obtain a feature value corresponding to each of the first feature maps, so as to obtain a plurality of feature values as sample weighting weights, including: Arrange the multiple feature values in the order of the shooting angles corresponding to the multiple images to be detected to obtain the sample weighting weights; The step of weighting the plurality of second feature maps with the sample weighting weight to obtain a classification feature map includes: Arranging the plurality of second feature maps in the order of the shooting angles corresponding to the plurality of images to be detected; and The weighted sum of the plurality of second feature maps is calculated using the sample weights in a consistent order to obtain the classification feature map.
5. The mold cleaning effect inspection method based on sample dimension weighting of pre-detection weights according to claim 1, wherein: The convolutional neural network is a deep residual network.
6. A mold cleaning effect inspection system based on sample dimension weighting of pre-detection weights, characterized in that: include: Training modules include: A training image acquisition unit, used to acquire images of the cleaned mold taken at multiple angles as multiple training images; A first training feature map generating unit, configured to input the plurality of training images obtained by the training image acquiring unit into a pre-detection convolutional neural network to obtain a plurality of first training feature maps corresponding to the plurality of training images; a training sample weighted weight generating unit, configured to perform global average pooling on each of the plurality of first training feature maps obtained by the first training feature map generating unit to obtain a feature value corresponding to each of the first training feature maps, so as to obtain a plurality of feature values as sample weighted weights; A second training feature map generating unit, configured to input the plurality of training images obtained by the training image acquiring unit into a convolutional neural network to obtain a plurality of second training feature maps corresponding to the plurality of training images; a training classification feature map generating unit, configured to weight the plurality of second training feature maps obtained by the second training feature map generating unit with the sample weighting weight obtained by the sample weighting weight generating unit, so as to obtain a training classification feature map; a classification loss function value calculation unit, configured to pass the training classification feature graph obtained by the training classification feature graph generation unit through a classifier to obtain a classification loss function value; and a parameter updating unit, configured to update parameters of the convolutional neural network and the classifier based on the classification loss function value obtained by the classification loss function value calculating unit; and Inference module, including: An image acquisition unit to be inspected, used to acquire multiple images to be inspected of the cleaned mold to be inspected, taken at multiple angles; A first detection feature map generating unit, used for inputting the plurality of images to be detected obtained by the image to be detected acquiring unit into the pre-detection convolutional neural network to obtain a plurality of first feature maps corresponding to the plurality of images to be detected; a detection sample weighted weight generating unit, configured to perform global average pooling on each of the plurality of first feature maps obtained by the first detection feature map generating unit to obtain a feature value corresponding to each of the first feature maps, so as to obtain a plurality of feature values as sample weighted weights; A second detection feature map generating unit, used for inputting the multiple images to be detected obtained by the image to be detected acquiring unit into the convolutional neural network to obtain multiple second feature maps corresponding to the multiple images to be detected; a detection classification feature map generating unit, configured to weight the plurality of second feature maps obtained by the second detection feature map generating unit with the sample weighting weight obtained by the detection sample weighting weight generating unit, so as to obtain a classification feature map; and The classification result generating unit is used to pass the classification feature graph obtained by the detection classification feature graph generating unit through the classifier to obtain a classification result, wherein the classification result is used to indicate whether the cleaning effect of the cleaned mold to be detected is qualified.
7. The mold cleaning effect inspection system based on sample dimension weighting of pre-detection weights according to claim 6, wherein: The parameter updating unit is further used to update the parameters of the convolutional neural network, the classifier and the pre-detection convolutional neural network based on the classification loss function value.
8. The mold cleaning effect inspection system based on sample dimension weighting of pre-detection weights according to claim 6, wherein: The classification loss function value calculation unit comprises: A training classification feature vector generating subunit, used for passing the training classification feature map through one or more fully connected layers to obtain a training classification feature vector; a training classification result generating subunit, configured to input the training classification feature vector into a classification function to obtain a classification result; and The loss function calculation subunit is used to input the difference between the classification result and the true value into the loss function to obtain the classification loss function value.
9. The mold cleaning effect inspection system based on sample dimension weighting of pre-detection weights according to claim 6, wherein: The detection sample weighted weight generation unit is further used to: arrange the multiple feature values in the order of the shooting angles corresponding to the multiple images to be detected to obtain the sample weighted weights; wherein the detection classification feature map generation unit is further used to: arrange the multiple second feature maps in the order of the shooting angles corresponding to the multiple images to be detected; and calculate the weighted sum of the multiple second feature maps with the sample weighted weights in a consistent order to obtain the classification feature map.
10. An electronic device comprising: processor; as well as A memory, in which computer program instructions are stored, and when the computer program instructions are executed by the processor, the processor executes the mold cleaning effect inspection method based on sample dimension weighting based on pre-detection weights as described in any one of claims 1-5.
