Back to Browse

Convolutional Neural Network (CNN--7 Layers) Image Classification in Matlab (with Complete Code)

17.6K views
Jan 14, 2021
21:30

This example shows how to create and train a simple convolutional neural network for deep learning classification. Convolutional neural networks are essential tools for deep learning and are especially suited for image recognition. The example demonstrates how to: Load image data. Define the network architecture. Specify training options. Train the network. Predict the labels of new data in real-time Prerequisite: Building a Convolutional Neural Network to Classify Images -- Activation Functions , Pooling Layers https://youtu.be/My6BnXrbMRw Code for Data Collection is given in the comment section. Training Part: --------------------- clc clear all close all warning off allImages=imageDatastore('Database','IncludeSubfolders',true, 'LabelSource','foldernames'); layers=[imageInputLayer([227 227 3]), convolution2dLayer(5,20) reluLayer maxPooling2dLayer(2,'Stride',2) fullyConnectedLayer(2) softmaxLayer classificationLayer()]; options = trainingOptions('sgdm', ... 'LearnRateSchedule','piecewise', ... 'LearnRateDropFactor',0.2, ... 'LearnRateDropPeriod',5, ... 'MaxEpochs',30, ... 'MiniBatchSize',100, ... 'InitialLearnRate',0.0001,... 'Plots','training-progress'); convnet=trainNetwork(allImages,layers,options); save convnet; Testing Part: --------------------- clc; close all; clear all warning off load convnet; x=0; y=0; height=200; width=200; bboxes=[x y height width]; c=webcam; while true e=c.snapshot; IFaces = insertObjectAnnotation(e,'rectangle',bboxes,'Processing Area'); es=imcrop(e,bboxes); es=imresize(es,[227 227]); label=classify(convnet,es); imshow(IFaces); title(char(label)); drawnow; end If you want to make Hand Gesture Recognition using Transfer Learning , then you can refer this video for details: https://youtu.be/JU2qHAE0h2Q Learn Complete Machine Learning & Data Science using MATLAB: https://www.youtube.com/playlist?list=PLjfRmoYoxpNoaZmR2OTVrh-72YzLZBlJ2 Learn Digital Signal Processing using MATLAB: https://www.youtube.com/playlist?list=PLjfRmoYoxpNr3w6baU91ZM6QL0obULPig Learn Complete Image Processing & Computer Vision using MATLAB: https://www.youtube.com/playlist?list=PLjfRmoYoxpNostbIaNSpzJr06mDb6qAJ0 🙏🙏🙏🙏🙏🙏🙏🙏 YOU JUST NEED TO DO 3 THINGS to support my channel LIKE SHARE & SUBSCRIBE TO MY YOUTUBE CHANNEL #NeuralNetworks #ComputerVision #MachineLearning #MATLAB #DataScience

Download

0 formats

No download links available.

Convolutional Neural Network (CNN--7 Layers) Image Classification in Matlab (with Complete Code) | NatokHD