License

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the distribution.
* In all cases, the software is, and all modifications and derivatives
of the software shall be, licensed to you solely for use in conjunction
with MathWorks products and service offerings.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

The code provides hands-on examples to implement convolutional neural networks (CNNs) for object recognition. The three demos have associated instructional videos that will allow for a complete tutorial experience to understand and implement deep learning techniques.
The demos include:
- Training a neural network from scratch
- Using a pre-trained model (transfer learning)
- Using a neural network as a feature extractor
The corresponding videos for the demos are located here: https://www.mathworks.com/videos/series/deep-learning-with-MATLAB.htmlThe use of a GPU and Parallel Computing Toolbox™ is recommended when running the examples. Demo 3 requires Statistics and Machine Learning Toolbox™ in addition to the required products below.

When i ran the file Demo_TransferLearning.mlx at trainNetwork() function, it crashed, given the information "Out of Memory on device....".
I tried gpuDevice(1) statement, but it occurred again.
My GPU is GeForce GTX 965M with 4GB.
Should i config some parameters in Matlab?

In the program demo_TrainingFromScratch:
fc1 = fullyConnectedLayer(64,'BiasLearnRateFactor',2);
In the above code how are 64 neurons chosen in the fully connected layer.
fc1.Weights = single(randn([64 576])*0.1);
Also what does 576 indicate in the above code.

confMat = confusionmat(imds_test.Labels, labels);
confMat = confMat./sum(confMat,2);
mean(diag(confMat))
when i am runnig this part of code i got this massege(error using ./ matrix dimensions must agree ) what should i change to make it right

thanks for so excellent video. I have a question for the transfer learning demo. In Matlab, all layers except the last three(any other number) are extracted from the pretrained network, and the last three layers are replaced by new one. There are a few finetune ways, such as finetune the whole network, finetune the last classifier layer, or finetune from any specificed layer. So, I wonder what is the finetune ways in Matlab. finetune the whole network or finetune the last classifier layer? the trainNetwork function implements the retrain( finetune the whole network) ?