자율주행 자동차/인지

Lidar Point Cloud Segmentation - matlab

이게될까 2024. 7. 2. 16:18
728x90
728x90

일단 라이다를 이동 못 하는 상황에선 rosbag파일로 진행해봤습니다...

rosbag  play -l ~/Desktop/lanerosbag/2024-02-14-15-18-47.bag

이 전에 lanedetection을 시도하면서 저장했던 losbag

%clear; close all; clc;

rosshutdown;
rosinit('http://localhost:11311')
tftree = rostf;
pause(3);

roi = [0, 18, -18, 18, -2, 2];
params = lidarParameters('OS1Gen1-64',1024);
lidarSub = rossubscriber('/ouster/points', "DataFormat", "struct");

기존에 진행했던 것과 똑같습니다.
ROI는 여기서 필요 없습니다.

pretrainedNetwork = load('trainedPointSegNet.mat');
net = pretrainedNetwork.net;

classNames = [
    "background"
    "car"
    "truck"
];

pre-trained 된 네트워크 파라미터를 불러오고, class도 붙여줍니다.

네트워크 구조는 상당히 복잡하고 380만개의 파라미터로 이루어져 있습니다.

figure;
while true
    
    lidarData = receive(lidarSub);
    xyzData = rosReadXYZ(lidarData);
    intensityData = rosReadField(lidarData, 'intensity');
    ptCloud = pointCloud(xyzData, 'Intensity', intensityData);
    %ptCloud = pointCloud(xyzData);
    ptCloudOrg = pcorganize(ptCloud, params);
    I = helperPointCloudToImage(ptCloudOrg);

    predictedResult = semanticseg(I, net);


    helperDisplayLidarOverlayImage(I, predictedResult, classNames);
    title('Semantic Segmentation Result');


end

반복마다 네트워크 결과를 보여주는데... 밖에서 해봐야 알 것 같네요

 

결과는 좋지 않네요....

전부 초록색으로 나와야 하는데...

예시는 확실하게 깔끔하게 나옵니다.,,,

 

728x90