Real-time target detection system for industrial fabric detection

By optimizing the structure of the YOLOv5 model, a lightweight LGTNet model is built, which solves the problem of imbalance in detection of fabric defects, and realizes efficient real-time detection in resource-constrained environments.

CN120259179APending Publication Date: 2025-07-04ZHEJIANG SCI-TECH UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510214801.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-26
Publication Date
2025-07-04

AI Technical Summary

Technical Problem

The existing lightweight object detection model has imbalance in detection accuracy and computational complexity in fabric defect detection, making it difficult to achieve efficient real-time reasoning on industrial sites or embedded devices.

Method used

The structure optimization of the YOLOv5 model is used to optimize the structure of the efficient gradient aggregation feature extraction module, feature-guided fusion pyramid network and selective downsampling module to build a lightweight LGTNet model, and combine data annotation and training to generate a detection system suitable for resource-constrained environments.

Benefits of technology

While maintaining high detection accuracy, it greatly reduces the amount of calculation and parameters and improves the inference speed. It is suitable for industrial inspection equipment and mobile terminals with limited resources to meet real-time inspection needs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120259179A_ABST
    Figure CN120259179A_ABST
Patent Text Reader

Abstract

The invention relates to the field of computer vision and deep learning, and discloses an industrial fabric detection-oriented real-time target detection system, which comprises a sample acquisition module used for acquiring fabric defect pictures and providing original data required by detection; the data labeling module is used for labeling defect categories of the collected fabric defect pictures and dividing data to generate sample image data; and the model structure optimization module is used for carrying out structure innovation on the YOLOv model by adopting an efficient gradient aggregation feature extraction module, a feature guide fusion pyramid network and a selective down-sampling module to obtain a lightweight LGTNet model. According to the method, the calculation structure of the target detection model is optimized by introducing the efficient gradient aggregation feature extraction module, the feature guide fusion pyramid network and the selective down-sampling module, so that the calculation amount (FLOPs) and the parameter quantity (Params) are greatly reduced while high detection precision is kept, and the reasoning speed of the model is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the fields of computer vision and deep learning, and in particular to a real-time object detection system for industrial fabric detection. Background Art

[0002] In the process of textile industrial production, fabric defect detection is an important part of quality control. Traditional detection methods mainly rely on manual inspection or computer vision algorithms based on handcrafted features (such as threshold segmentation, edge detection, etc.). Manual detection is limited by human visual fatigue and subjective judgment, with low efficiency and poor consistency. Traditional computer vision methods are difficult to accurately identify tiny or irregular defects in complex backgrounds because they cannot comprehensively capture the complex texture features of fabrics. In addition, in recent years, object detection methods based on deep learning (such as Faster R-CNN, SSD, YOLO series) have made certain progress in the field of fabric defect detection, and can improve the detection accuracy to a certain extent. However, due to the large computational amount and high number of parameters of these models, it is difficult to perform efficient real-time inference on industrial sites or embedded devices, which affects the feasibility of actual deployment.

[0003] The current lightweight improvement methods mainly focus on two aspects: on the one hand, by introducing lightweight networks such as GhostNet, MobileNet, and ELAN structures, the number of model parameters and computational complexity are reduced; on the other hand, multi-scale fusion strategies such as Feature Pyramid Network (FPN) and BiFPN are used to improve the detection ability for small targets and defects in complex backgrounds. However, these methods still have the problem of balancing detection accuracy and model lightweight, especially in the fabric defect detection task, problems such as insufficient multi-scale feature fusion, weak fine-grained feature expression ability, and easy information loss caused by traditional downsampling methods, resulting in a decline in model performance when facing complex textures and multi-scale targets. Summary of the Invention

[0004] In response to the above challenges, there is an urgent need for a lightweight object detection network that can balance high detection accuracy and low computational complexity to improve the efficiency and generalization ability of fabric defect detection, so that it can be applied to resource-constrained industrial environments and embedded devices. The present invention proposes a real-time object detection system for industrial fabric detection, which improves the lightweight level and detection accuracy of the model through key technologies such as an efficient gradient aggregation feature extraction module, a feature-guided fusion pyramid network, and a selective downsampling module, providing an efficient and low-cost automated detection solution for the textile industry.

