Built to order

Fabric Defect Detection using CNN

This project builds a CNN classifier that detects weaving defects in textile images for automated quality checks. Trained on the public TILDA textile texture database, the model learns the visual patterns of defective versus defect-free fabric and reports a defect class with confidence per image. The build compares a custom convolutional backbone against a transfer-learning variant, and the included Jupyter notebook computes accuracy, precision, recall, F1 and a confusion matrix on the validation split during the buyer's build.

Close-up of a fabric swatch with a flagged weft slub defect, alongside a detection results table and a defect class distribution pie chart for the Fabric Defect Detection using CNN project.
More project photos (2)

The problem

Textile mills inspect fabric for weaving defects such as holes, slubs, broken picks and oil stains — work still done largely by eye on fast-moving lines, where fatigue makes human inspection inconsistent: the same defect can be caught or missed depending on the inspector and the shift. Automated visual inspection promises consistency, but fabric is a hard texture problem: genuine weaving defects must be distinguished from normal texture variation, prints and lighting artefacts in fabric photographs. This project studies that idea end to end on the public TILDA textile texture database: a CNN classifier that detects weaving defects and reports the defect class with a confidence score per image. As with the rail project, honesty is built in — the evaluation notebook collects misclassified images into a review gallery so failures are inspected openly rather than hidden behind a single accuracy number, and the model only knows the defect types and textures represented in the TILDA data.

How it works

Dataset & model:
Dataset name: TILDA — textile texture database (public research collection used in fabric defect detection studies).
Source: Public academic release of the TILDA database.
Task: Multi-class image classification (weaving defect recognition).
Classes: Defect-free plus the documented TILDA defect taxonomy — hole, oil spot/stain, thread error, foreign body/object — per the research literature's TILDA class descriptions; the exact class list used in the build is confirmed in the report.
Model: CNN classifier — custom convolutional backbone, plus an ImageNet-pretrained transfer-learning variant for comparison (TensorFlow/Keras).
Input: Fabric photographs, normalized to a fixed input size with histogram equalization.
Prediction: Probability distribution over the defect classes.
Output: Most likely defect class with a confidence score and an adjustable threshold; misclassification review gallery.
Evaluation metrics: Accuracy, precision, recall, F1 and confusion matrix on a held-out validation split — computed by the Jupyter notebook during the buyer's build. No measured performance claimed; design target approximately 85% or better accuracy on the split.

Working:

  1. Fabric images are loaded from the TILDA dataset structure, normalized to a fixed input size and histogram-equalized.
  2. Preprocessing: augmentation with rotations, flips, brightness and noise jitter tolerates mill lighting and camera variation.
  3. Training phase: a CNN (custom backbone, plus an optional transfer-learning variant) trains for defect classification, with accuracy and loss logged each epoch.
  4. Evaluation phase: the Jupyter notebook runs the full evaluation on the held-out validation split — accuracy, precision, recall, F1, confusion matrix — and collects misclassified images into a review gallery.
  5. Inference phase: the trained model scores new fabric images, outputting the most likely defect class with a confidence score and an adjustable threshold.
  6. Output: per-image defect class prediction with confidence; the notebook's misclassification gallery documents exactly which images the model gets wrong.

Specifications:
Model | CNN classifier (custom backbone + ImageNet-pretrained transfer-learning variant), TensorFlow/Keras
Dataset | TILDA textile texture database, public research collection
Task | Multi-class weaving-defect classification
Classes | Defect-free, hole, oil spot/stain, thread error, foreign body/object (documented TILDA taxonomy)
Input | Fabric photographs, fixed input size with histogram equalization
Output | Most likely defect class with confidence score and adjustable threshold
Evaluation | Accuracy, precision, recall, F1, confusion matrix on held-out validation split — computed during the buyer's build
Design target | Approximately 85% or better accuracy on the split (target, not a measured claim)
Error analysis | Misclassification review gallery documenting real failure modes

Project features

[Multi-Class Defect Recognition] (implemented) — CNN classifier recognizing the documented TILDA defect types — hole, oil spot/stain, thread error, foreign body/object — plus a defect-free class.
[Confidence-Scored Predictions] (implemented) — Per-image defect class prediction with a confidence score and an adjustable decision threshold.
[From-Scratch vs Transfer-Learning Comparison] (implemented) — A custom convolutional backbone and an ImageNet-pretrained transfer-learning variant are both included for direct comparison.
[Mill-Condition Augmentation] (implemented) — Rotations, flips, brightness and noise jitter tolerate mill lighting and sensor noise.
[Misclassification Review Gallery] (implemented) — Misclassified images are collected into a review gallery for honest, open error analysis.
[Training Curves and Confusion Matrix] (implemented) — Training/validation loss and accuracy curves plus a confusion matrix feed the report's error analysis.
[Mill-Specific Retraining] (optional) — Training on a buyer's own mill fabric data is outside the base build and can be developed as an extension, scoped at quotation.

What is included

