SlideShare a Scribd company logo
T. Mensink et al.,
Distance-Based Image Classification:
Generalizing to new classes at near-zero cost,
IEEE PAMI, April, 2013
Reviewed by
LG CNS, AI Tech Team
Sangjun Han
2018. 12. 09
2
Metric Learning
• What is metric learning
- Learning metrics for solving machine learning problems
- Simply speaking, a loss function can be defined using metrics
- e.g. Euclidean distance, cosine similarity…
• Why metric learning
- General classification problems => softmax(losses for each class)
- Their output values tell us which is more probable, but no more information
- Metric learning => not only single probability, but also metrics between its classes
- e.g. The distance (or similarity) between class 1 and class 2
- Image retrieval, face verification, incremental learning… more flexible!
3
Nearest Class Mean Metric Learning (NCMML)
• Concept
- Assign an x (image or feature from image) to the class
where it is closest to class prototype uc
- The prototype can be obtained by averaging input training data in a class
(So, you can get C prototypes which stands for each class)
- Mahalanobis distance between x and uc
We learn W to minimize distance of x and x’
It means to minimize Euclidean distance in semantic space
4
Nearest Class Mean Metric Learning (NCMML)
Wu1
Wu2 Wu3
Wx
5
Nearest Class Mean Metric Learning (NCMML)
• Concept
- Softmax activation for distance matrix
- Cross entropy loss function
- Gradient descent for the loss function
6
Nearest Class Mean Metric Learning (NCMML)
W : d x D
X : D x N
Mmeans : D x C (prototype for each class)
D : feature dimension in original space
d : feature dimension in sematic space
N : The number of data
C : The number of class
Forward pass
How to compute Euclidean distance efficiently between two matrices
https://scikit-learn.org/stable/modules/generated/sklearn.metrics.pairwise.euclidean_distances.html
• Implementation
- You can get the author’s code at (written on MATLAB)
https://staff.fnwi.uva.nl/t.e.j.mensink/uva12/code.php
7
Nearest Class Mean Metric Learning (NCMML)
Compute gradient
• Implementation
- You can get the author’s code at (written on MATLAB)
https://staff.fnwi.uva.nl/t.e.j.mensink/uva12/code.php
8
Nearest Class Mean Metric Learning (NCMML)
• Results
- NCMML performs well comparable to a SVM baseline (one-vs-rest linear SVM)
- 8,500 fold speed-up faster than the SVM baseline
- Generalized well to unseen classes at a negligible cost
9
Nearest Class Multiple Centroids (NCMC)
• Expansion of NCMML
- Multiple prototypes (or centroids) for each class => non-linear classification
- The prototypes can be obtained by k-means clustering (k is parameter)
when k = 3
10
Etc
• No available online code in Python
- PyDML v0.0.1 (by Juan Luis) supports NCMML and NCMC
- However, NCMML is not working on the small machine
(it requires hard computation for matrix outer product, not efficient code)
- In NCMC, wrongly written from the paper
- Recommend to write your code based on the author’s Matlab code
Sangjun Han
hjun1008@gmail.com
https://www.linkedin.com/in/sangjun-han-78a166b8/

More Related Content

PDF
Using Multi-layered Feed-forward Neural Network (MLFNN) Architecture as Bidir...
PPTX
Neural netorksmatching
PPTX
Comparison of Learning Algorithms for Handwritten Digit Recognition
PPTX
support vector machine and associative classification
PDF
Siamese networks
PPTX
Handwritten Digit Recognition and performance of various modelsation[autosaved]
PDF
Handwritten Digit Recognition using Convolutional Neural Networks
PPTX
Convolutional neural network from VGG to DenseNet
Using Multi-layered Feed-forward Neural Network (MLFNN) Architecture as Bidir...
Neural netorksmatching
Comparison of Learning Algorithms for Handwritten Digit Recognition
support vector machine and associative classification
Siamese networks
Handwritten Digit Recognition and performance of various modelsation[autosaved]
Handwritten Digit Recognition using Convolutional Neural Networks
Convolutional neural network from VGG to DenseNet