[0005] The present invention adopts the following technical solutions: A real-time object detection system for industrial fabric detection, comprising:

[0006] A sample acquisition module, configured to obtain fabric defect pictures and provide the original data required for detection;

[0007] A data annotation module that annotates the defect categories of the collected fabric defect pictures and divides the data to generate sample image data;

[0008] A model structure optimization module that uses an efficient gradient aggregation feature extraction module, a feature-guided fusion pyramid network, and a selective downsampling module to innovate the structure of the YOLOv5 model and obtain a lightweight LGTNet model;

[0009] A training module that uses the pre-collected and annotated sample data to train the improved LGTNet to improve the detection accuracy;

[0010] A deployment module that deploys the efficient lightweight LGTNet model to the target mobile device to achieve efficient fabric defect detection;

[0011] The sample collection module, the data annotation module, the model structure optimization module, the training module, and the deployment module are connected through network communication.

[0012] A real-time object detection method for industrial fabric detection specifically includes the following steps:

[0013] S1: Collect fabric defect pictures and annotate and divide the collected pictures according to the corresponding defect categories to construct a sample image data set;

[0014] S2: In terms of model structure, combine an efficient gradient aggregation feature extraction module, a feature-guided fusion pyramid network, and a selective downsampling module to optimize the YOLOv5 structure and construct a lightweight LGTNet network;

[0015] S3: Use the sample image data to train the LGTNet to obtain an efficient lightweight object detection model;

[0016] S4: Deploy the trained lightweight model to the target mobile device to achieve efficient fabric defect detection

[0017] As a further description of the above technical solution:

[0018] In S1, it is necessary to collect fabric defect pictures covering multiple defect categories on the premise of ensuring the same production conditions to ensure the diversity and representativeness of the data and perform standardized processing on the data.

[0019] As a further description of the above technical solution:

[0020] The method for obtaining the sample image data in S1 is to use LabelImg software to annotate the collected defective pictures, and use the minimum bounding rectangle (BoundingBox) to frame the fabric defects. Among them, class represents the category of the defect, and x min and y min are the coordinates of the upper left vertex of the rectangle respectively, and x max and y max are the coordinates of the lower right vertex, so as to accurately describe the category of the defect and its specific position in the image. At the same time, a data augmentation strategy is adopted to improve the generalization ability of the dataset.

[0021] As a further description of the above technical solution:

[0022] The specific method in S2 is to use an efficient gradient aggregation feature extraction module to improve the feature extraction ability through dynamic channel adjustment and multi-branch feature fusion strategies, while reducing the computational amount. Use a feature-guided fusion pyramid network to enhance the feature fusion of different scales through a feature-guided mechanism and a bidirectional interactive dynamic fusion module, and improve the object detection ability of the model. Use a selective downsampling module, adopt deformable convolution and adaptive offset adjustment techniques, while retaining local fine-grained features, optimize the compression of the global spatial resolution, and improve the detection performance and computational efficiency.

[0023] As a further description of the above technical solution:

[0024] It further includes the following steps:

[0025] S5: Use the sample image data to train on LGTNet variants with different depths and widths (such as LGTNet-n, LGTNet-s, LGTNet-m) to generate multiple trained models;

[0026] S6: Perform performance evaluation and comparison on multiple trained models, and select the model with the best comprehensive performance as the final deployed LGTNet version according to indicators such as detection accuracy (mAP), inference speed (FLOPs), and lightweight effect (number of parameters).

[0027] As a further description of the above technical solution:

[0028] The method for training the model in S5 is to use common performance evaluation indicators in the field of object detection, including but not limited to precision (P), recall (R), mean average precision (mAP), floating point operations (FLOPs), and number of parameters (Params), comprehensively measure the detection performance, computational complexity, and inference efficiency of the model, and select the optimal model for deployment.

[0029] As a further description of the above technical solution:

