Answers.Body: <p>The term you are looking for is <strong>multi-label classification</strong>, i.e. where you are making more than one classification on each image (one for each label). Most examples you'll find online are in the NLP domain but it is just as easy with CNNs since it's essentially defined by the structure of the output layer and the loss function used. It's not as complicated as it might sound if you are already familiar with CNNs. </p>
  
  <p>The output layer of a neural network (for 3 or more classes) has as many units as there are targets. The network learns to associate each of those units with a corresponding class. A <strong>multi-class classifier</strong> normally applies a softmax activation function to the raw unit output, which yields a probability vector. To get the final classification, the <code>max()</code> of the probability vector is taken (the most probable class). The output would look like this: </p>
  
  <pre><code>                 Cat    Bird   Plane   Superman  Ball   Dog   
  Raw output:      -1     2      3       6         -1     -1
  Softmax:         0.001  0.017  0.046   0.934     0.001  0.001
  Classification:  0      0      0       1         0      0
  </code></pre>
  
  <p><strong>Multi-label classification</strong> typically uses a sigmoid activation function since the probabilities of a label occuring can be treated independently. The classification is then determined by the probability (>=0.5 for True). For your problem, this output could look like:</p>
  
  <pre><code>                 Big nose  Long hair  Curly hair  Superman  Big ears  Sharp Jawline
  Raw output:      -1        -2         3           6         -1        10
  Sigmoid:         0.269     0.119      0.953       0.998     0.269     1.000
  Classification:  0         0          1           1         0         1
  </code></pre>
  
  <p>The <strong>binary crossentropy</strong> loss function is normally used for a multi-label classifier since a <em>n</em>-label problem is essentially splitting up a multi-class classification problem into <em>n</em> binary classification problems.</p>
  
  <p>Since all you need to do to get from a multi-class classifier to a multi-label classifier is change the output layer, its very easy to do with pre-trained networks. If you get the pre-trained model from Keras its as simple as including <code>include_top=False</code> when downloading the model and then adding the correct output layer.</p>
  
  <p>With 13000 images, I would recommend using Keras' <code>ImageDataGenerator</code> class with the <code>flow_from_dataframe</code> method. This allows you to use a simple pandas dataframe to label and feed in all your images. The dataframe would look like this:</p>
  
  <pre><code>Filename  Big nose  Long hair  Curly hair  Superman  Big ears  Sharp Jawline
  0001.JPG  0         0          1           1         0         1
  0002.JPG  1         0          1           0         1         1
     .      .         .          .           .         .         .
  </code></pre>
  
  <p><code>flow_from_dataframe</code>'s <code>class_mode</code> parameter can be set to <code>raw</code> or <code>multi_output</code> along with <code>x_col</code> to <code>'Filename'</code> and <code>y_col</code> to <code>['Big nose', 'Long hair', 'Curly hair', 'Superman', 'Big ears', 'Sharp Jawline']</code> (in this example). Check out the <a href="https://keras.io/preprocessing/image/#imagedatagenerator-class" rel="nofollow noreferrer">documentation</a> for more details.</p>
  
  <p>The amount of data you need <strong>for each label</strong> depends on many factors and is essentially impossible to know without trying. 13000 sounds like a good start but it also depends on how many labels you have and how evenly distributed they are between the labels. A decent guide (one of many) on how to set up a multi-label classifier and how to implement it with Keras can be found <a href="https://towardsdatascience.com/multi-label-image-classification-with-neural-network-keras-ddc1ab1afede" rel="nofollow noreferrer">here</a>. It also covers imbalances on label frequency and is well worth a read. I'd <em>highly</em> recommend that you become as intimately familiar with your dataset as possible before you start tuning your neural network architecture.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-03-10T22:31:00.067Z
