File Exchange

image thumbnail

Demos from " Deep Learning for Computer Vision" Webinar

version (18.4 MB) by Johanna Pingel
Files Used in "Deep Learning for Computer Vision" Webinar - 17A


Updated 03 May 2017

View License

These examples go through the 3 demos explained in the "Deep Learning for Computer Vision" Webinar

The demos are as follows:
- Object Classification using a Pre-trained Network
- Transfer Learning - altering AlexNet to perform vehicle classification
- Object Detection using Deep Learning (Faster R-CNN)
**Please note: these are the demos only and a small set of images. No pre-trained networks are included

Cite As

Johanna Pingel (2021). Demos from " Deep Learning for Computer Vision" Webinar (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (28)

Daisy Villano

angel lerma

Greetings from Mexico, excellent contribution, very interesting truth.
I tell you that I am a newbie in MatLab and download the example to execute it like this, I am trying to execute demo 3 but it marks me an error in the following line:

% Run the detector.
[bboxes, scores] = detect (detector, I);

The error is as follows:
Error using gpuArray / double
Out of memory on device. To view more detail about available memory on the GPU, use 'gpuDevice ()'. If the problem persists, reset the GPU by calling 'gpuDevice (1)'.

I already did what he advises and nothing.

My work environment:
Win 10, MatLab R2018b, 8 RAM, GPU 2 RAM

Any idea of a solution?

Thank you


Johanna Pingel

This MATLAB code is freely available to use under XLA license. I'm not certain how to cite this, you may cite the webinar or the code as you would any other video or code.

Alam Noor

Can I use your custom read function in my research ? and how i can site it. Thanks

Yh Jiang

Oh dear, I found it~~~~

Yh Jiang

dear Johanna, is the data images of cars available?

Johanna Pingel

For minibatch errors, go into the createCNN function and add a parameter to the training options: 'MiniBatchSize',1

Hui Yin Lee

Hi, when i run the code for demo Object Detection using Deep Learning (Faster R-CNN) , there is an error showing "Error using vision.internal.cnn.parseInputsFasterRCNN (line 24)
The 'MiniBatchSize' training option must be set to 1 for training Fast R-CNN or Faster R-CNN object detectors. To set this
value, use the trainingOptions function."
How should i overcome it?

Alam Noor

@Johanna Pingel. Thanks for your Webinar. I'm a research student in Harbin Institute of Technology China. Can you please comment if possible. How I can use it for sheep images data-set, if dataset is not label? Second if I will label dataset than which plate form is better for facial recognition? Thanks

nithiswar reddy

Stephen Sheppard

Very helpful introduction.

ridvan ozdemir

Hi, Johanna Pingel ! thanks for the Demos.
but i can't use imageLabeler's new version. Do you have any demo for R2018a?

Linxiang Zhou

Running TransferLearnnigDemo in Demo_TransferLearning folder often display "Error using trainNetwork (line 133)
Undefined function or variable 'plotObj'.

Error in TransferLearningDemo (line 130), net = trainNetwork(trainDS, layers, opts);"
, so it can't complete running.
Who can tell me why?

Linxiang Zhou

Dear Johanna, I'm pleased to read your codes. I found out that the plotTrainingAccuracy.m and
stopTrainingAtThreshold.m have some the marker "...", which should be '...'.
and I have a question: could you please tell me what is included in your vehicleRois.mat? Maybe it is
important part when we want to do object detection. Or could you tell me how do you make your
Please your answer to my email address:

shikha purwar

I am trying to classify images into two categories viz. healthy vs diseased. I am using Alexnet for this using the transfer learning on single GPU. But since the original net is not trained on these specific class of images, the accuracy of the classification is only around 60%. So what can be done to increase the accuracy?

Lipika Kanojia

Hi Johanna, I want to modify Alexnet to classify Grayscale images. What changes should I make? and how? Because the first layer of Alexnet says: 227*227*3 .

Thank you in advance!

Johanna Pingel

@rcjr15 - This is a challenging question because it depends on your data, and what you are trying to do - accuracy is a difficult thing to increase without trying a lot of options and seeing what helps it to improve.

A few things to try:
If you have the ability to create more images for training this could help. With the 17b release you can augment your dataset with ImageDataAugmenter
If you are not seeing the accuracy improve, you could try a different classification technique. Would a machine learning technique give higher accuracy?
as you mentioned, Alexnet doesn't have your categories or similar categories. How about a different network. Have you tried some of the models in Caffe model zoo?
Good luck!

Johanna Pingel

@Biserka - I'm not sure what the problem is without debugging the code. The error appears to be something related to the number of predictions in the variable "labels" and the number of images used in the variable testDS.Labels
You can try finding out the sizes of both of these variables - they need to be the same.

Biserka Petrovska

When I run the code I get this error

Error using confusionmat (line 75)
G and GHAT need to have same number of rows

Error in TransferLearningDemo (line 150)
confMat = confusionmat(testDS.Labels, labels);

What could be the problem?

Sehairi K.

Hi Johanna Pingel
Thanks very much for this interesting webinar
I just need the name (or link to download) the video file played to test the CNN 28:23


@Johanna Pingel, I am trying to classify images into two categories viz. healthy vs diseased. I am using Alexnet for this using the transfer learning on single GPU. But since the original net is not trained on these specific class of images, the accuracy of the classification is only around 60%. So what can be done to increase the accuracy? I have around 500 labeled images that I could use for training and testing.

Norsalina Hassan

Hi @Johanna Pingel, can this be used for speaker classification?

Razouane Issam

Hi @Johanna Pingel
is there any configuration to speed up the training in a single CPU because I don't have a GPU in my laptop
really need your help, please
thank you

Johanna Pingel

@xiao - The trainedNet is too large of a file to submit to file-exchange. If you take the time to train a neural network before VisualizeActivations, you can replace that name with a saved network of your choice. If you don't want to retrain the network, just use AlexNet.


@Johanna Pingel, thank you and it has worked out. but there is no 'trainedNet48_test.mat' in the downloaded files (for VisualizeActivations.m of TransferLearningdemo) . Where to get the mat file?

Johanna Pingel

@xiao - the OutputFcn was introduced in r2017a - if you are running an earlier version, this section of code will not run unless you remove the OutputFcn. AlexNet should have 25 layers, can you try to re-download from here?
This requires r2016b


Hi, Johanna Pingel ! thanks for the Demos.
However the alexnet downloaded at Add-Ons has only 23 layers, the code is with 25 layers. And the 'OutputFcn' is not a recognized parameter for trainingOptions. The error occurs at the line of "opts = trainingOptions()". (for TransferLearningdemo)
So, Is there anything wrong?

MATLAB Release Compatibility
Created with R2017a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!