Upload
others
View
13
Download
0
Embed Size (px)
Citation preview
1
Tensors - theory, properties and applications in computer vision and pattern recognition
Bogusław Cyganek
AGH University of Science and TechnologyAl. Mickiewicza 30, 30-059 Kraków, Poland
(C) ML PAN, Warszawa, 12 listopada 2013
An overview:
2
What are tensors and why tensors in pattern recognition.
Short introduction to the tensor mathematics.
Tensor decompositions as a way of multi-dimensional data
analysis.
Higher-Order Singular Value Decomposition (HOSVD).
Applications in pattern recognition.
Implementation and practical issues.
Conclusions.
2
3
Short intro to tensors
Tensor definitions:
4
Tensors can be especially useful in the following two situations:
1. Description of physical laws independent of the coordinate systems;
2. Representation of multidimensional data, in which each factor is governed by
a separate index of a tensor.
We have three equivalent definitions of a tensor:
1. A multilinear function which takes the p-dimensional vector space and
q-dimensional its dual, into the space of real values ;
2. A mathematical object described by the indexed values ti..jm..n, in which there
is p covariant and q contravariant indices. These values transform in
accordance with the transformation laws with a change of the base of the
spaces;
3. A multi-dimensional array of data with N=p+q independent indices.
3
Tensor definitions:
5
Let W and W* be the vector space and its dual, respectively. A tensor over the
base W is a multilinear scalar function f with arguments from W and W*
* *: p times q times
f W W W W
The number of arguments p and q denote a covariant and a contravariant degrees
(a valence) of a tensor
Bishop R.L., Goldberg S.I.: Tensor Analysis on Manifolds. Dover, 1980.
Origin of tensor transformations, basic properties:
6
THEOREM:
A tensor is uniquely determined by its values on the basis and its dual basis. The
values are products of the tensor and the elements of the base and the dual base.
THEOREM:
A dimension of a tensor of p covariant and q contravariant indices is dp+q, where
d=dim(W) denotes dimension of the vector space W
EXAMPLE:
Scalaras and vectors are both special cases of a more general object called a
tensor of order n. In a 3D Euclidean space we have:
d=3
a scalar – a tensor of a 0-th order – has 30=1 element
a vector – a tensor of a 1-st order – has 31=3 elements
a matrix – a tensor of a 2-nd order – has 32=9 elements
However, what is important are the TRANSFORMATION LAWS !!
4
Origin of tensor transformations, index notations:
7
A vector x in the L dimensional space with basis bi can be expressed as
1
Li i
i i
i
x x
x b b
The Einstein’s notation
the contravariant (upper) index position
the covariant (lower) index position
Summation can only take place over „dummy” indices in different positions (i.e.
one subscript, the other superscript).
The tensor algebra is constructed mostly on two mathematical concepts:
• The linear operators.
• Change of the coordinate system (the Jacobian).
Origin of tensor transformations, basic properties:
8
let us assume that the base b linearly transforms into b’ as follows
Ai
j j i b b
the elements Aij form a square matrix A for which we assume that it is invertible,
so the change of base is possible in two directions
A j
i j i b b
A’ij are elements of A-1.
Let us now find coefficients of a vector x in this new base b’:
A A
i
i i j i j
i i j j i
x
x x x
x b b b
Ai i j
jx x
when the new base (primed) is obtained from the original one by multiplication with the
matrix A, coordinates of a vector x’ in this new (primed) space are related to the original
vector x by its inverse, i.e. A-1,
5
Origin of tensor transformations, basic properties:
9
For instance in the simplest 1D case, when going from one space U into U’, the
covariant components of a tensor T transform as
k
k
ii TT '
' α ki
k
i TT '' α
Coefficients of the direct and indirect transformation of the coordinates spaces
αj
j
i i
x
x
The ordered table of ij is called a coordinate
systems transformation matrix, called also a
Jacobian matrix J=[ij].
Origin of tensor transformations, basic properties:
10
For instance in the simplest 1D case, when going from one space U into U’, the
covariant components of a tensor T transform as
k
k
ii TT '
' α ki
k
i TT '' α
Coefficients of the direct and indirect transformation of the coordinates spaces
Today tensors in computer science (computer vision, image processing,
data mining, medicine, pattern recognition):
• Multi-view correspondance.
• Image synthesis.
• MRI, analysis, filtering and visualization.
• Intertia tensors for object representation.
• Local structure in multi-dimensional signals.
• Multi-dimensional data processing.
Tensors in mathematics and physics, then psychometrics and chemistry.
6
11
Tensors for multi-dimensional data processing:
Tensors can be relaxed from their physical meaning and can be viewed as
multidimensional arrays of data, in which each dimension separately corresponds
usually to a different feature of described objects or phenomena.
This point of view is “parallel” to the previous one, rather than “instead”, since even
with explicitly provided n covariant and m contravariant indices, a tensor in a given
base is unanimously described by nm real (or complex) values.
This way we obtain a multilinear approach which constitutes an extension to the
classical two-dimensional (matrix) analysis. Such an approach was recently
undertaken to tackle problems of data mining, pattern recognition, neuroscience and
psychometrics, chemistry, signal processing, computer vision and many more
Tensors for multi-dimensional data processing:
12
An image and its three color channels as an example of a 3D tensor
7
Tensors for multi-dimensional data processing:
13
A hyperspectral image with selected regions of different reflectance properties.
Series of hyperspectral images naturally form 3D tensors with two spatial
dimensions (x,y) and one spectral λ.
400 2400
Wavelength (nm)
Reflecta
nce
0
1
400 2400
Wavelength (nm)
Reflecta
nce
0
1
400 2400
Wavelength (nm)
Reflecta
nce
0
1
x
y
l
Tensors for multi-dimensional data processing:
14
A tensor T of P dimensions of values N1, N2, …, NP, is denoted as follows
1 2 PN N N
A single element t of T is addressed providing its precise position by a series of
indices n1, n2, …, nP,
1 2 1 2P Pn n n n n nt
1 1 2 21 , 1 , , 1
P Pn N n N n N
in the equivalent function-like notation
1 2 1 2
, , ,Pn n n P
t n n n
8
Tensors for multi-dimensional data processing – an example:
15
A 333 tensor and possible representation with three frontal 2D slices.
0
0
12 0
4 1
-132
N1
N2
N3
-2
4
0 0
10 0
012
1
4
1 -1
0 4
125
0
0
12 0
4 1
-132
12 0 0 1 1 1 0 0 2
0 4 1 4 0 4 4 10 0
2 3 1 5 2 1 2 1 0
1
2
3
Tensors for multi-dimensional data processing – an example:
16
12 0 0 1 1 1 0 0 2
0 4 1 4 0 4 4 10 0
2 3 1 5 2 1 2 1 0
1
2
3
123
1,2,3 0t
133
1,3,3 2t
312
3,1,2 5t
A middle slice of T can be written using the colon notation
1 1 1
:,:,2 4 0 4
5 2 1
:,2,3 0 10 1
A specific vector cut out from T is known also as a fiber
9
17
Basic concepts of the multilinear algebra – tensor flattening:
Tensor flattening (known also as tensor unfolding or matricization):
Three types of k-mode vectors (fibers) for a three dimensional tensors: 1-mode (column)
fibers, 2-mode (row) fibers, and 3-mode (tube) fibers
18
N1=3
N2=4
N 3=2
N1=3
N1=3
N 3=2
N2=4
N2=4
N3=2
N1=3
N3=2
N2=4
N1=3
N 3=2
N2=4
N1=3
N1=3
N3=2
N2=4
N1=3
N 3=2
N2=4
N2=4 N2=4
T(1)
T(2)
T(3)
Flattening of the N1N2N3 tensor T to obtain the matrix
T(1) of dimensions N1N2N3, T(2) – N2N1N3, and T(3) – N3N1N2
Basic concepts of the multilinear algebra – tensor flattening:
10
19
1
12 1 0 0 1 0 0 1 2
0 4 4 4 0 10 1 4 0
2 5 2 3 2 1 1 1 0
T
2
12 0 2 1 4 5 0 4 2
0 4 3 1 0 2 0 10 1
0 1 1 1 4 1 2 0 0
T
3
12 0 0 0 4 1 2 3 1
1 1 1 4 0 4 5 2 1
0 0 2 4 10 0 2 1 0
T
-2
4
0 0
10 0
012
1
4
1 -1
0 4
125
0
0
12 0
4 1
-132
Basic concepts of the multilinear algebra – tensor flattening:
20
Basic concepts of the multilinear algebra – tensor flattening:
1
3 2
1
23
1
3 2
1
3 2
1
23
1
3 2
Two types of permutations of the three indices 1,2, and 3. Grayed circle denotes a
starting index. Forward permutations (adding 1) are 1-2-3, 2-3-1, and 3-1-2 . Backward
permutations (subtracting 1) from the top to the bottom rows are 1-3-2, 2-1-3, and 3-2-1
Forward Backward
11
21
Basic concepts of the multilinear algebra – video tensor flattening:
Nk
Nr
Nf
Nc
..
..
..
Nr
Nk
Nc
Nf
Image 1
red channel
Image 1
green channel
Image 1
blue channel
Image 2
red channel
Image f
blue channel...
A color video stream can be
represented as a four dimensional
tensor. An example of such a tensor
of dimensions 32024043
(columns Nk rows Nr frames Nf
color-channels Nc)
A practical way of tensor flattening - the forward mode - which maps images to the
memory in the scanning order
Basic concepts of the multilinear algebra – tensor products:
22
• Outer product of tensors.
• Contracted product of tensors.
• Inner product of tensors (all contracted indices)
1 2
1 2 1 2
1 21 1 1
,C
C C
C
K K K
k k k k k kk k k
s t
Orthogonal tensors
0
12
Basic concepts of the multilinear algebra – product examples:
23
1 2 3 0 0 8
0 1 7 2 11 11
2 1 1 2 0 4
0 2 4 1 1 0
1 23 3
2 4 8
, 10 23 7
30 17 21K K
1 2 1 2
1 2 1 2
2 2 2 2
3 2 1 2 1 21 1 1 1
3,2 , ,3 , ,2
0 8 2 11 4 11 2 17
k k k kk k k k
s t k k k k
0Their inner product
Their contructed product for the first common indices K1=2 and K2=2 yields a 3x3 matrix:
24
Basic concepts of the multilinear algebra - k-mode product:
The k-mode product k1 2 PN N N
kQ NM k
M
1 2 1 1k k PN N N Q N N
1 2 1 1 1 2 1 11 2 1 1 1
k
k k P k k k P kk k Pk
N
n n n qn n k n n n n n n qnn n n qn nn
t mM
of a tensor and a matrix
The k-mode product can be equivalently expressed in terms of the flattened matrices
k M k k
S MT
1 2 TT SVD V S D
For example:
1 V S SV 2 TS D SDsince
13
25
-2
4
0 0
10 0
012
1
4
1 -1
0 4
125
0
0
12 0
4 1
-132
N1=3
N2=4
N 3=2
1
2
1 0
2 1
100
0
2
1 0
4 1
-1100
0
0
12
-10
023
A
B
C
477726 88
8718156 190
695512 50
-6 -18 -8 -20
-45
-19
iA
iB
iC
An example of a 1-mode, 2-mode, and 3-mode products of a 333 tensor T with
the three matrices A, B, and C. The resulting tensor has dimensions 342 imposed
by dimensions of the three matrices
Basic concepts of the multilinear algebra - k-mode product example:
1 2 3 2 1 3A B C B A C
26
-2
4
0 0
10 0
012
1
4
1 -1
0 4
125
0
0
12 0
4 1
-132
N1=3
N2=4
N 3=2
1
2
1 0
2 1
100
0
2
1 0
4 1
-1100
0
0
12
-10
023
A
B
C
477726 88
8718156 190
695512 50
-6 -18 -8 -20
-45
-19
iA
iB
iC
An example of a 1-mode, 2-mode, and 3-mode products of a 333 tensor T with
the three matrices A, B, and C. The resulting tensor has dimensions 342 imposed
by dimensions of the three matrices
Basic concepts of the multilinear algebra - k-mode product example:
1 2 3 2 1 3A B C B A C
14
27
-2
4
0 0
10 0
012
1
4
1 -1
0 4
125
0
0
12 0
4 1
-132
0
2
1 0
4 1
-1100
023
B
iB
*
Basic concepts of the multilinear algebra - k-mode product example:
*
2
12 24 0 36 1 1 11 1 0 2 2 0
0 17 39 8 4 12 4 12 4 48 100 32
2 17 31 12 5 19 19 19 2 8 10 8
B
28
Basic concepts of the multilinear algebra – ranks of a tensor:
Rank-1 of a tensor.
A P-dimensional tensor T has rank 1 if it is an outer product of P vectors s1,
…, sP, as follows
1 2 Ps s s
Rank of a tensor
The rank of a P-dimensional tensor T is the minimal number of rank-1
tensors that produce T in their linear combination
The k-rank of a tensor
k kR rank
is a dimension of the vector space spanned by its k-mode vectors
15
29
Tensor Decompositions
30
Types of tensor decompositions:
30
Higher Order Singular Value Decomposition (HOSVD, ~Tucker)
Rank-1 (Canonical decomposition, CANDECOMP/PARAFAC or
CP)
Best Rank-Rk
Nonnegative matrix and tensor decompositions
16
31
Visualization of the HOSVD for a 3D tensor
Types of tensor decompositions – HOSVD:
S1
S2
S3
N1
N2
N3
N1
N1
N2
N2
N3
N3
N1
N2
N3
Nr
Nr
1 1 2 2 3 3S S S
32
Types of tensor decompositions – Rank-1 decomposition:
N1
N2
N3
...
R components
N1
N3
N2
1
11s
12s
13s
2
21s
22s
23s
R
1
Rs
2
Rs
3
Rs
N1
N2
N3
Visualization of the rank-1 decomposition of a 3D tensor
1
Rr r r
r
a b c
T can be expressed as a pure sum of rank-1 tensors
Efficient linear discriminant analysis LDA (Fisher Bauckhage ...)
17
33
Types of tensor decompositions – Best rank-Rk decomposition:
Visualization of the rank-Rk decomposition of a 3D tensor
S1
S2
S3
N1
N2
N3
R1
N1
R2
N2
N3
R3
R1
R2
R3
1 1 2 2 3 3S S S
1 1
1
N RS P PN R
PS
Similar to HOSVD but different properties !
1 1rank R
P Prank R
desired ranks
34
Higher Order Singular Value Decomposition
(HOSVD, ~Tucker)
18
35
Basic concepts of the multilinear algebra – tensor decompositions:
Can we do the SVD for 3D cubes (3D tensors)?
Assuming a 3D tensor, of dimensions spanning N1N2N3, can it be written as a
sum of rank-one tensors
1 2 3
1 1 1
N N Np q r
pqrp q r
v a b cTucker
decomposition
36
1 2 m n PN N N N N A tensor:
Basic concepts of the multilinear algebra – HOSVD:
can be decomposed to
1 1 2 2 P P S S S
Sk denotes a mode matrix, which is a unitary matrix of dimensions NkNk spanning
the column space of the matrix T(k) obtained from the mode-n flattening of T;
1 2 m n PN N N N N
is a core tensor of the same dimensions as T.
19
37
Visualization of the HOSVD for a 3D tensor
Basic concepts of the multilinear algebra – HOSVD:
S1
S2
S3
N1
N2
N3
N1
N1
N2
N2
N3
N3
N1
N2
N3
Nr
Nr
1 1 2 2 3 3S S S
38
Properties of the core tensor:
Basic concepts of the multilinear algebra – HOSVD:
kn a kn bTwo sutensors
obained by fixing the nk index to a, or b respectively, are orthogonal
0k kn a n b
Subtensors can be ordered according to their norms
1 20
k k k Pn n n N
k
k
n a a
is the a-mode singular value of T
Each i-th vector of the matrix Sk is the i-th k-mode singular vector
2
1
20
39
Basic concepts of the multilinear algebra – HOSVD:
1 1 2 2 P P S S S
1
PNh
h P Ph
s 1 1 2 2 1 1h P P S S S
the basis tensors
shP are columns of the unitary matrix SP.
N1
N2
N3
s1
...
N3 components
N1
N3
N2
s2
N1
N3
N2
s
N1
N3
N2
N3
1 2N3
Th are orthogonal. Hence, Th constitute a basis. This result allows
construction of classifiers based on the HOSVD decomposition!
Pattern recognition in the HOSVD spanned multilinear spaces:
40
Pattern recognition with HOSVD boils down to testing a distance of a given testpattern Px to its projections in each of the spaces spanned by the set of the bases Th.
This can be done by computing the following minimization problem
2
, 1
minih
Ni i
x h hi c h
P c
where cih are the coordinates of Px in the space spanned by Th
i, N≤NP denotes a
number of chosen dominating components. Due to the orthogonality of the tensors
Thi, the above reduces to the maximization of the following parameter
2
1
ˆ ˆ,N
i
i h xh
P
.,. denotes the scalar product of the tensors, Px and Thi are normalized. Returned is a
class i for which the corresponding i from is the largest .
21
Pattern recognition in multilinear spaces – practical issues
41
The higher N, the better fit, though at an expense of computation time. The
original tensor Ti of a class i is obtained from the available exemplars of the
prototype patterns for that class (which can be of different number).
2
1
ˆ ˆ,N
i
i h xh
P
Pattern recognition in multilinear spaces – practical issues
42
The higher N, the better fit, though at an expense of computation time. The
original tensor Ti of a class i is obtained from the available exemplars of the
prototype patterns for that class (which can be of different number).
Where to take the prototype tensors from?
For example, the patterns can be cropped from the training images(road signs)
which are additionally rotated in a given range (e.g. ±12° with a step of 2°) with
additionally added normal noise. Such a strategy allows each pattern to be trained
with different number of prototypes.
2
1
ˆ ˆ,N
i
i h xh
P
22
43
A Word on
Nonnegative Decompositions
44
Nonnegative matrix (tensor) factorization:
...
N
L
D
...
R
B
L×N
M
C
L×R R×N
...di ciD BC
2
2 2
, ,min min min
F F FD D
D BC BCD D D BC D BC
0, 0,B Csubject to:
Lee D.D, Seung H.S.: Learning the parts of objects by non-negative matrix
factorization. Nature, Vol. 401, pp. 788-791, 1999.
Solution – the
multiplicative update rules:
,
T
nrnr nr T
nr
b bDC
BCC
,
T
rmrm rm T
rm
c cB D
B BC
23
45
Nonnegative matrix (tensor) factorization:
46
Tucker L.R.: Some mathematical notes of three-mode factor analysis. Psychometrika, 31,
1966, pp. 279-311.
Harshman, R. A.: Foundations of the PARAFAC procedure: Models and conditions for an
“explanatory” multimodal factor analysis. UCLA Papers in Phonetics, 16, pp. 1-84, 1970.
Lathauwer de L.: Signal Processing Based on Multilinear Algebra. PhD dissertation,
Katholieke Universiteit Leuven, 1997.
Lathauwer de L., Moor de, B., Vandewalle J.: On the Best Rank-1 and Rank-(R1, R2, …,
RN) Approximation of Higher-Order Tensors, Vol. 21, No. 4, pp. 1324-1342, 2000.
Literature on tensors and their decompositions:
Lathauwer de L., Moor de, B., Vandewalle J.: On the Best Rank-1 and Rank-(R1, R2, …,
RN) Approximation of Higher-Order Tensors, Vol. 21, No. 4, pp. 1324-1342, 2000.
Kolda T.G., Bader B.W.: Tensor Decompositions and Applications. SIAM Review, 2008.
24
47
PATTERN RECOGNITION
APPLICATIONS
48
Human Face Recognition
25
Human face recognition:
49
Images of different persons in different lighting and pose conditions build up a tensor.
Human face recognition:
50
After the HOSVD decomposition:
1 2 3 4 5faces views illum expressions pixelsU U U U U
The first mode matrix Ufaces, of dimensions 2828, spans the space of human face
parameters, the 55 mode Uviews spans the space of viewpoints, the two 33
matrices Uilluminations and Uexpressions – the spaces of illumination and face expression
parameters, respectively.
The last matrix Upixels has dimensions 79437943 and orthonormally spans the space
of images. Each column of this matrix is an eigenimage (eigenface)
Vasilescu M.A., Terzopoulos D.: Multilinear analysis of image ensembles:
TensorFaces. Proceedings of Eurpoean Conference on Computer Vision, pp. 447-
460, 2002
26
Human face recognition:
51
A training image for the f-th face, v-th view, i-th illumination, and e-th expression
can be represented as the following 1111Ipixel tensor
, , , T T T T
5 1 2 3 4 exp
f v i e f v i e
pixels faces views illum ressd U u u u u
Human face recognition:
52
A training image for the f-th face, v-th view, i-th illumination, and e-th expression
can be represented as the following 1111Ipixel tensor
, , , T T T T
5 1 2 3 4 exp
f v i e f v i e
pixels faces views illum ressd U u u u u
Now we have a new test image dx which parameters, such as person, view, etc. are
unknown. We can assume that it can also be expressed in the same way as were
all the training images d
T T T T
5 1 2 3 4 expx pixels faces views illum ressd U u u u u
27
Human face recognition:
53
A training image for the f-th face, v-th view, i-th illumination, and e-th expression
can be represented as the following 1111Ipixel tensor
, , , T T T T
5 1 2 3 4 exp
f v i e f v i e
pixels faces views illum ressd U u u u u
Now we have a new test image dx which parameters, such as person, view, etc. are
unknown. We can assume that it can also be expressed in the same way as were
all the training images d
T T T T
5 1 2 3 4 expx pixels faces views illum ressd U u u u u unknown ....
Human face recognition:
54
A training image for the f-th face, v-th view, i-th illumination, and e-th expression
can be represented as the following 1111Ipixel tensor
, , , T T T T
5 1 2 3 4 exp
f v i e f v i e
pixels faces views illum ressd U u u u u
Now we have a new test image dx which parameters, such as person, view, etc. are
unknown. We can assume that it can also be expressed in the same way as were
all the training images d
T T T T
5 1 2 3 4 expx pixels faces views illum ressd U u u u u unknown ....
A reconstruction of mode parameters of a test image can be represented as follows
exp
2
, , ,
ˆ ˆ ˆ ˆ, , , argminfaces views illum ress
faces views illum express t xu u u u
u u u u d d Solution:
tensor
factorization
28
55
Road Signs Recognition in
Digital Images
What we try to achieve?
56
A computer system for recognition of the road signs which fulfills:
Accuracy (high accuracy rate).
Flexibility (operates in real traffic conditions).
Response time (real-time response).
Extensibility (easy to add new prototype signs).
Further assumption:
In this research we focus on
the circular signs
(most demanding than
rectangular & triangular)
– these are prohibition and
obligation signs.
29
Road signs recognition problem – simple or not?
57
Traffic scenes are acquired in different
viewpoints, distances,
weather & lighting conditions, ...
Exemplary application – road signs recognition:
58
The architecture of the system for road signs recognition with HOSVD:
SIGN DETECTION
WITH AN ADAPTIVE
WINDOW TECHNIQUE
AND BASED ON
CHARACTERISTIC
COLORS
Sign cropping,
extraction of the
blue channel and
registration
Answer
”No right turn”CLASSIFICATION
IN THE TENSOR
SPACE
BASE TENSORS
FOR EACH SIGN
HOSVD
DETECTION MODULE
TRAINING MODULE
Deformable
prototypes
generator
Important factors:
• accuracy
• response time (training can take longer)
30
59
The data base – where take the prototypes for training from?
1. Take enough real examples (pictures taken of different
signs, in different conditions).
2. Take the formal specification – just one exemplar per sign
(formal regulations).
Exemplary application – road signs recognition:
60
A generator of the geometrically deformed prorotype patterns
We generate rotated versions of
each of the prototypes, as well as we
add some Gaussian noise
In result we obtain a tensor Tof the deformed prototypes
Exemplary application – road signs recognition:
31
61
1 1 2 2 P P S S S
Consecutive ”layers” of the core tensorZ
ENERGY FACTOR
1
PNh
h P Ph
s
1 1 2 2 1 1h P P S S S
Base tensors(!)
shP are columns of the unitary matrix SP.
Exemplary application – road signs recognition:
62 Input color image (RGB) After color detection
Exemplary application – road signs recognition:
32
63 Morphological filteringProposed objects
(an adaptive window growing method)
Exemplary application – road signs recognition:
64 Properly found object (fuzzy rules) The sign in the original image
Exemplary application – road signs recognition:
33
65 Blue channel of the RGB image Registered test pattern
ˆxP input pattern
Exemplary application – road signs recognition:
”No
right
turn”
66
Exemplary application – road signs recognition results:
Speed of 15-25 frames/s of resolution 640480.
The obtained accuracy on the group of the prohibition signs reached 95%
(daily conditions).
A threshold =0.85 was set below which the system answers “don’t know”. Such
a situation arises e.g. if a pattern is provided which the system was not trained for.
Error rate – prohibition signs Error rate – obligation signs
34
67
A word on implementations
68
The HOSVD algorithm:
1. For each k=1, …, P do:
a. Flatten tensor T to obtain Tk;
b. Compute Sk
from the SVD decomposition
of the flattening matrix Tk
Tk=S
kVkDkT
2. Compute the core tensor from the formula:
1 1 2 2
T T T
P P S S S
Experimental setup – implementation issues:
The HOSVD algorithm relies on successive application of the matrix SVD
decompositions applied to each of the flattened versions T(k) of the original tensor T.
In result the Sk matrices are obtained.
The problem – how to avoid data copying for different modes of T(k) in HOSVD?
35
69
The HOSVD algorithm:
1. For each k=1, …, P do:
a. Flatten tensor T to obtain Tk;
b. Compute Sk
from the SVD decomposition
of the flattening matrix Tk
Tk=S
kVkDkT
2. Compute the core tensor from the formula:
1 1 2 2
T T T
P P S S S
Experimental setup – implementation issues:
The HOSVD algorithm relies on successive application of the matrix SVD
decompositions applied to each of the flattened versions T(k) of the original tensor T.
In result the Sk matrices are obtained.
The problem – how to avoid data copying for different modes of T(k) in HOSVD?
Can be parallelized (Cyganek, 2013)
A class hierarchy for efficient tensor representation
70
TImageFor
# fData : pixel type = val
Pixel Type
+ GetPixel( matrix_index ) : PixelType
N
1..*
Composite
relation
TFlatTensorFor
# fTensorMode : int
Element
Type
TFlatTensorProxyFor
Element
Type
- fMotherTensor : TFlatTensorFor &
+ SetPixel( matrix_index ) : PixelType
HIL Library
+ GetElement( TensorIndex ) : ElType
+ SetElement( TensorIndex, ElType )
# Offset_ForwardCyclic
( TensorIndex, MatrixIndex, Mode )
# Offset_BackwardCyclic
( TensorIndex, MatrixIndex, Mode )
# fIndexVector: vector
+ GetElement( TensorIndex ) : ElType
+ SetElement( TensorIndex, ElType )
Action delegation to
the mother tensor
+ GetPixel( matrix_index ) : PixelType
+ SetPixel( matrix_index ) : PixelTypeMatrix data access
with mapped matrix
index to the proxy
mode
Matrix
representation
# Offset_BackwardCyclic
( MatrixIndex, TensorIndex, Mode )
# Offset_ForwardCyclic
( MatrixIndex, TensorIndex, Mode )
Proxy Design Pattern
36
71
TensorAlgebraFor
Best_Rank_R_DecompFor
T
S_Matrix_Initializer
+ operator()( const FlatTensor & T,
const RankVector & ranks,
SingleMatrixVector & S_vector ) = 0 : bool
T
OrphanInitializedMatrices_S_UniformRandomGenerator
T
+ operator()( const FlatTensor & T, const RankVector & ranks, SingleMatrixVector & S_vector ) : bool
T
# fMatrix_Initializer_Obj : S_Matrix_Initializer< T, ACC > *
11
+ FindDominantSubspace(
Compute_SVD & svd_calculator,
const typename FlatTensor::DataMatrix & S_hat,
typename FlatTensor::DataMatrix & S,
int requested_tensor_Rank_k,
int tensor_index_k );
+ operator() ( const FlatTensor & T,
const RankVector & requested_ranks,
typename SingleMatrixVector & S_vector,
const AccumulatorType epsilon = 1e-6,
const int max_iter_counter = 1000,
int * num_of_iterations = 0 ) : FlatTensor_AP
1
TFlatTensorFor
# fTensorMode : int
+ GetElement( TensorIndex ) : ElType
+ SetElement( TensorIndex, ElType )
# fIndexVector: vector
T
+ TFlatTensorFor(
const TensorElem_IndexVector & indexVec,
int tensor_mode,
ECyclicMode cyclicMode = kForward )
N
HOSVD
+ operator()( const TFlatTensorFor< U > & T,
SingleMatrixVector & S_vector )
: FlatTensor_AP
T
Software framework for tensor representation and decomposition:
DeRecLib available on the Internet for free ...
72
TensorAlgebraFor
Best_Rank_R_DecompFor
T
S_Matrix_Initializer
+ operator()( const FlatTensor & T,
const RankVector & ranks,
SingleMatrixVector & S_vector ) = 0 : bool
T
OrphanInitializedMatrices_S_UniformRandomGenerator
T
+ operator()( const FlatTensor & T, const RankVector & ranks, SingleMatrixVector & S_vector ) : bool
T
# fMatrix_Initializer_Obj : S_Matrix_Initializer< T, ACC > *
11
+ FindDominantSubspace(
Compute_SVD & svd_calculator,
const typename FlatTensor::DataMatrix & S_hat,
typename FlatTensor::DataMatrix & S,
int requested_tensor_Rank_k,
int tensor_index_k );
+ operator() ( const FlatTensor & T,
const RankVector & requested_ranks,
typename SingleMatrixVector & S_vector,
const AccumulatorType epsilon = 1e-6,
const int max_iter_counter = 1000,
int * num_of_iterations = 0 ) : FlatTensor_AP
1
TFlatTensorFor
# fTensorMode : int
+ GetElement( TensorIndex ) : ElType
+ SetElement( TensorIndex, ElType )
# fIndexVector: vector
T
+ TFlatTensorFor(
const TensorElem_IndexVector & indexVec,
int tensor_mode,
ECyclicMode cyclicMode = kForward )
N
HOSVD
+ operator()( const TFlatTensorFor< U > & T,
SingleMatrixVector & S_vector )
: FlatTensor_AP
T
Software framework for tensor representation and decomposition:
• Object-oriented design (templates, C++)
• Software attached to the recent book: ”Object Detection
and Recognition in Digital Images ”, Wiley, 2013
DeRecLib available on the Internet for free ...
37
73
Other applications ...
74
Other applications of multi-dimensional pattern recognition:
Chemistry.
Smilde A., Bro R., Geladi P.: Multi-way Analysis: Applications in the Chemical
Sciences. Wiley, 2004.
38
75
Other applications of multi-dimensional pattern recognition:
Web link analysis.
Kolda T.G., Bader B.W., Kenny J.P.: Higher-Order Web Link Analysis Using
Multilinear Algebra. Sandia Report, 2005
Chemistry.
Smilde A., Bro R., Geladi P.: Multi-way Analysis: Applications in the Chemical
Sciences. Wiley, 2004.
76
Other applications of multi-dimensional pattern recognition:
Web link analysis.
Kolda T.G., Bader B.W., Kenny J.P.: Higher-Order Web Link Analysis Using
Multilinear Algebra. Sandia Report, 2005
Signal filtering.
Muti D., Bourennane S.: Survey on tensor signal algebraic filtering. Signal
Processing 87, pp. 237-249, 2007.
Chemistry.
Smilde A., Bro R., Geladi P.: Multi-way Analysis: Applications in the Chemical
Sciences. Wiley, 2004.
39
77
Other applications of multi-dimensional pattern recognition:
Ensembles of tensor based classifiers:
Cyganek B.: Ensemble of Tensor Classifiers Based on the Higher-Order
Singular Value Decomposition. Springer, Lecturer Notes in Computer Science
7209, pp. 578–589, 2012
Web link analysis.
Kolda T.G., Bader B.W., Kenny J.P.: Higher-Order Web Link Analysis Using
Multilinear Algebra. Sandia Report, 2005
Signal filtering.
Muti D., Bourennane S.: Survey on tensor signal algebraic filtering. Signal
Processing 87, pp. 237-249, 2007.
Chemistry.
Smilde A., Bro R., Geladi P.: Multi-way Analysis: Applications in the Chemical
Sciences. Wiley, 2004.
78
Conclusions
40
79
Conclusions:
Tensors provide an efficient tool for multi-dimensional data
processing, pattern recognition (image processing).
Tensor decompositions allow a view into data contents.
Nonnegative decompositions allow easy interpretation of the
factoring components.
The HOSVD decomposition can be effectively used for pattern
recognition (face, road signs, handwritten chars, chemistry, ...).
Very good accuracy and fast response.
Effective computer implementation (software, parallel operation).
80
Thank you!