{"id":378,"date":"2018-05-03T14:35:43","date_gmt":"2018-05-03T12:35:43","guid":{"rendered":"https:\/\/blogs.fu-berlin.de\/reseda\/?page_id=378"},"modified":"2018-09-27T15:00:56","modified_gmt":"2018-09-27T13:00:56","slug":"classification-in-r","status":"publish","type":"page","link":"https:\/\/blogs.fu-berlin.de\/reseda\/classification-in-r\/","title":{"rendered":"Classification in R"},"content":{"rendered":"<p>We want to utilize a Random Forest (RF) and a Support Vector Classifier (SVM) algorithm in order to classify the Berlin land cover in six elementary categories: <em>bare soil<\/em>, <em>water<\/em>, <em>grassland<\/em>, <em>forest<\/em>, <em>urban low density<\/em>, and <em>urban high density<\/em>. Therefore, we need an image dataset and a shapefile containing points or polygons to which the respective class is attributed.<\/p>\n<p>The workflow will be exemplified by a L8 scene (ID: LC08_L1TP_193023_20170602_20170615_01_T1), which you may already have acquired during the <a href=\"https:\/\/blogs.fu-berlin.de\/reseda\/earthexplorer-exercise\/\" rel=\"noopener\" target=\"_blank\">L8 Download Exercise<\/a>. You need to preprocess the scene as shown in chapter <a href=\"https:\/\/blogs.fu-berlin.de\/reseda\/landsat-8-preprocessing\/\">Preprocess<\/a>. In addition, we narrowed our research area to Berlin to keep the data small (as shown in chapter <a href=\"https:\/\/blogs.fu-berlin.de\/reseda\/visualize-in-r\/\">Visualize in R<\/a>).<\/p>\n<p>You can download both the preprocessed image and the shapefile for testing purposes <a href=\"http:\/\/+\">here<\/a>.<\/p>\n<div style=\"background-color:#f1f1f1;padding:18px 30px 1px\">\n<h1>Section in a Box<\/h1>\n<p>This section guides you through a complete classification process for satellite imagery. The resulting classification maps will be validated in the <a href=\"https:\/\/blogs.fu-berlin.de\/reseda\/validate\/\">next chapter<\/a>.<\/p>\n<p><a href=\"https:\/\/blogs.fu-berlin.de\/reseda\/sampling-in-qgis\/\"><strong>Sample in QGIS<\/strong><\/a><br \/>\n&#8211; some basic considerations and tips for sampling<br \/>\n&#8211; collect training polygons in QGIS for supervised classification<br \/>\n<a href=\"https:\/\/blogs.fu-berlin.de\/reseda\/prepare-samples\/\"><strong>Prepare Samples in R<\/strong><\/a><br \/>\n&#8211; import training polygons into R<br \/>\n&#8211; use training polygons to extract raster information<br \/>\n&#8211; put everything together in a data frame<br \/>\n<a href=\"https:\/\/blogs.fu-berlin.de\/reseda\/preprocess-sentinel-2\/\"><strong>RF Classification<\/strong><\/a><br \/>\n&#8211; train a RF model with &#8220;randomForest&#8221; package<br \/>\n&#8211; classify image data and export a classification image<br \/>\n<a href=\"https:\/\/blogs.fu-berlin.de\/reseda\/preprocess-sentinel-2\/\"><strong>SVM Classification<\/strong><\/a><br \/>\n&#8211; train a SVM (C-Classification method) with &#8220;e1071&#8221; package<br \/>\n&#8211; classify image data and export a classification image\n<\/div>\n<p><\/br><\/br><\/p>\n<hr style=\"height:4px;background-color:#6b9e1f\">\n<a href=\"https:\/\/blogs.fu-berlin.de\/reseda\/sampling-in-qgis\/\"><br \/>\n<button style=\"width:100%;text-align:right;padding: 10 0;background-color:white;margin:-55px 0 0 0\"><\/p>\n<div style=\"font-family: 'Noto Sans',sans-serif;line-height: 1.2\">\n<span style=\"font-size: 12px;color:#bfbfbf\"><strong><em>NEXT<\/em><\/strong><\/span><br \/>\n<span style=\"font-size: 30px;color:#6b9e1f\"><strong><em>Sample in QGIS<\/em><\/strong><\/span>\n<\/div>\n<p><\/button><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>We want to utilize a Random Forest (RF) and a Support Vector Classifier (SVM) algorithm in order to classify the Berlin land cover in six elementary categories: bare soil, water, grassland, forest, urban low density, and urban high density. Therefore, we need an image dataset and a shapefile containing points or polygons to which the &hellip; <a href=\"https:\/\/blogs.fu-berlin.de\/reseda\/classification-in-r\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Classification in R&#8221;<\/span><\/a><\/p>\n","protected":false},"author":3237,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-378","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/blogs.fu-berlin.de\/reseda\/wp-json\/wp\/v2\/pages\/378","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.fu-berlin.de\/reseda\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/blogs.fu-berlin.de\/reseda\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.fu-berlin.de\/reseda\/wp-json\/wp\/v2\/users\/3237"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.fu-berlin.de\/reseda\/wp-json\/wp\/v2\/comments?post=378"}],"version-history":[{"count":18,"href":"https:\/\/blogs.fu-berlin.de\/reseda\/wp-json\/wp\/v2\/pages\/378\/revisions"}],"predecessor-version":[{"id":2609,"href":"https:\/\/blogs.fu-berlin.de\/reseda\/wp-json\/wp\/v2\/pages\/378\/revisions\/2609"}],"wp:attachment":[{"href":"https:\/\/blogs.fu-berlin.de\/reseda\/wp-json\/wp\/v2\/media?parent=378"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}