Answers.Body: <p>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.</p>
  <p>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).</p>
  <p>We can understand each of these pixels as a subspace on the vector space of &quot;all possible pixels&quot; (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.</p>
  <p>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.</p>
  <p>So what does this mean? Well, one thing that you could do is take two images, one &quot;base&quot; photo and two &quot;scaled&quot; photos and determine &quot;how different are these two photos from the base photo&quot;? 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 &quot;further away&quot; from the base photo. That is, we can compare the two mappings together to determine which mapping is closer to the original.</p>
  <p>What's more, these mapping functions are often composable and commutative. That is if you do a &quot;scale-then-rotate&quot;, that is very similar if not exactly identical to doing &quot;rotate-then-scale&quot;. Let's take a look at why this is. Let's consider that we take a unit vector from either one. We then apply &quot;scale&quot; 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 <em>new</em> vector which represents all of these applied changes. What's more, we can do this to <em>both</em> of the &quot;scale-then-rotate&quot; function and the &quot;rotate-then-scale&quot; function.</p>
  <p>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.</p>
  <p>So then how do we get back to the question of &quot;how different are these two objects&quot;? Well, one way that we could do it is to attempt to answer the question &quot;What set of composed functions maps from one object onto the other one?&quot;. If we can create a new &quot;vector&quot; 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.</p>
  <p>But the question that you may then ask is &quot;why is this useful&quot;? Well, imagine that you are a neural network. You've been given a picture and tasked with answering the question &quot;Is this a cat?&quot;. How would you go about answering this? Well, one thing as a neural net that you've learned is &quot;cats have ears&quot;. You have a canonical representation of a &quot;cat ear&quot; encoded in the weights of your neural network, so you go about looking at different subsets of the picture to say &quot;is this a cat ear&quot;? 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 &quot;cat ear&quot; is, and <strong>if the angle between your canonical &quot;cat ear&quot; and your sample is below some amount</strong>, you can say with confidence that what you have found is a &quot;cat ear&quot;. 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 &quot;cat&quot;.</p>
  <p>(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 &quot;lines&quot; vs &quot;curves&quot; vs &quot;textures&quot;, which then yield &quot;circles&quot; vs &quot;rectangles&quot; vs &quot;cross-hashes&quot;, which then yield &quot;eyes&quot; vs &quot;fur&quot; vs &quot;skin&quot;, etc. Each different layer could be implemented with its own comparison in this same method though!)</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-09-17T03:31:03.680Z
Answers.Text: 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.
Answers.UserDisplayName: Nate Diamond
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-09-17T16:24:57.007Z
Answers.Text: 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!
Answers.UserDisplayName: Nate Diamond
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-09-17T21:34:54.583Z
Answers.Text: So, I can link you to a couple of mathematical definitions, but so does the OP and that wasn't the question. To quote, "I couldn't understand the real physical meaning behind the term." I was trying to provide an intuitive understanding as to the use of the term and why it is valuable physically. These analogies can sometimes be stretched, but can also be useful. If you have a better answer, provide it and maybe I can learn something too! I'm excited to see.
Answers.UserDisplayName: Nate Diamond
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-08-17T23:23:27.923Z
Answers.LastActivityDate: 2020-08-17T23:23:27.923Z
Answers.UserDisplayName: Nate Diamond
Body: <p>I came across the term '<em>principal angle between subspaces</em>' 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.</p>
  <p>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.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-01-15T11:36:53.477Z
Comments.Text: 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.
Comments.UserDisplayName: nbro
Tags: <computer-vision><terminology><object-detection><linear-algebra>
Title: What do we mean by 'principal angle between subspaces'?
UserDisplayName: Manish Kausik Hari Baskar
ThreadText: # What do we mean by 'principal angle between subspaces'?
  
  (Asked by: username_0 on 2020-08-17)
  
  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.
  
  **Tags:** computer-vision, terminology, object-detection, linear-algebra
  
  > **Comments:**
  > **username_1**: 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.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2020-08-17. Score: 1
  
  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!)
  
  > **Comments:**
  > **username_2**: 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.  
  > **username_2**: 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!  
  > **username_2**: So, I can link you to a couple of mathematical definitions, but so does the OP and that wasn't the question. To quote, "I couldn't understand the real physical meaning behind the term." I was trying to provide an intuitive understanding as to the use of the term and why it is valuable physically. These analogies can sometimes be stretched, but can also be useful. If you have a better answer, provide it and maybe I can learn something too! I'm excited to see.  
  
  ---
  
  