Azzera filtri
Azzera filtri

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

11 visualizzazioni (ultimi 30 giorni)
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.

Risposta accettata

Avadhoot
Avadhoot il 21 Feb 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.

Più risposte (0)

Categorie

Scopri di più su Guidance, Navigation, and Control (GNC) in Help Center e File Exchange

Prodotti


Release

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by