What's hot (19)

DOCX
Digit recognition using mnist database
PPTX
(Eckovation machine learning) mnist handwritten digit recognition
PPT
2.6 support vector machines and associative classifiers revised
PPT
Sefl Organizing Map
PPTX
Introduction to Convolutional Neural Networks
PPTX
Event classification & prediction using support vector machine
PPTX
Image Classification And Support Vector Machine
PPTX
Intrusion Detection Model using Self Organizing Maps.
PPTX
Digit recognition
PPTX
Support vector machine-SVM's
PPTX
Neural network
PDF
Hand Written Digit Classification
PPTX
Handwritten Digit Recognition(Convolutional Neural Network) PPT
PPTX
Basics of Machine Learning
PPTX
Support Vector Machine
PPTX
Neural networks
PDF
Online Coreset Selection for Rehearsal-based Continual Learning
DOC
SVM Tutorial
PDF
Machine Learning: Introduction to Neural Networks
Digit recognition using mnist database
(Eckovation machine learning) mnist handwritten digit recognition
2.6 support vector machines and associative classifiers revised
Sefl Organizing Map
Introduction to Convolutional Neural Networks
Event classification & prediction using support vector machine
Image Classification And Support Vector Machine
Intrusion Detection Model using Self Organizing Maps.
Digit recognition
Support vector machine-SVM's
Neural network
Hand Written Digit Classification
Handwritten Digit Recognition(Convolutional Neural Network) PPT
Basics of Machine Learning
Support Vector Machine
Neural networks
Online Coreset Selection for Rehearsal-based Continual Learning
SVM Tutorial
Machine Learning: Introduction to Neural Networks
Ad

Similar to Nearest Class Mean Metric Learning (20)

PDF
Distance Metric Learning
PDF
Introduction to machine learning
PPTX
MachineLearningGlobalAcademyofTechnologySlides
PDF
Machine Learning and Data Mining: 13 Nearest Neighbor and Bayesian Classifiers
PDF
Distance Metric Learning tutorial at CVPR 2015
PDF
KNN presentation.pdf
PDF
Lecture 6 - Classification Classification
PDF
Dr. Shivu__Machine Learning-Module 3.pdf
PDF
09_dm1_knn_2022_23.pdf
PPT
Instance Based Learning in Machine Learning
PPT
Support Vector Machines Support Vector Machines
PDF
Introduction to k-Nearest Neighbors and Amazon SageMaker
PDF
KNN,Weighted KNN,Nearest Centroid Classifier,Locally Weighted Regression
PDF
Chapter2 NEAREST NEIGHBOURHOOD ALGORITHMS.pdf
PPTX
k-Nearest Neighbors with brief explanation.pptx
PDF
K Nearest neighbour
PPT
similarities-knn-1.ppt
PDF
Metric learning ICML2010 tutorial
PPT
K nearest neighbors s machine learning method
Distance Metric Learning
Introduction to machine learning
MachineLearningGlobalAcademyofTechnologySlides
Machine Learning and Data Mining: 13 Nearest Neighbor and Bayesian Classifiers
Distance Metric Learning tutorial at CVPR 2015
KNN presentation.pdf
Lecture 6 - Classification Classification
Dr. Shivu__Machine Learning-Module 3.pdf
09_dm1_knn_2022_23.pdf
Instance Based Learning in Machine Learning
Support Vector Machines Support Vector Machines
Introduction to k-Nearest Neighbors and Amazon SageMaker
KNN,Weighted KNN,Nearest Centroid Classifier,Locally Weighted Regression
Chapter2 NEAREST NEIGHBOURHOOD ALGORITHMS.pdf
k-Nearest Neighbors with brief explanation.pptx
K Nearest neighbour
similarities-knn-1.ppt
Metric learning ICML2010 tutorial
K nearest neighbors s machine learning method
Ad

Recently uploaded (20)

