Comparative Evaluation of a Custom CNN, Mobilenetv2, and A Lightweight Vision Transformer for Automated Woven-Fabric Weave-Pattern Classification
Abstract
Weave-pattern identification is one of the more tedious quality-control steps in textile manufacturing, and most mills still rely on a trained inspector holding a swatch up to the light. This paper benchmarks three deep-learning classifiers — a custom convolutional neural network (CNN) built from scratch, a transfer-learning pipeline built on MobileNetV2, and a compact, single-block Vision Transformer (ViT) implemented without ImageNet pre-training — on the task of sorting 224×224 fabric-swatch photographs into four weave families: honeycomb, plain, satin, and twill. All three models were trained under an identical 80/20 split of 1,496 images (1,197 train / 299 validation) for ten epochs, with the input pipeline deliberately desaturated (RGB → grayscale → RGB) so that classification decisions could not lean on dye color. The transfer-learning model reached a validation accuracy of 95.99% (peak 97.32% at epoch 6) with a weighted F1-score of 0.96, comfortably outperforming the from-scratch CNN (52.51% accuracy, F1 = 0.51) and the untrained ViT (68.90% accuracy, F1 = 0.69). Confusion-matrix analysis shows that the plain and twill classes are the primary sources of error for the weaker models, and a qualitative single-image test on the best model reproduces this exact confusion, misclassifying a twill sample as plain with 96.78% confidence. The results argue for pretrained, parameter-efficient backbones over either shallow custom CNNs or non-pretrained transformers when the available fabric dataset is in the low thousands of images, and they surface a preprocessing detail — an unintended double normalization inside the custom-CNN branch — that likely worsened that model's already modest showing.