{"id":13616,"date":"2024-01-16T09:20:21","date_gmt":"2024-01-16T14:20:21","guid":{"rendered":"https:\/\/blogs.mathworks.com\/deep-learning\/?p=13616"},"modified":"2024-02-12T20:20:54","modified_gmt":"2024-02-13T01:20:54","slug":"lidar-code-along","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/deep-learning\/2024\/01\/16\/lidar-code-along\/","title":{"rendered":"Lidar Code-Along"},"content":{"rendered":"<h6><\/h6>\r\n<a href=\"https:\/\/www.mathworks.com\/discovery\/lidar.html\">Lidar<\/a> (light detection and ranging) is a remote sensing technology. Lidar sensors emit laser pulses that reflect off objects, allowing them to perceive the structure of their surroundings. The sensors record the reflected light energy to determine the distances to objects to create a 2D or 3D representations of the surroundings.\r\n<h6><\/h6>\r\nWith lidar technology a <a href=\"https:\/\/www.mathworks.com\/discovery\/point-cloud.html\">point cloud<\/a> is created, that is a collection of data points plotted in 3-D space, where each point represents the X-, Y-, and Z-coordinates of a location on a real-world object\u2019s surface, and the points collectively map the entire surface. Lidar is used in many industries including forestry, infrastructure analysis, and mining.\r\n<h6><\/h6>\r\n<a href=\"https:\/\/www.mathworks.com\/discovery\/deep-learning.html\">Deep learning<\/a> adds precision and speed to the processing of point cloud data.\u00a0Watch the following five videos that walk you through the steps of a lidar processing workflow with deep learning. You can also find the videos <a href=\"https:\/\/www.mathworks.com\/videos\/series\/lidar-code-along-tutorial.html\">here<\/a>.\r\n<h6><\/h6>\r\nFor more examples, see <a href=\"https:\/\/www.mathworks.com\/help\/deeplearning\/examples.html?category=lidar-processing&amp;s_tid=CRUX_topnav\">lidar with deep learning examples<\/a>. To learn more about how MATLAB users can use deep learning, <a href=\"https:\/\/www.mathworks.com\/discovery\/computer-vision.html\">computer vision<\/a>, and image processing for addressing lidar challenges, check out this story: <a href=\"https:\/\/www.mathworks.com\/company\/user_stories\/spacesium-creates-deep-learning-system-to-segment-large-lidar-point-clouds-with-matlab.html\">Spacesium Creates Deep Learning System to Segment Large Lidar Point Clouds with MATLAB<\/a>.\r\n<h6><\/h6>\r\n&nbsp;\r\n<h6><\/h6>\r\n<p style=\"font-size: 18px;\"><strong>Load Point Cloud Data<\/strong><\/p>\r\nLoad point cloud data as a data store using the <a href=\"https:\/\/www.mathworks.com\/help\/vision\/ref\/pcread.html\">pcread<\/a> function and load the bounding box labels using the <a href=\"https:\/\/www.mathworks.com\/help\/vision\/ref\/boxlabeldatastore.html\">boxLabelDatastore<\/a> function.\r\n<h6><\/h6>\r\n<div class=\"row\"><div class=\"col-xs-12 containing-block\"><div class=\"bc-outer-container add_margin_20\"><videoplayer><div class=\"video-js-container\"><video data-video-id=\"6282206991001\" data-video-category=\"blog\" data-autostart=\"false\" data-account=\"62009828001\" data-omniture-account=\"mathwgbl\" data-player=\"rJ9XCz2Sx\" data-embed=\"default\" id=\"mathworks-brightcove-player\" class=\"video-js\" controls><\/video><script src=\"\/\/players.brightcove.net\/62009828001\/rJ9XCz2Sx_default\/index.min.js\"><\/script><script>if (typeof(playerLoaded) === 'undefined') {var playerLoaded = false;}(function isVideojsDefined() {if (typeof(videojs) !== 'undefined') {videojs(\"mathworks-brightcove-player\").on('loadedmetadata', function() {playerLoaded = true;});} else {setTimeout(isVideojsDefined, 10);}})();<\/script><\/div><\/videoplayer><\/div><\/div><\/div>\r\n<h6><\/h6>\r\n&nbsp;\r\n<h6><\/h6>\r\n<p style=\"font-size: 18px;\"><strong>Preprocess Data<\/strong><\/p>\r\nSplit the data into training and testing sets. Synthetically increase the size of the training data set by randomly adding a fixed number of car and truck class objects to every point cloud and by using augmentation techniques such as flipping, scaling, rotation, and translation. To learn more about typical data augmentation techniques for 3-D object detection workflows with lidar data, see <a href=\"https:\/\/www.mathworks.com\/help\/lidar\/ug\/data-augmentations-for-lidar-object-detection-networks.html\">Data Augmentations for Lidar Object Detection Using Deep Learning<\/a>.\r\n<h6><\/h6>\r\n<div class=\"row\"><div class=\"col-xs-12 containing-block\"><div class=\"bc-outer-container add_margin_20\"><videoplayer><div class=\"video-js-container\"><video data-video-id=\"6282207177001\" data-video-category=\"blog\" data-autostart=\"false\" data-account=\"62009828001\" data-omniture-account=\"mathwgbl\" data-player=\"rJ9XCz2Sx\" data-embed=\"default\" id=\"mathworks-brightcove-player\" class=\"video-js\" controls><\/video><script src=\"\/\/players.brightcove.net\/62009828001\/rJ9XCz2Sx_default\/index.min.js\"><\/script><script>if (typeof(playerLoaded) === 'undefined') {var playerLoaded = false;}(function isVideojsDefined() {if (typeof(videojs) !== 'undefined') {videojs(\"mathworks-brightcove-player\").on('loadedmetadata', function() {playerLoaded = true;});} else {setTimeout(isVideojsDefined, 10);}})();<\/script><\/div><\/videoplayer><\/div><\/div><\/div>\r\n<h6><\/h6>\r\n&nbsp;\r\n<h6><\/h6>\r\n<p style=\"font-size: 18px;\"><strong>Define Deep Neural Network<\/strong><\/p>\r\nDefine network parameters, such as anchor boxes and pillars, for the PointPillars network. Then, define the PointPillars detection network using the <a href=\"https:\/\/www.mathworks.com\/help\/lidar\/ref\/pointpillarsobjectdetector.html\">pointPillarObjectDetector<\/a> function.\r\n<h6><\/h6>\r\n<div class=\"row\"><div class=\"col-xs-12 containing-block\"><div class=\"bc-outer-container add_margin_20\"><videoplayer><div class=\"video-js-container\"><video data-video-id=\"6282207245001\" data-video-category=\"blog\" data-autostart=\"false\" data-account=\"62009828001\" data-omniture-account=\"mathwgbl\" data-player=\"rJ9XCz2Sx\" data-embed=\"default\" id=\"mathworks-brightcove-player\" class=\"video-js\" controls><\/video><script src=\"\/\/players.brightcove.net\/62009828001\/rJ9XCz2Sx_default\/index.min.js\"><\/script><script>if (typeof(playerLoaded) === 'undefined') {var playerLoaded = false;}(function isVideojsDefined() {if (typeof(videojs) !== 'undefined') {videojs(\"mathworks-brightcove-player\").on('loadedmetadata', function() {playerLoaded = true;});} else {setTimeout(isVideojsDefined, 10);}})();<\/script><\/div><\/videoplayer><\/div><\/div><\/div>\r\n<h6><\/h6>\r\n&nbsp;\r\n<h6><\/h6>\r\n<p style=\"font-size: 18px;\"><strong>Train Network<\/strong><\/p>\r\nTo train a network, you must specify training options. Because training a network can be time consuming, a pretrained PointPillars model is used for this workflow.\r\n<h6><\/h6>\r\n<div class=\"row\"><div class=\"col-xs-12 containing-block\"><div class=\"bc-outer-container add_margin_20\"><videoplayer><div class=\"video-js-container\"><video data-video-id=\"6282207257001\" data-video-category=\"blog\" data-autostart=\"false\" data-account=\"62009828001\" data-omniture-account=\"mathwgbl\" data-player=\"rJ9XCz2Sx\" data-embed=\"default\" id=\"mathworks-brightcove-player\" class=\"video-js\" controls><\/video><script src=\"\/\/players.brightcove.net\/62009828001\/rJ9XCz2Sx_default\/index.min.js\"><\/script><script>if (typeof(playerLoaded) === 'undefined') {var playerLoaded = false;}(function isVideojsDefined() {if (typeof(videojs) !== 'undefined') {videojs(\"mathworks-brightcove-player\").on('loadedmetadata', function() {playerLoaded = true;});} else {setTimeout(isVideojsDefined, 10);}})();<\/script><\/div><\/videoplayer><\/div><\/div><\/div>\r\n<h6><\/h6>\r\n&nbsp;\r\n<h6><\/h6>\r\n<p style=\"font-size: 18px;\"><strong>Object Detection<\/strong><\/p>\r\nTest the PointPillars network on a test dataset and display the detected output point cloud with bounding boxes.\r\n<h6><\/h6>\r\n<div class=\"row\"><div class=\"col-xs-12 containing-block\"><div class=\"bc-outer-container add_margin_20\"><videoplayer><div class=\"video-js-container\"><video data-video-id=\"6282207356001\" data-video-category=\"blog\" data-autostart=\"false\" data-account=\"62009828001\" data-omniture-account=\"mathwgbl\" data-player=\"rJ9XCz2Sx\" data-embed=\"default\" id=\"mathworks-brightcove-player\" class=\"video-js\" controls><\/video><script src=\"\/\/players.brightcove.net\/62009828001\/rJ9XCz2Sx_default\/index.min.js\"><\/script><script>if (typeof(playerLoaded) === 'undefined') {var playerLoaded = false;}(function isVideojsDefined() {if (typeof(videojs) !== 'undefined') {videojs(\"mathworks-brightcove-player\").on('loadedmetadata', function() {playerLoaded = true;});} else {setTimeout(isVideojsDefined, 10);}})();<\/script><\/div><\/videoplayer><\/div><\/div><\/div>\r\n<h6><\/h6>\r\n&nbsp;","protected":false},"excerpt":{"rendered":"<p>\r\nLidar (light detection and ranging) is a remote sensing technology. Lidar sensors emit laser pulses that reflect off objects, allowing them to perceive the structure of their surroundings. The... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/deep-learning\/2024\/01\/16\/lidar-code-along\/\">read more >><\/a><\/p>","protected":false},"author":194,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[36,17,9],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/deep-learning\/wp-json\/wp\/v2\/posts\/13616"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/deep-learning\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/deep-learning\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/deep-learning\/wp-json\/wp\/v2\/users\/194"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/deep-learning\/wp-json\/wp\/v2\/comments?post=13616"}],"version-history":[{"count":15,"href":"https:\/\/blogs.mathworks.com\/deep-learning\/wp-json\/wp\/v2\/posts\/13616\/revisions"}],"predecessor-version":[{"id":13661,"href":"https:\/\/blogs.mathworks.com\/deep-learning\/wp-json\/wp\/v2\/posts\/13616\/revisions\/13661"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/deep-learning\/wp-json\/wp\/v2\/media?parent=13616"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/deep-learning\/wp-json\/wp\/v2\/categories?post=13616"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/deep-learning\/wp-json\/wp\/v2\/tags?post=13616"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}