I'm getting an error on the coder.internal.DeepLearningNetwork. What is the solution for this?
3 views (last 30 days)
Show older comments

function varargout = HumanSkinDiseaseDetectionUIDesign(varargin) % HUMANSKINDISEASEDETECTIONUIDESIGN MATLAB code for HumanSkinDiseaseDetectionUIDesign.fig % HUMANSKINDISEASEDETECTIONUIDESIGN, by itself, creates a new HUMANSKINDISEASEDETECTIONUIDESIGN or raises the existing % singleton*. % % H = HUMANSKINDISEASEDETECTIONUIDESIGN returns the handle to a new HUMANSKINDISEASEDETECTIONUIDESIGN or the handle to % the existing singleton*. % % HUMANSKINDISEASEDETECTIONUIDESIGN('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in HUMANSKINDISEASEDETECTIONUIDESIGN.M with the given input arguments. % % HUMANSKINDISEASEDETECTIONUIDESIGN('Property','Value',...) creates a new HUMANSKINDISEASEDETECTIONUIDESIGN or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before HumanSkinDiseaseDetectionUIDesign_OpeningFcn gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to HumanSkinDiseaseDetectionUIDesign_OpeningFcn via varargin. % % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one % instance to run (singleton)". % % See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help HumanSkinDiseaseDetectionUIDesign
% Last Modified by GUIDE v2.5 20-May-2022 18:00:41
% Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @HumanSkinDiseaseDetectionUIDesign_OpeningFcn, ... 'gui_OutputFcn', @HumanSkinDiseaseDetectionUIDesign_OutputFcn, ... 'gui_LayoutFcn', [] , ... 'gui_Callback', []); if nargin && ischar(varargin{1}) gui_State.gui_Callback = str2func(varargin{1}); end
if nargout [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); else gui_mainfcn(gui_State, varargin{:}); end % End initialization code - DO NOT EDIT
% --- Executes just before HumanSkinDiseaseDetectionUIDesign is made visible. function HumanSkinDiseaseDetectionUIDesign_OpeningFcn(hObject, eventdata, handles, varargin) % This function has no output args, see OutputFcn. % hObject handle to figure % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % varargin command line arguments to HumanSkinDiseaseDetectionUIDesign (see VARARGIN)
% Choose default command line output for HumanSkinDiseaseDetectionUIDesign handles.output = hObject;
% Update handles structure guidata(hObject, handles);
% create an axes that spans the whole gui ah = axes('unit', 'normalized', 'position', [0 0 1 1]); % import the background image and show it on the axes bg = imread('bg.jpg'); imagesc(bg); % prevent plotting over the background and turn the axis off set(ah,'handlevisibility','off','visible','off') % making sure the background is behind all the other uicontrols uistack(ah, 'bottom');
% UIWAIT makes HumanSkinDiseaseDetectionUIDesign wait for user response (see UIRESUME) % uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line. function varargout = HumanSkinDiseaseDetectionUIDesign_OutputFcn(hObject, eventdata, handles) % varargout cell array for returning output args (see VARARGOUT); % hObject handle to figure % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure varargout{1} = handles.output;
% hObject handle to pushbutton1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in pushbutton2. function pushbutton2_Callback(hObject, eventdata, handles) clc cla(handles.axes4,'reset'); cla(handles.axes6,'reset'); set(handles.edit1,'string',''); set(handles.edit2,'string','');
% hObject handle to pushbutton2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
function edit1_Callback(hObject, eventdata, handles) % hObject handle to edit1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit1 as text % str2double(get(hObject,'String')) returns contents of edit1 as a double
% --- Executes during object creation, after setting all properties. function edit1_CreateFcn(hObject, eventdata, handles) % hObject handle to edit1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end
function edit2_Callback(hObject, eventdata, handles) % hObject handle to edit2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit2 as text % str2double(get(hObject,'String')) returns contents of edit2 as a double
% --- Executes during object creation, after setting all properties. function edit2_CreateFcn(hObject, eventdata, handles) % hObject handle to edit2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end
% --- Executes during object creation, after setting all properties. function axes4_CreateFcn(hObject, eventdata, handles) % hObject handle to axes4 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called
% Hint: place code in OpeningFcn to populate axes4
% --- Executes on button press in pushbutton3. function pushbutton3_Callback(hObject, eventdata, handles) global im [path,user_cancel]=imgetfile(); if user_cancel msgbox(sprintf('Selection Cancelled!'),'Error','Warn'); return end im=imread(path); axes(handles.axes4); A=imresize(im,[224 224]); imshow(A)
guidata(hObject, handles); % hObject handle to pushbutton3 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles) global im
selectedFile = im;
%Initialize DNN and the input size net = coder.loadDeepLearningNetwork('resnettrainedmodel'); inputSize = [224 224]; %net.Layers(1).InputSize;
%Initialize text to display textToDisplay = '......';
fprintf('Detecting Skin Diseases.\n');
for ii = 1:10; %Capture image from webcam imgSizeAdjusted = imresize(selectedFile,inputSize);
%Classify the input image
[label,score] = net.classify(imgSizeAdjusted);
maxScore = max(score);
labelStr = cellstr(label);
textToDisplay = sprintf('Label : %s \nScore : %f',labelStr{:},maxScore);
end
set(handles.axes4,'Units','normalized'); set(handles.edit1,'string', labelStr); set(handles.edit2,'string', maxScore*100);
[~,idx] = sort(score,'descend'); idx = idx(3:-1:1); classes = net.Layers(end).Classes; classNamesTop = string(classes(idx)); scoreTop = score(idx);
%Plotting the Histogram barh(handles.axes6,scoreTop) xlim(handles.axes6,[0 1]) title(handles.axes6,'Top 3') xlabel(handles.axes6,'Probability') yticklabels(handles.axes6,classNamesTop) handles.axes6.YAxisLocation = 'left';
0 Comments
Answers (0)
See Also
Categories
Find more on 2-D and 3-D Plots 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!