PPTX
sap open course for s4hana steps from ECC to s4
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Approach and Philosophy of On baking technology
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
Big Data Technologies - Introduction.pptx
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
KodekX | Application Modernization Development
PDF
cuic standard and advanced reporting.pdf
sap open course for s4hana steps from ECC to s4
Programs and apps: productivity, graphics, security and other tools
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
20250228 LYD VKU AI Blended-Learning.pptx
Approach and Philosophy of On baking technology
Chapter 3 Spatial Domain Image Processing.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
Review of recent advances in non-invasive hemoglobin estimation
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
NewMind AI Weekly Chronicles - August'25 Week I
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
The Rise and Fall of 3GPP – Time for a Sabbatical?
Mobile App Security Testing_ A Comprehensive Guide.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
Big Data Technologies - Introduction.pptx
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Per capita expenditure prediction using model stacking based on satellite ima...
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
KodekX | Application Modernization Development
cuic standard and advanced reporting.pdf

Nearest Class Mean Metric Learning

  • 1. T. Mensink et al., Distance-Based Image Classification: Generalizing to new classes at near-zero cost, IEEE PAMI, April, 2013 Reviewed by LG CNS, AI Tech Team Sangjun Han 2018. 12. 09
  • 2. 2 Metric Learning • What is metric learning - Learning metrics for solving machine learning problems - Simply speaking, a loss function can be defined using metrics - e.g. Euclidean distance, cosine similarity… • Why metric learning - General classification problems => softmax(losses for each class) - Their output values tell us which is more probable, but no more information - Metric learning => not only single probability, but also metrics between its classes - e.g. The distance (or similarity) between class 1 and class 2 - Image retrieval, face verification, incremental learning… more flexible!
  • 3. 3 Nearest Class Mean Metric Learning (NCMML) • Concept - Assign an x (image or feature from image) to the class where it is closest to class prototype uc - The prototype can be obtained by averaging input training data in a class (So, you can get C prototypes which stands for each class) - Mahalanobis distance between x and uc We learn W to minimize distance of x and x’ It means to minimize Euclidean distance in semantic space
  • 4. 4 Nearest Class Mean Metric Learning (NCMML) Wu1 Wu2 Wu3 Wx
  • 5. 5 Nearest Class Mean Metric Learning (NCMML) • Concept - Softmax activation for distance matrix - Cross entropy loss function - Gradient descent for the loss function
  • 6. 6 Nearest Class Mean Metric Learning (NCMML) W : d x D X : D x N Mmeans : D x C (prototype for each class) D : feature dimension in original space d : feature dimension in sematic space N : The number of data C : The number of class Forward pass How to compute Euclidean distance efficiently between two matrices https://scikit-learn.org/stable/modules/generated/sklearn.metrics.pairwise.euclidean_distances.html • Implementation - You can get the author’s code at (written on MATLAB) https://staff.fnwi.uva.nl/t.e.j.mensink/uva12/code.php
  • 7. 7 Nearest Class Mean Metric Learning (NCMML) Compute gradient • Implementation - You can get the author’s code at (written on MATLAB) https://staff.fnwi.uva.nl/t.e.j.mensink/uva12/code.php
  • 8. 8 Nearest Class Mean Metric Learning (NCMML) • Results - NCMML performs well comparable to a SVM baseline (one-vs-rest linear SVM) - 8,500 fold speed-up faster than the SVM baseline - Generalized well to unseen classes at a negligible cost
  • 9. 9 Nearest Class Multiple Centroids (NCMC) • Expansion of NCMML - Multiple prototypes (or centroids) for each class => non-linear classification - The prototypes can be obtained by k-means clustering (k is parameter) when k = 3
  • 10. 10 Etc • No available online code in Python - PyDML v0.0.1 (by Juan Luis) supports NCMML and NCMC - However, NCMML is not working on the small machine (it requires hard computation for matrix outer product, not efficient code) - In NCMC, wrongly written from the paper - Recommend to write your code based on the author’s Matlab code Sangjun Han hjun1008@gmail.com https://www.linkedin.com/in/sangjun-han-78a166b8/