[0030] The specific method of S4 is to use the trained LGTNet model to replace the YOLOv5 model file in the original detection software, verify the input and output data dimensions of the model, and adjust them if necessary to match the actual detection requirements. At the same time, update the label file to ensure the consistency of detection categories, configure the interface, name, and icon of the target APP, generate and export the installation package containing the LGTNet model, import and install this installation package onto the target mobile device to form a runnable detection APP, start the target APP and run LGTNet to complete the efficient detection task of fabric defects.

[0031] The present invention has the following beneficial effects:

[0032] 1. In the present invention, by introducing an efficient gradient aggregation feature extraction module, a feature-guided fusion pyramid network, and a selective downsampling module, the computational structure of the object detection model is optimized, so that while maintaining high detection accuracy, the amount of computation (FLOPs) and the number of parameters (Params) are significantly reduced, the inference speed of the model is increased, enabling it to operate efficiently on resource-constrained industrial detection devices, mobile terminals, or embedded devices, meeting the requirements of real-time detection and lightweight deployment.

[0033] 2. In the present invention, through the feature-guided fusion pyramid network structure, a two-way interaction and dynamic feature fusion mechanism are introduced to enhance the fusion of features at different levels, improve the cross-scale object detection ability, optimize the small object detection performance, and ensure that defects can still be accurately detected in complex texture, multi-scale, and low-contrast environments.

[0034] 3. In the present invention, by adopting an efficient gradient aggregation feature extraction module, combined with a dynamic channel adjustment and multi-branch feature fusion strategy, the ability to extract local fine-grained features is enhanced, while computational redundancy is reduced, and the detection stability of the model is improved. In addition, the selective downsampling module optimizes the downsampling process through deformable convolution and adaptive offset adjustment techniques, reduces information loss while improving the detection ability for defect targets with different types, shapes, and position distributions, and enhances the adaptability of the model.

[0035] 4. In the present invention, by adopting a modular deployment strategy, through optimizing the model file format and software adaptability, it supports various industrial application scenarios such as mobile terminals (such as Android and iOS devices), embedded platforms (such as NVIDIA Jetson Nano, RK3588), and edge computing devices. In the model deployment stage, input and output data format adjustment, label file matching, and model optimization and compression can be carried out through automated adaptation tools to ensure compatibility in different device environments, reduce deployment costs, and improve the actual application efficiency.

[0036] In summary, the present invention has significant advantages in terms of detection accuracy, computational efficiency, lightweight deployment, generalization ability, and industrial applicability. It can be widely applied to fields such as intelligent quality inspection in the textile industry, industrial automation detection, and embedded AI vision systems, providing an efficient, low-cost, and deployable intelligent detection solution for fabric defect detection and meeting the requirements of industrial production for efficient detection and quality control. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Figure 1 FIG. is a flowchart of a real-time object detection system for industrial fabric detection according to the present invention;

[0038] Figure 2 FIG. is a structural diagram of an efficient gradient aggregation lightweight object detection network according to the present invention;

[0039] Figure 3 FIG. is a schematic structural diagram of an improved efficient gradient aggregation feature extraction module according to the present invention;

[0040] Figure 4 FIG. is a schematic structural diagram of a multi-feature guided fusion pyramid network according to the present invention;

[0041] Figure 5 FIG. is a selective downsampling structure diagram according to the present invention;

[0042] Figure 6 FIG. is a schematic diagram of the system framework in the present invention.

[0043] Legend Explanation:

[0044] 1. Sample acquisition module; 2. Data annotation module; 3. Model structure optimization module; 4. Training module; 5. Deployment module; 6. Model compression and acceleration module. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0045] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0046] Refer to Figures 1-6

[0047] Embodiment 1

[0048] The present invention provides a real-time object detection system for industrial fabric detection, including:

[0049] A sample acquisition module 1 for obtaining fabric defect pictures and providing the original data required for detection;

[0050] The data annotation module 2 annotates the collected fabric defect images with defect categories and divides the data to generate sample image data;

[0051] The model structure optimization module 3 uses an efficient gradient aggregation feature extraction module, a feature-guided fusion pyramid network, and a selective downsampling module to innovate the structure of the YOLOv5 model and obtain a lightweight LGTNet model;

