0% found this document useful (0 votes)
8 views15 pages

Raja Corrections

Uploaded by

raji7balag
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views15 pages

Raja Corrections

Uploaded by

raji7balag
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

DETECTION OF MANUFACTURING DEFECTS USING

SIAMESE NETWORK

A PROJECT REPORT

Submitted by

RAJA MARIAPPAN T
(2023178056)

submitted to the Faculty of

INFORMATION AND COMMUNICATION ENGINEERING

in partial fulfillment for the award of the degree


of

MASTER OF COMPUTER APPLICATIONS

DEPARTMENT OF INFORMATION SCIENCE AND TECHNOLOGY


COLLEGE OF ENGINEERING, GUINDY
ANNA UNIVERSITY, CHENNAI 600 025

MAY 2025
ii

ANNA UNIVERSITY
CHENNAI - 600 025
BONA FIDE CERTIFICATE

Certified that this project report titled “DETECTION OF


MANUFACTURING DEFECTS USING SIAMESE NETWORK” is the
bona fide work of Raja Mariappn (2023178056) who carried out project work
under my supervision. Certified further that to the best of my knowledge
and belief, the work reported herein does not form part of any other thesis or
dissertation on the basis of which a degree or an award was conferred on an
earlier occasion on this or any other candidate.

PLACE: CHENNAI
DATE: Dr. M. DEIVAMANI
ASSISTANT PROFESSOR
PROJECT GUIDE
DEPARTMENT OF IST, CEG
ANNA UNIVERSITY
CHENNAI 600025

COUNTERSIGNED

Dr. S. SWAMYNATHAN
HEAD OF THE DEPARTMENT
DEPARTMENT OF INFORMATION SCIENCE AND TECHNOLOGY
COLLEGE OF ENGINEERING, GUINDY
ANNA UNIVERSITY, CHENNAI 600025
vi

TABLE OF CONTENTS

ABSTRACT iii
ABSTRACT(TAMIL) iv
ACKNOWLEDGEMENT v
LIST OF FIGURES ix
LIST OF TABLES x

1 INTRODUCTION 1
1.1 DEFECT DETECTION IN MANUFACTURING 1
1.1.1 Visual Inspection Systems 1
1.1.2 Siamese Networks in Defect Detection 2
1.2 CHALLENGES IN DEFECT DETECTION 3
1.2.1 Variability in Defect Appearance 3
1.2.2 Real-Time Processing Requirements 3
1.2.3 Limited Training Data 3
1.2.4 Environmental Factors 4
1.2.5 Cost and Integration 4
1.3 MOTIVATION 5
1.3.1 Quality Assurance 5
1.3.2 Cost Reduction 5
1.3.3 Production Efficiency 5
1.3.4 Adaptability to New Products 5
1.4 OBJECTIVES 6
1.5 CHALLENGES 7
1.6 PROPOSED SOLUTION 7
1.7 TESTING AND EVALUATION 8
1.8 ORGANIZATION OF THE REPORT 8

2 LITERATURE SURVEY 10
2.1 SIAMESE NETWORKS FOR DEFECT DETECTION 10
2.1.1 Basic Architecture and Working Principles 10
2.1.2 Twin and Triple Siamese Networks 11
2.2 OPTIMIZATION TECHNIQUES FOR SIAMESE
NETWORKS 12
2.2.1 Parameter Reduction and Feature Enhancement 12
vii

2.2.2 Loss Functions and Distance Metrics 13


2.3 PERFORMANCE ANALYSIS AND COMPARATIVE
STUDIES 13
2.3.1 Accuracy and Efficiency Metrics 14
2.3.2 Training Efficiency and Sample Requirements 15
2.4 APPLICATIONS IN SPECIALIZED DOMAINS 16
2.4.1 Manufacturing and Industrial Inspection 16
2.4.2 Small Sample Recognition Challenges 16
2.5 SUMMARY 17

3 SYSTEM DESIGN 19
3.1 SYSTEM ARCHITECTURE 20
3.1.1 Data Acquisition 21
3.1.2 Data Preprocessing 21
3.1.3 Siamese Network Model 22
3.1.4 Training Process 22
3.1.5 Evaluation Method 23

