£7 ^flBRARV " U B I V E R S I T Y OF M O R A T U W A . SR I I A N « — — M O R A T U W A A Neural Network Approach to Classification of Textile Defects J.T.S. Priyadarshani 08/10036 University of Moratuwa O 0 4 f 11 102481 Dissertation submitted to the Faculty of Information Technology, University of Moratuwa for the partial fulfillment of the requirements of the of MSc. (PG Dip) in Information Technology /O^tyS f February 201 102481 Lb/ DO*/ /9/20/X Declaration I declare this thesis is my own work and has not been submitted in any form for another degree or diploma at any other university or other institution of tertiary education. Information derived from the published or unpublished work of others has been acknowledged in the text and a list of references is given. JTS Priyadarshani Name of Student Signature of Student Date: |3|c7f>Uo// 1 Supervised by Prof. AS Karunananda Name of Supervisor(s) Signature of Supervisor(s) Date: W/C,*/**' ii Dedication This Outcome is lovingly dedicated to Thaththa, Amma and Upul. iii Acknowledgments While I am preparing this report, I turned back to convey my gratitude to many people for their valuable time spend towards me. This research will be benefited in many ways through their generosity and opinions which are expressed are not to be interpreted as held by those whose courtesy and helpfulness are here acknowledged. First, I wish to sincerely thank the research supervisor, Prof. A S Karunananda, Dean, Faculty of Information Technology, for guiding me to complete this valuable research project. Secondly, I wish to express my sincere gratitude to the senior lecturers, Mr. Saminda Premaratne in Department of Information Technology and Dr Ranga Rodrigo Department of Electronic and Telecommunication Engineering for their valuable advices on the technical matters. Further I would like to express my heartfelt appreciation to Mr. Sahan Ranasinghe, Department of Electrical and Information Engineering in the University of Ruhuna and Rasika Jayewardena, Instructor in the Department of Electrical Engineering for spending their valuable time in sharing their knowledge with me. In fact, I would like to thank, Mr. Upul Dharmadasa and Ms. Nilupa Liyanage, Indika Samarasinghe and Dilhan Thilakarathne for assisting me in different ways in making this project a success in the initial stage. In addition, I wish to convey my heartiest gratitude to Mourice Jochim, Product Dvelopment manager of Penguine Sportswear, Mr. Chandika Dharmadasa, Quality Executive, Brandix Casualwear, Mr. Mr. Sisira Bandaranayake, Group Sample Room Manager, Emjeyi Apparel Ltd, Mr. Kapila Jayesundara, Quality manager in MAS Casual Line, Mr. Lahiru Ranasinghe, Metropolitan Ltd by providing me in requiring hardware and software. Last but not least I convey my heartiest gratitude to my dearest parents and all the others who guided me even in a word to make this outcome a perfectly one. Finally I would like to thank Ms. Judith Labrooy for proof reading this report within very short period of time. Thank you all! JTS Priyadarshani Faculty of IT iv Abstract All textile industries aim to produce competitive textiles. The competition enhancement depends mainly on productivity and quality of the textiles produced by each industry. Especially in the least developed countries like Sri Lanka, India, Bangladesh where textile is one of the main incomes of economy, still using manual quality control techniques to identify defects in their textile products. Therefore this study carries out to classify defects in textiles with minimum intervention of human being using artificial neural network technology and some principles of image processing techniques. My approach is to identify defects in textile comprises three steps, namely, image processing, image classification and producing the output as a classification chart. I have used the standard techniques of image processing; while the image classification is handled by an ANN trained in the supervised mode with the aid of back propagation training algorithm. I have selected three major defect types of defects from textile quality process. They are cut hole damages, open seam of the garment and pen marks. Input data is a 185220x30 matrix and it is representing 30 samples of 185220 elements. The output of the system will be an image file with a defect classification chart. In fact, basically this system is able to classify defects in to three categories. This system mainly is divided in to three sections namely; image processing module, neural network module and output generator module. But the system design is separated in to two parts. The first part of the research processes the images to fit for the input layer of the neural network. The second part uses the input set to classify the defects and adapts the neural net. The prototype develop in this project have been trained to identify cut hole damages, open seam and pen mark of the garments by considering 300 images. A concatenate image, which contained 300 samples of each defect type, was trained and tested. The accuracy rate of recognizing the numbers and symbols were 77%. However this accuracy rate is very high. Using the neural network technology and back propagation learning algorithm, to classify textile defects were successful even there was a high probability to misclassify different types of defect images with different range of severity rates. Keywords: Neural network, Back propagation learning algorithm Contents Chapter 1 Introduction 1 1.1 Introduction 1 1.2 Textile Quality Control System 1 1.3 Background and Motivation 3 1.4 Aim and Objectives 3 1.5 Towards the Technology and Solution 4 1.6 Resource Requirement 4 1.7 Structure of the Dissertation 4 1.8 Summary 5 Chapter 2 Review of Textile Defects Classification Systems 6 2.1 Introduction 6 2.2 Current Approaches for Textile Defects Recognition and classification Systems 6 2.3 Discussion on Others' Approaches 8 2.4 Summary 8 Chapter 3 Principles of Image Processing and Artificial Neural Networks 10 3.1 Introduction 10 3.2 Review of Available Technologies 10 3.2.1 Principle Component Analysis (PCA) 10 3.2.1.1 Objectives of principal component analysis 10 3.2.1.2 Limitations of PCA 11 3.2.2 Statistical Models 11 3.2.3 Artificial Neural Network (ANN) 11 3.2.3.1 Why use neural networks? 11 3.3 Image Processing 12 3.4 Artificial Neural Network 13 3.4.1 Network layers 15 vi Page 3.4.2 Types of Neural Networks 15 vn 3.4.2.1 Multi-Layer Feed -forward Neural Networks 16 3.4.2.2. Feedback networks 17 3.4.2.3 Back Propagation Algorithm 17 3.5 Summary 19 Chapter 4 Approach 20 4.1 Introduction 20 4.2 Textile Defects classification Using Neural Network 20 4.2.1 Input 20 4.2.2 Output 21 4.2.3 User 21 4.2.4 Processes 22 4.2.5 Features 22 4.3 Summary 22 Chapter 5 Analysis and Design 23 5.1 Introduction 23 5.2 Top Level Architecture 23 5.3 Image Processing Module 24 5.3.1 Normalization 24 5.3.2 Thresholding 24 5.3.3 Segmentation 25 5.3.4 Feature Extraction 25 5.4 Artificial Neural Network Module 25 5.5 Output Generator Module 26 5.6 Summary 26 Chapter 6 Implementation of the Textile Defects Classification System 28 6.1 Introduction 28 6.2 Creating the Textile Defects Classification System viii 6.3 Preparing Training and Testing Data Set 6.3.1 Training 6.3.2 Validation 6.3.3 Testing 6.3.4 Concatenate images; 6.4 Normalization and Reading Pixel Value of the Image 6.5 Neural Network Architecture 6.6 Training and Learning Mechanism 6.6.1 Setting the Weights 6.6.2 Backpropagation Algorithm 6.6.3 Training of Network 6.6.4 Training performance 6.7 Simulation Results 6.8 Error Rate Estimation 6.9 Output Generator Module 6.10 Summary Chapter 7 Evaluation of the Textiles Defects Classification Syst< 7.1 Introduction 7.2 Evaluation of Textile Defects Classification System 7.3 Summary Chapter 8 Conclusion and Further Works 8.1 Introduction 8.2 Conclusion 8.3 Limitations 8.4 Further Improvements 8.5 Summary References ix Appendix A - Use Case Diagram for Recognition of Textile Defects Appendix B - Source Code of Create a Neural Network Appendix C - Source Code of GUI Design List of Figures Page No. Figure 3.1: Multi Layer Artificial Neural Networks 15 Figure 3.2: Three layers feed - forward neural net 16 Figure 3.3: Processing unit element 17 Figure 3.4: Multilayer feedback ANN 17 Figure 3.5: Forward and Backward propagation 18 Figure 5.1: Top Level Architecture of the System 23 Figure 6.1: System Design of Textile Defects Detector 29 Figure 6.2: Normalization (55 X 55 Open seam) 32 Figure 6.3: Neural Network Architecture 33 Figure 6.4: Flow Chart of Training the Network 36 Figure 6.5: Training the Network with nftool in Matlab 37 Figure 6.6: Training Performance 38 Figure A. l : Use case Diagram for Defect Recognition 50 x List of Tables Table 1.1: Discussions on Others' Approaches Table 6.1: Results of Classification Table 6.2: Output Layer Target Neuron Values xi