[0052] The training module 4 uses the pre-collected and annotated sample data to train the improved LGTNet to improve the detection accuracy;

[0053] The deployment module 5 deploys the efficient and lightweight LGTNet model to the target mobile device to achieve efficient fabric defect detection;

[0054] The sample collection module 1, the data annotation module 2, the model structure optimization module 3, the training module 4, and the deployment module 5 are connected through network communication.

[0055] Embodiment 2

[0056] Based on Embodiment 1, the present invention also provides a real-time object detection method for industrial fabric detection, which specifically includes the following steps:

[0057] S1: Collect fabric defect images, annotate and divide the collected images according to the corresponding defect categories to construct a sample image data set. Specifically, on the premise of ensuring the same production conditions, collect fabric defect images covering a variety of defect categories to ensure the diversity and representativeness of the data, and perform standardization processing on the data. Further, the method for obtaining sample image data is to use LabelImg software to annotate the collected defect images, use the minimum bounding rectangle (BoundingBox) to frame the fabric defects, where class represents the category of the defect, x min and y min are the coordinates of the upper left vertex of the rectangle respectively, and x max and y max are the coordinates of the lower right vertex, so as to accurately describe the category of the defect and its specific position in the image. At the same time, adopt data augmentation strategies to improve the generalization ability of the data set;

[0058] Further, S1 includes:

[0059] S101: Collect fabric defect images. Under uniform lighting conditions and the same production environment, use a high-resolution industrial camera to collect fabric defect images. Due to the large differences in the characteristics of fabric defects (such as broken yarns, oil stains, wrinkles, color differences, holes, etc.), it is necessary to ensure the diversity and representativeness of the data samples. The following specifications should be followed during data collection:

[0060] Camera parameter settings: Use an industrial camera with a resolution of 50 million pixels, an aperture of f / 2.8, and an exposure time of 1 / 1000 s to ensure high-definition and high-contrast imaging;

[0061] Acquisition environment: Adopt a standard D65 light source to reduce ambient light interference and ensure detection consistency.

[0062] Data format: Store as a 24-bit RGB three-channel image (JPEG / PNG format), with a resolution of not less than 2048×2048 pixels;

[0063] S102: Data preprocessing. Since the fabric surface has complex textures and obvious color variations, directly using the original data may affect the detection accuracy of the model. Therefore, in the data preprocessing stage, the following optimizations are carried out:

[0064] Normalization processing, normalize all input images to make the pixel value distribution uniform:

[0065]

[0066] where I is the original image, and μ and σ are the mean and standard deviation of the dataset respectively;

[0067] Data augmentation, rotate, mirror flip, randomly crop, color perturb, and add Gaussian noise to the dataset to enhance the generalization ability of the model;

[0068] Lighting equalization, adopt histogram equalization and Gamma correction to improve the robustness of detection and reduce the impact of lighting on model learning;

[0069] S103: Use LabelImg software for manual annotation, and each defect is annotated with a minimum bounding rectangle (BoundingBox);

[0070] S104. Set the defect category class;

[0071] S105. Calculate the coordinates of the rectangle:

[0072] x min ,y min : The upper left corner coordinates, x max ,y max : The lower right corner coordinates. The dataset is divided into training and test sets at a ratio of 8:2 to ensure the generalization ability of the model.

[0073] S2: In terms of the model structure, the YOLOv5 structure is optimized by integrating an efficient gradient aggregation feature extraction module, a feature-guided fusion pyramid network, and a selective downsampling module to construct a lightweight LGTNet network. The specific method is as follows: Use the efficient gradient aggregation feature extraction module to enhance the feature extraction ability and reduce the computational cost through dynamic channel adjustment and multi-branch feature fusion strategies. Use the feature-guided fusion pyramid network to enhance the feature fusion at different scales and improve the object detection ability of the model through the feature guidance mechanism and the bidirectional interaction dynamic fusion module. Use the selective downsampling module to optimize the global spatial resolution compression while retaining local fine-grained features and improve the detection performance and computational efficiency by adopting deformable convolution and adaptive offset adjustment techniques;