4 IMPLEMENTATION 25
4.1 SETTING UP THE ENVIRONMENT 25
4.1.1 Development Environment Configuration 25
4.1.2 Data Loading and Preprocessing 26
4.1.3 API Setup for Integration 26
4.2 SIAMESE NETWORK ARCHITECTURE 27
4.3 Network Architecture Implementation 28
4.4 TRAINING PROCEDURE 31
4.5 DEFECT DETECTION AND QUANTIFICATION 34
4.6 WEB API FOR INTEGRATION 37

5 RESULTS AND DISCUSSION 40


5.1 SYSTEM PERFORMANCE EVALUATION 40
5.1.1 Training Convergence 40
5.1.2 Classification Performance 41
5.2 COMPUTATIONAL PERFORMANCE 42
5.2.1 Training Efficiency 42
5.3 WEB INTERFACE EVALUATION 42
5.3.1 Technical Implementation Details 43
viii

5.4 DISCUSSION OF RESULTS 44


5.4.1 Addressing Industrial Defect Detection Challenges 45
5.4.2 Limitations 46

6 CONCLUSION AND FUTURE WORK 47


6.1 CONCLUSION 47
6.2 FUTURE WORK 47

REFERENCES 48
ix

LIST OF FIGURES

3.1 Architecture of the Manufacturing Defect Detection System 20


3.2 Defect-Free Product 21
3.3 Defective Product 21
3.4 Steps Involved in Training the Model 23

4.1 Code Defining the Siamese Model Architecture. 30

5.1 Training Loss Convergence over 50 Epochs for the


Combined Dataset. 40
5.2 Web Interface for Defect Detection Showing Reference
image, Test image, and Detection results. 43
x

LIST OF TABLES

5.1 Classification Accuracy by Product Category 41


5.2 Training Performance Metrics 42
5.3 Key Technologies Used in Web Interface Implementation 44
18

Significant contributions to the field include the triplet-based


approach by Banerjee et al. [2], the locality-sensitive hashing technique by
Fisichella [5], and the category-aware architecture by Rahman et al. [7].
Additionally, applications in specialized domains such as remote sensing by
Yang et al. [6], road region recognition by Liu et al. [9], and few-shot learning
by Snell et al. [8] demonstrate the versatility and effectiveness of Siamese
networks across various similarity-based tasks.

The system advances these efforts by applying Siamese networks


specifically to defect detection using the architecture shown in the diagram. The
model processes pairs of images through a ResNet18-based feature extractor,
calculates the absolute difference between feature vectors, and computes a
similarity score through a fully connected layer trained with Binary Cross
Entropy loss. This approach not only optimizes defect detection accuracy but
also enhances the system’s ability to identify previously unseen defect types, a
critical capability in industrial quality control applications.
21

3.1.1 Data Acquisition

The data required for this system consists of leather product


images categorized into “good” (defect-free) and “bad” (with defects) samples.
These images are collected from manufacturing facilities and organized into
appropriate directories for processing. The collected input data includes various
products textures, colors, and defect types to ensure comprehensive training
of the model.Example images representing the dataset is shown in Figure 3.2
Figure 3.3.

Figure 3.2: Defect-Free Figure 3.3: Defective


Product Product

3.1.2 Data Preprocessing

The collected input data undergoes preprocessing using various


image transformation techniques implemented through PyTorch’s transforms
module. The preprocessing pipeline includes:

• Resizing: Resizing images to a standard dimension (224x224 pixels)

• Flipping: Random horizontal flipping for data augmentation

• Rotation: Random rotation (up to 15 degrees) to introduce variance

• Color adjustments: Color jitter adjustments for brightness, contrast,


and saturation
23

carefully selected learning rate (0.00005) and weight decay (1e-5) is employed
to update the model weights during training. The system trains the model for
50 epochs, monitoring the loss value to ensure proper convergence.The steps
involved in the training process are shown in Figure 3.4.

The training data is organized into pairs consisting of:

• Same-class pairs: good-good or bad-bad (labeled as 1)

• Different-class pairs: good-bad (labeled as 0)

This pairwise training approach enables the model to learn the


similarity metric space effectively.

Figure 3.4: Steps Involved in Training the Model


30

through identical transformations, maintaining consistency in the feature space.


The absolute difference operation in the feature comparison stage highlights
discrepancies between the images while preserving spatial information about
potential defect locations.

Figure 4.1: Code Defining the Siamese Model Architecture.

The similarity head of the Siamese Network, as shown in Figure 4.1,


includes Batch Normalization layers that help stabilize training and improve
40

CHAPTER 5

RESULTS AND DISCUSSION

