fix some todos and spelling errors
All checks were successful
Build Typst document / build_typst_documents (push) Successful in 21s

This commit is contained in:
lukas-heiligenbrunner 2025-01-15 07:03:10 +01:00
parent 30d09a67d2
commit c5bd509f24
3 changed files with 25 additions and 23 deletions

View File

@ -6,32 +6,31 @@ Anomaly detection has especially in the industrial and automotive field essentia
Lots of assembly lines need visual inspection to find errors often with the help of camera systems. Lots of assembly lines need visual inspection to find errors often with the help of camera systems.
Machine learning helped the field to advance a lot in the past. Machine learning helped the field to advance a lot in the past.
Most of the time the error rate is sub $.1%$ and therefore plenty of good data and almost no faulty data is available. Most of the time the error rate is sub $.1%$ and therefore plenty of good data and almost no faulty data is available.
So the train data is heavily unbalaned.#cite(<parnami2022learningexamplessummaryapproaches>) So the train data is heavily unbalaned.~#cite(<parnami2022learningexamplessummaryapproaches>)
PatchCore and EfficientAD are state of the art algorithms trained only on good data and then detect anomalies within unseen (but similar) data. PatchCore and EfficientAD are state of the art algorithms trained only on good data and then detect anomalies within unseen (but similar) data.
One of their problems is the need of lots of training data and time to train. One of their problems is the need of lots of training data and time to train.
Moreover a slight change of the camera position or the lighting conditions can lead to a complete retraining of the model. Moreover a slight change of the camera position or the lighting conditions can lead to a mandatory complete retraining of the model.
Few-Shot learning might be a suitable alternative with hugely lowered train times and fast adaption to new conditions.~#cite(<efficientADpaper>)#cite(<patchcorepaper>)#cite(<parnami2022learningexamplessummaryapproaches>) Few-Shot learning might be a suitable alternative with hugely lowered train times and fast adaption to new conditions.~#cite(<efficientADpaper>)#cite(<patchcorepaper>)#cite(<parnami2022learningexamplessummaryapproaches>)
In this thesis the performance of 3 Few-Shot learning algorithms will be compared in the field of anomaly detection. In this thesis the performance of 3 Few-Shot learning algorithms (ResNet50, P>M>F, CAML) will be compared in the field of anomaly detection.
Moreover, few-shot learning might be able not only to detect anomalies but also to detect the anomaly class. Moreover, few-shot learning might be able not only to detect anomalies but also to detect the anomaly class.
== Research Questions <sectionresearchquestions> == Research Questions <sectionresearchquestions>
=== Is Few-Shot learning a suitable fit for anomaly detection? === Is Few-Shot learning a suitable fit for anomaly detection?
_Should Few-Shot learning be used for anomaly detection tasks?
Should Few-Shot learning be used for anomaly detection tasks? How does it compare to well established algorithms such as Patchcore or EfficientAD?_
How does it compare to well established algorithms such as Patchcore or EfficientAD?
=== How does disbalancing the Shot number affect performance? === How does disbalancing the Shot number affect performance?
Does giving the Few-Shot learner more good than bad samples improve the model performance? _Does giving the Few-Shot learner more good than bad samples improve the model performance?_
=== How does the 3 (ResNet, CAML, \pmf) methods perform in only detecting the anomaly class? === How does the 3 (ResNet, CAML, \pmf) methods perform in only detecting the anomaly class?
How much does the performance improve if only detecting an anomaly or not? _How much does the performance improve if only detecting an anomaly or not?
How does it compare to PatchCore and EfficientAD? How does it compare to PatchCore and EfficientAD?_
#if inwriting [ #if inwriting [
=== Extra: How does Euclidean distance compare to Cosine-similarity when using ResNet as a feature-extractor? === _Extra: How does Euclidean distance compare to Cosine-similarity when using ResNet as a feature-extractor?_
// I've tried different distance measures $->$ but results are pretty much the same. // I've tried different distance measures $->$ but results are pretty much the same.
] ]
@ -46,7 +45,7 @@ It outlines the experimental setup, including the use of Jupyter Notebook for pr
The experimental outcomes are presented in @sectionexperimentalresults. The experimental outcomes are presented in @sectionexperimentalresults.
This section addresses the research questions posed in @sectionresearchquestions, examining the suitability of Few-Shot Learning for anomaly detection tasks, the impact of class imbalance on model performance, and the comparative effectiveness of the three selected methods. This section addresses the research questions posed in @sectionresearchquestions, examining the suitability of Few-Shot Learning for anomaly detection tasks, the impact of class imbalance on model performance, and the comparative effectiveness of the three selected methods.
Additional experiments explore the differences between Euclidean distance and Cosine similarity when using ResNet as a feature extractor.#todo[Maybe remove this] //Additional experiments explore the differences between Euclidean distance and Cosine similarity when using ResNet as a feature extractor.#todo[Maybe remove this]
Finally, @sectionconclusionandoutlook, summarizes the key findings of this study. Finally, @sectionconclusionandoutlook, summarizes the key findings of this study.
It reflects on the implications of the results for the field of anomaly detection and proposes directions for future research that could address the limitations and enhance the applicability of Few-Shot Learning approaches in this domain. It reflects on the implications of the results for the field of anomaly detection and proposes directions for future research that could address the limitations and enhance the applicability of Few-Shot Learning approaches in this domain.