[0074] Further, S2 includes:

[0075] S201: The efficient gradient aggregation feature extraction module optimizes the backbone network to enhance the feature extraction ability and reduce the computational cost through dynamic channel adjustment and multi-branch feature fusion;

[0076] Multi-branch feature extraction:

[0077]

[0078] where F in is the input feature, Conv i is the convolution operation at different scales, w i is the learnable weight, and F out is the fused feature.

[0079] S202: The feature-guided fusion pyramid network optimizes the feature fusion layer to enhance the multi-scale object detection ability through bidirectional interaction and dynamic feature fusion.

[0080] Bidirectional interaction feature fusion:

[0081] F fused = Conv(ReLU(F low + Upsample(F high )))

[0082] where F low is the low-level feature, F high is the high-level feature, and Upsample is the bilinear interpolation upsampling.

[0083] Dynamic feature fusion weight calculation:

[0084] W = Softmax(W1·F low + W2·F high )

[0085] Among them, W1 and W2 are trainable parameters.

[0086] S203: The selective downsampling module optimizes the downsampling strategy, and uses deformable convolution and adaptive offset adjustment technology to retain local fine-grained features.

[0087] Formula for deformable convolution:

[0088]

[0089] Among them, x(p) is the input feature, w(p n ) is the convolution kernel weight, and Δp n is the adaptive sampling offset

[0090] S3: Use the sample image data to train LGTNet to obtain an efficient lightweight object detection model;

[0091] S4: Deploy the trained lightweight model to the target mobile device to achieve efficient fabric defect detection. Specifically, the specific method is to use the trained LGTNet model to replace the YOLOv5 model file in the original detection software, verify the input and output data dimensions of the model, and adjust them if necessary to match the actual detection requirements. At the same time, update the label file to ensure the consistency of the detection categories, configure the interface, name, and icon of the target APP, generate and export the installation package containing the LGTNet model, import and install this installation package to the target mobile device to form a runnable detection APP, start the target APP and run LGTNet to complete the efficient detection task of fabric defects;

[0092] Furthermore, S4 includes:

[0093] S401: Deploy the efficient lightweight model to the target mobile device for fabric defect detection, and use mixed-precision training (FP16) to accelerate the training process;

[0094] S402: Use the AdamW optimizer with an initial learning rate of 0.001 and decay using the cosine annealing strategy; S403: Use FocalLoss as the classification loss to optimize the object detection effect:

[0095] F(p t ) = -α(1 - p t ) γ log(p t )

[0096] S5: Use the sample image data to train on LGTNet variants with different depths and widths (such as LGTNet-n, LGTNet-s, LGTNet-m) to generate multiple trained models. Specifically, the method for training the model is to use the performance evaluation metrics commonly used in the field of object detection, including but not limited to precision (P), recall (R), mean average precision (mAP), floating point operations (FLOPs), and number of parameters (Params), comprehensively measure the detection performance, computational complexity, and inference efficiency of the model, and select the optimal model for deployment;

[0097] Furthermore, S5 includes:

[0098] S501: Convert to ONNX or TensorRT format to optimize the inference speed;

[0099] S502: Optimize the input and output data formats on embedded devices such as Jetson Nano and RK3588 to achieve real-time detection capabilities with low latency (Latency < 10ms) and high frame rate (FPS > 30).

[0100] S6: Perform performance evaluation and comparison on multiple trained models, and select the model with the best comprehensive performance as the final deployed LGTNet version according to indicators such as detection accuracy (mAP), inference speed (FLOPs), and lightweight effect (number of parameters).

[0101] In addition, in step S201, the method for feature extraction using the efficient gradient aggregation feature extraction module is as follows:

[0102] First, the input feature is divided into two channel components, namely the main path Y1 and the bypass path Y2 through a 1×1 convolution. Specifically, the input channels are reduced to 2C through the formula Y = Conv 1×1 (X), where C h = C2·e is the number of intermediate channels. Subsequently, use the chunk operation to split the reduced-dimensional feature into two equal-width parts. The main path Y1 is directly retained to supplement global information during splicing, and the bypass path Y2 enters the multi-layer convolution extraction stage. h

