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

조회 수: 3 (최근 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.

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by