フィルターのクリア

Can't load dataset from .mat correctly?

5 ビュー (過去 30 日間)
Maria Rasmussen
Maria Rasmussen 2017 年 12 月 29 日
コメント済み: Maria Rasmussen 2017 年 12 月 29 日
I have tried to follow this guide in the documentation: https://se.mathworks.com/help/vision/examples/object-detection-using-faster-r-cnn-deep-learning.html#d119e1400 I first load a folder with data locally and save it as .mat.
%%Load image folder and save as .mat
clear;
clc;
addpath(genpath(pwd));
dataFolder = '.../pathtofolder';
if ~isdir(dataFolder)
errorMessage = sprintf('Error: The following folder does not exist:\n%s',
dataFolder);
uiwait(warndlg(errorMessage));
return;
end
filePattern = fullfile(dataFolder, '*.tif');
pngFiles = dir(filePattern);
result = cell(1,100);
for k = 1:length(pngFiles)
baseFileName = pngFiles(k).name;
fullFileName = fullfile(dataFolder, baseFileName);
fprintf(1, 'Now reading %s\n', fullFileName);
imageArray= imread(fullFileName);
result{k} = imageArray;
end
save fasterRCNNtestImages.mat result;
And in another script after running the code above, I load it like so:
data = load('fasterRCNNtestImages.mat');
varoaDataset = data.fasterRCNNtestImages;
I have made the code as in the guide, but I seem to be misunderstanding something?
What I want to do is give a bunch of images as input and then "teach" it to search for some specific objects in the images. I could also do this by making a script that sorts objects in the images based on size, but I could not find a could source explaining how this can be done, and since my images are .png it appears to be a bit more tricky. I got the arror 2d image expected when I tried the other option any way and got stuck when I did not seem able to convert png. to another format (.jpg in my trial and error). So CNN seemed the better solution, but now I am stuck again.
  2 件のコメント
KALYAN ACHARJYA
KALYAN ACHARJYA 2017 年 12 月 29 日
Please clarify where you faced problem Load image from folder or save as .mat
Maria Rasmussen
Maria Rasmussen 2017 年 12 月 29 日
Loading the .mat

サインインしてコメントする。

採用された回答

Rik
Rik 2017 年 12 月 29 日
In your code you save the mat file with this line
save fasterRCNNtestImages.mat result;
This creates a mat file with the result variable inside it. However, when you load it, you try to get the variable fasterRCNNtestImages from the file. That isn't what you saved, so it is not there. Using the code below should fix your error.
data = load('fasterRCNNtestImages.mat');
varoaDataset = data.result;

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by