View File

@ -57,7 +57,8 @@
FSL offers a promising alternative by enabling models to generalize effectively from minimal samples, thus reducing training time and adaptation overhead. FSL offers a promising alternative by enabling models to generalize effectively from minimal samples, thus reducing training time and adaptation overhead.
The study evaluates three FSL methods—ResNet50, P>M>F, and CAML—using the MVTec AD dataset. The study evaluates three FSL methods—ResNet50, P>M>F, and CAML—using the MVTec AD dataset.
Experiments focus on tasks such as anomaly detection, class imbalance handling, and comparison of distance metrics. Experiments focus on tasks such as anomaly detection, class imbalance handling, //and comparison of distance metrics.
and anomaly type classification.
Results indicate that while FSL methods trail behind state-of-the-art algorithms in detecting anomalies, they excel in classifying anomaly types, showcasing potential in scenarios requiring detailed defect identification. Results indicate that while FSL methods trail behind state-of-the-art algorithms in detecting anomalies, they excel in classifying anomaly types, showcasing potential in scenarios requiring detailed defect identification.
Among the tested approaches, P>M>F emerged as the most robust, demonstrating superior accuracy across various settings. Among the tested approaches, P>M>F emerged as the most robust, demonstrating superior accuracy across various settings.

View File

@ -18,7 +18,7 @@ Each category comprises a set of defect-free training images and a test set of i
In this bachelor thesis only two categories are used. The categories are "Bottle" and "Cable". In this bachelor thesis only two categories are used. The categories are "Bottle" and "Cable".
The bottle category contains 3 different defect classes: 'broken_large', 'broken_small' and 'contamination'. The bottle category contains 3 different defect classes: _broken_large_, _broken_small_ and _contamination_.
#subpar.grid( #subpar.grid(
figure(image("rsc/mvtec/bottle/broken_large_example.png"), caption: [ figure(image("rsc/mvtec/bottle/broken_large_example.png"), caption: [
Broken large defect Broken large defect
@ -34,8 +34,8 @@ The bottle category contains 3 different defect classes: 'broken_large', 'broken
label: <full>, label: <full>,
) )
Whereas cable has a lot more defect classes: 'bent_wire', 'cable_swap', 'combined', 'cut_inner_insulation', Whereas cable has a lot more defect classes: _bent_wire_, _cable_swap_, _combined_, _cut_inner_insulation_,
'cut_outer_insulation', 'missing_cable', 'missing_wire', 'poke_insulation'. _cut_outer_insulation_, _missing_cable_, _missing_wire_, _poke_insulation_.
So many more defect classes are already an indication that a classification task might be more difficult for the cable category. So many more defect classes are already an indication that a classification task might be more difficult for the cable category.
#subpar.grid( #subpar.grid(
@ -72,31 +72,33 @@ So many more defect classes are already an indication that a classification task
=== Few-Shot Learning === Few-Shot Learning
Few-Shot learning is a subfield of machine-learning which aims to train a classification-model with just a few or no samples at all. Few-Shot learning is a subfield of machine-learning which aims to train a classification-model with just a few or no samples at all.
In contrast to traditional supervised learning where a huge amount of labeled data is required is to generalize well to unseen data. In contrast to traditional supervised learning, where a huge amount of labeled data is required to generalize well to unseen data,
So the model is prone to overfitting to the few training samples.#cite(<parnami2022learningexamplessummaryapproaches>) here we only have 1-10 samples per class (so called shots).
So the model is prone to overfitting to the few training samples and this means they should represent the whole sample distribution as good as possible.~#cite(<parnami2022learningexamplessummaryapproaches>)
Typically a few-shot leaning task consists of a support and query set. Typically a few-shot leaning task consists of a support and query set.
Where the support-set contains the training data and the query set the evaluation data for real world evaluation. Where the support-set contains the training data and the query set the evaluation data for real world evaluation.
A common way to format a few-shot leaning problem is using n-way k-shot notation. A common way to format a few-shot leaning problem is using n-way k-shot notation.
For Example 3 target classeas and 5 samples per class for training might be a 3-way 5-shot few-shot classification problem.#cite(<snell2017prototypicalnetworksfewshotlearning>)#cite(<patchcorepaper>) For Example 3 target classes and 5 samples per class for training might be a 3-way 5-shot few-shot classification problem.~@snell2017prototypicalnetworksfewshotlearning @patchcorepaper
A classical example of how such a model might work is a prototypical network. A classical example of how such a model might work is a prototypical network.
These models learn a representation of each class and classify new examples based on proximity to these representations in an embedding space.#cite(<snell2017prototypicalnetworksfewshotlearning>) These models learn a representation of each class in a reduced dimensionality and classify new examples based on proximity to these representations in an embedding space.~@snell2017prototypicalnetworksfewshotlearning
#figure( #figure(
image("rsc/prototype_fewshot_v3.png", width: 60%), image("rsc/prototype_fewshot_v3.png", width: 60%),
caption: [Prototypical network for few-shots. #cite(<snell2017prototypicalnetworksfewshotlearning>)], caption: [Prototypical network for 3-ways and 5-shots. #cite(<snell2017prototypicalnetworksfewshotlearning>)],
) <prototypefewshot> ) <prototypefewshot>
The first and easiest method of this bachelor thesis uses a simple ResNet to calucalte those embeddings and is basically a simple prototypical network. The first and easiest method of this bachelor thesis uses a simple ResNet50 to calucalte those embeddings and clusters the shots together by calculating the class center.
See @resnet50impl.~#cite(<chowdhury2021fewshotimageclassificationjust>) This is basically a simple prototypical network.
See @resnet50impl.~@chowdhury2021fewshotimageclassificationjust
=== Generalisation from few samples === Generalisation from few samples
An especially hard task is to generalize from such few samples. An especially hard task is to generalize from such few samples.
In typical supervised learning the model sees thousands or millions of samples of the corresponding domain during learning. In typical supervised learning the model sees thousands or millions of samples of the corresponding domain during learning.
This helps the model to learn the underlying patterns and to generalize well to unseen data. This helps the model to learn the underlying patterns and to generalize well to unseen data.
In few-shot learning the model has to generalize from just a few samples. In few-shot learning the model has to generalize from just a few samples.#todo[Source?]#todo[Write more about. eg. class distributions]
=== Softmax === Softmax
#todo[Maybe remove this section] #todo[Maybe remove this section]