Error using matlab.io.​datastore.​Transforme​dDatastore​/read Invalid transform function defined on datastore.

4 次查看(过去 30 天)
While running this code:
augData = read(cds);
augptCld = augData{1,1};
augLabels = augData{1,2};
augClass = augData{1,3};
labelsother = augLabels(augClass=='other',:);
labelsPedestrian = augLabels(augClass=='Pedestrian',:);
helperDisplay3DBoxesOverlaidPointCloud(augptCld.Location,labelsother,'green',...
labelsPedestrian,'magenta','Before Data Augmentation');
reset(cds);
classNames = {'other','Pedestrian'};
sampleLocation = fullfile("C:\Users\asus\Desktop\main",'GTsamples');
[ldsSampled,bdsSampled] = sampleLidarData(cds,classNames,'MinPoints',20,...
'Verbose',false,'WriteLocation',sampleLocation);
cdsSampled = combine(ldsSampled,bdsSampled);
numObjects = [10 10];
cdsAugmented = transform(cds,@(x)pcBboxOversample(x,cdsSampled,classNames,numObjects));
cdsAugmented = transform(cdsAugmented,@(x)augmentData(x));
augData = read(cdsAugmented);
augptCld = augData{1,1};
augLabels = augData{1,2};
augClass = augData{1,3};
labelsother = augLabels(augClass=='other',:);
labelsPedestrian = augLabels(augClass=='Pedestrian',:);
helperDisplay3DBoxesOverlaidPointCloud(augptCld.Location,labelsother,'green',...
labelsPedestrian,'magenta','After Data Augmentation');
i got this error: Error using matlab.io.datastore.TransformedDatastore/read
Invalid transform function defined on datastore.
Caused by:
Invalid argument at position 1. Expected input to be one of these types:
single, double
Instead its type was uint8.
how to convert it into single or double.

采纳的回答

Avadhoot
Avadhoot 2024-2-21
Hi Gaurav,
I get that you are encountering an error while using the transformed Datastore. The error is caused because the first argument of the pointCloud function is uint8. You need to convert this to either a single or a double datatype. You can use the following syntax to convert the variable to your desired datatype.
my_variable = single(my_variable); % for converting to single
my_variable = double(my_variable); % for converting to double
You can do this before passing the variable to the "pointCloud" function to get rid of the error. This method works on arrays as well.
I hope it helps.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Guidance, Navigation, and Control (GNC) 的更多信息

产品


版本

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by