[0103] In the bypass path feature extraction, Y2 first extracts local features through a 3×3 convolution, and the number of its output channels is determined by mid = C h ·scale. Then, the convolved feature passes through N - 1 3×3 convolution modules layer by layer, and the formula is Y i+1 = Conv 3×3 (Y i), i ∈ [3, 3 + n - 1], realizing recursive deep feature extraction. At the last stage of the side path, the features are compressed to a fixed dimension through a 1×1 convolution to prepare for subsequent fusion.

[0104] All the features extracted from the side path and the main path Y1 will be concatenated in the channel dimension to generate the fused feature Y concat = Concat(Y1, Y3, …, Yn+2). This operation integrates features at different levels and enriches the expressive ability of the output. To obtain the final output, the fused features are compressed to the target number of channels C2 through a 1×1 convolution, and the final output feature dimension is (H, W, C2).

[0105] In step S202, a feature-guided fusion pyramid network is used to replace the Neck network of the YOLOv5 model. The method for cross-scale feature fusion is as follows:

[0106] First, the module receives the input feature map (such as a three-dimensional feature of C×H×W) and locally enhances the input features through the ELA module. The ELA module uses a local attention mechanism to extract fine-grained information in the features and generates a set of weighted feature maps for subsequent dynamic adjustment. Then, the input features are multiplied element-wise with the weighted features generated by the ELA to complete the dynamic feature enhancement. This operation significantly improves the expressive ability of the features by enhancing important features and suppressing irrelevant or noisy features.

[0107] Subsequently, the enhanced feature map is subjected to channel integration through a 1×1 convolutional layer (Conv1×1). This step not only effectively reduces the computational overhead but also further optimizes the expressive ability of the feature map. Finally, the output feature map has the same size as the input feature, but its expressive ability is more rich and efficient. The whole module is characterized by dynamicity, light weight, and enhancement. It realizes the adaptive adjustment of the input features through the dynamic weight generation mechanism of the ELA module, simplifies the computational complexity through the light-weight design, and significantly enhances the expressive ability of important features, providing efficient support for the overall detection network.

[0108] The fusion process is divided into two parts. In the first part, the high-level feature (F high ) is processed through a 2D convolution and then passed to the ELA module to extract the attention information in the horizontal and vertical directions and generate a position attention mask. This mask is multiplied with the low-level feature (F low ) to complete the detail enhancement under semantic guidance. Subsequently, the enhanced low-level feature and the original low-level feature are fused through addition to generate a preliminarily enhanced output feature.

[0109] In the second stage, the fused low-level features are processed through a downsampling pattern and input into the ELA module together with the high-level features. At this time, the low-level features reversely generate an attention mask to guide the high-level features and enhance their ability to express details. Finally, through multiplication and addition fusion, the final output features containing high-level semantics and detailed information are generated.

[0110] In step S203, the selective downsampling module is used to replace the downsampling module of the YOLOv5 model. The method of enhancing the feature expression ability and adapting to the diversity of target shapes through dynamically adjusting the sampling point positions and the efficient feature fusion mechanism is as follows:

[0111] Based on the input feature map C, H, W, the module first reduces the number of channels to C / 2 through channel downsampling operation and divides it into two branches for feature processing: a part of the features are processed through standard convolution, and the other part of the features enter the linear deformable convolution branch to generate dynamic sampling features.

[0112] In the LDConv branch, first, a two-dimensional convolution (2DConv) is used to generate an offset. This offset calculates the initial shape of the sampling points through a dynamic generation algorithm (GeneratingAlgorithm) and determines the distribution of the sampling area based on the parameter N (the number of dynamic convolution sampling points). The generation of the offset is based on the initial coordinate P0, and combined with the dynamic adjustment mechanism, a sampling point distribution that flexibly adapts to different target shapes is obtained. These offset points are used to dynamically adjust the sampling positions, so as to select more representative and fine-grained regions on the feature map.

