DOI : 10.5281/zenodo.24739638
- Open Access

- Authors : Swati Shinde, Mauryan Savla, Priyanka Palkar, Unnati Agavane
- Paper ID : IJERTV15IS111713
- Volume & Issue : Volume 15, Issue 11 , November – 2026
- Published (First Online): 02-12-2026
- ISSN (Online) : 2278-0181
- Publisher Name : IJERT
- License:
This work is licensed under a Creative Commons Attribution 4.0 International License
Fabric Defect Detection using YOLO – Multi-Source Dataset Preparation, Model Evaluation, and IoT-Based Prototype Development
Multi-Source Dataset Preparation, Model Evaluation, and IoT-Based Prototype
Development
Swati Shinde (1), Mauryan Savla (2), Priyanka Palkar (3), Unnati Agavane (4)
(1) Asst. Professor, (2,3,4) Student, Dept. of Electronics & Telecommunication engineering,
K. J. Somaiya Institute of Technology, Mumbai, India
Abstract – Fabric defects such as holes, stains, weaving defects, and yarn defects have an effect on fabric quality, which is why it is necessary to use automated fabric inspection systems in fabric production process. In this paper, we discuss YOLO based fabric defect detection that includes the following areas: multi-source dataset preparation, comparison of the models, implementation, and hardware integration. Since there was no single dataset including all four fabric defect classes, so we collected several fabric defect datasets and unified them into one common dataset. We also created additional versions of the datasets by adding more samples of the defect class that the models had difficulty in detecting. Training and comparing multiple YOLO models such as YOLO26n, YOLO26s, YOLO26m and YOLO11m was conducted as well. In the experiment where the dataset size was increased, the performance of YOLO26m was much better than others, scoring 73.18% precision, 62.05% recall, 62.26% mAP@0.5 and 31.95% mAP@0.5:0.95 in the test set. The YOLO26m model was selected as the final model to be used for the Streamlit web application in detecting defects in images, videos and live camera input. Also, a prototype using a motorized roller and an ESP32 microcontroller, controlled over Wi-Fi from the web application, was also built to feed fabric for inspection.
Keywords – YOLO; object detection; fabric defects; IoT; Streamlit; prototyping; evaluation
-
INTRODUCTION
Fabric defects may seem small in size, but they affect the quality, appearance and value of that fabric. Common Fabric defects include holes, stains, weaving flaws, yarn defects and many more. Visual examination is primarily utilized method for fabric inspection in textile industry, whereas its accuracy depends on inspector’s experience, attention, working conditions and fabric quality. It is challenging to spot the minute flaws or defects which blended in fabric texture. These challenges have encouraged idea of using computer vision and deep learning for automated textile inspection [1].
Object detection is useful for fabric defects detections, as it identifies defect types as well as their locations. YOLO (You Only Look Once) is a single-stage object detection family that predicts object classes and bounding boxes in a single inference process [2]. Different YOLO versions and model sizes offer different detection capabilities and computational requirements [3]. However, detection accuracy also depends on the quality of train set, number of samples available for each defect class, annotation accuracy, and variations in fabric appearance.
One of the main challenges encountered in this work was preparing a dataset containing all four required defect categories. The available datasets explored during the project
covered different defect types and used different annotation formats. To address this, images from multiple sources were filtered and combined, and their annotations were converted into a common bounding-box format. Dataset variants were then prepared to improve the representation of defect categories that showed weaker detection performance during the initial experiments.
This study evaluates multiple YOLO models through two stages of experiments. Initially, YOLO26n, YOLO26s, and YOLO26m were trained and compared using the first prepared dataset. After examining the class-wise performance of the trained models, additional data were introduced for weaker defect classes to support their training, followed by another comparison of YOLO26s, YOLO26m, and YOLO11m using this updated dataset. Hyperparameter tuning was also performed on the model selected through validation results to find out whether further improvements could be achieved or not. The baseline YOLO26m checkpoint was subsequently used in the Streamlit web application for image, video, and live-camera defect detection. An ESP32-controlled motorized roller prototype was also developed to support fabric transportation during inspection.
The main contributions of this work are as follows:
-
Preparation of a unified four-class fabric-defect dataset using multiple sources, including annotation conversion, filtering, and class distribution adjustment.
-
Comparative evaluation of YOLO models using successive dataset versions, followed by hyperparameter tuning and class-wise performance analysis.
-
Implementation of the trained detection model in a web application and development of an ESP32-based motorized fabric-transport prototype.
The primary focus of this study is the preparation of the dataset and the experimental evaluation of YOLO-based fabric defect detection models.
-
-
RELATED WORK
Fabric defect detection has been explored through traditional image processing techniques, machine learning, and deep learning. The traditional techniques focus on the application of statistical, spectral, structural and modelling approaches in identifying variations in fabric texture. GLCM, Gabor filters, wavelet transform, and texture analysis have been used to identify defective parts of the images, but their success has been dependent on fabric texture patterns, image
conditions, and the nature of defects. Li et al. [1] and Guo et al.
[4] provided a review of traditional techniques and the evolution of learning techniques for inspection of fabric.Improvements and innovations in deep learning have also increased the use of CNN models and object detection models for fabric defect detection. The approach is capable of learning image features during the process of training and detecting defects in different shapes and appearances. Carrilho et al. [5] review the recent advances in the computer vision field and also discuss about the challenges encountered in terms of dataset availability, standardization, and reproducibility. Mao and Hong [6] provide a review on the development of YOLO models starting from YOLOv1 to YOLOv11 and their applications in fabric defect detection, including limitations of variable defect appearance and computational requirements.
Also, a few researchers have worked on developing modifications to YOLO models for fabric defect recognition. Specifically, Luo et al. [7] introduced the use of deformable convolution, data augmentation and focal loss with YOLOv3 to enhance defect recognition for challenging and unbalanced samples. This model provided a better average accuracy than original YOLOv3 model. In addition, Kang and Li [8] suggested implementing AYOLOv7-tiny to inspect solid-color circular weft fabric, where additional feature extraction and attention were used to enhance recognition accuracy.
It is evident from the reviewed studies that deep learning and YOLO-based models could be utilized for fabric inspection tasks. Still, the difference in dataset composition, classes of defects, acquisition conditions of images, and format of annotations remains one of the most challenging factors during the development and evaluation of detection models. In particular, during this research, it became cear that there are no datasets suitable to be used that include all four necessary defect types. That is why the current study is concerned with creating a unified dataset from several sources and experimentally testing various YOLO models for different dataset versions.
-
PROPOSED SYSTEM ARCHITECTURE
The design of proposed system includes two primary stages: preparation of dataset and creation of model. The flowchart of this process is provided in Fig. 1.
In first stage, images have been collected from five different fabric-defect datasets. Because these original datasets differ in defect type, format, and number of classes, individual processing of each of them had to be conducted before combining all of them together. All unnecessary classes, annotated anomalies, and images unfit for using have been deleted. Annotations have been aligned to four target categories: hole, stain, weaving flaw, and yarn defect. In cases when segmentation annotations required, their conversion to axis-aligned bounding boxes has been conducted. Processed images were selected and combined into one master dataset. The additional set of 78 images without defect annotations was created.
There were two versions of the dataset prepared in this stage. The first dataset (V1) included 1,613 images, including background images. The second version (V2) included 184 additional images to provide a better distribution of selected defect types and was composed of 1,797 images.
Fig. 1. Proposed system architecture.
In second phase, multiple YOLO architectures such as YOLO26n, YOLO26s, YOLO26m, and YOLO11m were
trained and tested using the created datasets. They were analyzed based on the following metrics: precision, recall, F1- score, mAP@0.5, and mAP@0.5:0.95. Moreover, additional hyperparameter tuning and augmentation experiments were performed to explore any potential increase in performance. YOLO26m model was chosen to be used as baseline for practical implementation.
Finally, the chosen model was implemented in a Streamlit- based application for detecting defects on images, videos, and live camera. It provides the user with the ability to see the detected defect class along with the bounding box. Moreover, there is a possibility to download original input, output, and annotation file. Additionally, an ESP32 controlled motorized roller prototype was built using a stepper motor and driver to move fabric for inspection.
All this is covered in one fabric defect inspection pipeline including multi-source datasets creation, comparison of different object total.
-
DATASET PREPARATION AND CONSTRUCTION
-
Dataset Sources
The dataset was created by combining five existing fabric defect datasets. These were selected due to having defect classes that acted as samples for our four target classes, which include hole, stain, weaving defect, and yarn defect. As the five datasets had different names and formats, they were analyzed first before combining them. The five sources used in this study are listed in Table I.
Table I. Source Datasets Used to Build the Unified Dataset
Dataset
Source
FD_Dataset
Figshare[9]
FabricSpotDefect
Mendeley Data [10]
Tianchi
Roboflow Universe [11]
Fabric Defect Detection (V3)
Roboflow Universe[12]
Fabric-Defect (V4)
Roboflow Universe[13]
-
Dataset Cleaning and Mapping to Classes
Source datasets were separately processed before the images were selected for the combined data set. Defect classes that are not needed, invalid annotations, and unneeded images were deleted. The rest of the source class labels were then mapped to the project classes.
In FD_Dataset, class 0 from the original data set was mapped to stain, whereas classes 1, 2, and 3 were mapped to hole. A large-hole annotation that was flagged was deleted, and all images that do not have any valid label left were also deleted. There remained 719 images to be selected.
FabricSpotDefect initially had 1,014 images with COCO annotation labels. Spot was mapped to stain, while the category named Hole-EnBF was deleted. Annotation points outside the image and very small spot annotations were deleted. There were 748 images remaining after converting the COCO annotation labels into YOLO format.
For the Tianchi dataset, 5,364 augmentation marked images were removed from the data set which initially consisted of 9,475 images. Other unnecessary classes and anomalies in annotations were also removed. The stains class was renamed as stain, holes as hole and pattern_skips as weaving flaw. Certain yarn related categories like knots, thick_ends, three_yarn, broken_ends, warp_knots and broken_spandex were renamed as yarn defect.
The V3 Fabric Defect Detection dataset originally consisted of 749 images. The excluded classes were the following: broken button, button hike, and color defect. The preserved classes were foreign yarn mapped as yarn_defect, hole mapped as hole, and sewing error mapped as weaving flaw. Some of the annotations were represented by polygons rather than rectangles, which were consequently translated into axis- aligned bounding boxes. Thus, the cleaned dataset comprised 305 images.
The V4 Fabric-Defect dataset had 672 images. The class Kusut was not used for further processing while Lubang was mapped to hole and Noda to stain. There were two instances of
annotations that had been labeled as Noda but modified to Lubang while the coordinates of the bounding boxes remained the same. In addition, big anomalous bounding boxes were deleted. Thus, the pool consisted of 364 images.
Thus, in total, five source image pools were cleaned and included 5,070 candidate images. These pools are intermediate and some of the images will be selected for the final datasets.
-
Datset Representation and Classification
The first amalgamated data set, V1, was constructed by using a quota-based, instance-driven image selection process. Rather than selecting an equal number of images per class, this selection process was driven by the target numbers of instances per class. Whole images were selected, and valid annotations of other classes existing within those images were included. Repeated Images were deleted to prevent duplication.
All 473 images having weaving_flaw were kept intact during the V1 image selection process. Extra images were selected from the original datasets for meeting the targets of annotation in hole, stain, and yarn_defect. Because the selected image may have had more than one class of defects, the number of images and instances selected for each class did not match equally.
V1 included 1,535 labelled images from the original datasets. The class distribution is given in Table II. The image counts per class overlap because an image may have been included in more than one category of defect classes.
Table II. Class Distribution of the V1 Dataset
Class
Images containing class
Annotation instances
Hole
476
548
Stain
295
559
Weaving flaw
473
520
Yarn defect
414
771
In addition to the labelled images, 78 background images without defect annotations were included. These images were assigned empty label files and used in both V1 and V2. Therefore, the complete V1 dataset contained 1,613 images, divided into 1,140 training images, 237 validation images, and 236 test images.
-
Dataset Expansion
After the first round of model experiments, the class-wise results showed that stain and yarn defect detections needed further improvement. Thus, a second version of the data set, referred to as V2, was created by augmenting and adding extra data to V1.
The process of V2 used the same initial V1 images along with new ones selected from the source training candidates. Specifically, 120 more instances of stains and 150 more instances of yarn defects were chosen. FD_Dataset and FabricSpotDefect were preferred sources for the stains and V3 and Tianchi were preferred for the yarn defects. Images that had already been included in the data set were not selected again.
Total 184 additional images were selected; 50 from FD_Dataset, 20 from FabricSpotDefect, 80 from V3, and 34
from Tianchi. No images from V4 were selected. Like V1, valid co-annotations on the selected images were kept. Thus, the new images also brought 29 hole instances. These annotation count changes are summarized in Table III.
Table III. Class-Wise Annotation Counts after V2 Expansion
Class
V1
instances
Additional instances
V2
instances
Hole
548
29
577
Stain
559
125
684
Weaving flaw
520
0
520
Yarn defect
771
159
930
Total
2,398
313
2,711
78 background images were included in V2 as well. As a result, the larger dataset has total 1,797 images. A new grouped split was created for V2 and yielded 1,258 training images, 270 validation images, and 269 test images.
This process of selecting classes helped to improve the balance for staining and yarn defects, but did not create an even number of images per class. This is due to the whole image selection, the existence of several annotations per one image, and the inclusion of all weaving flaws that qualify in V1.
-
-
MODEL TRAINING AND EVALUATION METHODOLOGY
-
Experimental Stages
The model design was carried out in two phases based on V1 and V2 data sets. In the first phase, an experiment was performed based on YOLO26 models (YOLO26n, YOLO26s, and YOLO26m) on the V1 set in order to evaluate their performances and detect the defect classes that need further improvements.
Based on the findings regarding the different performances of the models in classifying the defects in class-wise manner, the data set is expanded to V2 set including more stain and yarn defects. In the second phase, an experiment is carried out on YOLO26s, YOLO26m, and YOLO11m based on the expanded data set.
-
Training Configuration
Pretrained weights were used to initialize all models. The models were trained on a Kaggle machine using 2 X NVIDIA Tesla T4 GPUs. The best checkpoint for each training (best.pt) was saved for evaluation purposes.
For first experiment, different training settings were used according to the model size. YOLO26n had a 640-pixel input size, 100 epochs in total and a batch size of 32. YOLO26s and YOLO26m both had an 832-pixel input size, 150 epochs in total, and batch sizes of 24 and 16 correspondingly. MuSGD optimizer and conservative image augmentations including horizontal flipping and mosaic augmentation were used during YOLO26s and YOLO26m trainings.
Table IV. Training Configurations for the First Experiment
Model
Input size
Maximum epochs
Batch size
YOLO26n
640 × 640
100
32
YOLO26s
832 × 832
150
24
YOLO26m
832 × 832
150
16
In the second experiment, all three baseline models were trained with an input size of 832 × 832 pixels, up to 100 epochs, and a batch size of 16. YOLO26 models utilized MuSGD optimizer, whereas the YOLO11m model employed AdamW optimizer with the learning rate of 0.001 and cosine learning rate scheduler. Augmentation parameters were set as follows: mosaic probability of 0.5, horizontal flipping probability of 0.5, without mixup and vertical flipping. The early stopping parameter was set as a patience of 25 epochs.
YOLO26s and YOLO26m were initialized by the weights of the saved V1 experiment, and YOLO11m was initialized with its pretrained weights. The second experiment used a fixed random seed 20261007 and deterministic training.
-
Hyperparameter Tuning
Following the second baseline comparison, hyperparameter tuning was conducted for YOLO26s chosen based on validation performance. For choosing YOLO26s, the criteria were validation mAP@0.5, mAP@0.5:0.95, and recall in decreasing order of preference.
The hyperparameter tuning process consisted of 10 rounds, during each of which 30 training epochs were carried out, while the input was sized 832 pixels. learning rate, weight decay, and detection loss weights are involved in the tuning process. The augmentation process includes parameters such as mosaic, scale, shift, horizontal flip, rotate, and shear.
Once the optimal combination of parameters was identified, YOLO26s was trained using those parameters in up to 100 epochs. The final result of the tuning process was tested independently on both validation and test sets.
-
Evaluation Metrics
Precision, recall, mean Average Precision at an IoU threshold of 0.5 (mAP@0.5), and mean Average Precision at IoU thresholds from 0.5 to 0.95 (mAP@0.5:0.95) were utilized as metrics for evaluating the models. Class-wise precision, recall, F1-score, and mAP metrics were also computed in order to evaluate performance of the models on the four classes of defects.
Precision is the metric that determines the fraction of detected objects that were correctly predicted. Recall is the metric that determines the fraction of true positive predictions out of all ground truth objects.
For the second experiment, the validation data was used for choosing the baseline model for tuning. The test dataset was evaluated independently and was not involved in the baseline model selection procedure.
-
-
EXPERIMENTAL RESULTS AND DISCUSSION
-
First Experiment: YOLO26 Model Comparsion on V1
The first experiment evaluated YOLO26n, YOLO26s, and YOLO26m using the V1 dataset. The models were evaluated on the same test split containing 236 images and 366 labelled defect instances. The results are presented in Table V.
Table V. Test Results of the First Experiment Using V1
Model
Precision (%)
Recall (%)
mAP@0.5 (%)
mAP@0.5:0.95 (%)
YOLO26n
75.62
55.16
62.27
32.96
YOLO26s
77.17
58.15
64.27
34.61
YOLO26m
79.87
61.04
65.46
36.77
In this experiment, YOLO26m demonstrated the best results across all the four test metrics mentioned. It reached 79.87% of precision, 61.04% of recall, 65.46% mAP@0.5, and 36.77% mAP@0.5:0.95. YOLO26s had good results, whereas YOLO26n had relatively low results according to the mentioned test metrics.
Class-wise evaluation showed that there were discrepancies in the defect detection efficiency among the classes. Holes and weaving defects were easier to detect than other more complicated defect classes. Detecting stains and yarn defects remained problematic, which directed us to expand the dataset for the second experiment.
It is necessary to mention that the first experiment involved various input resolutions, epoch limits, and batch sizes for the three tested models. Thus, the mentioned results characterize not the comparison between the three configurations but their performance.
-
Second Experiment: Model Comparison on V2
Additional stain and yarn defect samples were added to V2 based on the results from the first experiment. In the second experiment, YOLO26s, YOLO26m, and YOLO11m were evaluated using this new dataset. All three baseline networks took input at the resolution of 832 × 832 pixels.
The test set contained 269 images and 406 defect instances.
Overall results are listed in Table VI.
Table VI. Test Results of the Second Experiment Using V2
Model
Precision (%)
Recall (%)
mAP@0.5 (%)
mAP@0.5:0.95 (%)
YOLO26s
71.01
59.89
62.91
30.77
YOLO26m
73.18
62.05
62.26
31.95
YOLO11m
61.74
51.93
53.22
23.91
The YOLO26m had the highest value of precision, recall, and mAP@0.5:0.95 among the three baseline networks. YOLO26s showed a slightly better mAP@0.5 of 62.91%, compared with 62.26% of YOLO26m. This result proves that neither model performed better across evaluation metric.
The YOLO11m had the lowest values in all four overall test criteria of this experiment. Based on the above, it can be concluded that YOLO26 models detected better in V2 dataset.
The class-wise results further showed that hole detection remained the strongest category In addition, the class-wise results further proved that hole detection was still the dominant category of YOLO26m with a test mAP@0.5 score of 85.5%. Detection scores for stain, weaving flaw, and yarn defect were 59.6%, 59.0%, and 44.9% respectively, which revealed that yarn defect detection was still difficult for the current model.
The results of the first experiment and the second experiment were obtained based on different dataset versions and different test datasets. So, these results can be viewed as two different experimental stages rather than the improvement of only dataset augmentation.
-
Hyperparameter Tunning of YOLO26s
After the initial baseline comparison on V2, the YOLO26s was selected for hyper parameter tuning. The selection criteria was, in order of importance, validation mAP@0.5, mAP@0.5:0.95, and recall. There were ten tuning experiments, with a maximum number of 30 epochs per experiment. Then, using the tuned parameters, the final training was done with a maximum of 100 epochs.
Baseline and tuned models of YOLO26s were tested on the same validation and testing splits V2. The test results of baseline and tuned YOLO26s are compared in Table VII.
TABLE VII. YOLO26s BASELINE AND TUNED MODEL COMPARISON ON THE
V2 Test Set
Metric
Baseline (%)
Tuned (%)
Precision
71.01
80.06
Recall
59.89
56.91
mAP@0.5
62.91
63.08
mAP@0.5:0.95
30.77
32.17
It is observed that tuning increased test precision by approximately 9.05 percentage points and mAP@0.5:0.95 by
1.40 percentage points. Whereas recall declined by approximately 2.98 percentage points, while mAP@0.5 increased by just 0.17 percentage points.
There were mixed effects on the validation performance. Validation mAP@0.5 decreased from 56.58% to 53.85%, but validation mAP@0.5:0.95 increased from 31.13% to 31.55%. Therefore, the hyperparameter tuning was not a success for all performance metrics.
-
Overall Discussion
The experiments demonstrate that YOLO-based models can detect, classify and locate fabric defects, but their performance depends on the model configuration, dataset, training and defect category.
In the first experiment, YOLO26m had the best performance compared to YOLO26n and YOLO26s in terms of the number of correctly classified defects. In the second experiment, YOLO26m had higher precision, recall, and mAP@0.5:0.95 metrics, while YOLO26s had a slightly better mAP@0.5. Precision and mAP@0.5:0.95 were increased by the tuning experiment at the expense of recall, which was slightly decreased. It means that tuning was not beneficial for all detection aspects.
Holes appeared to be the easiest class of defects to detect during all the experiments. At the same time, stains and yarn
defects were the most difficult to detect. These results were used to select the model for implementation into the application presented in the next section.
-
-
APPLICATION DEVLOPMENT AND PROTOTYPE IMPELEMENTATION
-
Streamlit-Based Detection Application
A Streamlit web application was developed for fabric defect detection using pre-trained YOLO26m model. It runs on a laptop and can be opened either on a laptop web browser or via a smartphone. The same YOLO26m checkpoint (best.pt) is utilized for image, video, and live-camera detection tasks.
There are three main tabs in the application Photo, Video, and Live. Standard parameters include the confidence parameter, image resolution, YOLO frame rate, and screen type for laptop/phone and tablet devices.
Photo Tab allows users to upload an image or take it using the laptop or smartphone web camera. The model detects fabric defects and displays bounding boxes with defect class labels and confidence values. There is also a count of detected defects, coordinates of bounding boxes, and a ZIP-file with original images, annotated images, and YOLO label files.
The Video tab allows uploading and recording videos with the help of the browser. The application performs frame-by- frame video processing with the same YOLO26m checkpoint and produces the annotated H.264 MP4 video. It is possible to view both the original video and the processed one and to download the annotated video and/or the dataset ZIP file, including videos, frames, and label files.
Fig. 2. Streamlit application showing fabric defect detection results: (a) weaving flaw detection (top) and (b) hole detection (bottom).
The Live tab allows working with two cameras either the laptop or phone’s one using the browser or the ESP32-CAM by its MJPEG stream. The application processes the most recent frame and does not create any queues with the past frames to decrease the detection delay. The Live mode includes the bounding box, detections, inference time, and connection state. Some features of the phone camera (zooming, focusing, flash usage, etc.) may work only depending on the browser and device capabilities. The application GUI and example detection results are demonstrated in Fig. 2.
-
ESP32-CAM live Camera Intergraion
An additional source of live camera is an ESP32-CAM equipped with 2MP GC2145 image sensor which is an AI Thinker camera. Firmware creates a separate Wi-Fi network, ESP32CAM_SOFTAP, and provides a stream in MJPEG format at the following URL http://192.168.4.1/stream. ESP32- CAM is connected to the laptop via Micro-USB cable for power supply. Data from video frames are transmitted independently via Wi-Fi.
Using ESP32-CAM requires connecting to the corresponding Wi-Fi network from the laptop and enterng the stream address in the Live tab of application. Background reader downloads the stream, breaks it into frames in JPEG format and sends the latest frame for processing by YOLO26m model. ESP32-CAM transmits frames in 320 × 240 format. Because of conversion from RGB to JPEG inside the firmware there is additional computation cost that can negatively affect the frame rate and latency. ESP32-CAM supports only one viewer of the stream.
ESP32-CAM provides a functional source of live camera data for application, however, due to low resolution and latency problems, it cannot be used for defect detection.
-
ESP32-CAM live Camera Intergration
A prototype of motorized roller was designed to move the fabric through the inspection zone of the camera. The system contains ESP32-WROOM, A4988 stepper motor driver, NEMA17 motor, a collecting roller, and passive supply roller. The complete prototype is given in Fig. 3.
Fig. 3. ESP32-based motorized roller prototype for fabric transportation.
ESP32-WROOM connected to laptop with Micro-USB. Laptop will sends commands like START, PAUSE, and STOP via USB to ESP32. The motor control was done by the ESP32 through the A4988 motor driver. The NEMA17 motor was connected to the motor driver, which is supplied from external SMPS. The capacitor of value 100 µF, 25 V is connected to the VMOT and GND supply terminals of the driver. Connect the ESP32 control signals with A4988 drivers as follows: GPIO25 to DIR, GPIO26 to STEP, and GPIO27 to EN. Additionally, connect the 3.3V pin to VDD. The driver SLEEP and RESET pin are connected to VDD.
The motors are controlled from the Live tab in the application. The user has to connect to the COM port for the ESP32-WROOM and is able to start, stop, and pause the motor. Automatic pausing (Autostop) takes place when the YOLO26m detects a defect in sequential frames and stop the motion of fabric. Autostop works well when camera streaming and frame processing latency is low. There is also a communication watchdog that pauses the motor if heartbeats from the laptop are not received.
-
System Intergration
The laptop becomes the controller and processor. Processing of images and videos takes place in the application directly. Laptop/phone camera and ESP32-CAM all can provide the input. Video is sent via Wi-Fi from ESP32-CAM, and the command for the motor comes through USB serial from the laptop to ESP32-WROOM. After that, ESP32- WROOM controls A4988 driver and NEMA17 motor.
This separates live streaming from motor-control communication channel. Usage of photo and video detection can take place separately, and motor movement via the live tab. This is an example of system integration of fabric defect detection with camera input and motorized fabric transport.
-
-
CONCLUSION AND FUTURE SCOPE
-
Conclusion
The presented research used a method based on the YOLO framework for detection of four fabric defect types: hole, stain, weaving defect, and yarn defect. Because there was no dataset containing all four fabric defects at once, a total of five public datasets were merged after filtering, label mapping, annotation conversion, and elimination of non-relevant samples. Two dataset variations were created for testing and conducting further experiments.
Various YOLO models were tested using the aforementioned datasets. In case of test set based on the expanded dataset, YOLO26m achieved 73.18% precision, 62.05% recall, 62.26% mAP@0.5, and 31.95% mAP@0.5:0.95. YOLO26s reached better mAP@0.5 while YOLO26m had a higher precision, recall, and mAP@0.5:0.95 out of all baselines. Further fine-tuning of YOLO26s did not yield an improvement in any evaluation metrics. Class-wise analysis also shows that detection of yarn defects and some difficult visual defects remains problematic.
The YOLO26m best.pt model was incorporated in the Streamlit application and is used in detection in photos, videos, camera from laptop/phone, and ESP32-CAM live streams. Also, an ESP32 motorized roller prototype was designed and
was incorporated in the application through USB serial communication. In addition to the manual control of the motors, there is an automatic stopping function of the fabric movement if the actual YOLO26m model detects any defect in it. However, the response is dependent on the time taken by the camera frames to be delivered and processed and does not happen consistently under all conditions.
-
Future Scope
The improvements which could be done in future research include those given below:
Firstly, the dataset could be increased by including more images of textiles, specifically for stain, yarn defects, and weaving defects classes because they were difficult to classify even in the present experiment. Light, camera angles, fabric texture, defect size and more factors increases variability in dataset.
The model configuration, input resolution, augmentation and other hyperparameters could be varied in future experiments. False positive and false negative detections should be reviewed to understand poor class-wise results.
The camera system can be improved by using 510 MP OmniVision sensor with an onboard JPEG encoder, which could help to achieve a frame rate of at least 25 FPS. Camera quality, frame rate, network latency, and inference time must be evaluated and optimized together
NEMA-17 Motor should be testing at different fabric speeds and roller conditions. Calibrating Calibrating fabric movement and stopping distance can more accurately center detected defects within the camera’s field of view. Additional testing should assess false detections, missed defects, communication failures, and motor responsiveness under varying latency. Meanwhile, generative AI could be applied to annotation, dataset preparation, and direct defect identification, potentially replacing the entire YOLO model.
Overall, this project demonstrates a prototype integrating multi-source dataset preparation, YOLO-based defect detection, web application, ESP32-CAM live input, and ESP32-controlled fabric transportation. Image quality, defect detection accuracy, and inference latency must be improved before proposed system can be deployed for industrial textile inspection.
REFERENCES
-
C. Li, J. Li, Y. Li, L. He, X. Fu, and J. Chen, Fabric defect detection in textile manufacturing: A survey of the state of the art, Secur. Commun. Netw., vol. 2021, Art. no. 9948808, 2021, doi: 10.1155/2021/9948808.
-
J. Redmon, S. Divvala, R. Girshick, and A. Farhadi, You only look once: Unified, real-time object detection, in Proc. IEEE Conf. Comput. Vis. Pattern Recognit. (CVPR), 2016, pp. 779788, doi: 10.1109/CVPR.2016.91.
-
G. Jocher, J. Qiu, M. Liu, S. Lyu, F.C. Akyon, and M.E. Kalfaoglu, Ultralytics YOLO26: Unified real-time end-to-end vision models, arXiv preprint arXiv:2606.03748, 2026, doi: 10.48550/arXiv.2606.03748.
-
P. Guo, Y. Liu, Y. Wu, H. Gong, and Y. Li, Intelligent quality control of surface defects in fabrics: A comprehensive research progress, IEEE Access, vol. 12, Art. no. 63777, 2024, doi: 10.1109/ACCESS.2024.3396053.
-
R. Carrilho, E. Yaghoubi, J. Lindo, K. Hambarde, and H. Proença, Toward automated fabric defect detection: A survey of recent computer vision approaches, Electronics, vol. 13, no. 18, Art. no. 3728, 2024, doi: 10.3390/electronics13183728.
-
M. Mao and M. Hong, YOLO object detection for real-time fabric defect inspection in the textile industry: A review of YOLOv1 to YOLOv11, Sensors, vol. 25, no. 7, Art. no. 2270, 2025, doi: 10.3390/s25072270.
-
X. Luo et al., Defect detection algorithm for fabric based on deformable convolutionalnetwork, Text. Res. J., vol. 93, nos. 910, 2023, doi: 10.1177/00405175221143742.
-
X. Kang and J. Li, AYOLOv7-tiny: Towards efficient defect detection in solid color circular weft fabric, Text. Res. J., vol. 94, nos. 12, 2024, doi: 10.1177/00405175231205898.
-
FD_Dataset_7z, Figshare. [Online]. Available: https://figshare.com/articles/dataset/FD_Dataset_7z/25546465?file=454 60297. [Accessed: Nov. 25, 2026].
-
Sumaya, F. Islam, M.F. Monir, and A. Islam, FabricSpotDefect: An annotated dataset for identifying spot defects in different fabric types, Mendeley Data, Version 1, 2024, doi: 10.17632/6574nhzm8x.1.
-
Graduation Project, Tianchi dataset, Roboflow Universe, Version 1. [Online]. Available: https://universe.roboflow.com/graduation-project- 1ploy/tianchi-novkl/dataset/1. [Accessed: Nov. 25, 2026].
-
fabric, Fabric-defect-detection dataset, Roboflow Universe, Version
3. [Online]. Available: https://universe.roboflow.com/fabric- oqsdi/fabric-defect-detection-oqke3/dataset/3. [Accessed: Nov. 25, 2026].
-
fabricdefects, Fabric-Defect dataset, Roboflow Universe, Version 4. [Online]. Available: https://universe.roboflow.com/fabricdefects/fabric- defect-lk8nb/dataset/4. [Accessed: Nov. 25, 2026].
