I came across the term 'principal angle between subspaces' as a tool for comparing objects in images. All material that I found on the internet seems to deal with this idea in a highly mathematical way and I couldn't understand the real physical meaning behind the term.

I have some knowledge of linear algebra. Any help to understand the physical significance of this term and its application in object recognition would be appreciated.

  • $\begingroup$ This is not a new question, but it would be nice if you can provide a link to the article or paper where you found this term/expression, so that to have specific context. $\endgroup$ – nbro Jan 15 at 11:36

Let's consider the case where you have two photos, one base photo and one other photo which is a scaled version of the base photo. Consider then that you could create a 'mapping' from the base photo to the scaled photo as defined by a set of vector changes for each pixel in the base photo.

That is to say, if you had a pixel at point (0,0) in the base photo it would be in position (0,0) on the scaled photo. If you had a pixel at point (0,1) on the base photo, it would be at point (0,s) on the scaled photo, where s is the scale factor between them. The same would be true for (1,0) mapping to (s,0) and (1,1) mapping to (s,s).

We can understand each of these pixels as a subspace on the vector space of "all possible pixels" (possibly with an included vector for the 'value' of each pixel as a third+ dimension, based on how it's represented). Note though, that they are different subspaces. There are vectors that exist in the scaled picture for scale factors greater than 1 which are not in the original picture. For scale values less than one, there are vectors which are in the original picture which are not in the scaled picture. For scale vector equal to one, it's basically the identity and they're the same picture.

What's more, we can do the same for rotation. If you have base photo and rotated photo, then there is a mapping from one pixel on the base photo to one pixel on the rotated photo, I'll leave the math up to you. The same is further true for translating, skewing, and even changing the colors of the image. Each one denotes a type of mapping that you could make from one subspace to another.

So what does this mean? Well, one thing that you could do is take two images, one "base" photo and two "scaled" photos and determine "how different are these two photos from the base photo"? That is, if the first scaled photo has a scaling factor of 10 and the second has a scaling factor of 100, then you could say that the larger scaled-photo is "further away" from the base photo. That is, we can compare the two mappings together to determine which mapping is closer to the original.

What's more, these mapping functions are often composable and commutative. That is if you do a "scale-then-rotate", that is very similar if not exactly identical to doing "rotate-then-scale". Let's take a look at why this is. Let's consider that we take a unit vector from either one. We then apply "scale" which scales both the x and y components, and then rotate this unit vector about some axis (let's assume the origin, though maybe there's a translation that happens as well). You will then yield a new vector which represents all of these applied changes. What's more, we can do this to both of the "scale-then-rotate" function and the "rotate-then-scale" function.

Now we have two vectors, and we want to determine if they are the same. Well, one way to do that is to calculate the angle between two vectors. If the angle is 0, then we can say that the vectors are the same (with the assumption that they are also of the same magnitude). In this case, both would yield the same vector, the angle between them is 0, so we can say they are the same.

So then how do we get back to the question of "how different are these two objects"? Well, one way that we could do it is to attempt to answer the question "What set of composed functions maps from one object onto the other one?". If we can create a new "vector" which is the representation of the full set of changes from one picture to the other, we can then attempt to determine how different these two objects are, as represented in the dimensional spaces of their image.

But the question that you may then ask is "why is this useful"? Well, imagine that you are a neural network. You've been given a picture and tasked with answering the question "Is this a cat?". How would you go about answering this? Well, one thing as a neural net that you've learned is "cats have ears". You have a canonical representation of a "cat ear" encoded in the weights of your neural network, so you go about looking at different subsets of the picture to say "is this a cat ear"? You can do this, for example, by taking a cropped section of the picture, determining the angle and dimensions apart that cropped section is from your canonical "cat ear" is, and if the angle between your canonical "cat ear" and your sample is below some amount, you can say with confidence that what you have found is a "cat ear". A couple cat ears, eyes, a nose, some fur, and a tail (though maybe the tail is occluded), and you can be confident that you have found a "cat".

(Note: This is an oversimplification and this is usually done in deep networks by breaking pictures out into a continually composing series of features, for instance first "lines" vs "curves" vs "textures", which then yield "circles" vs "rectangles" vs "cross-hashes", which then yield "eyes" vs "fur" vs "skin", etc. Each different layer could be implemented with its own comparison in this same method though!)

  • $\begingroup$ Can you cite some souces.... because i didn't understand the part where the scaled version of a picture is in a different subspace than the original picture. $\endgroup$ – DuttaA Sep 17 '20 at 3:00
  • $\begingroup$ So this is where some of the analogy may get stretched. In something like image analysis, the "dimensions" of an image can literally be the number of pixels, so scaling an image may change the literal "dimensions" if each pixel position is a dimension being analyzed (as opposed to something like the length vs height, which we often think of as the "dimensions" of an image). As an example, a black and white image of the same size has reduced dimensionality from a color image. This is how I've always understood it when studying CNNs, but I may be wrong. The terminology there was a bit different. $\endgroup$ – Nate Diamond Sep 17 '20 at 3:31
  • $\begingroup$ I am confused by your idea of dimension. Length and breadth are not really the type of 'dimension' we talk about when we talk about subsapces. The very requirement of a subsapce is that it include all scaled version of a vector/matrix in the subspace. So I am pretty sure if I interpreted your answer correctly it is wrong. $\endgroup$ – DuttaA Sep 17 '20 at 4:12
  • $\begingroup$ I realize that about length and width, I was clarifying that's not what I was talking about. As an example, a given convolutional layer may create a set of non-linear inputs from a sampling of a subset of pixels or color channels of a given image, creating a new matrix based on the values created. So if one layer is looking at base pixels, the next layer is looking at "textures". The dimensionality of the second layer is only tangentially related to the first, though is often lower. Scaling was just one example transformation that is easily understood. Feel free to add your own answer though! $\endgroup$ – Nate Diamond Sep 17 '20 at 16:24
  • $\begingroup$ I mean you can cite some sources for the definition, because I have heard such a definition for first time. Because the PA between subspace has a specific meaning (atleast mathematically), which doesn't add up to your definition. So I maybe wrong, but I am interested in the source of your definition. $\endgroup$ – DuttaA Sep 17 '20 at 17:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.