• Skip to primary navigation
  • Skip to content
  • Skip to primary sidebar
  • Skip to footer
flicsDB

flicsDB

Every Pro was once a Noob

  • Home
  • Courses
  • About
  • Log In | Sign Up

Deep Learning in Matlab

May 18, 2019 by zshaik

In this blog post we will discuss how to do image classification using MATLAB, Let’s begin.
deep learning vs machine learning

What is deep learning?

Deep learning is a subset of machine learning in Artificial Intelligence (AI) that has networks capable of learning unsupervised from data that is unstructured or unlabeled. Also known as Deep Neural Learning or Deep Neural Network.

Prerequisites

  • Deep learning tool box
  • Alexnet add-on

Installing Alexnet Add-on

You can install this add-on from the menu, home->addons and search for alexnet and click on install.

Image classification using Alexnet

Alexnet is a CNN (Convolution Neural Network) designed in 2012 at University of Toronto, read more about it here Matlab’s deep learning toolbox has this built-in function which can be used for image classification, consider the example below, Create a new script from the menu, New -> Script and copy the following snippet in the script and execute it using runicon. Make sure that the image is present in the directory where the script is saved, if not you can define in a more concrete manner like $User/Pictures/monkey.jpegfor linux and –E:/monkey.jpegdepending on where you have it saved. So, let’s create the script from the snippet below and save it to say, alexExample.m
net=alexnet;
I = imread('monkey.jpeg');
I = imresize(I, [227,227]);
sz = net.Layers(1).InputSize;
I = I(1:sz(1),1:sz(2),1:sz(3));
figure
imshow(I)
label = classify(net,I)
Please note that the size of picture should be equal to the network in order for it to evaluate. This is a condition, so we need to resize & crop it to that size. The image size here 227 x 227 is hard-coded based on the size of the neural network.

Result

label = 

  categorical

     macaque
Finally, as we can see that the output displays the resized image with the classification result macaque
Please make sure that you have deep learning toolbox and alexnet addon already installed on your matlab before starting this example.

Primary Sidebar

en English
ar Arabiczh-CN Chinese (Simplified)nl Dutchen Englishfr Frenchde Germanhi Hindiid Indonesianit Italianja Japanesems Malaypt Portugueseru Russianes Spanishte Telugu

Course Tags

free

Recent Posts

  • Restrict resources within a namespace in kubernetes
  • How to setup TLS certs in nginx ingress using certbot
  • Download kubeconfig using eksctl
  • How to install minikube on windows using virtual box
  • Kubernetes: Deploying on master node only
  • Facebook
  • GitHub
  • YouTube

Contact

Navigation

  • flicsDB pro
« squashing in git
Install MATLAB »

Footer

Newsletter

Stay up to date by subscribing to our newsletter.

© Copyright 2016-2019 flicsDB · All Rights Reserved ·