How can i take a noisy image matrix data as a input in neural network
Show older comments
after adding noise to an image , i convereted the image pixel in a matrix then i convert the matrix in 0 and 1 value. now how can i insert this data in neural network for performing percepton AND logic
Answers (1)
Soumya
on 23 Jun 2025
The ‘perceptron’ function in MATLAB is used to create a simple single-layer neural network model that performs binary classification. It takes input vectors and learns to produce the correct output based on given target values using supervised learning. By training the ‘perceptron’ with standard AND logic input-output pairs, the model becomes capable of classifying noisy inputs.
Since you have completed the preprocessing steps including adding the noise, you can now follow the below steps to insert the data into a ‘perceptron’ model to simulate AND gate behaviour:
- As neural network needs input as a column vector, we flatten the image into single column:
input_vector = double(binary_img(:));
- Define the training data for the AND logic:
P = [0 0 1 1; 0 1 0 1];
T = [0 0 0 1];
- Create and train the perceptron using MATLAB’s built-in ‘perceptron’ function:
net = perceptron;
net = train(net, P, T); % here, P=input data, T=target data
- Test the network with binary inputs extracted from the noisy image:
output = net(input_vector);
Please refer to the following documentation to get more information on the ‘perceptron’ function in MATLAB:
- https://www.mathworks.com/help/deeplearning/ug/perceptron-neural-networks.html
- https://www.mathworks.com/help/deeplearning/ref/perceptron.html
I hope this helps!
Categories
Find more on Deep Learning Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!