Project Report Final 5 58
Project Report Final 5 58
ACKNOWLEDGEMENT
I also thank the faculty member and non teaching staff members
of the Department of Information Science and Technology, Anna University,
Chennai for their valuable support throughout the course of our project work.
RAJA MARIAPPAN T
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
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
REFERENCES 48
ix
LIST OF FIGURES
LIST OF TABLES
CHAPTER 1
INTRODUCTION
1.3 MOTIVATION
The motivation for this research stems from the potential benefits that
advanced defect detection systems can bring to manufacturing industries:
1.4 OBJECTIVES
1.5 CHALLENGES
CHAPTER 2
LITERATURE SURVEY
tasks with limited training data. Experimental results demonstrated that their
SGCCN reduced parameter usage by 57.65% while increasing recognition
accuracy by 7.67% compared to conventional Siamese capsule networks.
2.5 SUMMARY
CHAPTER 3
SYSTEM DESIGN
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.
CHAPTER 4
IMPLEMENTATION
• PyTorch (1.12.0) for building and training the neural network models
• Flask (2.2.2) for creating a RESTful API to integrate the model into
production systems
defect detection that accepts a reference image (defect-free sample) and one
or more test images. It returns detailed information about each test image,
including a similarity score, defect prediction, and defect percentage. The API
implementation includes:
Input
Assumptions
• The model should generalize across different types of defects within the
same product category
Algorithm
Time Complexity:
Space Complexity: The space complexity is O(b · d), where b is the batch size
and d is the dimension of the feature vectors
29
Expected Output
This module details the training procedure for the Siamese network,
including data preparation, loss function selection, and optimization strategies.
The model was trained on multiple product categories simultaneously to
improve generalization and reduce the need for product-specific models.
Input
• Training dataset containing pairs of images (reference and test) with binary
labels
• Images are preprocessed and augmented to improve model robustness
Assumptions
Algorithm
Time Complexity:
Space Complexity: The space complexity is O(m + bd), where m is the model
size, b is the batch size, and d is the dimension of the processed data.
Implementation Details
Expected Output
Input
• One or more test images that are to be evaluated for the presence of
manufacturing defects by comparing their features to those of the reference
image.
Assumptions
• The reference image used during the evaluation phase is an accurate and
consistent representation of a defect-free product.
• The Siamese network model has been adequately trained using a wide
variety of defective and non-defective samples, enabling it to effectively
generalize to new, unseen defect patterns.
• All input images, including both reference and test samples, are assumed
to be uniformly preprocessed.
• It is assumed that the input images are free from excessive noise,
occlusions, or distortions that could adversely affect the feature extraction
and similarity measurement process.
35
Algorithm
Time Complexity:
Process
Expected Output
Input
• HTTP POST requests are sent to the API endpoint containing a reference
image (assumed to be defect-free) and a test image for comparison. These
images are essential for identifying visual differences that may indicate
defects.
Assumptions
• The client systems send images in supported formats such as JPEG or PNG,
ensuring compatibility with the image processing pipeline.
• The system assumes a stable and reliable network connection that can
handle the transfer of image files without interruptions, which is critical
for real-time or batch processing scenarios.
38
Algorithm
Time Complexity: Per Request: O(tm), where t is the number of test images
and m is the complexity of model inference
Space Complexity: O(ts), where t is the number of test images and s is the
average size of an image
39
Implementation Details
Expected Output
• JSON response containing defect detection results for each test image
CHAPTER 5
Figure 5.1: Training loss convergence over 50 epochs for the combined
dataset.
41
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 web interface for the defect detection system was implemented
using React.js (v18.2.0) to provide a responsive and interactive user experience.
44
5.4.2 Limitations
CHAPTER 6
6.1 CONCLUSION