I am really new to Deep Learning and, unfortunately, I can't find example codes on land cover classification other than this one where the author wrote a script in R for a large dataset.

The main reason that I am asking is because recently I found a few papers on Remote Sensing Image classification using Deep Learning and I was wondering if there were any R examples on that subject.

So, is there a code example, preferably a step-by-step, which I can use?

I found several git repos like Deep Neural Network with keras-R: Satellite-Image Classification that can do Deep Learning classification with R, BUTT, I am still looking for a simple multi-spectral image segmentation method. An example of that can be found at Unsupervised Image Segmentation with Spectral Clustering with R and I also found a similar question in Multispectral image segmentation for natural-resources applications using R for which the answer is "use something else other than R if you can".

If I find anything that works today I will be posting a working answer.

  • You say deep learning, but you mean machine learning in general right?
    – RJJoling
    Apr 17, 2018 at 7:57
  • R is not the first language I would think of for large image processing. There are many packages for deep learning (Caffe, Tensorflow, keras...) but I don't know from R
    – radouxju
    Apr 17, 2018 at 7:58
  • @RJJoling No, I meant Deep Learning. Actually, I have done with Machine Learning but right now I am trying to find a way to segment my Remote Sensing Image and then classify it. P.S When I said classification I meant either supervised or unsupervised, whatever you know.
    – Ka_Papa
    Apr 17, 2018 at 8:09
  • Now I am confused : do you want to do image segmentation or image classification ?
    – radouxju
    Apr 17, 2018 at 14:20
  • @radouxju I'm sorry for the confusion. I wanted to know about image classification but I wanted to know about unsupervised or object oriented by using segmentation (yes I didn't mention that but I realized my mistake way too late when I have found a couple of solutions)
    – Ka_Papa
    Apr 17, 2018 at 15:05

2 Answers 2


The use of tensors in the evolution of deep learning methods has notably pushed the field of machine learning forward. This is why there is such buzz over Googles Tensorflow approach. It also provides a flexible framework in deploying a large variety of models.

As mentioned, Convolutional Neural Networks (CNN) for Semantic Segmentation is the current "go to" approach in image analysis using deep learning. Due to RStudio's efforts, in building a comprehensive package interface to Googles Tensorflow libraries, R is a reasonable platform to conduct this type of analysis. Between R and Python, it really is just preference.

I should point out that, whereas this is a powerful approach, CNN is intended for supervised classification problems and not just returning unsupervised image objects. The method also generally assumes, due to dialiation functions, a dense-pixel image. Is is also common practice to apply a Conditional Random Field (CRF) model as a secondary model to improve results of the segmentation produced by CNN's.

Honestly, if you want to perform an image segmentation with the intent of producing image "polygons" a better choice would be the Orfeo toolbox. It is fairly complex to build a deep learning models and results are quite sensitive to how the model is structured and specified. It seems like quite a bit of unnecessary work to build a deep learning model just for an unlabeled image segmentation. If you are going to go down this road, why not just leverage the model and build a supervised classification? Here is a tutorial in specifying a CNN model in R. This will give you some idea in what is involved, it is not just a few lines of code. You have to give considerable though into the structure of your data, characteristics of the training data and sensitivity of the model parameters.


How to implement Deep Learning in R using Keras and Tensorflow is a link where they use R for deep learning. In this tutorial they classify images to a certain class, I think you are interested in Semantic segmentation. Some terms you might be looking for:

  • Semantic Segmentation

  • Convolutional neural networks such as 'Unet' and 'Segnet' but there are more

  • Tensorflow is the way to go, I think and use Keras to make it simpeler

Lots of semantic segmentation and deep learning in general is done in Python so I would consider switching to Python. It will be easier to find documentation and tutorials.

  • 2
    You use Convolutional neural networks in Semantic Segmentation. In a deep learning context, they are not independent methods. Apr 17, 2018 at 16:05
  • Link is broken - leads to page that says "This account is under investigation or was found in violation of the Medium Rules."
    – PolyGeo
    Jun 6, 2021 at 22:10

Not the answer you're looking for? Browse other questions tagged or ask your own question.