pksvmogr(1)
π pksvmogr β classify vector dataset using Support Vector Machine π
okay bestie, welcome to pksvmogr(1), the pktools page that teaches you how to let a Support Vector Machine do your land-cover homework for you. it's giving β¨machine learning but make it GISβ¨. let's go π¦
β¨ SYNOPSIS β¨
pksvmogr -t training [-i input] [-o output] [-cv value] [options]
[advanced options]
πΈ DESCRIPTION πΈ
so pksvmogr implements a support vector machine (SVM) to solve a supervised classification problem. yes, actual SVM, no cap. the implementation is based on the open source C++ library libSVM (β¨http://www.csie.ntu.edu.tw/~cjlin/libsvmβ©), so shoutout to the legends over there π«Ά
both raster and vector files are supported as input. the output will contain the classification result, either in raster or vector format, corresponding to the format of the input β so basically whatever vibe you feed it, that's the vibe you get back π
a training sample must be provided as an OGR vector dataset that contains the class labels and the features for each training point. important: the point locations are not considered in the training step (iconic of it tbh, the geometry is just there for decoration).
you can use the same training sample for classifying different images, provided the number of bands of the images are identical. same bands = same training sample, periodt.
use the utility pkextract to create a suitable training sample, based on a sample of points or polygons. and for raster output maps you can attach a color table using the option -ct π¨
β¨ OPTIONS β¨
-t filename,--training filenameβ Training vector file. a single vector file contains all training features (must be set as:b0,b1,b2,...) for all classes (class numbers identified by label option). use multiple training files for bootstrap aggregation (alternative to the--bagand--bagsizeoptions, where a random subset is taken from a single training file) π-i filename,--input filenameβ input image πΈ-o filename,--output filenameβ Output classification image πΌοΈ-cv value,--cv valueβ N-fold cross validation mode (default:0)-tln layer,--tln layerβ Training layer name(s)-c name,--class nameβ List of class names.-r value,--reclass valueβ List of class values (use same order as in--classoption).-of GDALformat,--oformat GDALformatβ Output image format (see alsogdal_translate(1)).-f format,--f formatβ Output ogr format for active training sample-co NAME=VALUE,--co NAME=VALUEβ Creation option for output file. Multiple options can be specified.-ct filename,--ct filenameβ Color table in ASCII format having 5 columns:id R G B ALFA(0: transparent,255: solid) π-label attribute,--label attributeβ Identifier for class label in training vector file. (default:label)-prior value,--prior valueβ Prior probabilities for each class (e.g.,-prior 0.3 -prior 0.3 -prior 0.2). Used for input only (ignored for cross validation)-g gamma,--gamma gammaβ Gamma in kernel function-cc cost,--ccost costβ The parameterCofC_SVC,epsilon_SVR, andnu_SVR-m filename,--mask filenameβ Only classify within specified mask (vector or raster). For raster mask, set nodata values with the option--msknodata.-msknodata value,--msknodata valueβ Mask value(s) not to consider for classification. Values will be taken over in classification image.-nodata value,--nodata valueβ Nodata value to put where image is masked as nodata-v level,--verbose levelβ Verbose level
π§ Advanced options π§
-b band,--band bandβ Band index (starting from0, either use--bandoption or use--startbandto--endband)-sband band,--startband bandβ Start band sequence number-eband band,--endband bandβ End band sequence number-bal size,--balance sizeβ Balance the input data to this number of samples for each class-min number,--min numberβ If number of training pixels is less then min, do not take this class into account (0: consider all classes)-bag value,--bag valueβ Number of bootstrap aggregations (default is no bagging:1)-bagsize value,--bagsize valueβ Percentage of features used from available training features for each bootstrap aggregation (one size for all classes, or a different size for each class respectively-comb rule,--comb ruleβ How to combine bootstrap aggregation classifiers (0: sum rule,1: product rule,2: max rule). Also used to aggregate classes with rc option.-cb filename,--classbag filenameβ Output for each individual bootstrap aggregation-prob filename,--prob filenameβ Probability image.-offset value,--offset valueβ Offset value for each spectral band input features:refl[band]=(DN[band]-offset[band])/scale[band]-scale value,--scale valueβ Scale value for each spectral band input features:refl=(DN[band]-offset[band])/scale[band](use0if scale min and max in each band to-1.0and1.0)-svmt type,--svmtype typeβ Type of SVM (C_SVC,nu_SVC,one_class,epsilon_SVR,nu_SVR)-kt type,--kerneltype typeβ Type of kernel function (linear,polynomial,radial,sigmoid)-kd value,--kd valueβ Degree in kernel function-c0 value,--coef0 valueβ Coef0 in kernel function-nu value,--nu valueβ The parameter nu of nu-SVC, one-class SVM, and nu-SVR-eloss value,--eloss valueβ The epsilon in loss function of epsilon-SVR-cache number,--cache numberβ Cache β¨http://pktools.nongnu.org/html/classCache.htmlβ© memory size in MB (default:100)-etol value,--etol valueβ the tolerance of termination criterion (default:0.001)-shrink,--shrinkβ Whether to use the shrinking heuristics-na number,--nactive numberβ Number of active training points
okay that's the whole thing bestie, every single flag, no gatekeeping π go classify something gorgeous. iykyk π
mwah π this page is pktools, version of 01 January 2025, and yes it's literally called pksvmogr(1) β see you in the man pages, queen πβ¨
π¦ where this page comes from
- ubuntu questing: pktools 2.6.7.6+ds-6build4
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms