Click here to Skip to main content
15,896,726 members

Unable to find the error in code MATLAB

Parth_k asked:

Open original thread
I trying to develop a program using neural network to solve any real-life problem.
so, I took retinopathy detection using Probabilistic neural network using MATLAB. I took some help from professor and developed the program. I have trained the neural network and created the dataset but when testing the my neural network I m not getting output...
I'm new to MATLAB and this is the 1st program I wrote in MATLAB .
---THIS CODE IS TO CREATE TRANING DATASET---

clc;

clear all;

close all;

img=imread('nor4.jpg');

m=impixel(img);

dlmwrite('D:\Retinopathy detection\Training.csv',m,'-append');

%figure(1),imshow(img);


---CODE FOR ACTUCAL IMPLEMENTATION---

clc;
clear all;
close all;
fileID = fopen('Training.csv');
C = textscan(fileID,'%f%f%f%f','Delimiter',',');
fclose(fileID);
x=[C{1} C{2} C{3}];
t=[C{4}];
s=input('Enter spread : ');
net = newpnn(x',t',s);
img=imread('trr.jpg');
[m,n,p]=size(img);
R=img(:,:,1);
G=img(:,:,2);
B=img(:,:,3);
RR=reshape(R,m*n,1);
GG=reshape(G,m*n,1);
BB=reshape(B,m*n,1);
Xtest=double([RR GG BB]);
Y = sim(net,Xtest');
Im=reshape(Y,m,n);
for i=1:1:m
    for j=1:1:n
        if Im(i,j)==1
            Newimg(i,j,:)=[230,166,122];
        else
            Newimg(i,j,:)=img(i,j,:);
        end
    end
end
figure(1),imshow(img);
figure(2),imshow(Newimg);

---sorry to share the whole code im not getting the error --

when I run this program ..I should get two image window one with input image and second window will have the retinopathy detected area ..

but when I run this program i'm getting on image window correct but...on the second window i'm only getting green color or if I change the value i'll get different color...

can you please help me out with this I'm really stuck !! I'm not getting help from my professor.

What I have tried:

i have tried to run the im getting wrong output
Tags: MatLab, Neural Networks, Image Processing

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900