Developing a convolutional neural network from scratch in MATLAB

27 vues (au cours des 30 derniers jours)
Memo Remo
Memo Remo le 29 Nov 2022
Commenté : Memo Remo le 21 Mar 2023
Hi Everyone,
I am trying to understand the architecture of the convolutional neural network (CNN) by developing its algorithm from scratch. First, I developed functions that can perform convolutions and pooling on input images. Then I wanted to feed the outputs of these sequential layers to MATLAB's built-in Neural network models (like fitcnet) to perform image segmentation. I think in CNNs the filters' (kernels') elements are treated like weights in NNet architecture and are determined using an iterative approach. In other words, we just define the total number of filters and let the CNN algorithm calculate the values of their elements.
I don't know how to use MATLAB's NNet models to calculate the filter's elements. Please let me know how this can be implemented in MATLAB. Should I develop the NNet algorithm myself?
I appreciate any help you can provide.

Réponse acceptée

Sourabh
Sourabh le 20 Mar 2023
If you want to develop your own Convolutional Neural Network architecture from scratch and train it using MATLAB, you can use the Deep Learning Toolbox.
You can define the architecture of your CNN using the layerGraph object, which allows you to add different types of layers to your network (such as convolutional layers, pooling layers, and fully connected layers).
Once you have defined the architecture of your CNN, you can train it using the trainNetwork function. This function takes as input your training data (images and corresponding labels), your CNN architecture, and training options (such as the optimization algorithm and the number of epochs).
To answer your question about whether you have to develop the neural network algorithm yourself, the answer is no.
MATLAB's Deep Learning Toolbox also provides a variety of pre-defined functions for segmentation tasks, such as the segnetLayers andunetLayers functions. Therefore, it is not necessary to write from scratch and instead you can utilize these functions.
In terms of initializing the filters (kernels) in your CNN, you can either initialize them randomly or use pre-trained filters from a pre-existing network (such as AlexNet or VGG16) and fine-tune them for your specific task.
I hope this helps!
  1 commentaire
Memo Remo
Memo Remo le 21 Mar 2023
Thanks, Sourabh! I appreciate your help.
However, I wanted to define everything myself using a simple MATLAB script to fully understand how these deep learning algorithms are working.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Image Data Workflows dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by