Structure classification of weft-knitted fabric based on lightweight convolutional neural network
Objective The structure of the fabric is one of the important parameters to guide the production of fabric.The automatic identification of the fabric structure through machine vision helps to improve the design and production efficiency.Weft knitted fabrics have complex knitting methods and various structures,and it is difficult to accurately determine the structure of the fabric only by the image of one side of the fabric.Therefore,it is necessary to design an efficient and accurate classification method for the special structure of weft knitted fabrics.Method A fabric image acquisition platform was built to capture images of both sides of fabric samples at multi-scale and various lighting conditions.A dataset containing images of weft knitted fabrics in nine categories was produced.The method in this paper was improved based on GhostNet which is a lightweight convolutional neural network.In order to improve the network's ability to learn different features,two strategies were adopted to introduce an attention mechanism in the feature extraction stage.The network structure was adjusted to a dual-branch architecture,so that the features of the double-sided image of knitted fabrics were simultaneously extracted through the weight-sharing sub-network,and the extracted high-dimensional feature maps were serially fused.Results The experimental part analyzes the effectiveness and performance of the proposed method.Multiple online augmentation methods increase the diversity of fabric sample data and improve the robustness of the model.Compared with the original data set,the model has higher accuracy rate on the validation set.Adding a dropout layer after the fully connected layer improves the generalization performance of the model.When the dropout rate is 0.4,the model has the best performance.For the fabric categories that are difficult to distinguish based on single-sided images,the proposed method has achieved a classification accuracy of more than 99%.In order to observe the feature extraction effect of the model more intuitively,the feature maps of different levels of the fabric image are visualized.The model pays more attention to important features such as the shape and texture of the fabric.Accuracy,macro precision,macro recall,and macro F1 are adopted to evaluate the performance of the model,and the number of parameters and computational complexity are calculated to measure the resource consumption of the model.The results of the ablation experiments show that the incorporation of the CBAM module effectively improves the performance of the model.Different models and methods are compared under the same hyper parameter settings.First,common CNN models are tested on the dataset constructed in this paper.The prosposed method achieves the highest classification accuracy of 99.51%,the macro precision rate is 0.994 1,the macro recall rate is 0.994 6,and the macro F1 score is 0.994 2,with lower FLOPs(0.31 G)and params(4.62 M)compared to other models.Conclusion Aiming at the classification of weft-knitted fabrics,a double-sided image data set is used in the classification of knitted fabrics.An end-to-end classification method of knitted fabric structure was prosposed based on GhostNet,which is a lightweight convolutional neural network.The experimental results show that the CBAM module enhances the feature discrimination between different fabrics,which improves the network performance.The double-sided features of weft-knitted fabric were efficiently extracted by dual-branch network architecture.Compared with other classification methods based on CNN,the proposed method has a higher classification accuracy and consumes less resources,which is conducive to the deployment of the model on mobile devices or embedded devices.In future work,the case that a single fabric image contains multiple fabric structure will become the focus of research,which is of great significance to further improve the recognition efficiency of the algorithm in the actual design and production process of fabrics.