Logo Lanfrica

qazsweet/modelling-analytics-of-classification

Domain:

agriculturegeospatial

Record type:

software
Creator:
qaz
Host:
Classification of Smallholder farming landscape in Africa Read me first. Title Module 13: Spatio-Temporal Modelling and Analytics Classification of Smallholder farming landscape in Africa Written by - Tian Mengge Purpose: In this practice, we want to compare two classifiers: Random Forest(RF) and Support Vector Machine(SVM). Datasets: In this case, we use a stack of 3 WorldView-2 images resampled to 20m spatial resolution to classify 5 crops and 1 non-crop in mali, Africa. A shapefile of groundtruth information for training and testing the classifiers. Display: In this folder, there are several python files. Only muitiparaRF.py and muitiparaSVM.py are used to display the comparison of two classification methods, RF and SVM. Other files are libraries of functions to support this project. In muitiparaRF.py, firstly, there are a kind of definitions of variables like paths, file names, label names. And then, set the current work path (some IDE do not need this, but some recognize this as necessary). Although the images we get have the same projection with the shapefile, they have different coordinate systems (one in meter unit, the other in decimal degree). So the next step is to reproject the shapefile. After all these preprocesses, there is a function named testAcc to try different values of parameters combination. In this case, we compare the influence of the percentage of training sample and the number of trees (in program, it is shown as n_estimator). The function testAcc could give we the accuracy of each combination. The following function use the given parameter to build a random forest model and use it for the whole image. In the main function, we identify the label for four situations and select one to run this program. The four situation is for the first, second, third and the stack of all images. After you select one situation, the program get samples, test different parameter combinations, choose the highest accuracy, and use that pair of parameters to build a RF model for the full image, show it in your scr …