Sefism is free for learners. We are here to help you grow, one step at a time.Join for free
Sefism.
AI & ML

Fabric Defect Inspection with Anomaly Detection for Small Textile Units

A final year project that builds a camera-based fabric inspection aid for small weaving and knitting units, using anomaly detection trained mostly on defect-free fabric. You compare anomaly methods on public data and your own images, and deliver an inspection screen that flags and logs defects by roll.

Difficulty

Beginner

Achievable by one student in a semester with familiar tools.
Effort

1 semester · 2 students

Deliverables

6 to ship

3 optional extras

Suggested stack

PythonPyTorchAnomalibOpenCVFastAPIReactSQLite
A suggestion, not a requirement. Swap anything for what you already know.

What you should ship

  • A reproducible benchmark of at least two anomaly detection methods (for example PatchCore and PaDiM) on the public AITEX fabric dataset.
  • A small in-house dataset of at least 500 images of one or two local fabrics captured under fixed lighting, with defect regions marked on the defective ones.
  • A trained model that produces a per-image defect score and a heatmap locating the defect.
  • An inspection screen that shows a live or uploaded frame, the heatmap overlay and a pass or flag decision at a threshold the supervisor can set.
  • A defect log per fabric roll with image, position, time and operator confirmation, exportable to CSV.
  • An evaluation report with image-level AUROC, pixel-level localisation quality and the false alarm rate at the chosen threshold.

If you have time left

  • Classify confirmed defects into types (hole, stain, broken yarn, slub) once enough examples exist.
  • Run the model on a Raspberry Pi 5 or a low-cost mini PC and report frames per second.
  • A simple conveyor rig with a fixed camera and LED bar to simulate an inspection table.

The problem small textile units have with inspection

In large mills, fabric inspection is increasingly automated. In small weaving, knitting and finishing units, which make up a large part of the textile trade in Pakistan, Bangladesh, India and Turkey, inspection is still a person standing at a lit table watching fabric roll past. Human inspectors tire quickly, miss small defects late in a shift, and rarely record where on the roll a defect was found. A defect found by the buyer instead of the unit means a rejected lot, a claim and a lost customer.

The hard part for small units is not the camera. It is that they cannot collect thousands of labelled defect images for every fabric they run.

What already exists and the gap

  • Smartex fits cameras to circular knitting machines and detects defects in real time; the EU innovation council profile credits it with cutting defective production sharply at partner mills. It is a hardware and software system aimed at larger manufacturers.
  • Cognex and other machine vision vendors sell deep learning inspection tools that work well but need integration budgets far beyond a small unit.
  • Roboflow and similar platforms make training a defect detector easy, but a supervised detector needs many labelled defect examples.

The gap is a low-cost inspection aid that learns mostly from good fabric, which is abundant, and flags anything unusual for a human to confirm.

What you build

An inspection assistant with three parts. A capture setup: a fixed phone or USB camera above a lit table with consistent lighting. A model service that scores each frame for anomalies and returns a heatmap. And an inspection screen where the operator sees the flagged area, confirms or dismisses it, and the confirmation is logged against the roll number and position.

You use unsupervised anomaly detection: the model sees only defect-free images during training and learns what normal texture looks like. Anything that looks different gets a high score. Libraries such as Anomalib implement PatchCore, PaDiM and other methods, so your effort goes into data, evaluation and the workflow rather than reimplementing papers.

The technically interesting part

Choosing a threshold that a factory will accept. Anomaly models output a continuous score; the operator needs a yes or no. Set the threshold too low and the tool cries wolf on every lighting change, so operators ignore it. Too high and it misses the small holes that matter. Show your evaluator the trade-off explicitly: a precision and recall curve on your own images, the false alarms per 100 metres of fabric at your chosen threshold, and what changes when lighting shifts. The public AITEX dataset (245 large images of seven fabrics, with twelve defect types) is small and controlled, which is exactly why you also need your own images: showing how a model trained on AITEX transfers, or fails to transfer, to a local fabric is a result worth reporting.

How to evaluate it

  • Image-level AUROC and pixel-level localisation score for each method on AITEX and on your own dataset.
  • False alarms per 100 frames of defect-free fabric at the chosen threshold, and recall on defective frames.
  • Robustness: repeat the test with lighting dimmed by a fixed amount and report the change.
  • Inference time per frame on a laptop CPU.
  • A trial with one inspector or a classmate playing that role: defects found with and without the tool on the same set of images.

Suggested plan

  1. Weeks 1 to 2: reproduce PatchCore and PaDiM on AITEX with Anomalib.
  2. Weeks 3 to 5: build the capture setup and collect your own fabric images, including real or simulated defects.
  3. Weeks 6 to 8: train on your data, tune thresholds, test lighting robustness.
  4. Weeks 9 to 11: inspection screen, defect log and export.
  5. Weeks 12 to 14: inspector trial and write-up.

Path to a product

The first customer is a small finishing or knitting unit near your university; offer a free pilot on one line in exchange for data and feedback. The product is a kit (camera, light bar, mini PC and software) sold for a one-time price with an annual support fee, or leased monthly. Scaling means a library of fabric profiles trained per customer, which the anomaly approach makes cheap to create.

Scope warning

Do not attempt a full automatic reject or cutting system, and do not promise defect classification before you have enough confirmed examples. Do not build custom hardware beyond a simple fixed camera and light. The contribution is the measured anomaly workflow, not the rig.

Learn what you need on Sefism

Get help with this idea

The make-or-break decisions are your capture setup and your threshold policy. A mentor can help you plan the data collection so the evaluation is fair. Bring your draft scope, the dataset you plan to use and your evaluation table, and we can look at them together. The build is yours; the guidance is on scope, stack and how to measure it. If you are new here, create a free account first.

Ideas and guidance, not finished projects

These are project ideas and scoping guidance, published free for students to use as a starting point. I do not build, write, or sell final-year projects, and I do not complete coursework for anyone. Take an idea, make it yours, and build it.

Not sure this one fits you?

I help students pick an idea that matches their skills and their deadline, then scope it down until it is finishable. Guidance only, never done for you.

Discuss this idea
Work with me

Stuck on something specific?

Writing only gets you so far. If you want an answer to your situation rather than the general case, book a session and we will work through it together. Sessions are free for approved Sefism members, and a few slots open each week.