Error using matlab.io.datastore.TransformedDatastore/read Invalid transform function defined on datastore.
15 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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:
Error using pointCloud/validateAndParseInputs
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.
0 commentaires
Réponse acceptée
Avadhoot
le 21 Fév 2024
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 commentaires
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!