A hose optimization design method and device based on deep learning
By calculating the target chaotic feature value of the hose sample, the pooling method is determined, combined with the training of the convolutional neural network, the problems of overfitting and low generalization capabilities in the hose optimization design are solved, and more reliable and efficient hose optimization is achieved.
Patent Information
- Application Number
- CN202410678432.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-29
- Publication Date
- 2024-12-24
- Estimated Expiration
- 2044-05-29
AI Technical Summary
In the existing hose optimization design based on deep learning, the overfitting, computing complexity and low generalization ability of the convolutional neural network lead to poor optimization results in hose optimization, wasted resources and time consumption.
By obtaining the two-dimensional matrix of the grayscale image of the hose sample, input it into the convolutional neural network, the target chaotic feature value is calculated to determine the pooling method, and combining the training of the convolutional layer, the pooling layer and the fully connected layer to optimize the hose design.
Effectively prevent overfitting, improve the generalization ability of convolutional neural networks, and ensure the reliability and accuracy of hose optimization design.
Smart Images

Figure CN118378539B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of hose optimization, and in particular to a hose optimization design method and device based on deep learning. Background Art
[0002] Hoses are widely used in industrial and commercial fields, including the transportation of liquids, gases and other substances, so the optimization of their design is of great significance to improve efficiency, reduce costs and reduce resource waste.
[0003] The existing technology mainly relies on deep learning related technologies to achieve the optimal design of hoses. For example, a large amount of data or images is used to train the network model, and the hose is optimized based on the output results of the trained convolutional neural network. However, the overfitting, complex calculations and high dimensions caused by a large number of convolution kernels and feature maps in the traditional neural network training process will lead to low generalization ability of the network model, and will also waste resources and time, which will lead to the inability to reliably optimize the hose. Summary of the invention
[0004] In order to solve the above problems, the present invention provides a hose optimization design method and device based on deep learning, and the technical solutions adopted are as follows:
[0005] In a first aspect, an embodiment of the present invention provides a hose optimization design method based on deep learning, comprising the following steps:
[0006] Obtain a two-dimensional matrix corresponding to each hose sample grayscale image in the hose sample grayscale image set;
[0007] Inputting the two-dimensional matrix corresponding to each grayscale image of the hose sample into the convolution layer of the convolutional neural network, the convolution layer outputs the first feature map corresponding to each grayscale image of the hose sample; obtaining the target chaotic feature value corresponding to the first feature map according to the first feature map;
[0008] According to the target chaotic feature value, a pooling method corresponding to the first feature map is obtained; the first feature map is input into the pooling layer of the convolutional neural network, and a pooling operation is performed on the corresponding first feature map according to the pooling method corresponding to the first feature map, and the pooling layer outputs a second feature map corresponding to the first feature map;
[0009] Inputting the second feature map into the fully connected layer of the convolutional neural network, completing the training of the convolutional neural network according to the output result of the fully connected layer and the loss function, and obtaining a trained convolutional neural network;
[0010] The image of the hose to be detected is obtained, the image of the hose to be detected is input into a trained convolutional neural network, and the hose is optimized and designed according to the output result of the trained convolutional neural network.
[0011] In a second aspect, the present invention provides a hose optimization design device based on deep learning, comprising a memory and a processor, wherein the processor executes a computer program stored in the memory to implement the above-mentioned hose optimization design method based on deep learning.
[0012] Preferably, the method for obtaining the target chaotic eigenvalue corresponding to the first characteristic map includes:
[0013] For any first feature map:
[0014] Obtaining information entropy of the first feature map, and obtaining a first eigenvalue corresponding to the first feature map according to the information entropy;
[0015] Obtaining a maximum grayscale value on the first characteristic map and a minimum grayscale value on the first characteristic map, and recording a difference between the maximum grayscale value and the minimum grayscale value as a grayscale difference corresponding to the first characteristic map;
[0016] Obtaining a grayscale maximum limit value, and recording a ratio of the grayscale difference value to the grayscale maximum limit value as a second eigenvalue corresponding to the first eigenvalue map;
[0017] Obtaining the gradient amplitude of each pixel point on the first feature map, and recording the normalized value of the mean value of the gradient amplitude of all pixel points on the first feature map as the first representation value corresponding to the first feature map;
[0018] Obtain a neighborhood pixel point set corresponding to each pixel point on the first feature map, and obtain a second representation value corresponding to the first feature image according to the grayscale value of each pixel point on the first feature map and the grayscale value of each neighborhood pixel point in the neighborhood pixel point set corresponding to each pixel point;
[0019] A target chaotic eigenvalue corresponding to the first characteristic graph is obtained according to the first eigenvalue, the second eigenvalue, the first characterization value, and the second characterization value.
[0020] Preferably, the method for obtaining the first eigenvalue corresponding to the first characteristic graph includes:
[0021] A negative correlation mapping is performed on the information entropy, and a value obtained by subtracting the negative correlation mapping from a constant 1 is recorded as a first eigenvalue corresponding to the first characteristic map.
[0022] Preferably, the method for obtaining a neighborhood pixel point set corresponding to each pixel point on the first feature map includes:
[0023] For any pixel point on the first feature image: all pixel points in the eight neighborhoods of the pixel point on the first feature image are recorded as neighborhood pixel points corresponding to the pixel point, and the set constructed by all neighborhood pixel points corresponding to the pixel point is recorded as the neighborhood pixel point set corresponding to the pixel point.
[0024] Preferably,
[0025] Preferably, the method for obtaining the second characterization value corresponding to the first feature image includes:
[0026] For any pixel point on the first feature image, the absolute value of the difference between the grayscale value of each neighboring pixel point in the neighborhood pixel point set corresponding to the pixel point and the grayscale value of the pixel point is recorded as the grayscale feature difference value corresponding to the corresponding neighborhood pixel point, and the average of the grayscale feature difference values corresponding to each neighboring pixel point in the neighborhood pixel point set corresponding to the pixel point is recorded as the feature difference value corresponding to the pixel point;
[0027] A value obtained by normalizing the average of the feature difference values corresponding to all pixels on the first feature image is recorded as a second characterization value corresponding to the first feature image.
[0028] Preferably, a method for obtaining a target chaotic eigenvalue corresponding to the first characteristic graph according to the first eigenvalue, the second eigenvalue, the first characterization value and the second characterization value includes:
[0029] Recording a value obtained by weighted summing the first eigenvalue and the second eigenvalue corresponding to the first feature graph as the first chaotic eigenvalue corresponding to the first feature graph;
[0030] Recording a value obtained by weighted summing the first characterization value and the second characterization value corresponding to the first characteristic graph as the second chaotic characteristic value corresponding to the first characteristic graph;
[0031] The calculated average of the first chaotic eigenvalue corresponding to the first feature map and the second chaotic eigenvalue corresponding to the first feature map is recorded as the target chaotic eigenvalue corresponding to the first feature map.
[0032] Preferably, the method for obtaining the pooling mode corresponding to the first feature map includes:
[0033] For any first feature image: determine whether the target chaos feature value corresponding to the first feature image is greater than the preset chaos threshold. If so, use maximum pooling as the pooling method corresponding to the first feature image; otherwise, use average pooling as the pooling method corresponding to the first feature image.
[0034] Beneficial effect: The present invention first obtains a two-dimensional matrix corresponding to each hose sample grayscale image in a hose sample grayscale image set; then the two-dimensional matrix corresponding to each hose sample grayscale image is input into a convolutional layer of a convolutional neural network, the convolutional layer outputs a first feature map corresponding to each hose sample grayscale image, and according to the first feature map, a target chaotic eigenvalue corresponding to the first feature map is obtained; then, according to the target chaotic eigenvalue, a pooling method corresponding to the first feature map is obtained, and subsequently the first feature map is input into a pooling layer of a convolutional neural network, and a pooling operation is performed on the corresponding first feature map according to the pooling method corresponding to the first feature map, the pooling layer outputs a second feature map corresponding to the first feature map, the second feature map is input into a fully connected layer of the convolutional neural network, and the convolutional neural network is trained according to the output result of the fully connected layer and the loss function to obtain a trained convolutional neural network; finally, the hose image to be detected is obtained, the hose image to be detected is input into the trained convolutional neural network, and the hose is optimized and designed according to the result output by the trained convolutional neural network. The pooling method corresponding to the first feature map obtained based on the target chaotic eigenvalue in the present invention can effectively prevent overfitting, thereby enabling the trained convolutional neural network model to have better generalization ability. The hose can also be optimized more reliably based on the network model with better generalization ability. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0036] Figure 1 This is a flow chart of a hose optimization design method based on deep learning of the present invention. DETAILED DESCRIPTION
[0037] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field belong to the scope of protection of the embodiments of the present invention.
[0038] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.
[0039] This embodiment provides a hose optimization design method based on deep learning, which is described in detail as follows:
[0040] like Figure 1 As shown, the hose optimization design method based on deep learning includes the following steps:
[0041] Step S001, obtaining a two-dimensional matrix corresponding to each hose sample grayscale image in a hose sample grayscale image set.
[0042] The main purpose of this embodiment is to train the convolutional neural network so that the generalization ability of the trained network model is better, and then the prediction result of the trained network model is more accurate. Then, based on the more accurate prediction result, the hose can be more reliably optimized and designed. The convolutional neural network in this embodiment refers to the CNN convolutional neural network.
[0043] In this embodiment, a preset number of hoses are first selected and recorded as sample hoses. An industrial camera is used to capture images of each sample hose, and the captured images are recorded as hose sample images corresponding to the sample hoses. A set constructed by all the captured hose sample images is recorded as a hose sample image set. In specific applications, the implementer needs to set the preset number of values according to actual conditions, and a larger number of hose sample images is required in this embodiment. In addition, the hose sample images captured in this embodiment also include images reflecting the physical characteristics of the hose, and the physical characteristics include material texture, diameter, shape edge, etc.
[0044] Then, all the acquired hose sample images are denoised and grayscaled, and the hose sample images after denoising and grayscale processing are recorded as hose sample grayscale images corresponding to the corresponding hose sample images, and the set constructed by all the hose sample grayscale images is recorded as a hose sample grayscale image set, and each hose sample grayscale image is converted into a two-dimensional matrix to obtain a two-dimensional matrix corresponding to each hose sample grayscale image, and the two-dimensional matrix corresponding to each hose sample grayscale image is composed of the grayscale value of each pixel in the corresponding hose sample grayscale image; in addition, the method of converting a two-dimensional image into a two-dimensional matrix is a well-known technology, so it will not be described in detail in this embodiment.
[0045] Therefore, this embodiment can obtain the two-dimensional matrix corresponding to each hose sample grayscale image in the hose sample grayscale image set through the above process; in this embodiment, the hose sample grayscale image set is a training set during network training, and in subsequent testing, a set constructed by arbitrarily selecting B hose sample grayscale images in the hose sample grayscale image set can be used as a test set, and the value of B needs to be set by the implementer according to actual conditions.
[0046] Step S002: input the two-dimensional matrix corresponding to each hose sample grayscale image into the convolution layer of the convolutional neural network, and the convolution layer outputs the first feature map corresponding to each hose sample grayscale image; according to the first feature map, obtain the target chaotic eigenvalue corresponding to the first feature map.
[0047] Next, this embodiment will train the convolutional neural network based on the two-dimensional matrix corresponding to each hose sample grayscale image in the hose sample grayscale image set obtained above. However, since the input layer will input a large number of two-dimensional matrices corresponding to the images during the training process, that is, it contains more convolution kernels and feature maps, this situation will lead to overfitting, high computational complexity and too high dimension. Therefore, after the convolution layer is built, a pooling layer is usually used to perform a pooling operation on the feature map obtained by the convolution operation. However, when performing the pooling operation, the pooling method is usually selected randomly or based on experience. Although this method of selecting the pooling method is not very useful in subsequent pooling operations, The operation can reduce the computational complexity or reduce the dimension, but this may not effectively prevent overfitting, which may lead to low generalization ability of the network model. Therefore, in order to make the generalization ability of the network model higher, this embodiment will determine the corresponding pooling method based on the chaotic features of the feature map output by the convolution layer. Therefore, this embodiment will analyze the first feature map corresponding to each hose sample grayscale image output by the convolution layer to obtain the target chaotic feature value corresponding to the first feature map. The target chaotic feature value is used to determine the pooling method of the first feature map. Therefore, the specific process of obtaining the target chaotic feature value corresponding to the first feature map is as follows:
[0048] There are two common pooling methods, namely maximum pooling and average pooling; maximum pooling refers to taking the maximum of feature points in the neighborhood, so maximum pooling can retain the maximum value in the feature map and enhance the model's sensitivity to small local changes, that is, maximum pooling can well retain texture feature information or help highlight the most significant features in the region. Therefore, when the first feature map contains obvious local features, such as edge texture information, using maximum pooling to perform a pooling operation on the first feature map can retain or highlight texture feature information, that is, when the overall texture distribution of the image is relatively uneven or relatively chaotic, the effect of using maximum pooling is better; average pooling refers to only averaging the feature points in the neighborhood, so average pooling helps to suppress noise and make the features more stable, that is, average pooling can well retain the background or smooth feature map, so it is more effective to use average pooling when smooth features need to be extracted, that is, when the overall texture of the image is relatively uniform or relatively less chaotic, the effect of using average pooling is better. Therefore, based on the above feature analysis of maximum pooling and average pooling, this embodiment then analyzes the first feature map, obtains the target chaos feature value corresponding to the first feature map based on the analysis result, and subsequently determines the pooling method based on the target chaos feature value corresponding to the first feature map, specifically:
[0049] For any first feature map:
[0050] First, the information entropy of the first feature map is obtained, and a negative correlation mapping is performed on the information entropy of the first feature map. The value obtained by subtracting the negative correlation mapping from the constant 1 is recorded as the first eigenvalue corresponding to the first feature map; and the information entropy can reflect the degree of confusion of the image information. When the value of the information entropy of the first feature map is larger, it indicates that the degree of confusion of the grayscale value of the pixel point on the first feature map is higher, that is, the distribution of texture information on the first feature map is more chaotic. Conversely, when the value of the information entropy of the first feature map is smaller, it indicates that the degree of confusion of the grayscale value of the pixel point on the first feature map is lower, that is, the distribution of texture information on the first feature map is less chaotic. Therefore, when the first eigenvalue corresponding to the first feature map is larger, it indicates that the distribution of texture information on the first feature map is more chaotic, and when the first eigenvalue corresponding to the first feature map is smaller, it indicates that the distribution of texture information on the first feature map is less chaotic.
[0051] Then, the maximum grayscale value and the minimum grayscale value on the first characteristic map are obtained, and the difference between the maximum grayscale value on the first characteristic map and the minimum grayscale value on the first characteristic map is recorded as the grayscale difference value corresponding to the first characteristic map; the grayscale maximum limit value is obtained, and the ratio of the grayscale difference value corresponding to the first characteristic map to the grayscale maximum limit value is recorded as the second eigenvalue corresponding to the first characteristic map; and when the difference between the maximum grayscale value on the first characteristic map and the minimum grayscale value on the first characteristic map is larger, that is, the second eigenvalue is larger, indicating that the disorder degree of the first characteristic map is higher, that is, the first characteristic map is The more chaotic the distribution of texture information on the graph, the smaller the difference between the maximum grayscale value on the first feature map and the minimum grayscale value on the first feature map, that is, the smaller the second eigenvalue, indicating that the degree of chaos of the first feature map is lower, that is, the less chaotic the distribution of texture information on the first feature map; in addition, the maximum grayscale limit value in this embodiment is 255, and the difference between the maximum grayscale value on the first feature map and the minimum grayscale value on the first feature map is compared with 255 in order to reflect the degree of difference, that is, to reflect the proportion of grayscale difference, and also to normalize the grayscale difference.
[0052] Then, the first eigenvalue and the corresponding second eigenvalue corresponding to the first feature map are weighted summed, and the value after the weighted sum is recorded as the first chaotic eigenvalue corresponding to the first feature map; the first chaotic eigenvalue corresponding to the first feature map is calculated according to the following formula:
[0053]
[0054] in, is the first chaotic eigenvalue corresponding to the first characteristic map, is the first weight value, is the information entropy of the first feature graph, exp() is an exponential function with a constant e as the base, is the second weight value, is the maximum grayscale value on the first feature map, is the minimum grayscale value on the first feature map, is the difference between the maximum grayscale value on the first feature map and the minimum grayscale value on the first feature map, is the first eigenvalue corresponding to the first characteristic graph, is the second characterization value corresponding to the first feature map.
[0055] And when The larger the value, The larger the value of The larger the value of The larger the value of is, the more chaotic the texture information distribution on the first feature map is. The smaller the value of The smaller the value of The smaller the value of The smaller the value is, the less chaotic the distribution of texture information on the first feature map is; in addition, in a specific application, the implementer can set the first weight value and the second weight value according to actual conditions. For example, in this embodiment, the first weight value and the second weight value are set to 0.6 and 0.4 respectively.
[0056] The first chaotic eigenvalue calculated above is obtained by analyzing the grayscale value distribution of the entire image. In order to more accurately analyze the image texture distribution characteristics, this embodiment will then obtain the second chaotic eigenvalue corresponding to the first feature map based on the gradient information and the grayscale difference between the pixel point and its corresponding neighboring pixel point. The specific process is as follows:
[0057] The gradient amplitude of each pixel point on the first feature map is calculated, and the normalized value of the mean of the gradient amplitudes of all the pixel points on the first feature map is recorded as the first representation value corresponding to the first feature map; and when the mean of the gradient amplitudes of all the pixel points on the first feature map is larger, it indicates that the details on the first feature map are richer, and also indicates that the distribution of texture information on the first feature map is more chaotic; conversely, when the mean of the gradient amplitudes of all the pixel points on the first feature map is smaller, it indicates that the details on the first feature map are less rich, and also indicates that the distribution of texture information on the first feature map is less chaotic.
[0058] For any pixel point on the first feature image: all pixel points in the eight neighborhoods of the pixel point on the first feature image are recorded as neighborhood pixel points corresponding to the pixel point, and the set constructed by all neighborhood pixel points corresponding to the pixel point is recorded as the neighborhood pixel point set corresponding to the pixel point; the absolute value of the difference between the grayscale value of each neighborhood pixel point in the neighborhood pixel point set corresponding to the pixel point and the grayscale value of the pixel point is calculated, and recorded as the grayscale feature difference value corresponding to the corresponding neighborhood pixel point; the average of the grayscale feature difference values corresponding to each neighborhood pixel point in the neighborhood pixel point set corresponding to the pixel point is calculated, and recorded as the feature difference value corresponding to the pixel point.
[0059] Then, the mean of the feature difference values corresponding to all the pixels on the first feature image is calculated, and the value after normalization of the mean of the feature difference values corresponding to all the pixels on the first feature image is recorded as the second representation value corresponding to the first feature image; and when the mean of the feature difference values corresponding to all the pixels on the first feature image is larger, it indicates that the grayscale values corresponding to the pixels on the first feature image and their neighboring pixels are less similar, and further indicates that the distribution of texture information on the first feature image is more chaotic; conversely, when the mean of the feature difference values of all the pixels on the first feature image is smaller, it indicates that the grayscale values corresponding to the pixels on the first feature image and their neighboring pixels are more similar, and also indicates that the distribution of texture information on the first feature image is less chaotic.
[0060] Then, the first characterization value and the corresponding second characterization value corresponding to the first feature map are weighted summed, and the value after the weighted sum is recorded as the second chaotic eigenvalue corresponding to the first feature map; the second chaotic eigenvalue corresponding to the first feature map is calculated according to the following formula:
[0061]
[0062] in, is the second chaotic eigenvalue corresponding to the first eigenmap, is the third weight value, Norm() is the normalization function, M is the total number of pixels on the first feature map, is the gradient amplitude of the i-th pixel on the first feature map, is the fourth weight value, is the number of neighboring pixels in the neighborhood pixel set corresponding to the i-th pixel on the first feature map, is the absolute value of the difference between the grayscale value of the i-th pixel on the first feature map and the grayscale value of the p-th neighboring pixel in its corresponding neighboring pixel set, is the first characterization value corresponding to the first feature map, is the second characterization value corresponding to the first feature map.
[0063] and The bigger, The larger the The larger the value of The larger the value of is, the more chaotic the texture information distribution on the first feature map is. The smaller, The smaller the time, the The smaller the value of The smaller the value is, the less chaotic the distribution of texture information on the first feature map is; in addition, in a specific application, the implementer can set the third weight value and the fourth weight value according to actual conditions. For example, in this embodiment, the third weight value and the fourth weight value are set to 0.7 and 0.3, respectively.
[0064] Therefore, through the above process, the first chaotic eigenvalue corresponding to the first feature map and the corresponding second chaotic eigenvalue are obtained, and then the average of the first chaotic eigenvalue corresponding to the first feature map and the corresponding second chaotic eigenvalue is recorded as the target chaotic eigenvalue corresponding to the first feature map. The larger the target chaotic eigenvalue corresponding to the first feature map is, the more chaotic the texture information distribution on the first feature map is. Conversely, the smaller the target chaotic eigenvalue corresponding to the first feature map is, the less chaotic the texture information distribution on the first feature map is.
[0065] Therefore, this embodiment can obtain the target chaotic feature values corresponding to all the first feature maps through the above-mentioned method of obtaining the target chaotic feature value corresponding to the first feature map.
[0066] Step S003, according to the target chaotic eigenvalue, obtain the pooling method corresponding to the first feature map; input the first feature map to the pooling layer of the convolutional neural network, and perform a pooling operation on the corresponding first feature map according to the pooling method corresponding to the first feature map, and the pooling layer outputs a second feature map corresponding to the first feature map; input the second feature map to the fully connected layer of the convolutional neural network, complete the training of the convolutional neural network according to the output result of the fully connected layer and the loss function, and obtain a trained neural network.
[0067] Next, this embodiment will determine the pooling methods corresponding to all the first feature maps based on the target chaotic feature value corresponding to the first feature map obtained in step S002, and then perform a pooling operation on the corresponding first feature map according to the pooling method corresponding to the first feature map, and complete the training of the network to obtain a trained convolutional neural network. The specific process is:
[0068] For any first feature image: determine whether the target chaos feature value corresponding to the first feature image is greater than the preset chaos threshold. If so, it indicates that the texture information distribution on the first feature image is relatively chaotic, then the maximum pooling is used as the pooling method corresponding to the first feature image; otherwise, it indicates that the texture information distribution on the first feature image is relatively non-chaotic, then the average pooling is used as the pooling method corresponding to the first feature image.
[0069] In a specific application, the implementer may set a preset confusion threshold according to actual conditions. For example, in this embodiment, the preset confusion threshold is set to 0.5.
[0070] Then the first feature map is input into the pooling layer of the convolutional neural network, and the corresponding first feature map is pooled according to the pooling method corresponding to the first feature map. The pooling layer outputs the second feature map corresponding to the first feature map. The second feature map is subsequently input into the fully connected layer of the convolutional neural network, and then the convolutional neural network is trained according to the output result of the fully connected layer and the loss function to obtain a trained convolutional neural network. The method for determining the pooling method in this embodiment can not only reduce the computational complexity, reduce the dimension, and retain the data information of the original image, but also effectively prevent overfitting, thereby making the subsequent network model have better generalization ability.
[0071] In addition, in neural networks, fully connected layers are usually used in the last few layers of neural networks to integrate the features extracted by the previous layers (such as convolutional layers and pooling layers) and perform final classification or regression. Pooling layers are commonly used in convolutional neural networks to reduce the size of feature maps while retaining important feature information. When the output of the pooling layer needs to be connected to the fully connected layer, the processing flow is usually as follows:
[0072] Flatten the pooling layer output: The fully connected layer requires a one-dimensional feature vector as input, while the pooling layer outputs a multi-dimensional feature map. Therefore, the first step is to "flatten" these multi-dimensional feature maps into one-dimensional vectors. This process is simply to arrange the elements in the multi-dimensional array into a long vector in a certain order (such as row priority or column priority).
[0073] Connect to the fully connected layer: The flattened one-dimensional vector will be used as the input of the fully connected layer. Each neuron in the fully connected layer is connected to all neurons in the previous layer. Specifically, each element of this one-dimensional vector will be multiplied by the weight of each neuron in the fully connected layer. The number of neurons in the fully connected layer is set according to the complexity of classification or regression required.
[0074] Applying activation functions: After the neurons in the fully connected layer calculate the weighted sum, they are usually passed an activation function, such as ReLU, Sigmoid, or Tanh, to introduce nonlinear factors so that the network can learn more complex functions.
[0075] Moreover, in the neural network, the output layer is responsible for converting the output of the previous layer (such as the fully connected layer) into the final prediction results, which can be the probability of the category label (in the classification task) or the specific value (in the regression task); the processing from the fully connected layer to the output layer depends on the specific task type and the selected activation function. The following is how the classification task and regression task are processed:
[0076] For classification tasks, the output layer usually uses a softmax activation function, which can convert the real-valued vector output by the fully connected layer into a probability distribution, in which the value of each element represents the probability of the corresponding category. That is, the output of the fully connected layer is usually a linearly transformed vector, and each element of this vector corresponds to the score of a category.
[0077] For regression tasks, if an activation function is used, it is usually an identity activation function, which means that the output layer directly outputs the result of the fully connected layer, that is, the result of the output layer is the final prediction value.
[0078] In this embodiment, the parameters of the network model are updated through an optimization algorithm according to the current weights and biases, as well as the gradient information of the loss function, so that the loss function gradually decreases and the model gradually converges to a better state, that is, the loss function is used for supervised training in the training process of the convolutional neural network, and the loss function is usually a mean square error loss function or a cross entropy loss function.
[0079] Step S005, obtaining an image of the hose to be detected, inputting the image of the hose to be detected into a trained convolutional neural network, and optimizing the design of the hose according to the output result of the trained convolutional neural network.
[0080] This embodiment will then implement the optimal design of the hose based on the trained convolutional neural network:
[0081] In this embodiment, all the hoses produced in the current time period are obtained and recorded as the hoses to be detected. Then, images of all the hoses to be detected are acquired using an industrial camera and recorded as the images of the hoses to be detected. Then, the images of the hoses to be detected are input into the trained convolutional neural network, and the hoses are optimized and designed according to the output results of the trained convolutional neural network. For example, if the task type in the present embodiment is classification, that is, the convolutional neural network trained in the present embodiment can realize the classification of the hoses to be inspected, so the hose image of the hose to be inspected is input into the trained convolutional neural network, and the hoses to be inspected corresponding to each category can be obtained, for example, all qualified hoses to be inspected and all unqualified hoses to be inspected can be obtained, then the production process of the hose can be optimized or the design parameters of the hose can be optimized based on the unqualified rate, and the design parameters include the inner diameter, wall thickness and length of the hose, so as to improve the qualified rate of subsequent hose production, that is, when the unqualified rate is greater than the preset threshold, it is determined that the production process of the hose needs to be optimized or the design parameters of the hose need to be optimized; in addition, in the present embodiment, the preset threshold needs to be set according to the actual situation, for example, the preset threshold can be set to one percent in the present embodiment; and the specific hose optimization process is a well-known technology, so this embodiment will not be described in detail.
[0082] In summary, the present embodiment first obtains a two-dimensional matrix corresponding to each hose sample grayscale image in a hose sample grayscale image set; then, the two-dimensional matrix corresponding to each hose sample grayscale image is input into a convolutional layer of a convolutional neural network, and the convolutional layer outputs a first feature map corresponding to each hose sample grayscale image, and obtains a target chaotic eigenvalue corresponding to the first feature map according to the first feature map; then, according to the target chaotic eigenvalue, a pooling method corresponding to the first feature map is obtained, and subsequently, the first feature map is input into a pooling layer of a convolutional neural network, and a pooling operation is performed on the corresponding first feature map according to the pooling method corresponding to the first feature map, and the pooling layer outputs a second feature map corresponding to the first feature map, and the second feature map is input into a fully connected layer of a convolutional neural network, and the convolutional neural network is trained according to the output result of the fully connected layer and the loss function to obtain a trained convolutional neural network; finally, the hose image to be detected is obtained, and the hose image to be detected is input into the trained convolutional neural network, and the hose is optimized and designed according to the result output by the trained convolutional neural network. In this embodiment, the pooling method corresponding to the first feature map obtained based on the target chaotic eigenvalue can effectively prevent overfitting, thereby enabling the trained convolutional neural network model to have better generalization ability. The subsequent hose production process can also be optimized more reliably based on the network model with better generalization ability.
[0083] A hose optimization design device based on deep learning in this embodiment includes a memory and a processor, and the processor executes a computer program stored in the memory to implement the above-mentioned hose optimization design method based on deep learning.
[0084] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A hose optimization design method based on deep learning, characterized in that: The method comprises the following steps: Obtain a two-dimensional matrix corresponding to each hose sample grayscale image in the hose sample grayscale image set; Inputting the two-dimensional matrix corresponding to each grayscale image of the hose sample into the convolution layer of the convolutional neural network, the convolution layer outputs the first feature map corresponding to each grayscale image of the hose sample; obtaining the target chaotic feature value corresponding to the first feature map according to the first feature map; According to the target chaotic feature value, a pooling method corresponding to the first feature map is obtained; the first feature map is input into the pooling layer of the convolutional neural network, and a pooling operation is performed on the corresponding first feature map according to the pooling method corresponding to the first feature map, and the pooling layer outputs a second feature map corresponding to the first feature map; Inputting the second feature map into the fully connected layer of the convolutional neural network, completing the training of the convolutional neural network according to the output result of the fully connected layer and the loss function, and obtaining a trained convolutional neural network; Acquire an image of a hose to be inspected, input the image of the hose to be inspected into a trained convolutional neural network, and optimize the design of the hose according to a result output by the trained convolutional neural network; The method for obtaining the target chaotic eigenvalue corresponding to the first eigenmap includes: For any first feature map: obtain the information entropy of the first feature map, and obtain the first eigenvalue corresponding to the first feature map according to the information entropy; obtain the maximum grayscale value and the minimum grayscale value on the first feature map, and record the difference between the maximum grayscale value and the minimum grayscale value as the grayscale difference corresponding to the first feature map; obtain the grayscale maximum limit value, and record the ratio of the grayscale difference value to the grayscale maximum limit value as the second eigenvalue corresponding to the first feature map; obtain the gradient amplitude of each pixel point on the first feature map, and record the normalized value of the mean of the gradient amplitudes of all pixels on the first feature map as the first characterization value corresponding to the first feature map; obtain the neighborhood pixel point set corresponding to each pixel point on the first feature map, and obtain the second characterization value corresponding to the first feature image according to the grayscale value of each pixel point on the first feature map and the grayscale value of each neighborhood pixel point in the neighborhood pixel point set corresponding to each pixel point; obtain the target chaos eigenvalue corresponding to the first feature map according to the first eigenvalue, the second eigenvalue, the first characterization value and the second characterization value; The method for obtaining the first eigenvalue corresponding to the first feature map includes: performing negative correlation mapping on the information entropy, and recording the value obtained by subtracting the negative correlation mapping from a constant 1 as the first eigenvalue corresponding to the first feature map; The method for obtaining a neighborhood pixel point set corresponding to each pixel point on the first feature image includes: for any pixel point on the first feature image: all pixel points in the eight neighborhoods of the pixel point on the first feature image are recorded as neighborhood pixel points corresponding to the pixel point, and a set constructed by all the neighborhood pixel points corresponding to the pixel point is recorded as the neighborhood pixel point set corresponding to the pixel point; The method for obtaining the second characterization value corresponding to the first characteristic image includes: for any pixel point on the first characteristic image, recording the absolute value of the difference between the grayscale value of each neighboring pixel point in the set of neighboring pixel points corresponding to the pixel point and the grayscale value of the pixel point as the grayscale characteristic difference value corresponding to the corresponding neighboring pixel point, and recording the average of the grayscale characteristic difference values corresponding to each neighboring pixel point in the set of neighboring pixel points corresponding to the pixel point as the characteristic difference value corresponding to the pixel point; recording the value after normalizing the average of the characteristic difference values corresponding to all pixels on the first characteristic image as the second characterization value corresponding to the first characteristic image; The method for obtaining a target chaotic eigenvalue corresponding to the first characteristic graph according to the first eigenvalue, the second eigenvalue, the first characterization value and the second characterization value includes: recording the value obtained by weighted summation of the first eigenvalue corresponding to the first characteristic graph and the corresponding second eigenvalue as the first chaotic eigenvalue corresponding to the first characteristic graph; recording the value obtained by weighted summation of the first characterization value corresponding to the first characteristic graph and the corresponding second characterization value as the second chaotic eigenvalue corresponding to the first characteristic graph; and recording the calculated mean of the first chaotic eigenvalue corresponding to the first characteristic graph and the corresponding second chaotic eigenvalue as the target chaotic eigenvalue corresponding to the first characteristic graph.
2. A hose optimization design method based on deep learning as claimed in claim 1, characterized in that: The method for obtaining the pooling mode corresponding to the first feature map includes: For any first feature image: determine whether the target chaos feature value corresponding to the first feature image is greater than the preset chaos threshold. If so, use maximum pooling as the pooling method corresponding to the first feature image; otherwise, use average pooling as the pooling method corresponding to the first feature image.
3. A hose optimization design device based on deep learning, comprising a memory and a processor, characterized in that: The processor executes the computer program stored in the memory to implement a hose optimization design method based on deep learning as described in any one of claims 1-2.