Answers.LastActivityDate: 2020-03-10T22:36:23.413Z
Answers.LastEditDate: 2020-03-10T22:36:23.413Z
Answers.UserDisplayName: tynowell
Answers.Body: <p>You can try image captioning. You can train a CNN model for image, and then, on top of that, provide the model embedding to another LSTM model to learn the encoded characteristics. You can directly use the pre-trained VGG-16 model and use the second last layer to create your image embeddings. </p>
  
  <p><a href="https://arxiv.org/abs/1411.4555" rel="nofollow noreferrer">Show and Tell: A Neural Image Caption Generator</a> is a really nice paper to start with. There is an implementation of it in TensorFlow: <a href="https://www.tensorflow.org/tutorials/text/image_captioning" rel="nofollow noreferrer">https://www.tensorflow.org/tutorials/text/image_captioning</a>. The paper focuses on generating caption, but you can provide your 'characteristics' to LSTM, so that it can learn it for each image. </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-03-11T16:48:00.123Z
Answers.LastActivityDate: 2020-03-11T20:52:30.080Z
Answers.LastEditDate: 2020-03-11T20:52:30.080Z
Answers.UserDisplayName: overflow95
Answers.Body: <p>You can use image captioning. Look at the article <a href="https://link.medium.com/qx7ZMHsWK4" rel="nofollow noreferrer">Captioning Images with CNN and RNN, using PyTorch</a>. The idea is very profound. The model encodes the image to high dimensional space and then passes it through LSTM cells and LSTM cells produce linguistic output. </p>
  
  <p>See also <a href="https://www.tensorflow.org/tutorials/text/image_captioning" rel="nofollow noreferrer">Image captioning with visual attention</a>.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-03-11T02:08:20.820Z
Answers.LastActivityDate: 2020-03-11T20:54:08.833Z
Answers.LastEditDate: 2020-03-11T20:54:08.833Z
Answers.UserDisplayName: Ta_Req
Answers.Body: <p>Im looking for something beyond just classification.  I would like to identify the component parts of a flat file jpg facebook ad (logo, product, headline, punchline, call to action, background) and have it return a json describing the parts, x,y cooridnates, the polygon shape it is, color and properties. Do you think this is relevant here or any other suggestions?</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-10-17T20:45:12.940Z
Answers.LastActivityDate: 2024-10-17T20:45:12.940Z
Answers.UserDisplayName: EvanG
Answers.Body: <p>I would do as suggested in the comments. First select an encoding scheme. I think what is called a difference hash would work well for this application. Code for that is shown below. Now take your data set of images and run them through the encoder and save the result in a database. The database would contain the "labeling" text and the encoder result. Now for a new image you are trying to label, input the image into the encoder. Take the encoder result and compare it to the encoded values in the database. Search through the encoded values in the database and find the closest match. You can then use a "threshold" value to determine if you want to give a specific label for the image or if the distance is above the threshold declare there is no matching label. You can determine the best "threshold" value by running you data set images with the known labels and iterate the threshold level and select the threshold with the least errors. I would use something like a 56 or a 128 length hash.</p>
  
  <pre><code>import cv2
  import os
  # f_path is the full path to the image file, hash length is an integer specifies length of the hash
  def get_hash(f_path, hash_length):    
      r_str=''    
      img=cv2.imread(f_path,0)        # read image as gray scale image
      img = cv2.resize(img, (hash_length+1, 1), interpolation = cv2.INTER_AREA)    
      # now compare adjacent horizontal values in a row if pixel to the left&gt;pixel toright result=1 else 0
      for col in range (0,hash_length):
          if(img[0][col]&gt;img[0][col+1]):
              value=str(1)
          else:
              value=str(0)
          r_str=r_str + value
      number=0
      power_of_two=1
      for char in r_str:        
          number = number + int(char) * power_of_two
          power_of_two=2 * power_of_two    
      return ( r_str, number) 
  # example on an image of a bird
  f_path=r'c:\Temp\birds\test\robin\1.jpg'
  hash=get_hash ( f_path, 16) # 16 length hash on a bird image
  print (' hash string ', hash[0], '   hash number ', hash[1])
  
  &gt; results is
   hash string  1111111100000000    hash number  255
  
  
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-03-10T16:51:41.333Z
Answers.LastActivityDate: 2020-03-10T16:51:41.333Z
Answers.UserDisplayName: Gerry P
Answers.Body: <p>From what you wrote, the problem sounds a bit like face recognition, where a camera takes a picture of your face and compares it with a bunch of pictures in a database, for example, one for each employee if its at a company's main gate. If you look "similar" to one of the pictures in the database, the door opens and your ID/Name is displayed on a terminal. </p>
  
  <p>This kind of system generates an encoding for each picture and evaluates the distance between your encoded picture and the encoding of each picture in the database. If this is at most some minimum value, it's considered a match.</p>
  
  <p>So, what you could do is figure out some way to encode your pictures (say sum the pixel values for a very simple example, ideally you would use some sort of vector here because distances make sense with vectors) and store this encoding together with the label of the picture.</p>
  
  <p>Once your database is complete (i.e. you have a bunch of pictures saved as a pair of [encoding, label]), you can "scan" each new picture, calculate its encoding (using the same algorithm that calculated your database encodings) and find the one entry in your database which minimizes the "encoding-distance".</p>
  
  <p>If this sounds like a way to solve your problem, you need to come up with a proper encoding (like "run my images through a CNN and save the output of my last fully connected layer") and apply this to all the images you want to use as "training data", before "testing" it on some of the leftover images.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-03-10T14:09:54.577Z
