Answers.Body: <p>As the question has been left unanswered, for future readers of the questions:</p>
  
  <p>The documentation you link gives the answer to your question.</p>
  
  <p>Given the fact you have a pre-trained model as you say:</p>
  
  <pre><code>YPred = classify(netTransfer,testDigitData);
  </code></pre>
  
  <p>where <code>netTansfer</code> is the pre-trained model and <code>testDigitData</code> is your test image that you want to predict the label.</p>
  
  <p>Your image(s) need to be loaded following the instruction also given in the documentation:</p>
  
  <pre><code>digitDatasetPath = fullfile(matlabroot,'toolbox','nnet','nndemos', ...
      'nndatasets','DigitDataset');
  
  digitData = imageDatastore(digitDatasetPath, ...
      'IncludeSubfolders',true,'LabelSource','foldernames');
  </code></pre>
  
  <p>(<code>digitData</code> will become <code>testDigitData</code> if the images that you load are for testing purpose only, which seems to be your case)</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-08-10T19:46:02.600Z
Answers.LastActivityDate: 2017-08-10T19:46:02.600Z
Answers.UserDisplayName: Eskapp
Body: <p>I was applying this <a href="https://www.mathworks.com/help/nnet/examples/transfer-learning-and-fine-tuning-of-convolutional-neural-networks.html" rel="nofollow noreferrer">CNN fine-tuning example from Matlab</a>.</p>
  
  <p>The example shows how to fine-tune a pre-trained CNN on letters to classify images of digits. Now I would like to use this new fine-tuned CNN on new images of digits that i have on my computer. How can I do that?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-05-17T15:08:25.617Z
Comments.Text: Are you basically asking how to do what apparently is already explained in the link you provided above?
Comments.UserDisplayName: nbro
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-05-17T15:56:17.737Z
Comments.Text: I want to use the newly trained CNN on digits for predicting the label of an image he has not seen before. An image that is not among the test images it was fine-tuned on. I tried using the predict function but it gives me an error.
Comments.UserDisplayName: F.Lin
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-05-18T20:55:17.040Z
Comments.Text: @F.Lin There is a misunderstanding I think: "An image that is not among the test images it was fine-tuned on" - Test images are by definition images that were NOT used for training the CNN. So, your images should go in place of the variable `testDigitData` in the example from the link you give. The CNN is trained on `trainDigitData`.
Comments.UserDisplayName: Eskapp
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-05-19T09:17:10.553Z
Comments.Text: Thank you Eskapp for the reply. The problem is that i don't have a dataset, actually i only have veriy few images.
Comments.UserDisplayName: F.Lin
Tags: <convolutional-neural-networks><matlab>
Title: How can I use a trained CNN to predict a new image label?
UserDisplayName: F.Lin
ThreadText: # How can I use a trained CNN to predict a new image label?
  
  (Asked by: username_0 on 2017-05-16)
  
  I was applying this [CNN fine-tuning example from Matlab](https://www.mathworks.com/help/nnet/examples/transfer-learning-and-fine-tuning-of-convolutional-neural-networks.html).
  
  The example shows how to fine-tune a pre-trained CNN on letters to classify images of digits. Now I would like to use this new fine-tuned CNN on new images of digits that i have on my computer. How can I do that?
  
  **Tags:** convolutional-neural-networks, matlab
  > **Comments:**
  > **username_1**: Are you basically asking how to do what apparently is already explained in the link you provided above?  
  > **username_0**: I want to use the newly trained CNN on digits for predicting the label of an image he has not seen before. An image that is not among the test images it was fine-tuned on. I tried using the predict function but it gives me an error.  
  > **username_2**: @F.Lin There is a misunderstanding I think: "An image that is not among the test images it was fine-tuned on" - Test images are by definition images that were NOT used for training the CNN. So, your images should go in place of the variable `testDigitData` in the example from the link you give. The CNN is trained on `trainDigitData`.  
  > **username_0**: Thank you Eskapp for the reply. The problem is that i don't have a dataset, actually i only have veriy few images.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2017-08-10. Score: 2
  
  As the question has been left unanswered, for future readers of the questions:
  The documentation you link gives the answer to your question.
  Given the fact you have a pre-trained model as you say:
  YPred = classify(netTransfer,testDigitData);
  
  where netTansfer is the pre-trained model and testDigitData is your test image that you want to predict the label.
  Your image(s) need to be loaded following the instruction also given in the documentation:
  digitDatasetPath = fullfile(matlabroot,'toolbox','nnet','nndemos', ...
      'nndatasets','DigitDataset');
  
  digitData = imageDatastore(digitDatasetPath, ...
      'IncludeSubfolders',true,'LabelSource','foldernames');
  
  (digitData will become testDigitData if the images that you load are for testing purpose only, which seems to be your case)
  
  
  ---
  
  