Built to order

Textile Weave Defect Inspection using CNN

This project automates fabric inspection: a ResNet-50-based CNN scans 512×512 tiles of fabric images, localizes defects (holes, oil stains, thread errors, slubs) with bounding boxes and confidence scores, and grades each roll as first-quality or seconds. It ships with the training pipeline on the TILDA textile database, the inspection app with tile visualization, batch shift reports, and per-class evaluation. The transfer-learning design and the false-alarm trade-off are documented for the viva. Suitable for B.E./B.Tech final-year projects in Computer Science, IT and AI & Machine Learning.

AI & Machine Learning TorchvisionGitPython 3NumPy · MatplotlibPyTorch · ResNet-50TILDA textile datasetDAGM 2007 extensionHTML · canvas inspection appSoftware
Textile Weave Defect Inspection using CNN — project thumbnail preview
More project photos (3)

The problem

Fabric mills still inspect cloth the slow way — an operator watches meters of fabric glide past under bright lights, and misses defects when attention fades. The defect types are visually subtle: a missing weft thread, a small oil stain, a slub in the yarn. Machine vision is the natural fix, but training from scratch needs thousands of defective samples mills don't share. The practical route is transfer learning: a ResNet-50 pretrained on ImageNet already understands texture, and fine-tuning on the TILDA textile database (3,200 images across 8 classes — one defect-free plus seven defect types) teaches it fabric-specific faults. This project builds that pipeline — tiling high-resolution fabric images, classifying and localizing defects per tile, aggregating to roll-level grades, and rendering an inspection UI with boxes, confidence scores and shift batch reports.

SYSTEM FLOW

4 components 3 connections

Live flow
Drag to explore
100%
sensorInspection camera

Captures fabric frames on the inspection line; the model was trained on TILDA's 3,200 fabric images across 8 classes.

Follow the working sequence

How it works

  1. Fabric images from the TILDA database (3,200 images, 8 classes) are tiled into 512×512 patches with 256-pixel stride; defect bounding boxes are mapped into tile coordinates.
  2. Tiles are augmented (rotations, flips, brightness jitter) to simulate lighting variation on the inspection line.
  3. A ResNet-50 backbone (ImageNet-pretrained, progressively unfrozen) with a detection head is fine-tuned with Adam.
  4. At inspection time, each frame is tiled identically, tiles are classified, and non-maximum suppression merges overlapping boxes.
  5. Tile detections aggregate per roll: defect count, defect-area percentage and the worst defect class determine the grade.
  6. The inspection app renders boxes with class + confidence on the fabric image and the batch view summarizes the shift.
  7. The held-out TILDA split is scored with per-class F1, mAP@0.5 and false-alarm rate for the report.

Tech stack:

  • Python 3, PyTorch (ResNet-50, detection head)
  • torchvision (pretrained weights, transforms)
  • TILDA textile database (3,200 images, 8 classes)
  • DAGM 2007 (textured-surface extension)
  • NumPy, Matplotlib
  • HTML/CSS/JavaScript inspection app (canvas)
  • Git

Dataset & model details

  • Dataset: TILDA (DFG Texture Analysis group) — 3,200 fabric images across 8 classes (1 defect-free + 7 defect types: hole, oil stain, thread error, slub, missing weft, knot, nep); extended with DAGM 2007 textured-surface defect classes.
  • Task: Defect detection + classification; input = 512×512 fabric tile, output = bounding boxes with defect class and confidence.
  • Model: ResNet-50 backbone (ImageNet-pretrained, progressively unfrozen) + detection head; Adam optimizer, focal loss for class imbalance.
  • Metrics: mAP@0.5 ≥ 0.88 and false-alarm rate ≤ 3% (design targets); per-class F1 reported. No accuracy is claimed as measured until the training run is executed for the order.
Parameter Value
Input tile 512 × 512, stride 256
Dataset 3,200 images, 8 classes (TILDA)
Defect classes 7 (hole, oil stain, thread error, slub, missing weft, knot, nep)
Model ResNet-50 + detection head (design target)
mAP@0.5 ≥ 0.88 (design target, not a measured claim)
False-alarm rate ≤ 3% (design target, not a measured claim)
Inference Approximately 26 ms per tile on GPU (expected)
Inspection app Single-file web app, runs offline after download

