MATLAB code associated with the demo in 'Deep Learning in 11 Lines of MATLAB Code' video.
This demo uses AlexNet, a pretrained deep convolutional neural network (CNN or ConvNet) that has been trained on over a million images.
The example has two parts: setting up the camera and performing object recognition. The first part shows how to use the webcam command to acquire images from the camera. Using the drawnow command, MATLAB is able to continuously update and display images taken by the camera.
You can download the webcam support package here:
The second part illustrates how to download a pretrained deep neural network called AlexNet and use MATLAB to continuously process the camera images. AlexNet takes the image as input and provides a label for the object in the image. You can experiment with objects in your surroundings to see how accurate AlexNet is.
You can download the AlexNet support package here:
MathWorks Deep Learning Toolbox Team (2020). Deep Learning in 11 Lines of MATLAB Code (https://www.mathworks.com/matlabcentral/fileexchange/60659-deep-learning-in-11-lines-of-matlab-code), MATLAB Central File Exchange. Retrieved .
which camera do you use?
please I need the images, to be able to develop the example. thank you very much, my email is email@example.com
fast, nice and easy
I solved this problem! It works
I have errors
Error using webcam (line 116)
No webcams have been detected. Please ensure the webcam is connected to the system.
Error in webcam_object_classification (line 5)
camera = webcam; % Connect to the camera
Is it possible to work with laptop built-in webcam? Or it works only with usb web-cams?
I was wondering if someone can help me with this matter.
I trained Alexnet for my pictures, I give it random images and it can detect them.
Now, I want to test it with a shot video. How should I modify the code to feed the video as a test? just to see how it works for video. I do not want to use the camera, I will use the shot video. Please feel free to contact me.
My email address: firstname.lastname@example.org
my skype id: email@example.com
work very well.
I am getting the that error while starting the TransferLearningVideo.m.
hi, there is an error when i run the codes: CUDA driver version is insufficient for CUDA runtime version. And i want to know what kind of CUDA does Alexnet need?
I could ony classify key board
when mouse was shone it was being classified as something else
I am getting the that error while starting the TransferLearningVideo.m. these errors ;
Error using trainNetwork (line 64)
The output size (5) of the last layer doesn't match the number of classes (1).
Error in TransferLearningVideo (line 17)
myNet = trainNetwork(trainingImages, layers, opts);
Thanks, Nice explanation!, please consider next time using less toolboxes that we need not to purchase.
Undefined function or variable 'alexnet'.
Error in DeepLearning_in_11_Lines (line 3)
nnet = alexnet;
I tried running this example, but it does not work. It is trying to use classify for statistics toolbox and not net classify - can you please help me solve this issue?
I have nnet installed as well.
> In alexnet (line 46)
In MyFirstDeepLearningTest (line 4)
Error using classify (line 122)
Requires at least three arguments.
Error in MyFirstDeepLearningTest (line 10)
label = classify(nnet, picture); % Classify the picture
@Anthony, this submission requires the Neural Network Toolbox. You may not have that toolbox installed.
I tried to run this code and it returns an error saying that "classify requires 3 parameters". What is the 3rd parameter?
Added link to demo video.