Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
ECCV2010: distance function and metric learning part 1
1. Distance Functions and Metric Learning: Part 1 12/1/2011 version. Updated Version: http://www.cs.huji.ac.il/~ofirpele/DFML_ECCV2010_tutorial/ Michael Werman Ofir Pele The Hebrew University of Jerusalem
4. Metric ² N o n - n e g a t i v i t y : D ( P ; Q ) ¸ 0 ² I d e n t i t y o f i n d i s c e r n i b l e s : D ( P ; Q ) = 0 i ® P = Q ² S y m m e t r y : D ( P ; Q ) = D ( Q ; P ) ² S u b a d d i t i v i t y ( t r i a n g l e i n e q u a l i t y ) : D ( P ; Q ) · D ( P ; K ) + D ( K ; Q )
5. Pseudo-Metric (aka Semi-Metric) ² N o n - n e g a t i v i t y : D ( P ; Q ) ¸ 0 ² P r o p e r t y c h a n g e d t o : D ( P ; Q ) = 0 i f P = Q ² S y m m e t r y : D ( P ; Q ) = D ( Q ; P ) ² S u b a d d i t i v i t y ( t r i a n g l e i n e q u a l i t y ) : D ( P ; Q ) · D ( P ; K ) + D ( K ; Q )
6. Metric A n o b j e c t i s m o s t s i m i l a r t o i t s e l f ² N o n - n e g a t i v i t y : D ( P ; Q ) ¸ 0 ² I d e n t i t y o f i n d i s c e r n i b l e s : D ( P ; Q ) = 0 i ® P = Q
7. Metric ² S y m m e t r y : D ( P ; Q ) = D ( Q ; P ) ² S u b a d d i t i v i t y ( t r i a n g l e i n e q u a l i t y ) : D ( P ; Q ) · D ( P ; K ) + D ( K ; Q ) U s e f u l f o r m a n y a l g o r i t h m s
9. Minkowski-Form Distances L 2 ( P ; Q ) = s X i ( P i ¡ Q i ) 2 L 1 ( P ; Q ) = X i j P i ¡ Q i j L 1 ( P ; Q ) = m a x i j P i ¡ Q i j
10.
11. Jensen-Shannon Divergence J S ( P ; Q ) = 1 2 K L ( P ; M ) + 1 2 K L ( Q ; M ) M = 1 2 ( P + Q ) J S ( P ; Q ) = 1 2 X i P i l o g 2 P i P i + Q i + 1 2 X i Q i l o g 2 Q i P i + Q i
22. The Quadratic-Form Histogram Distance Q F A ( P ; Q ) = q ( P ¡ Q ) T A ( P ¡ Q ) = s X i j ( P i ¡ Q i ) ( P j ¡ Q j ) A i j A = I = s X i j ( P i ¡ Q i ) 2 = L 2 ( P ; Q )
23.
24.
25. Pseudo-Metric (aka Semi-Metric) ² N o n - n e g a t i v i t y : D ( P ; Q ) ¸ 0 ² P r o p e r t y c h a n g e d t o : D ( P ; Q ) = 0 i f P = Q ² S y m m e t r y : D ( P ; Q ) = D ( Q ; P ) ² S u b a d d i t i v i t y ( t r i a n g l e i n e q u a l i t y ) : D ( P ; Q ) · D ( P ; K ) + D ( K ; Q )
26.
27. The Quadratic-Form Histogram Distance Q F A ( P ; Q ) = q ( P ¡ Q ) T A ( P ¡ Q ) = q ( P ¡ Q ) T W T W ( P ¡ Q ) = L 2 ( W P ; W Q )
28. The Quadratic-Form Histogram Distance We assume there is a linear transformation that makes bins independent There are cases where this is not true e.g. COLOR Q F A ( P ; Q ) = q ( P ¡ Q ) T A ( P ¡ Q ) = L 2 ( W P ; W Q )
36. The Quadratic-Chi Histogram Distance Code f u n c t i o n d i s t = Q u a d r a t i c C h i ( P , Q , A , m ) Z = ( P + Q ) * A ; % 1 c a n b e a n y n u m b e r a s Z _ i = = 0 i f f D _ i = 0 Z ( Z = = 0 ) = 1 ; Z = Z . ^ m ; D = ( P - Q ) . / Z ; % m a x i s r e d u n d a n t i f A i s % p o s i t i v e - s e m i d e f i n i t e d i s t = s q r t ( m a x ( D * A * D ' , 0 ) ) ;
37. The Quadratic-Chi Histogram Distance Code f u n c t i o n d i s t = Q u a d r a t i c C h i ( P , Q , A , m ) Z = ( P + Q ) * A ; % 1 c a n b e a n y n u m b e r a s Z _ i = = 0 i f f D _ i = 0 Z ( Z = = 0 ) = 1 ; Z = Z . ^ m ; D = ( P - Q ) . / Z ; % m a x i s r e d u n d a n t i f A i s % p o s i t i v e - s e m i d e f i n i t e d i s t = s q r t ( m a x ( D * A * D ' , 0 ) ) ; T i m e C o m p l e x i t y : O ( # A i j 6 = 0 )
38. The Quadratic-Chi Histogram Distance Code f u n c t i o n d i s t = Q u a d r a t i c C h i ( P , Q , A , m ) Z = ( P + Q ) * A ; % 1 c a n b e a n y n u m b e r a s Z _ i = = 0 i f f D _ i = 0 Z ( Z = = 0 ) = 1 ; Z = Z . ^ m ; D = ( P - Q ) . / Z ; % m a x i s r e d u n d a n t i f A i s % p o s i t i v e - s e m i d e f i n i t e d i s t = s q r t ( m a x ( D * A * D ' , 0 ) ) ; W h a t a b o u t s p a r s e ( e . g . B o W ) h i s t o g r a m s ?
39. The Quadratic-Chi Histogram Distance Code 0 0 0 0 0 0 0 0 0 4 5 0 -3 P ¡ Q = W h a t a b o u t s p a r s e ( e . g . B o W ) h i s t o g r a m s ? T i m e C o m p l e x i t y : O ( S K )
40. The Quadratic-Chi Histogram Distance Code 0 0 0 0 0 0 0 0 0 4 5 0 -3 P ¡ Q = # ( P 6 = 0 ) + # ( Q 6 = 0 ) W h a t a b o u t s p a r s e ( e . g . B o W ) h i s t o g r a m s ? T i m e C o m p l e x i t y : O ( S K )
41. The Quadratic-Chi Histogram Distance Code A v e r a g e o f n o n - z e r o e n t r i e s 0 0 0 0 0 0 0 0 0 4 5 0 -3 P ¡ Q = i n e a c h r o w o f A W h a t a b o u t s p a r s e ( e . g . B o W ) h i s t o g r a m s ? T i m e C o m p l e x i t y : O ( S K )
46. The Earth Mover’s Distance E M D D ( P ; Q ) = m i n F = f F i j g X i ; j F i j D i j s : t : X j F i j = P i X i F i j = Q j X i ; j F i j = X i P i = X j Q j = 1 F i j ¸ 0
47. The Earth Mover’s Distance E M D D ( P ; Q ) = m i n F = f F i j g P i ; j F i j D i j P i F i j s : t : X j F i j · P i X i F i j · Q j X i ; j F i j = m i n ( X i P i ; X j Q j ) f a l s e F i j ¸ 0
48.
49. Definition: E M D D C ( P ; Q ) = m i n F = f F i j g X i ; j F i j D i j + ¯ ¯ ¯ ¯ ¯ ¯ X i P i ¡ X j Q j ¯ ¯ ¯ ¯ ¯ ¯ £ C s : t : X j F i j · P i X i F i j · Q j X i ; j F i j = m i n ( X i P i ; X j Q j ) F i j ¸ 0 f a l s e
50. S u p p l i e r E M D D e m a n d e r D i j = 0 P D e m a n d e r · P S u p p l i e r
51. D e m a n d e r S u p p l i e r P D e m a n d e r · P S u p p l i e r D i j = C E M D
52.
53.
54.
55.
56.
57. C = 1 D i j = ( 0 i f i = j 2 o t h e r w i s e E M D D C ( P ; Q ) = m i n F = f F i j g X i ; j F i j D i j + ¯ ¯ ¯ ¯ ¯ ¯ X i P i ¡ X j Q j ¯ ¯ ¯ ¯ ¯ ¯ £ C ² E M D = L 1 i f : E M D - a N a t u r a l E x t e n s i o n t o L 1
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70. The Flow Network Transformation Original Network Simplified Network
71. The Flow Network Transformation Original Network Simplified Network
72. The Flow Network Transformation Flowing the Monge sequence (if ground distance is a metric, zero-cost edges are a Monge sequence)
73. The Flow Network Transformation Removing Empty Bins and their edges
87. Robust Distances ( b l u e ; r e d ) = 5 6 ¢E 0 0 ( b l u e ; y e l l o w ) = 1 0 2 ¢E 0 0
88.
89.
90. Robust Distances - Thresholded ² L e t d ( a ; b ) b e a d i s t a n c e m e a s u r e b e t w e e n t w o f e a t u r e s - a ; b . ² T h e t h r e s h o l d e d d i s t a n c e w i t h a t h r e s h o l d o f t > 0 i s : d t ( a ; b ) = m i n ( d ( a ; b ) ; t ) .
91.
92.
93.
94.
95. A Ground Distance for SIFT d R = j j ( x i ; y i ) ¡ ( x j ; y j ) j j 2 + m i n ( j o i ¡ o j j ; M ¡ j o i ¡ o j j ) d T = m i n ( d R ; T ) T h e g r o u n d d i s t a n c e b e t w e e n t w o S I F T b i n s ( x i ; y i ; o i ) a n d ( x j ; y j ; o j ) :
96. A Ground Distance for Color Image T h e g r o u n d d i s t a n c e s b e t w e e n t w o L A B i m a g e b i n s ( x i ; y i ; L i ; a i ; b i ) a n d ( x j ; y j ; L j ; a j ; b j ) w e u s e a r e : d c T = m i n ( ( j j ( x i ; y i ) ¡ ( x j ; y j ) j j 2 ) + ¢ 0 0 ( ( L i ; a i ; b i ) ; ( L j ; a j ; b j ) ) ; T )
120. Hands-On Code Example http://www.cs.huji.ac.il/~ofirpele/FastEMD/code/ http://www.cs.huji.ac.il/~ofirpele/QC/code/
121. Tutorial: Or “Ofir Pele” http://www.cs.huji.ac.il/~ofirpele/DFML_ECCV2010_tutorial/
Editor's Notes
Endres, D. M.; J. E. Schindelin (2003). "A new metric for probability distributions". IEEE Trans. Inf. Theory 49 : pp. 1858–1860. doi : 10.1109/TIT.2003.813506 . Ôsterreicher, F.; I. Vajda (2003). "A new class of metric divergences on probability spaces and its statistical applications". Ann. Inst. Statist. Math. 55 : pp. 639–653. doi : 10.1007/BF02517812
3 – Rubner’s thesis + Pele and Werman ECCV 2010
Pele and Werman ECCV 2010
Pele and Werman ECCV 2010
Pele and Werman ECCV 2010
Pele and Werman ECCV 2010
Pele and Werman ECCV 2010
Pele and Werman ECCV 2010
Pele and Werman ECCV 2010
Pele and Werman ECCV 2010
Pele and Werman ECCV 2010
Pele and Werman ECCV 2010
Full net
Full net
Full net
Full net
Full net
Full net
Full net
T = #random placements of grids N = #elements in histogram