Effacer les filtres
Effacer les filtres

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

11 vues (au cours des 30 derniers jours)
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.

Réponse acceptée

Avadhoot
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.

Plus de réponses (0)

Catégories

En savoir plus sur Guidance, Navigation, and Control (GNC) dans Help Center et File Exchange

Produits


Version

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by