Answers.LastActivityDate: 2020-03-11T20:55:26.287Z
Answers.LastEditDate: 2020-03-11T20:55:26.287Z
Answers.UserDisplayName: Akumetsu
Body: <p>I have collected a set of pictures of people with a text explaining the characteristics of the person on the picture, for example, "Big nose" or "Curly hair". </p>
  
  <p>I want to train some type of model that takes in any picture and returns a description of the picture in terms of characteristics.</p>
  
  <p>However, I have a hard time figuring out how to do this. It is not like labeling "dog" or "apple" because then I can create a set of training data and then evaluate its performance, now I can not. If so I would probably have used a CNN and probably also VGG-16 to help me out.</p>
  
  <p>I only have two ML courses under my belt and have never really encountered a problem like this before. Can someone help me to get in the right direction?</p>
  
  <p>As of now, I have a data set of 13000 labeled images I am very confident it is labeled well. I do not know of any pre-trained datasets that could be of help in this instance, but if you know of one it might help.</p>
  
  <p>Worth noting is that every label is or should at least be unique. If for example there exist two pictures with the same label of "Big nose" it is purely coincidental.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-03-10T07:22:33.963Z
Comments.Text: How large is your collection of pictures and captions? This kind of task typically requires a *lot* of data.
Comments.UserDisplayName: Neil Slater
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-03-10T07:35:46.403Z
Comments.Text: Ok, right now I have about 13000 labeled pictures, I guess that will not be enough. Edit: If I manage to collect enough, then how should I tackle the problem? Even if I now will be unable to do it, I still think it would be very fun to know.
Comments.UserDisplayName: Salviati
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-03-10T07:42:34.573Z
Comments.Text: I'm not experienced enough with the approach to be able to tell you for certain. It also doesn't prevent someone showing you an answer. It may help to have this in detail in the question though, because there might be ways to use a pre-trained network and fine tune it for your case. Also, your example targets are simpler than full image captions, so it is possible that your dataset size is enough
Comments.UserDisplayName: Neil Slater
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-03-10T09:43:45.403Z
Comments.Text: No need to signal your edits - if someone is interrested they can click the "edited X ago" link to see your revisions. I have tidied that up for you. The last detail you added does make a big difference to workable approaches because it will be very difficult for the model to learn with only one example of each label, thanks for adding it.
Comments.UserDisplayName: Neil Slater
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-03-10T09:49:13.383Z
Comments.Text: Sorry, will remember that. Yes I felt that it was not clear enough. I tried to take it into account regarding the "dog" and "apple" with that I can not create a training and evaluation set. So yeah, I should have made it more clear, it may not even be solvable because of this.
Comments.UserDisplayName: Salviati
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-03-10T14:22:01.973Z
Comments.Text: I have little experience with ConvNets but what I (think to) know is that the neural network architecture should be in balance with the data you are training it on. I read that VGG-16 is trained with 15 million high res images. 13.000 is < 1% of that. So I would say the number of filters in convolution can be less, and likely the number of layers as well. Besides that I think you need more than 1 network trained independently. 1 for each type of hair, 1 for each type of nose, etc. As one could have curly hair, and a big nose, for instance. Fruit cannot be an apple and peer at the same time
Comments.UserDisplayName: Mike de Klerk
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-03-10T14:27:29.830Z
Comments.Text: I think the title of the question is of. I think it should state you want to classify a multitude of characteristics, instead of comparing 1 image to another.
Comments.UserDisplayName: Mike de Klerk
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-03-11T16:21:15.967Z
Comments.Text: @Salviati Hi and welcome to AI SE! I've edited your post to make it clearer. Can you please confirm that the current post is consistent with your original question?
Comments.UserDisplayName: nbro
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-03-12T20:25:36.463Z
Comments.Text: I have had a few exams and been out of the sphere but yes, I approve the updated @nbro, thank you!
Comments.UserDisplayName: Salviati
Tags: <neural-networks><machine-learning><image-recognition>
Title: How can I train a neural network to describe the characteristics of a picture?
UserDisplayName: Salviati
ThreadText: # How can I train a neural network to describe the characteristics of a picture?
  
  (Asked by: username_0 on 2020-03-10)
  
  I have collected a set of pictures of people with a text explaining the characteristics of the person on the picture, for example, "Big nose" or "Curly hair".
  
  I want to train some type of model that takes in any picture and returns a description of the picture in terms of characteristics.
  
  However, I have a hard time figuring out how to do this. It is not like labeling "dog" or "apple" because then I can create a set of training data and then evaluate its performance, now I can not. If so I would probably have used a CNN and probably also VGG-16 to help me out.
  
  I only have two ML courses under my belt and have never really encountered a problem like this before. Can someone help me to get in the right direction?
  
  As of now, I have a data set of 13000 labeled images I am very confident it is labeled well. I do not know of any pre-trained datasets that could be of help in this instance, but if you know of one it might help.
  
  Worth noting is that every label is or should at least be unique. If for example there exist two pictures with the same label of "Big nose" it is purely coincidental.
  
  **Tags:** neural-networks, machine-learning, image-recognition
  
  > **Comments:**
  > **username_1**: How large is your collection of pictures and captions? This kind of task typically requires a *lot* of data.  
  > **username_0**: Ok, right now I have about 13000 labeled pictures, I guess that will not be enough. Edit: If I manage to collect enough, then how should I tackle the problem? Even if I now will be unable to do it, I still think it would be very fun to know.  
  > **username_1**: I'm not experienced enough with the approach to be able to tell you for certain. It also doesn't prevent someone showing you an answer. It may help to have this in detail in the question though, because there might be ways to use a pre-trained network and fine tune it for your case. Also, your example targets are simpler than full image captions, so it is possible that your dataset size is enough  
  > **username_1**: No need to signal your edits - if someone is interrested they can click the "edited X ago" link to see your revisions. I have tidied that up for you. The last detail you added does make a big difference to workable approaches because it will be very difficult for the model to learn with only one example of each label, thanks for adding it.  
  > **username_0**: Sorry, will remember that. Yes I felt that it was not clear enough. I tried to take it into account regarding the "dog" and "apple" with that I can not create a training and evaluation set. So yeah, I should have made it more clear, it may not even be solvable because of this.  
  > **username_2**: I have little experience with ConvNets but what I (think to) know is that the neural network architecture should be in balance with the data you are training it on. I read that VGG-16 is trained with 15 million high res images. 13.000 is < 1% of that. So I would say the number of filters in convolution can be less, and likely the number of layers as well. Besides that I think you need more than 1 network trained independently. 1 for each type of hair, 1 for each type of nose, etc. As one could have curly hair, and a big nose, for instance. Fruit cannot be an apple and peer at the same time  
  > **username_2**: I think the title of the question is of. I think it should state you want to classify a multitude of characteristics, instead of comparing 1 image to another.  
  > **username_3**: @username_0 Hi and welcome to AI SE! I've edited your post to make it clearer. Can you please confirm that the current post is consistent with your original question?  
  > **username_0**: I have had a few exams and been out of the sphere but yes, I approve the updated @username_3, thank you!  
  
  ---
  
  ## 6 answers
  
  ### Answer by username_4 on 2020-03-10. Score: 2 | Accepted answer
  
  The term you are looking for is **multi-label classification**, i.e. where you are making more than one classification on each image (one for each label). Most examples you'll find online are in the NLP domain but it is just as easy with CNNs since it's essentially defined by the structure of the output layer and the loss function used. It's not as complicated as it might sound if you are already familiar with CNNs.
  
  The output layer of a neural network (for 3 or more classes) has as many units as there are targets. The network learns to associate each of those units with a corresponding class. A **multi-class classifier** normally applies a softmax activation function to the raw unit output, which yields a probability vector. To get the final classification, the `max()` of the probability vector is taken (the most probable class). The output would look like this:
  
  ```
                   Cat    Bird   Plane   Superman  Ball   Dog   
  Raw output:      -1     2      3       6         -1     -1
  Softmax:         0.001  0.017  0.046   0.934     0.001  0.001
  Classification:  0      0      0       1         0      0
  
  ```
  
  **Multi-label classification** typically uses a sigmoid activation function since the probabilities of a label occuring can be treated independently. The classification is then determined by the probability (>=0.5 for True). For your problem, this output could look like:
  
  ```
                   Big nose  Long hair  Curly hair  Superman  Big ears  Sharp Jawline
  Raw output:      -1        -2         3           6         -1        10
  Sigmoid:         0.269     0.119      0.953       0.998     0.269     1.000
  Classification:  0         0          1           1         0         1
  
  ```
  
  The **binary crossentropy** loss function is normally used for a multi-label classifier since a *n*-label problem is essentially splitting up a multi-class classification problem into *n* binary classification problems.
  
  Since all you need to do to get from a multi-class classifier to a multi-label classifier is change the output layer, its very easy to do with pre-trained networks. If you get the pre-trained model from Keras its as simple as including `include_top=False` when downloading the model and then adding the correct output layer.
  
  With 13000 images, I would recommend using Keras' `ImageDataGenerator` class with the `flow_from_dataframe` method. This allows you to use a simple pandas dataframe to label and feed in all your images. The dataframe would look like this:
  
  ```
  Filename  Big nose  Long hair  Curly hair  Superman  Big ears  Sharp Jawline
  0001.JPG  0         0          1           1         0         1
  0002.JPG  1         0          1           0         1         1
     .      .         .          .           .         .         .
  
  ```
  
  `flow_from_dataframe`'s `class_mode` parameter can be set to `raw` or `multi_output` along with `x_col` to `'Filename'` and `y_col` to `['Big nose', 'Long hair', 'Curly hair', 'Superman', 'Big ears', 'Sharp Jawline']` (in this example). Check out the [documentation](https://keras.io/preprocessing/image/#imagedatagenerator-class) for more details.
  
  The amount of data you need **for each label** depends on many factors and is essentially impossible to know without trying. 13000 sounds like a good start but it also depends on how many labels you have and how evenly distributed they are between the labels. A decent guide (one of many) on how to set up a multi-label classifier and how to implement it with Keras can be found [here](https://towardsdatascience.com/multi-label-image-classification-with-neural-network-keras-ddc1ab1afede). It also covers imbalances on label frequency and is well worth a read. I'd *highly* recommend that you become as intimately familiar with your dataset as possible before you start tuning your neural network architecture.
  
  
  ---
  
  ### Answer by username_5 on 2020-03-11. Score: 2
  
  You can try image captioning. You can train a CNN model for image, and then, on top of that, provide the model embedding to another LSTM model to learn the encoded characteristics. You can directly use the pre-trained VGG-16 model and use the second last layer to create your image embeddings.
  
  [Show and Tell: A Neural Image Caption Generator](https://arxiv.org/abs/1411.4555) is a really nice paper to start with. There is an implementation of it in TensorFlow: <https://www.tensorflow.org/tutorials/text/image_captioning>. The paper focuses on generating caption, but you can provide your 'characteristics' to LSTM, so that it can learn it for each image.
  
  
  ---
  
  ### Answer by username_6 on 2020-03-11. Score: 1
  
  You can use image captioning. Look at the article [Captioning Images with CNN and RNN, using PyTorch](https://link.medium.com/qx7ZMHsWK4). The idea is very profound. The model encodes the image to high dimensional space and then passes it through LSTM cells and LSTM cells produce linguistic output.
  
  See also [Image captioning with visual attention](https://www.tensorflow.org/tutorials/text/image_captioning).
  
  
  ---
  
  ### Answer by username_7 on 2024-10-17. Score: 0
  
  Im looking for something beyond just classification. I would like to identify the component parts of a flat file jpg facebook ad (logo, product, headline, punchline, call to action, background) and have it return a json describing the parts, x,y cooridnates, the polygon shape it is, color and properties. Do you think this is relevant here or any other suggestions?
  
  
  ---
  
  ### Answer by username_8 on 2020-03-10. Score: 0
  
  I would do as suggested in the comments. First select an encoding scheme. I think what is called a difference hash would work well for this application. Code for that is shown below. Now take your data set of images and run them through the encoder and save the result in a database. The database would contain the "labeling" text and the encoder result. Now for a new image you are trying to label, input the image into the encoder. Take the encoder result and compare it to the encoded values in the database. Search through the encoded values in the database and find the closest match. You can then use a "threshold" value to determine if you want to give a specific label for the image or if the distance is above the threshold declare there is no matching label. You can determine the best "threshold" value by running you data set images with the known labels and iterate the threshold level and select the threshold with the least errors. I would use something like a 56 or a 128 length hash.
  
  ```
  import cv2
  import os
  # f_path is the full path to the image file, hash length is an integer specifies length of the hash
  def get_hash(f_path, hash_length):    
      r_str=''    
      img=cv2.imread(f_path,0)        # read image as gray scale image
      img = cv2.resize(img, (hash_length+1, 1), interpolation = cv2.INTER_AREA)    
      # now compare adjacent horizontal values in a row if pixel to the left>pixel toright result=1 else 0
      for col in range (0,hash_length):
          if(img[0][col]>img[0][col+1]):
              value=str(1)
          else:
              value=str(0)
          r_str=r_str + value
      number=0
      power_of_two=1
      for char in r_str:        
          number = number + int(char) * power_of_two
          power_of_two=2 * power_of_two    
      return ( r_str, number) 
  # example on an image of a bird
  f_path=r'c:\Temp\birds\test\robin\1.jpg'
  hash=get_hash ( f_path, 16) # 16 length hash on a bird image
  print (' hash string ', hash[0], '   hash number ', hash[1])
  
  > results is
   hash string  1111111100000000    hash number  255
  
  ```
  
  
  ---
  
  ### Answer by username_9 on 2020-03-10. Score: 0
  
  From what you wrote, the problem sounds a bit like face recognition, where a camera takes a picture of your face and compares it with a bunch of pictures in a database, for example, one for each employee if its at a company's main gate. If you look "similar" to one of the pictures in the database, the door opens and your ID/Name is displayed on a terminal.
  
  This kind of system generates an encoding for each picture and evaluates the distance between your encoded picture and the encoding of each picture in the database. If this is at most some minimum value, it's considered a match.
  
  So, what you could do is figure out some way to encode your pictures (say sum the pixel values for a very simple example, ideally you would use some sort of vector here because distances make sense with vectors) and store this encoding together with the label of the picture.
  
  Once your database is complete (i.e. you have a bunch of pictures saved as a pair of [encoding, label]), you can "scan" each new picture, calculate its encoding (using the same algorithm that calculated your database encodings) and find the one entry in your database which minimizes the "encoding-distance".
  
  If this sounds like a way to solve your problem, you need to come up with a proper encoding (like "run my images through a CNN and save the output of my last fully connected layer") and apply this to all the images you want to use as "training data", before "testing" it on some of the leftover images.
  
  
  ---
  
  