[0113] Subsequently, the adjusted sampling points transform the feature map through a resampling operation to generate a feature map containing more detailed information. The resampled features are processed through reshape, convolution, normalization (Norm), and SiLU activation function to further enhance the feature expression ability. Finally, the features of the LDConv branch and the features of the standard convolution branch are fused to output a downsampled feature map with a size of C, H / 2, W / 2.

[0114] In step S401, the method of deploying the efficient lightweight model to the target mobile device for fabric defect detection is as follows:

[0115] Model quantization makes the model more adaptable to mobile device hardware, improves the deployment efficiency and performance by reducing the model size, accelerating the inference speed, and reducing the power consumption. Common methods include Float16 quantization, dynamic quantization, and full integer quantization. For the scenario with limited computing power on the mobile side, the input resolution can be reduced by setting --imgsz=320 to further reduce the computational overhead.

[0116] Replace the corresponding YOLO model file, check the input and output data dimensions of the model, modify the input and output dimensions and label files, set the name and icon of the mobile APP, and package it into an APK format installation package.

[0117] Download the AndroidStdio software, put the mobile phone into the developer mode and turn on the USB debugging. After running, the set APP will be automatically installed. After opening and agreeing to the permissions, it is possible to achieve real-time detection of fabric defects on the mobile device.

[0118] Considering the actual requirements of high detection accuracy, high detection speed and real-time performance for the fabric defect detection task, this study proposes a real-time object detection system for industrial fabric detection. To meet the high real-time requirements of the fabric defect detection task, an efficient gradient aggregation feature extraction module, a feature-guided fusion pyramid network, and a selective downsampling module are designed, significantly improving the detection accuracy and inference speed of the model.

[0119] Example Three

[0120] Based on Example One and Example Two, in this example, before the deployment module 5, a model compression and acceleration module 6 is added, which specifically includes the following steps:

[0121] Model pruning: Remove redundant convolutional kernels and channels through structured pruning technology to reduce the number of model parameters.

[0122] Quantization training: Use INT8 quantization technology to convert the model weights and activation values from FP32 to INT8, reducing memory occupancy and computational complexity.

[0123] Knowledge distillation: Use a pre-trained large model as the teacher model to guide the training of the lightweight LGTNet model and improve the detection accuracy of the small model.

[0124] Hardware acceleration optimization: For target devices (such as Jetson Nano, RK3588, etc.), use TensorRT or OpenVINO for hardware acceleration optimization to further improve the inference speed.

[0125] In addition, in the deployment module 5, a dynamic adaptive detection module and a user interaction and visualization module are added. The dynamic adaptive detection module specifically includes the following functions:

[0126] Lighting adaption: By analyzing the lighting conditions of the input image in real time, dynamically adjust the input preprocessing parameters of the model (such as contrast, brightness) to improve the robustness of the model in different lighting environments.

[0127] Resolution Adaptation: Dynamically adjust the resolution of the input image according to device performance and detection requirements (e.g., adjust from 2048×2048 to 1024×1024), optimizing the calculation efficiency while ensuring detection accuracy.

[0128] Defect Priority Sorting: Sort the detection results according to defect categories and severity levels, and prioritize the handling of high-priority defects to improve detection efficiency.

[0129] The user interaction and visualization module specifically includes the following functions:

[0130] Real-time Visualization: During the detection process, display the detection results in real time (such as defect locations, categories, and confidence levels), and provide functions such as image zooming in, zooming out, and rotation.

[0131] Historical Data Management: Provide a historical record function for detection results, supporting queries and statistics according to conditions such as time, category, and severity level.

[0132] Report Generation: Automatically generate a detection report, including a defect distribution map, statistical data, and improvement suggestions, supporting export in PDF or Excel format.

[0133] Finally, it should be noted that the above are only the preferred embodiments of the present invention and are not used to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some of the technical features. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.

Claims

