obtain lidar labeler distance and timestamp to save into file

1 次查看(过去 30 天)
I am trying to save a single predicted results based off from the automation labeler example from MATLAB as well as obtain the timestamp and the distance from it in order to save it into the file. I am wondering about how to obtain these three items directly off from the app so that I would be able to save it into a file for sending across.
classdef ThreeNew
%UNTITLED8 Summary of this class goes here
% Detailed explanation goes here
% ----------------------------------------------------------------------
% Step 1: Define the required properties describing the algorithm. This
% includes Name, Description, and UserDirections.
properties(Constant)
% Name Algorithm Name
% Character vector specifying the name of the algorithm.
Name = 'Lidar Semantic Segmentation';
% Description Algorithm Description
% Character vector specifying the short description of the algorithm.
Description = 'Segment the point cloud using SqueezeSegV2 network';
% UserDirections Algorithm Usage Directions
% Cell array of character vectors specifying directions for
% algorithm users to follow to use the algorithm.
UserDirections = {['ROI Label Definition Selection: select one of ' ...
'the ROI definitions to be labeled'], ...
'Run: Press RUN to run the automation algorithm. ', ...
['Review and Modify: Review automated labels over the interval ', ...
'using playback controls. Modify/delete/add ROIs that were not ' ...
'satisfactorily automated at this stage. If the results are ' ...
'satisfactory, click Accept to accept the automated labels.'], ...
['Accept/Cancel: If the results of automation are satisfactory, ' ...
'click Accept to accept all automated labels and return to ' ...
'manual labeling. If the results of automation are not ' ...
'satisfactory, click Cancel to return to manual labeling ' ...
'without saving the automated labels.']};
end
% ---------------------------------------------------------------------
% Step 2: Define properties you want to use during the algorithm
% execution.
properties
% AllCategories
% AllCategories holds the default 'unlabelled', 'Vegetation',
% 'Ground', 'Road', 'RoadMarkings', 'SideWalk', 'Car', 'Truck',
% 'OtherVehicle', 'Pedestrian', 'RoadBarriers', 'Signs',
% 'Buildings' categorical types.
AllCategories = {'unlabelled'};
% PretrainedNetwork
% PretrainedNetwork saves the pretrained SqueezeSegV2 network.
PretrainedNetwork
end
methods
function isValid = checkSignalType(signalType)
% Only point cloud signal data is valid for the Lidar Vehicle
% detector algorithm.
isValid = (signalType == vision.labeler.loading.SignalType.PointCloud);
end
function isValid = checkLabelDefinition(algObj, labelDef)
% Only Voxel ROI label definitions are valid for the Lidar
% semantic segmentation algorithm.
isValid = labelDef.Type == lidarLabelType.Voxel;
if isValid
algObj.AllCategories{end+1} = labelDef.Name;
end
end
function isReady = checkSetup(algObj)
% Is there one selected ROI Label definition to automate.
isReady = ~isempty(algObj.SelectedLabelDefinitions);
end
function initialize(algObj,~)
% Load the pretrained SqueezeSegV2 semantic segmentation network.
outputFolder = fullfile(tempdir,'Pandaset');
pretrainedSqueezeSeg = load(fullfile(outputFolder,'trainedSqueezeSegV2PandasetNet.mat'));
% Store the network in the 'PretrainedNetwork' property of this object.
algObj.PretrainedNetwork = pretrainedSqueezeSeg.net;
end
function autoLabels = run(algObj, pointCloud)
% Setup categorical matrix with categories including default
% 'unlabelled', 'Vegetation', 'Ground', 'Road', 'RoadMarkings',
% 'SideWalk', 'Car', 'Truck', 'OtherVehicle', 'Pedestrian',
% 'RoadBarriers', and 'Signs'.
autoLabels = categorical(zeros(size(pointCloud.Location,1),size(pointCloud.Location,2)), ...
0:12,algObj.AllCategories);
% Convert the input point cloud to five channel image.
I = helperPointCloudToImage(pointCloud);
% Predict the segmentation result.
predictedResult = semanticseg(I,algObj.PretrainedNetwork);
autoLabels(:) = predictedResult;
end
end
end
  1 个评论
kevin harianto
kevin harianto 2022-3-25
%using this area we would be able to continuously update the latest file on
% sending the output towards the CAN Network or atleast ensure that the
% item is obtainable
% This area would work the best as it is the place where the
% lidar app will run every time.
%first we must specify an area to save the rangeData and the
%current label together into one file in simulation wise
projectDir = 'C:\OutputFolderTest';
mkdir( fullfile(projectdir, 'Data') );
%Now that the file location has been created we must now make a
%variable to hold both the data coordinates and the actual
%label itself
dataResult = union('pointCloud.Location''predictedResult');
%Now That we got the dataResult we will now save the variable
%into the file.
save('C:\OutputFolderTest/Data',dataResult)
Currently I am playing around with save as i am just trying to get the lidar labeller to read into a continuously updating file in the future

请先登录,再进行评论。

回答(0 个)

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by