Yarn-out state detection method and apparatus, device and storage medium
Provided is a yarn-out state detection method, an electronic device and a storage medium, relating to the field of computer, and in particular to the fields of detection technology, artificial intelligence technology and neural network model technology. The method includes: collecting a first image and laser reflection data of a target yarn path in a spinning box; obtaining an image feature of the target yarn path according to the first image; obtaining a laser feature of the target yarn path according to the laser reflection data; and using a yarn-out state detection model to obtain a yarn-out state of the target yarn path according to the image feature and the laser feature.
1 . A yarn-out state detection method, comprising:
collecting a first image and a laser reflection data of a target yarn path in a spinning box;
performing morphological processing on the first image, to obtain a second image;
dividing the second image into a plurality of segments in a length direction of the target yarn path, to obtain a plurality of sub-images;
performing feature extraction on the plurality of sub-images, to obtain a plurality of first image features;
obtaining an image feature of the target yarn path, according to the plurality of first image features and corresponding weight values, wherein the weight values are determined according to width values of yarn paths in the plurality of sub-images;
performing short-time Fourier transform on the laser reflection data, to obtain a time-frequency representation result;
determining a time-frequency feature, according to the time-frequency representation result;
obtaining a laser feature of the target yarn path, according to the time-frequency feature; and
using a yarn-out state detection model, to obtain a state category of the target yarn path according to the image feature and the laser feature.
2 . The method of claim 1 , wherein the collecting of the first image and the laser reflection data of the target yarn path in the spinning box, comprises:
controlling an inspection equipment to move to be in front of a spinning box to be detected; and
triggering a camera device and a laser scanning device of the inspection equipment to simultaneously collect the first image and the laser reflection data of the target yarn path in the spinning box, wherein the target yarn path comprises a moving path formed by converging a plurality of yarn bundles ejected from a spinneret plate into one strand through a yarn guide hook.
3 . The method of claim 1 , wherein the performing of the morphological processing on the first image, to obtain the second image, comprises:
using a first sliding window to traverse the first image, and performing a dilation operation to obtain a dilated image during each slide;
using a second sliding window to traverse the first image, and performing an erosion operation to obtain an eroded image during each slide; and
obtaining the second image according to morphological gradients of the dilated image and the eroded image.
4 . The method of claim 1 , wherein the obtaining of the image feature of the target yarn path, according to the plurality of first image features and corresponding weight values, comprises:
determining weight values of the plurality of sub-images according to width values of yarn paths contained in the plurality of sub-images;
obtaining second image features of the plurality of sub-images according to the weight values of the plurality of sub-images and the first image features; and
obtaining the image feature of the target yarn path according to the second image features of the plurality of sub-images.
5 . The method of claim 1 , wherein the obtaining of the laser feature of the target yarn path, according to the time-frequency feature, comprises:
extracting a main frequency feature, an energy peak feature and a dynamic change feature from the time-frequency feature; and
obtaining the laser feature of the target yarn path according to the main frequency feature, the energy peak feature and the dynamic change feature.
6 . The method of claim 1 , wherein the using of the yarn-out state detection model, to obtain a yarn-out state of the target yarn path according to the image feature and the laser feature, comprises:
obtaining a yarn-out state feature of the target yarn path by fusing the image feature and the laser feature; and
using the yarn-out state detection model to obtain the yarn-out state of the target yarn path according to the yarn-out state feature.
7 . A method for training a yarn-out state detection model, comprising:
performing morphological processing on a sample image, to obtain a third image;
dividing the third image into a plurality of segments in a length direction of a target yarn path, to obtain a plurality of sample sub-images;
performing feature extraction on the plurality of sample sub-images, to obtain a plurality of sample sub-image features;
obtaining a training image feature of the target yarn path, according to the plurality of sample sub-image features and corresponding weight values, wherein the weight values are determined according to width values of yarn paths in the plurality of sample sub-images;
performing short-time Fourier transform on laser sample data, to obtain a time-frequency representation result;
determining a time-frequency feature, according to the time-frequency representation result;
obtaining a training laser feature of the target yarn path, according to the time-frequency feature;
using a first detection model, to obtain a predicted result of a state category of the target yarn path according to the training image feature and the training laser feature;
determining a loss function according to the predicted result and an actual result of the state category of the target yarn path; and
updating a parameter of the first detection model based on the loss function to obtain a trained yarn-out state detection model.