DAG Network loading as Struct

3 ビュー (過去 30 日間)
Rachel Ball
Rachel Ball 2022 年 12 月 6 日
回答済み: Rachel Ball 2022 年 12 月 16 日
I am trying to use a nerual network on a set of data. This is my code:
%This code is to create data to analyse in another program to test the performance of the NN.
clear;
clc;
%Open files
testfiledir = 'Z:\eee_biophotonics1\Shared\SPOT dataset (Training data)\Testing Images\123 images on 456 network\OCT';
matfiles = dir(fullfile(testfiledir, '*.tif'));
nfiles = length(matfiles); %finds length of file
data = cell(nfiles);
for i = 1 : nfiles
fid = fopen( fullfile(testfiledir, matfiles(i).name) ); %retrieves specific file
net = load('net_456.mat'); % This loads the network back into MATLAB
result = semanticseg(fid,net); % This segments an image "fid" using the network
filename='Z:\eee_biophotonics1\Shared\SPOT dataset (Training data)\Testing Images\123 images on 456 network\nn segmented';
save(result,'%d',i,'-tif');
fclose(fid);
end
However this error comes up:
Error using semanticseg
Expected net to be one of these types:
SeriesNetwork, DAGNetwork, dlnetwork
Instead its type was struct.
Error in semanticseg>iCheckNetwork (line 723)
validateattributes(net, {'SeriesNetwork', 'DAGNetwork', 'dlnetwork'}, ...
Error in semanticseg>iParseInputs (line 416)
iCheckNetwork(net);
Error in semanticseg (line 244)
params = iParseInputs(I, net, varargin{:});
Error in SPOTimageconversion_123_456 (line 12)
result = semanticseg(fid,net); % This segments an image "fid" using the network

採用された回答

Rachel Ball
Rachel Ball 2022 年 12 月 16 日
remove: net = load('net_456.mat')
In the current folder pane in matlab, select the network you want and click on it, this should run load("x.mat") in the console
It will then show you the name of the DAG network insde details pane, Put this name in the semanticseg function

その他の回答 (0 件)

カテゴリ

Find more on Image Processing and Computer Vision 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!

Translated by