ai-toolbox
deep dive into applications and algorithms
AI Fabric Defect Inspection
D-TASE automates textile quality control using AI-powered visual defect detection.
Raw Data - Training
Learn moreRaw Data - Testing/Production
Preprocessing - Training Data
Learn morePreprocessing - Testing/Production Data
Dataset - Training
Learn moreDataset - Testing/Production
Model Training
Learn moreTrained Model
Learn moreModel Testing
Learn moreTested Model
Learn moreProject Results
The project delivered an AI-assisted fabric defect inspection workflow integrated with ROK Tekstil’s existing conventional inspection machine. High-resolution image acquisition, standardized lighting, annotated textile datasets, AI model training, and dashboard deployment were completed. The system inspected more than 50,000 meters of fabric, achieved real-time defect visualization, and supported anomaly logging and reporting. Operationally, the inspection process reached an average speed of 20 meters per minute, improving process efficiency by 33%. The second-quality product rate decreased from 1.56% to 1.33%, corresponding to an improvement of approximately 15% in the evaluated samples.
The model achieved an mAP50 of 89.2% on the full dataset. Class-wise performance was strongest for Hole and Scratch, where detection accuracy was close to 100%. Stain detection reached approximately 90% accuracy, while the Defect class reached about 75% accuracy. Despite the presence of improper annotations in the Denim subset, the model generalized well and detected most defects accurately. Qualitative examples show successful true-positive detections, while false positives were analysed to understand remaining limitations and guide future improvements.
The main achievements are the successful integration of AI into an existing industrial fabric inspection workflow, the creation of a usable dashboard for real-time visualization and review, and measurable improvements in process efficiency and quality outcomes. The system reduced operator workload, increased AI acceptance from fear to normal usage, and improved job satisfaction by 25%. It also supports sustainability goals by reducing second-quality products, textile waste, and water consumption. The project established a practical foundation for developing at least three production-scale AI-supported fabric defect control machines.
Figures
Data
Raw Data
Raw data collection
Raw data was acquired from fabric rolls moving through ROK Tekstil’s modified quality control setup. Industrial cameras, high-intensity LED illumination, a Manfrotto positioning arm, and auxiliary equipment were integrated into a conventional four-point fabric inspection machine. Camera position, distance, location, and lighting were standardized based on test-bed analysis to ensure stable image quality and reduce environmental variability. Images and video frames were collected from denim and non-denim fabrics during inspection, then transmitted to TR2. Anomalies were identified from the visual data, annotated in collaboration with ROK Tekstil, and forwarded to AIRISE/DFKI for AI model training and optimization. Data was stored using TR2 cloud storage with backup to support secure transfer, traceability, and continuity.
• Capture fabric images/videos using industrial cameras on the inspection machine.
• Maintain fixed camera position, controlled distance, and constant illumination.
• Extract relevant visual samples and identify defect regions.
• Annotate anomalies collaboratively with ROK Tekstil domain experts.
• Transfer annotated data securely to AIRISE/DFKI for model training.
Raw data description
The acquired data consists of textile inspection images from multiple cloth types: Anomaly, Cotton, Denim, and ElastaneLight. It includes normal fabric samples and defective samples with labels such as Hole, Stain, Scratch, and Defect. The data was originally organized into train, validation, and test folders for each cloth type, then consolidated into a unified defect detection dataset. The raw images reflect real production conditions under controlled acquisition settings.
Data preprocessing
Processing description
The report does not specify all low-level image preprocessing operations such as resizing, normalization, or augmentation. The documented preprocessing focused on acquisition standardization, dataset organization, annotation, and label consolidation. Images were collected under constant lighting and fixed positioning, then sorted by cloth type and split into train, validation, and test folders. Defect labels from different folders were unified into the final target classes. Validation and test samples were combined for model evaluation, and model predictions were logged with metadata for dashboard-based review.
Feature engineering
No separate handcrafted feature-engineering pipeline is specified. Domain expertise was used primarily during annotation, defect class definition, acquisition standardization, and validation. The AI model learns visual features directly from fabric images. Additional operational metadata such as timestamps, defect type, confidence score, source stream/file, and annotated snapshots are logged by the dashboard for traceability and analysis.
Raw Data
Data preprocessing
Datasets
ROK Tekstil denim and non-denim inspection images
License:
Internal / Proprietary
Size
2,993 training images and 817 testing images. Original folders: Anomaly, Cotton, Denim, and ElastaneLight. Consolidated annotation counts: Train - Hole 1,867, Stain 1,623, Defect 1,534, Scratch 114; Test - Hole 546, Stain 524, Defect 390, Scratch 50.
Trained model/s
Model types
Model selection
The model was selected to support automated, scalable fabric defect inspection with localization and classification of visual anomalies. A computer vision detection approach is suitable because the task requires identifying small visual defects in high-resolution fabric images and reporting their positions, classes, and confidence scores. Another reason to use the particular model was its real-time performance which was needed to integrate with TR2’s dashboard and operate in an industrial inspection workflow.
Hardware used for training
CUDA-enabled GPUs were used for training.
Model training
ROK Tekstil collected the raw fabric inspection data using the modified inspection machine. Anomalies were identified from visual data and annotations were prepared in collaboration with ROK Tekstil. The annotated data was forwarded to AIRISE/DFKI, where AI models were trained and optimized for fabric defect detection. The resulting trained model was transferred to TR2 for integration into a dashboard and testing under real scenarios.
Loss function
CrossEntropyLoss for classification
L2 loss for bounding box regression
Model testing
The trained model was evaluated on the consolidated test set and through operational validation on the inspection machine. Testing compared model detections with ground-truth annotations, produced quantitative metrics such as mAP50 and class-wise detection performance, and included qualitative analysis of true positives and false positives. Dashboard testing validated real-time visualization, anomaly logging, alerting, filtering, and reporting.
Testing metrics
• mAP50: 89.2% on the full dataset.
• Class-wise detection accuracy: close to 100% for Hole and Scratch, about 90% for Stain, and about 75% for Defect.
• Confusion matrix for class-wise detection analysis.
• Operational speed: approximately 20 meters per minute.
• Process efficiency improvement: 33%.
• Second-quality product rate reduction: from 1.56% to 1.33%.
• Operator/job satisfaction improvement: 25%.
• Downtime reduction: 20%.
Tested model
The final model is deployed in an AI-powered fabric inspection system connected to a secure web dashboard. It processes uploaded or streamed fabric images/video frames and returns bounding boxes, class labels, and confidence scores. Model size and exact inference time are not specified. Operationally, the integrated system generally supports inspection at around 20 meters per minute and provides real-time anomaly visualization, alerts, logging, and reporting.