Error when creating pixelLabelDatastore: The value of 'gTruth' is invalid

4 次查看(过去 30 天)
I am trying to create a pixelLabelDatastore to hold some segmented images that I created using Matlab's ImageLabeller.
The line:
labels = pixelLabelDatastore(data.gTruth);
in my code results in the following error:
Error using pixelLabelDatastore>parseGroundTruthInputs (line 225)
The value of 'gTruth' is invalid. Undefined function 'hasTimeStamps' for input
arguments of type 'cell'.
Error in pixelLabelDatastore (line 203)
[gTruth, params] = parseGroundTruthInputs(varargin{:});
Error in segmentation_neural_network (line 22)
labels = pixelLabelDatastore(data.gTruth);
data is a matfile containing the gTruth object generated by ImageLabeller:
data = matfile(strcat(training_datapath,'/pixel_maps/eye_segmentation_labels.mat'));
Below is my full script.
% Set datapath
datapath = '/scratch/qbi/uqhrile1';
training_datapath = strcat(datapath,'/training_dataset');
% Get training dataset
training_dataset = imageDatastore(strcat(training_datapath,'/images_rgb'));
% Get pixel map labels
data = matfile(strcat(training_datapath,'/pixel_maps/eye_segmentation_labels.mat'));
labels = pixelLabelDatastore(data.gTruth);
This script worked fine in the directory where I first created it (on an external harddrive). When I moved it and the dataset onto a supercomputer using an SSH connection the code stopped working.
Update: I just realized that different operating systems may be the cause of the issue. When I run my code on Windows it works fine, but the supercomputer I've moved it to is Linux. Could moving my mat file from Windows to Linux have changed the way its data is recognised? When I run
class(data.gTruth)
on Windows the variable is recognised as a ground truth object, but when I run my code on the supercomputer it seems to be treated as a cell array. I'm just waiting for supercomputer resources to become available and then I'll run the class function on there and update my question with the result.
  2 个评论
Walter Roberson
Walter Roberson 2019-9-16
When I use imageLabeller(), I do not seem to get any Ground Truth objects generated ?
MATLAB thinks that your data.gTruth is a cell array.
Heather Riley
Heather Riley 2019-9-16
I got the ground truth object by exporting my labels - they were saved to a .mat file. When I looked at the data in the .mat file the only variable was gTruth.

请先登录,再进行评论。

采纳的回答

Heather Riley
Heather Riley 2019-9-16
编辑:Heather Riley 2019-9-16
I have found the answer. The ground truth object I'm using contains absolute paths to its data source which are invalid now that I've moved it, so I need to use the changeFilePaths(gTruth,alterPaths) function to fix it.

更多回答(1 个)

hla hla myint
hla hla myint 2020-9-8
How to create ground turth object in 3 D volumetric with file extension nii. I know 2 D image, ground turth object create labeler app.

产品


版本

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by