5.1 SYSTEM PERFORMANCE EVALUATION

The Siamese network-based defect detection system was trained on


multiple product categories (hazelnut, leather, zipper, toothbrush, and capsule)
simultaneously to improve generalization capabilities. This section presents the
performance metrics, loss convergence during training, and evaluation results
across different product categories.

5.1.1 Training Convergence

As illustrated in Figure 5.1, the loss convergence over 50 epochs


of training on the combined dataset shows stable behavior. The model
demonstrated consistent convergence, with the Binary Cross-Entropy (BCE)
loss decreasing from an initial value of 0.7665 to 0.2105 by the end of training.

Figure 5.1: Training Loss Convergence over 50 Epochs for the Combined
Dataset.
43

5.3 WEB INTERFACE EVALUATION

The web interface developed for the defect detection system provides
an intuitive and accessible means for quality control personnel to interact with
the Siamese network model. Figure 5.2 shows the main interface for uploading
reference and test images.

Figure 5.2: Web Interface for Defect Detection Showing Reference image,
Test image, and Detection results.

The interface allows users to upload a reference image (defect-free


sample) and one or more test images for comparison. The system processes
the images and displays the results, including a similarity score, defect
classification, and defect percentage for each test image.

5.3.1 Technical Implementation Details

The web interface for the defect detection system was implemented
using React.js (v18.2.0) to provide a responsive and interactive user experience.
48
REFERENCES

[1] Mohammad, Taj, Boughey, Rajesh, Prasad, Ritu, “Implementation


of Siamese Network for Similarity Computation and Prediction of
Handwritten Digits”, International Conference on Current Development
in Engineering and Technology (ICCET), New Delhi, India, Page Number:
125-132, December 2022.
[2] Banerjee, Debapriya, Kyrarini, Maria, Kim, Won Hwa, “Image-Label
Recovery on Fashion Data Using Image Similarity from Triple Siamese
Network”, Technologies, Volume Number: 9, Issue Number: 1, Page
Number: 1-16, January 2021.
[3] Zhang, Zihan, Gao, Jing, Xu, Feng, Chen, Junjie, “Siamese GC Capsule
Networks for Small Sample Cow Face Recognition”, IEEE Access,
Volume Number: 11, Page Number: 125918-125926, November 2023.
[4] Melekhov, Iaroslav, Kannala, Juho, Rahtu, Esa, “Siamese Network
for Object Similarity Estimation”, International Conference on Pattern
Recognition (ICPR), Canc’un, Mexico, Volume Number: 45, Issue
Number: 2, Page Number: 378-383, December 2016.
[5] Fisichella, Marco, “SimPair LSH: A Novel Locality-Sensitive Hashing
for Faster Similarity Learning”, Journal of Machine Learning Research,
Volume Number: 1, Issue Number: 1, Page Number: 1-18, January 2021.
[6] Yang, Le, Jiang, Xiangyu, Zhou, Luming, Xia, Zhengchao, Zhou, Yanfei,
“Remote Sensing Image Change Detection Using Siamese Network”,
IEEE Transactions on Geoscience and Remote Sensing, Volume Number:
56, Issue Number: 6, Page Number: 3295-3305, June 2018.
[7] Rahman, Arif, Wang, Yang, Nguyen, Sinnathurai, Lyu, Siwei, Zhou,
Wei, “Category-Aware Siamese CNN for Image Similarity Learning”,
International Journal of Machine Learning and Cybernetics, Volume
Number: 11, Issue Number: 4, Page Number: 791-804, April 2020.
[8] Snell, Jake, Swersky, Kevin, Zemel, Richard, “Prototypical Networks for
Few-Shot Learning”, Neural Information Processing Systems (NeurIPS),
Volume Number: 30, Page Number: 4077-4087, December 2017.
[9] Liu, Huafeng, Chen, Liping, Zheng, Nanning, Xiong, Wei, Liu, Yiyi,
“Road Region Recognition Using SiNN with LiDAR and Camera Fusion”,
Sensors, Volume Number: 20, Issue Number: 7, Page Number: 2037,
March 2020.
49

[10] Tao, Bo, Wang, Pengfei, Zheng, Haotian, Wen, Yonghui, Luo, Shengyong,
“Probabilistic Siamese Network for Image Matching”, Pattern Recognition
Letters, Volume Number: 125, Page Number: 534-540, October 2019.

You might also like