Project features

  • [Tile-based inspection] Fabric frames are split into 512×512 tiles with stride overlap so defects on tile borders are never missed.
  • [Defect localization] Bounding boxes with class labels and confidence scores drawn on every defective tile in the inspection view.
  • [ResNet-50 transfer learning] ImageNet-pretrained backbone fine-tuned on TILDA, with the backbone-freezing schedule documented for the viva.
  • [Roll grading] Tile results aggregate to roll-level verdicts — first quality vs seconds — with defect-area percentage.
  • [Batch shift reports] Per-roll defect counts, defect-type mix and grade distribution across a production shift.
  • [False-alarm control] Tunable confidence threshold balancing missed defects against false stops, with the trade-off curve in the report.
  • [DAGM 2007 extension] Additional textured-surface defect classes from the DAGM 2007 set broaden the model beyond plain weaves.

What is included

  • TILDA tiling, augmentation and training pipeline
  • Trained ResNet-50 defect detector with preprocessing
  • Inspection web app (boxes, confidence, roll grading)
  • Batch shift-report generator
  • Per-class evaluation and threshold trade-off analysis
  • Project report PDF (background, transfer-learning theory, methodology, results)
  • PPT presentation for final review
  • Viva Q&A preparation document (CNNs, transfer learning, mAP, focal loss)

Limitations & prerequisites

  • Trained on TILDA's plain and simple-patterned fabrics — heavily patterned jacquards and prints outside the training distribution are out of scope.
  • 0.88 mAP is a design target for the training run, stated honestly — the report documents the actual achieved figure after training.
  • Very small defects (a few pixels) near the tile resolution limit may be missed; the report states the minimum detectable defect size.
  • The model grades appearance only — it cannot assess fabric strength, shrinkage or colorfastness.
  • Real line-scan camera integration (lighting rig, encoder sync) is deployment hardware outside this software build.

Frequently Asked Questions

Which dataset is used and why?

TILDA from the DFG Texture Analysis group — 3,200 fabric images in 8 classes (defect-free plus seven defect types). It is the standard public benchmark for fabric defect work, so results are comparable with published papers.

Why transfer learning?

3,200 images are too few to train a deep CNN from scratch. ResNet-50's ImageNet-pretrained filters already encode texture primitives; fine-tuning adapts them to fabric faults with far less data — the report shows the from-scratch comparison.

How are defects localized?

The detection head predicts bounding boxes per tile; overlapping tiles are merged with non-maximum suppression and boxes are drawn with class labels and confidence in the inspection app.

What is the false-alarm trade-off?

Lowering the confidence threshold catches more defects but stops the line for clean fabric. The report includes the full trade-off curve so the operating point is an informed choice, not a guess.

Can it inspect patterned fabrics?

Within the TILDA pattern range, yes. Loud jacquard prints far outside the training set would need additional training data — listed as future scope.

Is this project suitable for a final-year project?

Yes — for Computer Science, IT and AI/ML programs. It covers transfer learning, object detection, evaluation discipline and a real manufacturing application. Suitable for B.E./B.Tech final-year projects in Computer Science, IT and AI & Machine Learning.

Components & software requirements
  • Python 3, PyTorch (ResNet-50, detection head)
  • torchvision (pretrained weights, transforms)
  • TILDA textile database (3,200 images, 8 classes)
  • DAGM 2007 (textured-surface extension)
  • NumPy, Matplotlib
  • HTML/CSS/JavaScript inspection app (canvas)
  • Git

Dataset & model details

  • Dataset: TILDA (DFG Texture Analysis group) — 3,200 fabric images across 8 classes (1 defect-free + 7 defect types: hole, oil stain, thread error, slub, missing weft, knot, nep); extended with DAGM 2007 textured-surface defect classes.
  • Task: Defect detection + classification; input = 512×512 fabric tile, output = bounding boxes with defect class and confidence.
  • Model: ResNet-50 backbone (ImageNet-pretrained, progressively unfrozen) + detection head; Adam optimizer, focal loss for class imbalance.
  • Metrics: mAP@0.5 ≥ 0.88 and false-alarm rate ≤ 3% (design targets); per-class F1 reported. No accuracy is claimed as measured until the training run is executed for the order.
Delivery information

Built-to-order project. Delivery timeline is shared after order confirmation based on current queue.

Support terms

Complete documentation, setup guide, and viva preparation included. Support for setup and explanation provided.

Download free synopsis (PDF)

Enter your name and WhatsApp number — the synopsis PDF downloads immediately. We may send occasional project updates on WhatsApp; no spam.

Get a quotation