Start the container, if it is not already running, with
sudo docker start crc
or pull and run it with
sudo docker run -d -p 443:8888 -v yourImageFolder:/crc/imagery --name=crc mort/crcdocker
then point your browser to
http://loclahost:443
This example follows some of the development in Chapters 6 and 7 of my book.
First cd to the main directory in the container:
cd /crc
In the shared imagery directory there is an ASTER image over Juelich, Germany , acquired on May 01, 2007. Also a train shapefile containing the training regions for a supervised land cover classification. The shapefile was generated from an ENVI ROI training dataset, but could have been prepared from any suitable GIS or image analysis environment.
ls -l imagery/may0107.tif imagery/train*
The image consists of 9 bands:
!gdalinfo imagery/may0107.tif | grep Band
namely the three NIR bands at 15m ground resolution and six SWIR bands pan-sharpened to the same resolution. Since the SWIR bands are very strongly correlated, we first do principal components transformation:
run pca imagery/may0107.tif
and retain only the first four principal component bands for classification. The classification script is classify.py:
run classify -h
Let's run the Bayes Maximum Likelihood classifier first:
run classify -a 1 -p [1,2,3,4] imagery/may0107_pca.tif imagery/train.shp
and calculate a contingency table (aka confusion matrix) from the test data:
run ct imagery/may0107_pca_MaxLike.tst
The kappa coefficietn is 0.926 \(\pm\) 0.005. We will compare this with the Support Vector Machine algorithm (-a 4):
run classify -a 4 -p [1,2,3,4] imagery/may0107_pca.tif imagery/train.shp
Note that the run time was considerably longer than for Maximum likelihood. However the test results are better:
run ct imagery/may0107_pca_SVM.tst
To decide if the SVM result is significantly better, we run the Mcnemar test on the null hypothesis that both classifiers are equally good:
run mcnemar imagery/may0107_pca_SVM.tst imagery/may0107_pca_MaxLike.tst
The P-value is less than 0.05, indicating that the null hypothesis can be rejected. Here is the classified image obtained with the SVM (on the left) together with the NIR bands of the original image:
run dispms -f imagery/may0107_pca_class.tif -c -F imagery/may0107.tif -P [1,2,3] -E 4