1. A real-time object detection system for industrial fabric detection, characterized in that, Including: A sample collection module (1) for obtaining fabric defect pictures and providing the original data required for detection; A data annotation module (2) for annotating the defect categories of the collected fabric defect pictures and dividing the data to generate sample image data; A model structure optimization module (3) that uses an efficient gradient aggregation feature extraction module, a feature-guided fusion pyramid network, and a selective downsampling module to innovate the structure of the YOLOv5 model and obtain a lightweight LGTNet model; A training module (4) that uses the pre-collected and annotated sample data to train the improved LGTNet to improve the detection accuracy; A deployment module (5) that deploys the efficient lightweight LGTNet model to the target mobile device to achieve efficient fabric defect detection; The sample collection module (1), the data annotation module (2), the model structure optimization module (3), the training module (4), and the deployment module (5) are connected through network communication.

2. The real-time object detection method for industrial fabric detection according to claim 1, wherein: Specifically, it includes the following steps: S1: Collect fabric defect pictures, annotate and divide the collected pictures according to the corresponding defect categories, and construct a sample image data set; S2: In terms of the model structure, combine an efficient gradient aggregation feature extraction module, a feature-guided fusion pyramid network, and a selective downsampling module to optimize the YOLOv5 structure and construct a lightweight LGTNet network; S3: Use the sample image data to train LGTNet to obtain an efficient lightweight object detection model; S4: Deploy the trained lightweight model to the target mobile device to achieve efficient fabric defect detection.

3. The real-time object detection method for industrial fabric detection according to claim 2, wherein: In S1, it is necessary to collect fabric defect pictures covering multiple defect categories on the premise of ensuring the same production conditions to ensure the diversity and representativeness of the data, and perform standardized processing on the data.

4. The real-time object detection method for industrial fabric detection according to claim 3, wherein: The method for obtaining the sample image data in S1 is to use LabelImg software to annotate the collected defective pictures, and use the minimum bounding rectangle (BoundingBox) to frame the fabric defects. Among them, class represents the category of the defect, and x min and y min are the coordinates of the upper left corner vertex of the rectangle box respectively, and x max and y max are the coordinates of the lower right corner vertex, so as to accurately describe the category of the defect and its specific position in the image. At the same time, a data augmentation strategy is adopted to improve the generalization ability of the dataset.

5. The real-time object detection method for industrial fabric detection according to claim 2, characterized in that: The specific method in S2 is to use an efficient gradient aggregation feature extraction module to improve the feature extraction ability and reduce the computational amount through dynamic channel adjustment and multi-branch feature fusion strategies. Use a feature-guided fusion pyramid network to enhance the feature fusion of different scales and improve the object detection ability of the model through a feature-guided mechanism and a bidirectional interactive dynamic fusion module. Use a selective downsampling module to adopt deformable convolution and adaptive offset adjustment techniques to optimize the global spatial resolution compression while retaining local fine-grained features, and improve the detection performance and computational efficiency.

6. The real-time object detection method for industrial fabric detection according to claim 2, characterized in that: It also includes the following steps: S5: Use the sample image data to train on LGTNet variants with different depths and widths (such as LGTNet-n, LGTNet-s, LGTNet-m) to generate multiple trained models; S6: Perform performance evaluation and comparison on multiple trained models, and select the model with the best comprehensive performance as the final deployed LGTNet version according to indicators such as detection accuracy (mAP), inference speed (FLOPs), and lightweight effect (number of parameters).

7. A real-time object detection method for industrial fabric detection according to claim 6, characterized in that: The method of training the model in S5 is to use the commonly used performance evaluation indicators in the field of object detection, including but not limited to precision (P), recall (R), mean average precision (mAP), floating point operations (FLOPs), and number of parameters (Params), comprehensively measure the detection performance, computational complexity, and inference efficiency of the model, and select the optimal model for deployment.

8. The real-time object detection method for industrial fabric detection according to claim 2, characterized in that: The specific method of S4 is to use the trained LGTNet model to replace the YOLOv5 model file in the original detection software, verify the input and output data dimensions of the model, and adjust them if necessary to match the actual detection requirements. At the same time, update the label file to ensure the consistency of the detection categories, configure the interface, name, and icon of the target APP, generate and export the installation package containing the LGTNet model, import and install this installation package to the target mobile device to form a runnable detection APP, start the target APP and run LGTNet to complete the efficient detection task of fabric defects.