Complete source code (data pipeline, CNN training, transfer-learning variant, inference script)
Jupyter evaluation notebook (validation metrics, confusion matrix, misclassification review)
Project report PDF (background, TILDA dataset, methodology, evaluation, error analysis)
PPT presentation for final review
Viva Q&A preparation document (CNNs, texture features, transfer learning, classification metrics, quality-control context)
Setup guide (environment, dataset download, training and inference commands)

Limitations & prerequisites

The model only knows the defect types and fabric textures represented in the TILDA data; novel fabrics, prints and unseen defect types will not be classified correctly.
This is a design-target-driven prototype evaluated on a research dataset — it is not a production-line quality system and no deployed or line-speed performance is claimed.
Mill lighting, camera setups and fabric weaves outside the training data classify worse.
Performance depends on the split, augmentation and training conditions of the buyer's own run.
Defect-type naming follows the documented TILDA taxonomy; fine-grained industrial defect grading beyond it is outside the build.

Frequently Asked Questions

Which dataset and model are used?

The public TILDA textile texture database, used in fabric defect detection research. The build trains a CNN classifier — a custom convolutional backbone plus an ImageNet-pretrained transfer-learning variant for comparison — using TensorFlow/Keras.

What defects does the model detect?

The documented TILDA defect taxonomy: hole, oil spot/stain, thread error, and foreign body/object, plus a defect-free class. The exact class list used in the build is confirmed in the report.

Is the performance guaranteed?

No measured performance is claimed. The included Jupyter notebook computes accuracy, precision, recall, F1 and the confusion matrix on a held-out validation split during the buyer's build; the design target is approximately 85% or better accuracy on that split.

Can this run on a real textile production line?

No. This is a research-dataset prototype for study and demonstration. A production-line system would need mill-specific labeled data, line-speed cameras and integration work this project does not include.

Is this project suitable for a final-year project?

Yes, for B.E./B.Tech in Computer Science, AI/ML, Data Science, Electronics and related programs. It demonstrates CNN texture classification, transfer learning vs from-scratch comparison, and honest error analysis.

What will I receive, and can it be customized?

Source code (data pipeline, CNN training, transfer-learning variant, inference script), the evaluation notebook with the misclassification review gallery, report, PPT, viva Q&A and a setup guide. Customizable: mill-specific datasets, defect-localization outputs, or an inspection-station interface, scoped at quotation.

Components & software requirements

Python 3.10, TensorFlow/Keras (CNN training and inference)
OpenCV (image loading, resizing, histogram equalization)
NumPy, pandas (dataset handling, metric computation)
Matplotlib, Seaborn (training curves, confusion matrix)
Jupyter Notebook (evaluation procedure run during the buyer's build)
scikit-learn (train/validation splitting, metric utilities)
TILDA textile texture database (download guidance in the setup guide)
GPU recommended for CNN training (cloud-GPU guidance in the setup guide)

Delivery information

Built-to-order: the source code, evaluation notebook, report, PPT and viva kit are prepared fresh for the buyer. Typical delivery spans dataset setup, the training runs (both variants), evaluation and documentation; the exact schedule is confirmed at quotation.

Support terms

Setup guidance (environment, TILDA download, training and inference commands); viva preparation covering CNNs, texture features, transfer learning, classification metrics and the quality-control context; customization discussion (mill-specific datasets, localization outputs, inspection-station interface) scoped at quotation.

Download abstract (PDF)

Related guides

All guides
Blueprint-style technical illustration of multiple decision trees voting together into one final predictionStudents with basic Python and pandas skills who want a reliable first classifier for ML coursework and tabular data projects.

Random Forests Explained: Why Decision Trees Vote Better Together

Decision trees are readable but overfit; random forests fix this by training hundreds of varied trees on bootstrapped data with random feature subsets, then letting them vote. This guide explains Gini impurity, bagging, out-of-bag validation and the four hyperparameters that matter, with a complete scikit-learn workflow, honest feature-importance practices, and the mistakes students keep making.

Read guide
Illustration of object tracking showing video frames with bounding boxes and persistent ID labels following people and vehicles, comparing motion prediction and appearance matching.B.E./B.Tech Computer Science and Electronics students building video analytics projects — people counting, vehicle tracking, sports analysis — who have detection working and need

Object Tracking: DeepSORT and ByteTrack Explained

Detection finds objects per frame; tracking keeps their identities across frames. This guide explains tracking-by-detection, Kalman motion models, DeepSORT's appearance embeddings vs ByteTrack's low-confidence box recovery, tracking metrics (HOTA, IDF1, ID switches), and the tuning parameters that determine real-world quality.

Read guide
Illustration of image segmentation showing U-Net's U-shaped encoder-decoder with skip connections producing pixel masks, alongside Mask R-CNN detecting instances with masks.B.E./B.Tech Computer Science and AI/ML students moving from image classification or detection to pixel-level understanding — medical imaging, defect detection, autonomous driving

Image Segmentation: U-Net and Mask R-CNN

When projects need pixel-level answers, segmentation delivers. This guide explains semantic vs instance vs panoptic segmentation, U-Net's encoder-decoder with skip connections, Mask R-CNN's parallel mask head, Dice and IoU evaluation, paired augmentation, and how to choose the right architecture for your data and question.

Read guide
Get a quotation